[Spice-devel] [PATCH spice-server] display-channel: push monitor configuration

Frediano Ziglio fziglio at redhat.com
Sat Aug 19 09:37:41 UTC 2017


RedWorker should not handle directly to client but
defer the job to DisplayChannel.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/display-channel.c | 12 ++++++++++++
 server/display-channel.h |  1 +
 server/red-worker.c      | 13 +------------
 3 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/server/display-channel.c b/server/display-channel.c
index 68ea3bad..530f067b 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -2436,6 +2436,16 @@ gboolean display_channel_validate_surface(DisplayChannel *display, uint32_t surf
     return TRUE;
 }
 
+void display_channel_push_monitors_config(DisplayChannel *display)
+{
+    DisplayChannelClient *dcc;
+    GListIter iter;
+
+    FOREACH_DCC(display, iter, dcc) {
+        dcc_push_monitors_config(dcc);
+    }
+}
+
 void display_channel_update_monitors_config(DisplayChannel *display,
                                             QXLMonitorsConfig *config,
                                             uint16_t count, uint16_t max_allowed)
@@ -2446,6 +2456,8 @@ void display_channel_update_monitors_config(DisplayChannel *display,
 
     display->priv->monitors_config =
         monitors_config_new(config->heads, count, max_allowed);
+
+    display_channel_push_monitors_config(display);
 }
 
 void display_channel_set_monitors_config_to_primary(DisplayChannel *display)
diff --git a/server/display-channel.h b/server/display-channel.h
index d15aad46..e2ff07ab 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -260,6 +260,7 @@ void                       display_channel_gl_draw_done              (DisplayCha
 void display_channel_update_monitors_config(DisplayChannel *display, QXLMonitorsConfig *config,
                                             uint16_t count, uint16_t max_allowed);
 void display_channel_set_monitors_config_to_primary(DisplayChannel *display);
+void display_channel_push_monitors_config(DisplayChannel *display);
 
 gboolean display_channel_validate_surface(DisplayChannel *display, uint32_t surface_id);
 gboolean display_channel_surface_has_canvas(DisplayChannel *display, uint32_t surface_id);
diff --git a/server/red-worker.c b/server/red-worker.c
index f747e128..17541c7a 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -486,16 +486,6 @@ static void handle_dev_destroy_surfaces(void *opaque, void *payload)
     cursor_channel_reset(worker->cursor_channel);
 }
 
-static void red_worker_push_monitors_config(RedWorker *worker)
-{
-    DisplayChannelClient *dcc;
-    GListIter iter;
-
-    FOREACH_DCC(worker->display_channel, iter, dcc) {
-        dcc_push_monitors_config(dcc);
-    }
-}
-
 static void dev_create_primary_surface(RedWorker *worker, uint32_t surface_id,
                                        QXLDevSurfaceCreate surface)
 {
@@ -541,7 +531,7 @@ static void dev_create_primary_surface(RedWorker *worker, uint32_t surface_id,
         /* guest created primary, so it will (hopefully) send a monitors_config
          * now, don't send our own temporary one */
         if (!worker->driver_cap_monitors_config) {
-            red_worker_push_monitors_config(worker);
+            display_channel_push_monitors_config(display);
         }
         red_channel_pipes_add_empty_msg(RED_CHANNEL(worker->display_channel),
                                         SPICE_MSG_DISPLAY_MARK);
@@ -816,7 +806,6 @@ static void handle_dev_monitors_config_async(void *opaque, void *payload)
     display_channel_update_monitors_config(worker->display_channel, dev_monitors_config,
                                            MIN(count, msg->max_monitors),
                                            MIN(max_allowed, msg->max_monitors));
-    red_worker_push_monitors_config(worker);
 }
 
 /* TODO: special, perhaps use another dispatcher? */
-- 
2.13.5



More information about the Spice-devel mailing list