[Spice-devel] [spice-server v2 2/2] Use red_qxl_check_qxl_version in red-worker

Christophe Fergeau cfergeau at redhat.com
Thu Mar 17 15:35:50 UTC 2016


---
 server/red-qxl.c    | 2 +-
 server/red-qxl.h    | 1 +
 server/red-worker.c | 8 ++++----
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/server/red-qxl.c b/server/red-qxl.c
index 2b618f0..0f608db 100644
--- a/server/red-qxl.c
+++ b/server/red-qxl.c
@@ -63,7 +63,7 @@ struct QXLState {
     struct AsyncCommand *gl_draw_async;
 };
 
-static int red_qxl_check_qxl_version(QXLInstance *qxl, int major, int minor)
+int red_qxl_check_qxl_version(QXLInstance *qxl, int major, int minor)
 {
     int qxl_major = qxl_get_interface(qxl)->base.major_version;
     int qxl_minor = qxl_get_interface(qxl)->base.minor_version;
diff --git a/server/red-qxl.h b/server/red-qxl.h
index f58d42b..7287740 100644
--- a/server/red-qxl.h
+++ b/server/red-qxl.h
@@ -44,6 +44,7 @@ gboolean red_qxl_get_allow_client_mouse(QXLInstance *qxl, gint *x_res, gint *y_r
 SpiceMsgDisplayGlScanoutUnix *red_qxl_get_gl_scanout(QXLInstance *qxl);
 void red_qxl_put_gl_scanout(QXLInstance *qxl, SpiceMsgDisplayGlScanoutUnix *scanout);
 void red_qxl_gl_draw_async_complete(QXLInstance *qxl);
+int red_qxl_check_qxl_version(QXLInstance *qxl, int major, int minor);
 SpiceServer* red_qxl_get_server(QXLState *qxl);
 
 /* Wrappers around QXLInterface vfuncs */
diff --git a/server/red-worker.c b/server/red-worker.c
index 3a82aa4..8ca11c7 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -510,10 +510,10 @@ static void guest_set_client_capabilities(RedWorker *worker)
     };
     QXLInterface *qif = qxl_get_interface(worker->qxl);
 
-    if (qif->base.major_version < 3 ||
-        (qif->base.major_version == 3 &&
-        qif->base.minor_version < 2) ||
-        !qif->set_client_capabilities) {
+    if (!red_qxl_check_qxl_version(worker->qxl, 3, 2)) {
+        return;
+    }
+    if (!qif->set_client_capabilities) {
         return;
     }
 #define SET_CAP(a,c)                                                    \
-- 
2.5.0



More information about the Spice-devel mailing list