[Spice-devel] [PATCH spice-server v2 05/12] Check running state in red_qxl_set_client_capabilities

Frediano Ziglio fziglio at redhat.com
Tue Mar 26 19:10:31 UTC 2019


No reasons to expose red_qxl_is_running, this was used to not
send capability is the state was not running.

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

diff --git a/server/display-channel.c b/server/display-channel.c
index 1af87ba4..e9368668 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -2566,9 +2566,6 @@ static void guest_set_client_capabilities(DisplayChannel *display)
 #define CLEAR_CAP(a,c)                                                  \
         ((a)[(c) / 8] &= ~(1 << ((c) % 8)))
 
-    if (!red_qxl_is_running(display->priv->qxl)) {
-        return;
-    }
     if ((red_channel_get_n_clients(RED_CHANNEL(display)) == 0)) {
         red_qxl_set_client_capabilities(display->priv->qxl, FALSE, caps);
     } else {
diff --git a/server/red-qxl.c b/server/red-qxl.c
index e3fbf7b7..6dbd224c 100644
--- a/server/red-qxl.c
+++ b/server/red-qxl.c
@@ -68,6 +68,7 @@ struct QXLState {
 
 #define GL_DRAW_COOKIE_INVALID (~((uint64_t) 0))
 
+/* used by RedWorker */
 bool red_qxl_is_running(QXLInstance *qxl)
 {
     return qxl->st->running;
@@ -1048,7 +1049,9 @@ void red_qxl_set_client_capabilities(QXLInstance *qxl,
 {
     QXLInterface *interface = qxl_get_interface(qxl);
 
-    interface->set_client_capabilities(qxl, client_present, caps);
+    if (qxl->st->running) {
+        interface->set_client_capabilities(qxl, client_present, caps);
+    }
 }
 
 void red_qxl_async_complete(QXLInstance *qxl, uint64_t cookie)
diff --git a/server/red-qxl.h b/server/red-qxl.h
index 521f3659..94753948 100644
--- a/server/red-qxl.h
+++ b/server/red-qxl.h
@@ -44,9 +44,6 @@ const char* red_qxl_get_device_address(const QXLInstance *qxl);
 const uint32_t* red_qxl_get_device_display_ids(const QXLInstance *qxl);
 size_t red_qxl_get_monitors_count(const QXLInstance *qxl);
 
-/* check if QXL is running, should be used inside the worker thread */
-bool red_qxl_is_running(QXLInstance *qxl);
-
 /* Wrappers around QXLInterface vfuncs */
 void red_qxl_get_init_info(QXLInstance *qxl, QXLDevInitInfo *info);
 int red_qxl_get_command(QXLInstance *qxl, struct QXLCommandExt *cmd);
diff --git a/server/red-worker.h b/server/red-worker.h
index 54ab4da8..34c5b4af 100644
--- a/server/red-worker.h
+++ b/server/red-worker.h
@@ -35,6 +35,7 @@ void red_worker_free(RedWorker *worker);
 struct Dispatcher *red_qxl_get_dispatcher(QXLInstance *qxl);
 void red_qxl_destroy_primary_surface_complete(QXLState *qxl_state);
 void red_qxl_create_primary_surface_complete(QXLState *qxl_state, const QXLDevSurfaceCreate* surface);
+bool red_qxl_is_running(QXLInstance *qxl);
 void red_qxl_set_running(QXLInstance *qxl, bool running);
 
 typedef uint32_t RedWorkerMessage;
-- 
2.20.1



More information about the Spice-devel mailing list