[Spice-devel] [PATCH 16/19] worker: move red_pipes_remove_drawable

Frediano Ziglio fziglio at redhat.com
Wed Nov 25 07:27:40 PST 2015


From: Marc-André Lureau <marcandre.lureau at gmail.com>

---
 server/display-channel.c | 22 ++++++++++++++++++----
 server/display-channel.h |  1 -
 server/red_worker.c      | 14 --------------
 3 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/server/display-channel.c b/server/display-channel.c
index aa3e7fb..e29d2ad 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -403,6 +403,20 @@ static void current_remove_drawable(DisplayChannel *display, Drawable *item)
     display->current_size--;
 }
 
+static void drawable_remove_from_pipes(Drawable *drawable)
+{
+    DrawablePipeItem *dpi;
+    RingItem *item, *next;
+
+    RING_FOREACH_SAFE(item, next, &drawable->pipes) {
+        dpi = SPICE_CONTAINEROF(item, DrawablePipeItem, base);
+        if (pipe_item_is_linked(&dpi->dpi_pipe_item)) {
+            red_channel_client_pipe_remove_and_release(RED_CHANNEL_CLIENT(dpi->dcc),
+                                                       &dpi->dpi_pipe_item);
+        }
+    }
+}
+
 static void current_remove(DisplayChannel *display, TreeItem *item)
 {
     TreeItem *now = item;
@@ -415,7 +429,7 @@ static void current_remove(DisplayChannel *display, TreeItem *item)
         if (now->type == TREE_ITEM_TYPE_DRAWABLE) {
             Drawable *drawable = SPICE_CONTAINEROF(now, Drawable, tree_item);
             ring_item = now->siblings_link.prev;
-            red_pipes_remove_drawable(drawable);
+            drawable_remove_from_pipes(drawable);
             current_remove_drawable(display, drawable);
         } else {
             Container *container = (Container *)now;
@@ -482,7 +496,7 @@ static int current_add_equal(DisplayChannel *display, DrawItem *item, TreeItem *
         } else {
             pipes_add_drawable(display, drawable);
         }
-        red_pipes_remove_drawable(other_drawable);
+        drawable_remove_from_pipes(other_drawable);
         display_channel_drawable_unref(display, other_drawable);
         return TRUE;
     }
@@ -524,7 +538,7 @@ static int current_add_equal(DisplayChannel *display, DrawItem *item, TreeItem *
                 }
             }
             /* not sending other_drawable where possible */
-            red_pipes_remove_drawable(other_drawable);
+            drawable_remove_from_pipes(other_drawable);
 
             display_channel_drawable_unref(display, other_drawable);
             return TRUE;
@@ -533,7 +547,7 @@ static int current_add_equal(DisplayChannel *display, DrawItem *item, TreeItem *
     case QXL_EFFECT_OPAQUE_BRUSH:
         if (is_same_geometry(drawable, other_drawable)) {
             current_add_drawable(display, drawable, &other->siblings_link);
-            red_pipes_remove_drawable(other_drawable);
+            drawable_remove_from_pipes(other_drawable);
             current_remove_drawable(display, other_drawable);
             pipes_add_drawable(display, drawable);
             return TRUE;
diff --git a/server/display-channel.h b/server/display-channel.h
index 3f3c278..28ef66c 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -433,7 +433,6 @@ static inline void region_add_clip_rects(QRegion *rgn, SpiceClipRects *data)
 }
 
 uint32_t generate_uid(DisplayChannel *display);
-void red_pipes_remove_drawable(Drawable *drawable);
 void detach_streams_behind(DisplayChannel *display, QRegion *region, Drawable *drawable);
 void drawable_draw(DisplayChannel *display, Drawable *item);
 void drawables_init(DisplayChannel *display);
diff --git a/server/red_worker.c b/server/red_worker.c
index eb4be25..341574f 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -125,20 +125,6 @@ static int cursor_is_connected(RedWorker *worker)
         red_channel_is_connected(RED_CHANNEL(worker->cursor_channel));
 }
 
-void red_pipes_remove_drawable(Drawable *drawable)
-{
-    DrawablePipeItem *dpi;
-    RingItem *item, *next;
-
-    RING_FOREACH_SAFE(item, next, &drawable->pipes) {
-        dpi = SPICE_CONTAINEROF(item, DrawablePipeItem, base);
-        if (pipe_item_is_linked(&dpi->dpi_pipe_item)) {
-            red_channel_client_pipe_remove_and_release(RED_CHANNEL_CLIENT(dpi->dcc),
-                                                       &dpi->dpi_pipe_item);
-        }
-    }
-}
-
 static uint8_t *common_alloc_recv_buf(RedChannelClient *rcc, uint16_t type, uint32_t size)
 {
     CommonChannel *common = SPICE_CONTAINEROF(rcc->channel, CommonChannel, base);
-- 
2.4.3



More information about the Spice-devel mailing list