mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-27 15:45:54 +00:00
server: replace redundant code with red_cursor_reset
In addition (1) make handle_dev_destroy_surfaces call red_release_cursor
(2) call red_wait_outgoing_item(cursor_channel) only after adding msgs to pipe
[3d3066b175 cherry-pick with modifications]
This commit is contained in:
parent
7db7212c3a
commit
84ff23cd2b
@ -9716,6 +9716,27 @@ static inline void handle_dev_destroy_surface_wait(RedWorker *worker)
|
||||
write_message(worker->channel, &message);
|
||||
}
|
||||
|
||||
static inline void red_cursor_reset(RedWorker *worker)
|
||||
{
|
||||
if (worker->cursor) {
|
||||
red_release_cursor(worker, worker->cursor);
|
||||
worker->cursor = NULL;
|
||||
}
|
||||
|
||||
worker->cursor_visible = TRUE;
|
||||
worker->cursor_position.x = worker->cursor_position.y = 0;
|
||||
worker->cursor_trail_length = worker->cursor_trail_frequency = 0;
|
||||
|
||||
if (worker->cursor_channel) {
|
||||
red_pipe_add_type(&worker->cursor_channel->base, PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE);
|
||||
if (!worker->cursor_channel->base.migrate) {
|
||||
red_pipe_add_verb(&worker->cursor_channel->base, SPICE_MSG_CURSOR_RESET);
|
||||
}
|
||||
red_wait_outgoing_item((RedChannel *)worker->cursor_channel);
|
||||
ASSERT(!worker->cursor_channel->base.send_data.item);
|
||||
}
|
||||
}
|
||||
|
||||
/* called upon device reset */
|
||||
static inline void handle_dev_destroy_surfaces(RedWorker *worker)
|
||||
{
|
||||
@ -9735,15 +9756,6 @@ static inline void handle_dev_destroy_surfaces(RedWorker *worker)
|
||||
}
|
||||
ASSERT(ring_is_empty(&worker->streams));
|
||||
|
||||
red_wait_outgoing_item((RedChannel *)worker->cursor_channel);
|
||||
if (worker->cursor_channel) {
|
||||
red_pipe_add_type(&worker->cursor_channel->base, PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE);
|
||||
if (!worker->cursor_channel->base.migrate) {
|
||||
red_pipe_add_verb(&worker->cursor_channel->base, SPICE_MSG_CURSOR_RESET);
|
||||
}
|
||||
ASSERT(!worker->cursor_channel->base.send_data.item);
|
||||
}
|
||||
|
||||
if (worker->display_channel) {
|
||||
red_pipe_add_type(&worker->display_channel->base, PIPE_ITEM_TYPE_INVAL_PALLET_CACHE);
|
||||
red_pipe_add_verb(&worker->display_channel->base, SPICE_MSG_DISPLAY_STREAM_DESTROY_ALL);
|
||||
@ -9751,9 +9763,7 @@ static inline void handle_dev_destroy_surfaces(RedWorker *worker)
|
||||
|
||||
red_display_clear_glz_drawables(worker->display_channel);
|
||||
|
||||
worker->cursor_visible = TRUE;
|
||||
worker->cursor_position.x = worker->cursor_position.y = 0;
|
||||
worker->cursor_trail_length = worker->cursor_trail_frequency = 0;
|
||||
red_cursor_reset(worker);
|
||||
|
||||
message = RED_WORKER_MESSAGE_READY;
|
||||
write_message(worker->channel, &message);
|
||||
@ -9806,20 +9816,6 @@ static inline void handle_dev_destroy_primary_surface(RedWorker *worker)
|
||||
PANIC_ON(surface_id != 0);
|
||||
PANIC_ON(!worker->surfaces[surface_id].context.canvas);
|
||||
|
||||
if (worker->cursor) {
|
||||
red_release_cursor(worker, worker->cursor);
|
||||
worker->cursor = NULL;
|
||||
}
|
||||
|
||||
red_wait_outgoing_item((RedChannel *)worker->cursor_channel);
|
||||
if (worker->cursor_channel) {
|
||||
red_pipe_add_type(&worker->cursor_channel->base, PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE);
|
||||
if (!worker->cursor_channel->base.migrate) {
|
||||
red_pipe_add_verb(&worker->cursor_channel->base, SPICE_MSG_CURSOR_RESET);
|
||||
}
|
||||
ASSERT(!worker->cursor_channel->base.send_data.item);
|
||||
}
|
||||
|
||||
flush_all_qxl_commands(worker);
|
||||
destroy_surface_wait(worker, 0);
|
||||
red_destroy_surface(worker, 0);
|
||||
@ -9827,9 +9823,7 @@ static inline void handle_dev_destroy_primary_surface(RedWorker *worker)
|
||||
|
||||
ASSERT(!worker->surfaces[surface_id].context.canvas);
|
||||
|
||||
worker->cursor_visible = TRUE;
|
||||
worker->cursor_position.x = worker->cursor_position.y = 0;
|
||||
worker->cursor_trail_length = worker->cursor_trail_frequency = 0;
|
||||
red_cursor_reset(worker);
|
||||
|
||||
message = RED_WORKER_MESSAGE_READY;
|
||||
write_message(worker->channel, &message);
|
||||
@ -9865,24 +9859,7 @@ static void handle_dev_input(EventListener *listener, uint32_t events)
|
||||
clear_bit(RED_WORKER_PENDING_OOM, worker->pending);
|
||||
break;
|
||||
case RED_WORKER_MESSAGE_RESET_CURSOR:
|
||||
if (worker->cursor) {
|
||||
red_release_cursor(worker, worker->cursor);
|
||||
worker->cursor = NULL;
|
||||
}
|
||||
|
||||
red_wait_outgoing_item((RedChannel *)worker->cursor_channel);
|
||||
if (worker->cursor_channel) {
|
||||
red_pipe_add_type(&worker->cursor_channel->base, PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE);
|
||||
if (!worker->cursor_channel->base.migrate) {
|
||||
red_pipe_add_verb(&worker->cursor_channel->base, SPICE_MSG_CURSOR_RESET);
|
||||
}
|
||||
ASSERT(!worker->cursor_channel->base.send_data.item);
|
||||
|
||||
worker->cursor_visible = TRUE;
|
||||
worker->cursor_position.x = worker->cursor_position.y = 0;
|
||||
worker->cursor_trail_length = worker->cursor_trail_frequency = 0;
|
||||
}
|
||||
|
||||
red_cursor_reset(worker);
|
||||
message = RED_WORKER_MESSAGE_READY;
|
||||
write_message(worker->channel, &message);
|
||||
break;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user