[Spice-devel] [PATCH] server: remove unnecessary dependency between surfaces and Glz drawables

Yonit Halperin yhalperi at redhat.com
Wed Aug 11 04:21:57 PDT 2010


Fixes freedesktop bug #28568
---
 server/red_worker.c |   38 ++++----------------------------------
 1 files changed, 4 insertions(+), 34 deletions(-)

diff --git a/server/red_worker.c b/server/red_worker.c
index 1c32a26..87f5582 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -595,11 +595,9 @@ typedef struct GlzDrawableInstanceItem {
 
 struct RedGlzDrawable {
     RingItem link;    // ordered by the time it was encoded
-    RingItem surface_link;
     RedDrawable *red_drawable;
     Drawable    *drawable;
     uint32_t     group_id;
-    int32_t      surface_id;
     SpiceImage  *self_bitmap;
     GlzDrawableInstanceItem instances_pool[MAX_GLZ_DRAWABLE_INSTANCES];
     Ring instances;
@@ -837,7 +835,6 @@ typedef struct RedSurface {
     uint32_t refs;
     Ring current;
     Ring current_list;
-    Ring glz_drawables;
 #ifdef ACYCLIC_SURFACE_DEBUG
     int current_gn;
 #endif
@@ -1555,10 +1552,9 @@ static inline void set_surface_release_info(RedWorker *worker, uint32_t surface_
 }
 
 static inline void free_red_drawable(RedWorker *worker, RedDrawable *drawable, uint32_t group_id,
-                                     SpiceImage *self_bitmap, int surface_id)
+                                     SpiceImage *self_bitmap)
 {
     QXLReleaseInfoExt release_info_ext;
-    red_destroy_surface(worker, surface_id);
 
     if (self_bitmap) {
         red_put_image(self_bitmap);
@@ -1620,12 +1616,12 @@ static inline void release_drawable(RedWorker *worker, Drawable *item)
 
         remove_drawable_dependencies(worker, item);
         red_dec_surfaces_drawable_dependencies(worker, item);
+        red_destroy_surface(worker, item->surface_id);
 
         if (item->red_glz_drawable) {
             item->red_glz_drawable->drawable = NULL;
         } else { // no reference to the qxl drawable left
-            free_red_drawable(worker, item->red_drawable, item->group_id, item->self_bitmap,
-                              item->surface_id);
+            free_red_drawable(worker, item->red_drawable, item->group_id, item->self_bitmap);
         }
         free_drawable(worker, item);
     }
@@ -1824,24 +1820,6 @@ static void red_current_clear(RedWorker *worker, int surface_id)
     }
 }
 
-static void red_clear_surface_glz_drawables(RedWorker *worker, int surface_id)
-{
-    RingItem *ring_item;
- 
-    if (!worker->display_channel) {
-        return;
-    }
-
-    pthread_rwlock_wrlock(&worker->display_channel->glz_dict->encode_lock);
-
-    while ((ring_item = ring_get_head(&worker->surfaces[surface_id].glz_drawables))) {
-        RedGlzDrawable *now = SPICE_CONTAINEROF(ring_item, RedGlzDrawable, surface_link);
-        red_display_free_glz_drawable(worker->display_channel, now);
-    }
-
-    pthread_rwlock_unlock(&worker->display_channel->glz_dict->encode_lock);
-}
-
 static void red_clear_surface_drawables_from_pipe(RedWorker *worker, int surface_id)
 {
     Ring *ring;
@@ -3894,7 +3872,6 @@ static inline void red_process_surface(RedWorker *worker, RedSurfaceCmd *surface
         set_surface_release_info(worker, surface_id, 0, surface->release_info, group_id);
         red_handle_depends_on_target_surface(worker, surface_id);
         red_current_clear(worker, surface_id);
-        red_clear_surface_glz_drawables(worker, surface_id);
         red_clear_surface_drawables_from_pipe(worker, surface_id);
         red_destroy_surface(worker, surface_id);
         break;
@@ -5045,14 +5022,11 @@ static RedGlzDrawable *red_display_get_glz_drawable(DisplayChannel *channel, Dra
     ret->red_drawable = drawable->red_drawable;
     ret->drawable = drawable;
     ret->group_id = drawable->group_id;
-    ret->surface_id = drawable->surface_id;
     ret->self_bitmap = drawable->self_bitmap;
     ret->instances_count = 0;
     ring_init(&ret->instances);
 
     ring_item_init(&ret->link);
-    ring_item_init(&ret->surface_link);
-    ring_add(&surface->glz_drawables, &ret->surface_link);
     ring_add_before(&ret->link, &channel->glz_drawables);
     drawable->red_glz_drawable = ret;
 
@@ -5112,14 +5086,12 @@ static void red_display_free_glz_drawable_instance(DisplayChannel *channel,
             drawable->red_glz_drawable = NULL;
         } else { // no reference to the qxl drawable left
             free_red_drawable(channel->base.worker, glz_drawable->red_drawable,
-                              glz_drawable->group_id, glz_drawable->self_bitmap,
-                              glz_drawable->surface_id);
+                              glz_drawable->group_id, glz_drawable->self_bitmap);
         }
 
         if (ring_item_is_linked(&glz_drawable->link)) {
             ring_remove(&glz_drawable->link);
         }
-        ring_remove(&glz_drawable->surface_link);
         free(glz_drawable);
     }
 }
@@ -9118,7 +9090,6 @@ static inline void red_create_surface(RedWorker *worker, uint32_t surface_id, ui
     ring_init(&surface->current);
     ring_init(&surface->current_list);
     ring_init(&surface->depend_on_me);
-    ring_init(&surface->glz_drawables);
     region_init(&surface->draw_dirty_region);
     surface->refs = 1;
     if (worker->renderer != RED_RENDERER_INVALID) {
@@ -10155,7 +10126,6 @@ static inline void destroy_surface_wait(RedWorker *worker, int surface_id)
     }
     red_flush_surface_pipe(worker);
     red_current_clear(worker, surface_id);
-    red_clear_surface_glz_drawables(worker, surface_id);
     red_clear_surface_drawables_from_pipe(worker, surface_id);
     red_wait_outgoing_item((RedChannel *)worker->display_channel);
     if (worker->display_channel) {
-- 
1.7.1.1



More information about the Spice-devel mailing list