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

Frediano Ziglio fziglio at redhat.com
Mon Aug 21 13:24:58 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 | 11 +++++++++++
 server/display-channel.h |  1 +
 server/red-worker.c      | 12 +-----------
 3 files changed, 13 insertions(+), 11 deletions(-)

Updates:
- rebased on master

diff --git a/server/display-channel.c b/server/display-channel.c
index 924d219b..83ac692f 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -2426,6 +2426,15 @@ gboolean display_channel_validate_surface(DisplayChannel *display, uint32_t surf
     return TRUE;
 }
 
+void display_channel_push_monitors_config(DisplayChannel *display)
+{
+    DisplayChannelClient *dcc;
+
+    FOREACH_DCC(display, dcc) {
+        dcc_push_monitors_config(dcc);
+    }
+}
+
 void display_channel_update_monitors_config(DisplayChannel *display,
                                             QXLMonitorsConfig *config,
                                             uint16_t count, uint16_t max_allowed)
@@ -2436,6 +2445,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 01e3621e..75b1efea 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 36a29074..b510079d 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -485,15 +485,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;
-
-    FOREACH_DCC(worker->display_channel, dcc) {
-        dcc_push_monitors_config(dcc);
-    }
-}
-
 static void dev_create_primary_surface(RedWorker *worker, uint32_t surface_id,
                                        QXLDevSurfaceCreate surface)
 {
@@ -539,7 +530,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);
@@ -814,7 +805,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