[Spice-devel] [PATCH] worker: move red_drawable_count to DisplayChannel

Frediano Ziglio fziglio at redhat.com
Fri Nov 20 04:13:45 PST 2015


Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/display-channel.h |  1 +
 server/red_worker.c      | 13 ++++++-------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/server/display-channel.h b/server/display-channel.h
index d47abf7..990d756 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -198,6 +198,7 @@ struct DisplayChannel {
     _Drawable drawables[NUM_DRAWABLES];
     _Drawable *free_drawables;
 
+    uint32_t red_drawable_count;
     uint32_t glz_drawable_count;
 
     int stream_video;
diff --git a/server/red_worker.c b/server/red_worker.c
index 6d974d6..0b3545e 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -139,7 +139,6 @@ struct RedWorker {
     CursorChannel *cursor_channel;
     uint32_t cursor_poll_tries;
 
-    uint32_t red_drawable_count;
     uint32_t bits_unique;
 
     RedMemSlotInfo mem_slots;
@@ -565,7 +564,7 @@ void red_drawable_unref(RedWorker *worker, RedDrawable *red_drawable,
     if (--red_drawable->refs) {
         return;
     }
-    worker->red_drawable_count--;
+    worker->display_channel->red_drawable_count--;
     release_info_ext.group_id = group_id;
     release_info_ext.info = red_drawable->release_info;
     worker->qxl->st->qif->release_resource(worker->qxl, release_info_ext);
@@ -1752,7 +1751,7 @@ static RedDrawable *red_drawable_new(RedWorker *worker)
     RedDrawable * red = spice_new0(RedDrawable, 1);
 
     red->refs = 1;
-    worker->red_drawable_count++;
+    worker->display_channel->red_drawable_count++;
 
     return red;
 }
@@ -1879,7 +1878,7 @@ static void red_free_some(RedWorker *worker)
     RingItem *item, *next;
 
     spice_debug("#draw=%d, #red_draw=%d, #glz_draw=%d", display->drawable_count,
-                worker->red_drawable_count, display->glz_drawable_count);
+                display->red_drawable_count, display->glz_drawable_count);
     FOREACH_DCC(worker->display_channel, item, next, dcc) {
         GlzSharedDictionary *glz_dict = dcc ? dcc->glz_dict : NULL;
 
@@ -4533,7 +4532,7 @@ static void display_channel_client_on_disconnect(RedChannelClient *rcc)
 
     // this was the last channel client
     spice_debug("#draw=%d, #red_draw=%d, #glz_draw=%d",
-                display->drawable_count, worker->red_drawable_count,
+                display->drawable_count, display->red_drawable_count,
                 display->glz_drawable_count);
 }
 
@@ -6097,7 +6096,7 @@ static void handle_dev_oom(void *opaque, void *payload)
     // streams? but without streams also leak
     spice_debug("OOM1 #draw=%u, #red_draw=%u, #glz_draw=%u current %u pipes %u",
                 display->drawable_count,
-                worker->red_drawable_count,
+                display->red_drawable_count,
                 display->glz_drawable_count,
                 display->current_size,
                 worker->display_channel ?
@@ -6111,7 +6110,7 @@ static void handle_dev_oom(void *opaque, void *payload)
     }
     spice_debug("OOM2 #draw=%u, #red_draw=%u, #glz_draw=%u current %u pipes %u",
                 display->drawable_count,
-                worker->red_drawable_count,
+                display->red_drawable_count,
                 display->glz_drawable_count,
                 display->current_size,
                 worker->display_channel ?
-- 
2.4.3



More information about the Spice-devel mailing list