[Spice-devel] [PATCH spice-server 2/2] Move capability initialisation into channel creation
Frediano Ziglio
fziglio at redhat.com
Tue Oct 25 12:45:44 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 | 7 ++++++-
server/red-worker.c | 3 ---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/server/display-channel.c b/server/display-channel.c
index 0b8d6b5..78e385e 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -1935,8 +1935,9 @@ DisplayChannel* display_channel_new(RedsState *reds,
stat_init(&display->priv->add_stat, "add", stat_clock);
stat_init(&display->priv->exclude_stat, "exclude", stat_clock);
stat_init(&display->priv->__exclude_stat, "__exclude", stat_clock);
-#ifdef RED_STATISTICS
+
RedChannel *channel = RED_CHANNEL(display);
+#ifdef RED_STATISTICS
display->priv->cache_hits_counter = stat_add_counter(reds, channel->stat,
"cache_hits", TRUE);
display->priv->add_to_cache_counter = stat_add_counter(reds, channel->stat,
@@ -1957,6 +1958,10 @@ DisplayChannel* display_channel_new(RedsState *reds,
display->priv->video_codecs = g_array_ref(video_codecs);
display_channel_init_streams(display);
+ 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);
+
return display;
}
diff --git a/server/red-worker.c b/server/red-worker.c
index 40e58f2..1890512 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -1382,9 +1382,6 @@ RedWorker* red_worker_new(QXLInstance *qxl,
channel = RED_CHANNEL(worker->display_channel);
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);
- 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