When a client is done with drawing and sends SPICE_MSGC_DISPLAY_GL_DRAW_DONE, or when it ends, update the number of async counts. Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxx> --- server/dcc.c | 21 +++++++++++++++++++++ server/display-channel.c | 8 ++++++++ server/display-channel.h | 1 + 3 files changed, 30 insertions(+) diff --git a/server/dcc.c b/server/dcc.c index 6972616..750e2e8 100644 --- a/server/dcc.c +++ b/server/dcc.c @@ -494,6 +494,8 @@ static void dcc_destroy_stream_agents(DisplayChannelClient *dcc) void dcc_stop(DisplayChannelClient *dcc) { + DisplayChannel *dc = DCC_TO_DC(dcc); + pixmap_cache_unref(dcc->pixmap_cache); dcc->pixmap_cache = NULL; dcc_release_glz(dcc); @@ -502,6 +504,11 @@ void dcc_stop(DisplayChannelClient *dcc) free(dcc->send_data.free_list.res); dcc_destroy_stream_agents(dcc); dcc_encoders_free(dcc); + + if (dcc->gl_draw_ongoing) { + dcc->gl_draw_ongoing = FALSE; + display_channel_gl_draw_done(dc); + } } void dcc_stream_agent_clip(DisplayChannelClient* dcc, StreamAgent *agent) @@ -1391,6 +1398,18 @@ static int dcc_handle_preferred_compression(DisplayChannelClient *dcc, return TRUE; } +static int dcc_handle_gl_draw_done(DisplayChannelClient *dcc) +{ + DisplayChannel *display = DCC_TO_DC(dcc); + + g_return_val_if_fail(dcc->gl_draw_ongoing, FALSE); + + dcc->gl_draw_ongoing = FALSE; + display_channel_gl_draw_done(display); + + return TRUE; +} + int dcc_handle_message(RedChannelClient *rcc, uint32_t size, uint16_t type, void *msg) { DisplayChannelClient *dcc = RCC_TO_DCC(rcc); @@ -1403,6 +1422,8 @@ int dcc_handle_message(RedChannelClient *rcc, uint32_t size, uint16_t type, void case SPICE_MSGC_DISPLAY_PREFERRED_COMPRESSION: return dcc_handle_preferred_compression(dcc, (SpiceMsgcDisplayPreferredCompression *)msg); + case SPICE_MSGC_DISPLAY_GL_DRAW_DONE: + return dcc_handle_gl_draw_done(dcc); default: return red_channel_client_handle_message(rcc, size, type, msg); } diff --git a/server/display-channel.c b/server/display-channel.c index 0f962a7..be22e62 100644 --- a/server/display-channel.c +++ b/server/display-channel.c @@ -2176,3 +2176,11 @@ void display_channel_gl_draw(DisplayChannel *display, SpiceMsgDisplayGlDraw *dra num = red_channel_pipes_new_add_push(RED_CHANNEL(display), dcc_gl_draw_item_new, draw); set_gl_draw_async_count(qxl, num); } + +void display_channel_gl_draw_done(DisplayChannel *display) +{ + RedWorker *worker = COMMON_CHANNEL(display)->worker; + QXLInstance *qxl = red_worker_get_qxl(worker); + + set_gl_draw_async_count(qxl, qxl->st->gl_draw_async_count - 1); +} diff --git a/server/display-channel.h b/server/display-channel.h index 6eb947a..a0465bd 100644 --- a/server/display-channel.h +++ b/server/display-channel.h @@ -311,6 +311,7 @@ void display_channel_update_compression (DisplayCha void display_channel_gl_scanout (DisplayChannel *display); void display_channel_gl_draw (DisplayChannel *display, SpiceMsgDisplayGlDraw *draw); +void display_channel_gl_draw_done (DisplayChannel *display); static inline int validate_surface(DisplayChannel *display, uint32_t surface_id) { -- 2.5.0 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel