[Spice-devel] [PATCH 3/4] move gl_draw_async_count to DisplayChannel

Frediano Ziglio fziglio at redhat.com
Fri Feb 5 15:41:55 UTC 2016


Looks like is a more appropriate place.
Note that this make patch smaller.
Also this is more symmetric having gl_draw_ongoing in DisplayChannelClient.
This patch could be squashed in another.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/display-channel.c | 18 ++++++++----------
 server/display-channel.h |  2 ++
 server/reds.h            |  1 -
 3 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/server/display-channel.c b/server/display-channel.c
index be22e62..1662995 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -2155,9 +2155,12 @@ void display_channel_gl_scanout(DisplayChannel *display)
     red_channel_pipes_new_add_push(RED_CHANNEL(display), dcc_gl_scanout_item_new, NULL);
 }
 
-static void set_gl_draw_async_count(QXLInstance *qxl, int num)
+static void set_gl_draw_async_count(DisplayChannel *display, int num)
 {
-    qxl->st->gl_draw_async_count = num;
+    RedWorker *worker = COMMON_CHANNEL(display)->worker;
+    QXLInstance *qxl = red_worker_get_qxl(worker);
+
+    display->gl_draw_async_count = num;
 
     if (num == 0) {
         red_dispatcher_async_complete(qxl->st->dispatcher, qxl->st->gl_draw_async);
@@ -2167,20 +2170,15 @@ static void set_gl_draw_async_count(QXLInstance *qxl, int num)
 
 void display_channel_gl_draw(DisplayChannel *display, SpiceMsgDisplayGlDraw *draw)
 {
-    RedWorker *worker = COMMON_CHANNEL(display)->worker;
-    QXLInstance *qxl = red_worker_get_qxl(worker);
     int num;
 
-    spice_return_if_fail(qxl->st->gl_draw_async_count == 0);
+    spice_return_if_fail(display->gl_draw_async_count == 0);
 
     num = red_channel_pipes_new_add_push(RED_CHANNEL(display), dcc_gl_draw_item_new, draw);
-    set_gl_draw_async_count(qxl, num);
+    set_gl_draw_async_count(display, num);
 }
 
 void display_channel_gl_draw_done(DisplayChannel *display)
 {
-    RedWorker *worker = COMMON_CHANNEL(display)->worker;
-    QXLInstance *qxl = red_worker_get_qxl(worker);
-
-    set_gl_draw_async_count(qxl, qxl->st->gl_draw_async_count - 1);
+    set_gl_draw_async_count(display, display->gl_draw_async_count - 1);
 }
diff --git a/server/display-channel.h b/server/display-channel.h
index a0465bd..82fd663 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -202,6 +202,8 @@ struct DisplayChannel {
     ImageCache image_cache;
     RedCompressBuf *free_compress_bufs;
 
+    int gl_draw_async_count;
+
 /* TODO: some day unify this, make it more runtime.. */
     stat_info_t add_stat;
     stat_info_t exclude_stat;
diff --git a/server/reds.h b/server/reds.h
index bf66e62..2f40d39 100644
--- a/server/reds.h
+++ b/server/reds.h
@@ -39,7 +39,6 @@ struct QXLState {
     pthread_mutex_t scanout_mutex;
     SpiceMsgDisplayGlScanoutUnix scanout;
     struct AsyncCommand *gl_draw_async;
-    int gl_draw_async_count;
 };
 
 struct TunnelWorker;
-- 
2.5.0



More information about the Spice-devel mailing list