Remove some coupling, we mainly need to store a list of RedGlzDrawables. Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> --- server/dcc-encoders.c | 8 ++++---- server/dcc-encoders.h | 4 ++-- server/display-channel.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/server/dcc-encoders.c b/server/dcc-encoders.c index 97e1427..01138a2 100644 --- a/server/dcc-encoders.c +++ b/server/dcc-encoders.c @@ -609,20 +609,20 @@ void dcc_free_glz_drawables(EncodersData *enc) pthread_rwlock_unlock(&glz_dict->encode_lock); } -void dcc_glz_free_from_drawable(struct Drawable *drawable) +void dcc_glz_free_from_drawable_ring(Ring *drawable_ring) { RingItem *glz_item, *next_item; RedGlzDrawable *glz; - DRAWABLE_FOREACH_GLZ_SAFE(drawable, glz_item, next_item, glz) { + SAFE_FOREACH(glz_item, next_item, TRUE, drawable_ring, glz, LINK_TO_GLZ(glz_item)) { dcc_free_glz_drawable(glz->encoders, glz); } } -void dcc_glz_detach_from_drawable(struct Drawable *drawable) +void dcc_glz_detach_from_drawable_ring(Ring *drawable_ring) { RingItem *item, *next; - RING_FOREACH_SAFE(item, next, &drawable->glz_ring) { + RING_FOREACH_SAFE(item, next, drawable_ring) { SPICE_CONTAINEROF(item, RedGlzDrawable, drawable_link)->has_drawable = FALSE; ring_remove(item); } diff --git a/server/dcc-encoders.h b/server/dcc-encoders.h index 08f9826..09a86a0 100644 --- a/server/dcc-encoders.h +++ b/server/dcc-encoders.h @@ -41,8 +41,8 @@ int dcc_free_some_independent_glz_drawables(EncodersData *enc, int release_count void dcc_free_glz_drawables(EncodersData *enc); void dcc_free_glz_drawables_to_free(EncodersData* enc); gboolean dcc_glz_encoder_create(EncodersData *enc, uint8_t id); -void dcc_glz_free_from_drawable(struct Drawable *drawable); -void dcc_glz_detach_from_drawable(struct Drawable *drawable); +void dcc_glz_free_from_drawable_ring(Ring *drawable_ring); +void dcc_glz_detach_from_drawable_ring(Ring *drawable_ring); void dcc_glz_get_restore_data(EncodersData *enc, uint8_t *out_id, GlzEncDictRestoreData *out_data); diff --git a/server/display-channel.c b/server/display-channel.c index 60337b1..bcc2480 100644 --- a/server/display-channel.c +++ b/server/display-channel.c @@ -1230,7 +1230,7 @@ static bool free_one_drawable(DisplayChannel *display, int force_glz_free) drawable = SPICE_CONTAINEROF(ring_item, Drawable, list_link); if (force_glz_free) { - dcc_glz_free_from_drawable(drawable); + dcc_glz_free_from_drawable_ring(&drawable->glz_ring); } drawable_draw(display, drawable); container = drawable->tree_item.base.container; @@ -1398,7 +1398,7 @@ void drawable_unref(Drawable *drawable) drawable_unref_surface_deps(display, drawable); display_channel_surface_unref(display, drawable->surface_id); - dcc_glz_detach_from_drawable(drawable); + dcc_glz_detach_from_drawable_ring(&drawable->glz_ring); if (drawable->red_drawable) { red_drawable_unref(drawable->red_drawable); -- 2.7.4 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel