[Spice-devel] [RFC PATCH spice-server v5 19/22] cursor-channel: Allow to not handle a QXL device

Frediano Ziglio fziglio at redhat.com
Wed Aug 30 15:28:36 UTC 2017


QXL device requires a QXL interface which imply all sorts
of requirements like memory sharing.
Currently RedCursorChannel uses QXL to release resources
allocated from such devices.
However this is quite a limitation as potentially we
can implement cursors in a virtual device.
This for instance is the case of streaming device.

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

diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index 5ece576c..fa75dab2 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -94,7 +94,9 @@ static void cursor_item_unref(CursorItem *item)
         return;
 
     cursor_cmd = item->red_cursor;
-    red_qxl_release_resource(item->qxl, cursor_cmd->release_info_ext);
+    if (item->qxl) {
+        red_qxl_release_resource(item->qxl, cursor_cmd->release_info_ext);
+    }
     red_put_cursor_cmd(cursor_cmd);
     free(cursor_cmd);
 
@@ -290,7 +292,7 @@ static void cursor_channel_send_item(RedChannelClient *rcc, RedPipeItem *pipe_it
     red_channel_client_begin_send_message(rcc);
 }
 
-CursorChannel* cursor_channel_new(RedsState *server, QXLInstance *qxl,
+CursorChannel* cursor_channel_new(RedsState *server, QXLInstance *qxl, uint32_t id,
                                   const SpiceCoreInterfaceInternal *core)
 {
     spice_debug("create cursor channel");
@@ -298,7 +300,7 @@ CursorChannel* cursor_channel_new(RedsState *server, QXLInstance *qxl,
                         "spice-server", server,
                         "core-interface", core,
                         "channel-type", SPICE_CHANNEL_CURSOR,
-                        "id", qxl->id,
+                        "id", id,
                         "migration-flags", 0,
                         "qxl", qxl,
                         "handle-acks", TRUE,
diff --git a/server/cursor-channel.h b/server/cursor-channel.h
index 9f3ef52e..c173e2ca 100644
--- a/server/cursor-channel.h
+++ b/server/cursor-channel.h
@@ -56,8 +56,8 @@ GType cursor_channel_get_type(void) G_GNUC_CONST;
  * provided as helper functions and should only be called from the
  * CursorChannel thread.
  */
-CursorChannel*       cursor_channel_new         (RedsState *server, QXLInstance *qxl,
-                                                 const SpiceCoreInterfaceInternal *core);
+CursorChannel* cursor_channel_new(RedsState *server, QXLInstance *qxl, uint32_t id,
+                                  const SpiceCoreInterfaceInternal *core);
 
 /**
  * Cause the channel to disconnect all clients
diff --git a/server/red-worker.c b/server/red-worker.c
index 0e2e8fa3..81a318ca 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -1350,7 +1350,7 @@ RedWorker* red_worker_new(QXLInstance *qxl,
 
     worker->event_timeout = INF_EVENT_WAIT;
 
-    worker->cursor_channel = cursor_channel_new(reds, qxl,
+    worker->cursor_channel = cursor_channel_new(reds, qxl, qxl->id,
                                                 &worker->core);
     channel = RED_CHANNEL(worker->cursor_channel);
     red_channel_init_stat_node(channel, &worker->stat, "cursor_channel");
-- 
2.13.5



More information about the Spice-devel mailing list