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

Frediano Ziglio fziglio at redhat.com
Fri Aug 25 09:54:06 UTC 2017


QXL device requires a QXL interface which imply all set
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 or in a different
one.
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 63d6886d..18071ec7 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);
 
@@ -289,7 +291,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");
@@ -297,7 +299,7 @@ CursorChannel* cursor_channel_new(RedsState *server, QXLInstance *qxl,
                         "spice-server", server,
                         "core-interface", core,
                         "channel-type", SPICE_CHANNEL_CURSOR,
-                        "id", qxl->id,
+                        "id", qxl ? qxl->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 03a409cd..c3db477f 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -1342,7 +1342,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