Adds two functions:
 - red_dispatcher_use_client_monitors_config:
   check that QXLInterface supports client_monitors_config and that it's
   functional.
 - red_dispatcher_client_monitors_config:
   send the client monitors configuration to the guest.
---
 server/red_dispatcher.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 server/red_dispatcher.h |  4 ++++
 2 files changed, 53 insertions(+)

diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c
index 3a4229e..39d05ab 100644
--- a/server/red_dispatcher.c
+++ b/server/red_dispatcher.c
@@ -83,6 +83,22 @@ extern spice_wan_compression_t zlib_glz_state;
 
 static RedDispatcher *dispatchers = NULL;
 
+static int red_dispatcher_version_check(int major, int minor)
+{
+    if (num_active_workers > 0) {
+        RedDispatcher *now = dispatchers;
+        while (now) {
+            if (now->base.major_version != major ||
+                now->base.minor_version < minor) {
+                return FALSE;
+            }
+            now = now->next;
+        }
+        return TRUE;
+    }
+    return FALSE;
+}
+
 static void red_dispatcher_set_display_peer(RedChannel *channel, RedClient 
*client,
                                             RedsStream *stream, int migration,
                                             int num_common_caps, uint32_t 
*common_caps, int num_caps,
@@ -295,6 +311,39 @@ static void red_dispatcher_update_area(RedDispatcher 
*dispatcher, uint32_t surfa
                             &payload);
 }
 
+int red_dispatcher_use_client_monitors_config(void)
+{
+    RedDispatcher *now = dispatchers;
+
+    if (num_active_workers == 0) {
+        return FALSE;
+    }
+
+    for (; now ; now = now->next) {
+        if (!red_dispatcher_version_check(3, 3) ||
+            !now->qxl->st->qif->client_monitors_config ||
+            !now->qxl->st->qif->client_monitors_config(now->qxl, NULL)) {
+            return FALSE;
+        }
+    }
+    return TRUE;
+}
+
+void red_dispatcher_client_monitors_config(VDAgentMonitorsConfig 
*monitors_config)
+{
+    RedDispatcher *now = dispatchers;
+
+    while (now) {
+        if (!now->qxl->st->qif->client_monitors_config ||
+            !now->qxl->st->qif->client_monitors_config(now->qxl,
+                                                       monitors_config)) {
+            spice_warning("spice bug: QXLInterface::client_monitors_config"
+                          " failed/missing unexpectedly\n");
+        }
+        now = now->next;
+    }
+}
+
 static AsyncCommand *async_command_alloc(RedDispatcher *dispatcher,
                                          RedWorkerMessage message,
                                          uint64_t cookie)
diff --git a/server/red_dispatcher.h b/server/red_dispatcher.h
index 7e9ffe6..17eeb29 100644
--- a/server/red_dispatcher.h
+++ b/server/red_dispatcher.h
@@ -18,6 +18,8 @@
 #ifndef _H_RED_DISPATCHER
 #define _H_RED_DISPATCHER
 
+#include "red_channel.h"
+
 struct RedChannelClient;
 typedef struct AsyncCommand AsyncCommand;
 
@@ -35,6 +37,8 @@ uint32_t red_dispatcher_qxl_ram_size(void);
 int red_dispatcher_qxl_count(void);
 void red_dispatcher_async_complete(struct RedDispatcher *, AsyncCommand *);
 struct Dispatcher *red_dispatcher_get_dispatcher(struct RedDispatcher *);
+int red_dispatcher_use_client_monitors_config(void);
+void red_dispatcher_client_monitors_config(VDAgentMonitorsConfig 
*monitors_config);
 
 typedef struct RedWorkerMessageDisplayConnect {
     RedClient * client;
-- 
1.7.12

_______________________________________________
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to