[Spice-devel] [PATCH spice-server v2] Move capability initialisation into channel creation

Frediano Ziglio fziglio at redhat.com
Wed Oct 26 07:38:26 UTC 2016


No reason why RedWorker should know the capabilities of
DisplayChannel.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/display-channel.c | 6 +++++-
 server/red-worker.c      | 3 ---
 2 files changed, 5 insertions(+), 4 deletions(-)

Changes since v1:
- rebased on master.

Was already acked but the rebase changed a bit too much to keep
the ack.

diff --git a/server/display-channel.c b/server/display-channel.c
index bcf26bb..5521641 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -2025,6 +2025,7 @@ static void
 display_channel_constructed(GObject *object)
 {
     DisplayChannel *self = DISPLAY_CHANNEL(object);
+    RedChannel *channel = RED_CHANNEL(self);
 
     G_OBJECT_CLASS(display_channel_parent_class)->constructed(object);
 
@@ -2037,7 +2038,6 @@ display_channel_constructed(GObject *object)
     stat_init(&self->priv->__exclude_stat, "__exclude", CLOCK_THREAD_CPUTIME_ID);
 #ifdef RED_STATISTICS
     RedsState *reds = red_channel_get_server(RED_CHANNEL(self));
-    RedChannel *channel = RED_CHANNEL(self);
     self->priv->cache_hits_counter =
         stat_add_counter(reds, red_channel_get_stat_node(channel),
                          "cache_hits", TRUE);
@@ -2051,6 +2051,10 @@ display_channel_constructed(GObject *object)
     image_cache_init(&self->priv->image_cache);
     self->priv->stream_video = SPICE_STREAM_VIDEO_OFF;
     display_channel_init_streams(self);
+
+    red_channel_set_cap(channel, SPICE_DISPLAY_CAP_MONITORS_CONFIG);
+    red_channel_set_cap(channel, SPICE_DISPLAY_CAP_PREF_COMPRESSION);
+    red_channel_set_cap(channel, SPICE_DISPLAY_CAP_STREAM_REPORT);
 }
 
 void display_channel_process_surface_cmd(DisplayChannel *display,
diff --git a/server/red-worker.c b/server/red-worker.c
index f7f0726..ec8ebce 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -1379,9 +1379,6 @@ RedWorker* red_worker_new(QXLInstance *qxl,
     red_channel_set_stat_node(channel, stat_add_node(reds, worker->stat, "display_channel", TRUE));
     red_channel_register_client_cbs(channel, client_display_cbs, dispatcher);
     g_object_set_data(G_OBJECT(channel), "dispatcher", dispatcher);
-    red_channel_set_cap(channel, SPICE_DISPLAY_CAP_MONITORS_CONFIG);
-    red_channel_set_cap(channel, SPICE_DISPLAY_CAP_PREF_COMPRESSION);
-    red_channel_set_cap(channel, SPICE_DISPLAY_CAP_STREAM_REPORT);
     reds_register_channel(reds, channel);
 
     return worker;
-- 
2.7.4



More information about the Spice-devel mailing list