diff options
author | Marc-André Lureau <marcandre.lureau@gmail.com> | 2013-09-24 16:15:09 +0200 |
---|---|---|
committer | Frediano Ziglio <fziglio@redhat.com> | 2015-11-20 09:49:49 +0000 |
commit | 30a963d53a468da28b71dfd88b685423be60d446 (patch) | |
tree | 7bf91262e54ad7adb555a3cfbda24e097ba2f5ea | |
parent | aa8f2a1a95e3da3c4e0a55d25c06e1e47dd213a9 (diff) | |
download | spice-30a963d53a468da28b71dfd88b685423be60d446.tar.gz spice-30a963d53a468da28b71dfd88b685423be60d446.tar.xz spice-30a963d53a468da28b71dfd88b685423be60d446.zip |
worker: add display_channel_free_glz_drawables_to_free()
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
-rw-r--r-- | server/dcc-encoders.c | 17 | ||||
-rw-r--r-- | server/dcc-encoders.h | 2 | ||||
-rw-r--r-- | server/display-channel.c | 12 | ||||
-rw-r--r-- | server/display-channel.h | 1 | ||||
-rw-r--r-- | server/red_worker.c | 27 |
5 files changed, 33 insertions, 26 deletions
diff --git a/server/dcc-encoders.c b/server/dcc-encoders.c index 1f98d1a3..d8d6617e 100644 --- a/server/dcc-encoders.c +++ b/server/dcc-encoders.c @@ -472,3 +472,20 @@ void dcc_free_glz_drawable_instance(DisplayChannelClient *dcc, free(glz_drawable); } } + +void dcc_free_glz_drawables_to_free(DisplayChannelClient* dcc) +{ + RingItem *ring_link; + + if (!dcc->glz_dict) { + return; + } + pthread_mutex_lock(&dcc->glz_drawables_inst_to_free_lock); + while ((ring_link = ring_get_head(&dcc->glz_drawables_inst_to_free))) { + GlzDrawableInstanceItem *drawable_instance = SPICE_CONTAINEROF(ring_link, + GlzDrawableInstanceItem, + free_link); + dcc_free_glz_drawable_instance(dcc, drawable_instance); + } + pthread_mutex_unlock(&dcc->glz_drawables_inst_to_free_lock); +} diff --git a/server/dcc-encoders.h b/server/dcc-encoders.h index cdb44ac3..811183cf 100644 --- a/server/dcc-encoders.h +++ b/server/dcc-encoders.h @@ -38,6 +38,8 @@ typedef struct GlzDrawableInstanceItem GlzDrawableInstanceItem; void dcc_encoders_init (DisplayChannelClient *dcc); void dcc_free_glz_drawable_instance (DisplayChannelClient *dcc, GlzDrawableInstanceItem *item); +void dcc_free_glz_drawables_to_free (DisplayChannelClient* dcc); + void marshaller_add_compressed (SpiceMarshaller *m, RedCompressBuf *comp_buf, size_t size); diff --git a/server/display-channel.c b/server/display-channel.c index 0f801d31..3b7a0164 100644 --- a/server/display-channel.c +++ b/server/display-channel.c @@ -849,3 +849,15 @@ void display_channel_flush_all_surfaces(DisplayChannel *display) } } } + +static void rcc_free_glz_drawables_to_free(RedChannelClient *rcc) +{ + DisplayChannelClient *dcc = RCC_TO_DCC(rcc); + + dcc_free_glz_drawables_to_free(dcc); +} + +void display_channel_free_glz_drawables_to_free(DisplayChannel *display) +{ + red_channel_apply_clients(RED_CHANNEL(display), rcc_free_glz_drawables_to_free); +} diff --git a/server/display-channel.h b/server/display-channel.h index ac323e35..d47abf7f 100644 --- a/server/display-channel.h +++ b/server/display-channel.h @@ -276,6 +276,7 @@ void display_channel_current_flush (DisplayCha int surface_id); int display_channel_wait_for_migrate_data (DisplayChannel *display); void display_channel_flush_all_surfaces (DisplayChannel *display); +void display_channel_free_glz_drawables_to_free(DisplayChannel *display); static inline int is_equal_path(SpicePath *path1, SpicePath *path2) { diff --git a/server/red_worker.c b/server/red_worker.c index 633d5d45..2759857f 100644 --- a/server/red_worker.c +++ b/server/red_worker.c @@ -2004,23 +2004,6 @@ static void fill_base(SpiceMarshaller *base_marshaller, Drawable *drawable) spice_marshall_DisplayBase(base_marshaller, &base); } -static void red_display_handle_glz_drawables_to_free(DisplayChannelClient* dcc) -{ - RingItem *ring_link; - - if (!dcc->glz_dict) { - return; - } - pthread_mutex_lock(&dcc->glz_drawables_inst_to_free_lock); - while ((ring_link = ring_get_head(&dcc->glz_drawables_inst_to_free))) { - GlzDrawableInstanceItem *drawable_instance = SPICE_CONTAINEROF(ring_link, - GlzDrawableInstanceItem, - free_link); - dcc_free_glz_drawable_instance(dcc, drawable_instance); - } - pthread_mutex_unlock(&dcc->glz_drawables_inst_to_free_lock); -} - /* * Releases all the instances of the drawable from the dictionary and the display channel client. * The release of the last instance will also release the drawable itself and the qxl drawable @@ -6826,13 +6809,6 @@ RedWorker* red_worker_new(QXLInstance *qxl, RedDispatcher *red_dispatcher) return worker; } -static void red_display_cc_free_glz_drawables(RedChannelClient *rcc) -{ - DisplayChannelClient *dcc = RCC_TO_DCC(rcc); - - red_display_handle_glz_drawables_to_free(dcc); -} - SPICE_GNUC_NORETURN static void *red_worker_main(void *arg) { RedWorker *worker = arg; @@ -6868,8 +6844,7 @@ SPICE_GNUC_NORETURN static void *red_worker_main(void *arg) /* during migration, in the dest, the display channel can be initialized while the global lz data not since migrate data msg hasn't been received yet */ - red_channel_apply_clients(&worker->display_channel->common.base, - red_display_cc_free_glz_drawables); + display_channel_free_glz_drawables_to_free(worker->display_channel); } worker->event_timeout = INF_EVENT_WAIT; |