[Spice-commits] 4 commits - server/common-graphics-channel.c server/common-graphics-channel.h server/cursor-channel.c server/cursor-channel.h server/dcc-send.c server/dcc.c server/display-channel-private.h server/display-channel.c server/red-worker.c

Frediano Ziglio fziglio at kemper.freedesktop.org
Thu Sep 7 05:43:31 UTC 2017


 server/common-graphics-channel.c |   62 ---------------------------------------
 server/common-graphics-channel.h |    1 
 server/cursor-channel.c          |   14 ++------
 server/cursor-channel.h          |    4 +-
 server/dcc-send.c                |    2 -
 server/dcc.c                     |    2 -
 server/display-channel-private.h |    2 +
 server/display-channel.c         |   23 +++++++++++---
 server/red-worker.c              |    3 +
 9 files changed, 30 insertions(+), 83 deletions(-)

New commits:
commit 6db3ee7f83264927bcc8e3d64a01de3da9dc1b06
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Wed Sep 6 18:03:21 2017 +0100

    common-graphics-channel: Move "qxl" property to DisplayChannel
    
    Only DisplayChannel uses this property.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

diff --git a/server/common-graphics-channel.c b/server/common-graphics-channel.c
index e8c18a52..a664f05d 100644
--- a/server/common-graphics-channel.c
+++ b/server/common-graphics-channel.c
@@ -38,7 +38,6 @@ G_DEFINE_TYPE(CommonGraphicsChannelClient, common_graphics_channel_client, RED_T
 
 struct CommonGraphicsChannelPrivate
 {
-    QXLInstance *qxl;
     int during_target_migrate; /* TRUE when the client that is associated with the channel
                                   is during migration. Turned off when the vm is started.
                                   The flag is used to avoid sending messages that are artifacts
@@ -75,48 +74,6 @@ static void common_release_recv_buf(RedChannelClient *rcc, uint16_t type, uint32
     }
 }
 
-
-enum {
-    PROP0,
-    PROP_QXL
-};
-
-static void
-common_graphics_channel_get_property(GObject *object,
-                                   guint property_id,
-                                   GValue *value,
-                                   GParamSpec *pspec)
-{
-    CommonGraphicsChannel *self = COMMON_GRAPHICS_CHANNEL(object);
-
-    switch (property_id)
-    {
-        case PROP_QXL:
-            g_value_set_pointer(value, self->priv->qxl);
-            break;
-        default:
-            G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
-    }
-}
-
-static void
-common_graphics_channel_set_property(GObject *object,
-                                   guint property_id,
-                                   const GValue *value,
-                                   GParamSpec *pspec)
-{
-    CommonGraphicsChannel *self = COMMON_GRAPHICS_CHANNEL(object);
-
-    switch (property_id)
-    {
-        case PROP_QXL:
-            self->priv->qxl = g_value_get_pointer(value);
-            break;
-        default:
-            G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
-    }
-}
-
 bool common_channel_client_config_socket(RedChannelClient *rcc)
 {
     RedClient *client = red_channel_client_get_client(rcc);
@@ -145,21 +102,7 @@ bool common_channel_client_config_socket(RedChannelClient *rcc)
 static void
 common_graphics_channel_class_init(CommonGraphicsChannelClass *klass)
 {
-    GObjectClass *object_class = G_OBJECT_CLASS(klass);
-
     g_type_class_add_private(klass, sizeof(CommonGraphicsChannelPrivate));
-
-    object_class->get_property = common_graphics_channel_get_property;
-    object_class->set_property = common_graphics_channel_set_property;
-
-    g_object_class_install_property(object_class,
-                                    PROP_QXL,
-                                    g_param_spec_pointer("qxl",
-                                                         "qxl",
-                                                         "QXLInstance for this channel",
-                                                         G_PARAM_READWRITE |
-                                                         G_PARAM_CONSTRUCT_ONLY |
-                                                         G_PARAM_STATIC_STRINGS));
 }
 
 static void
@@ -178,11 +121,6 @@ gboolean common_graphics_channel_get_during_target_migrate(CommonGraphicsChannel
     return self->priv->during_target_migrate;
 }
 
-QXLInstance* common_graphics_channel_get_qxl(CommonGraphicsChannel *self)
-{
-    return self->priv->qxl;
-}
-
 static void
 common_graphics_channel_client_init(CommonGraphicsChannelClient *self)
 {
diff --git a/server/common-graphics-channel.h b/server/common-graphics-channel.h
index c478b319..d23f0c69 100644
--- a/server/common-graphics-channel.h
+++ b/server/common-graphics-channel.h
@@ -62,7 +62,6 @@ GType common_graphics_channel_get_type(void) G_GNUC_CONST;
 
 void common_graphics_channel_set_during_target_migrate(CommonGraphicsChannel *self, gboolean value);
 gboolean common_graphics_channel_get_during_target_migrate(CommonGraphicsChannel *self);
-QXLInstance* common_graphics_channel_get_qxl(CommonGraphicsChannel *self);
 
 enum {
     RED_PIPE_ITEM_TYPE_INVAL_ONE = RED_PIPE_ITEM_TYPE_CHANNEL_BASE,
diff --git a/server/dcc-send.c b/server/dcc-send.c
index 8e91b8fb..18e226f0 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -2324,7 +2324,7 @@ static void marshall_gl_scanout(RedChannelClient *rcc,
 {
     DisplayChannelClient *dcc = DISPLAY_CHANNEL_CLIENT(rcc);
     DisplayChannel *display_channel = DCC_TO_DC(dcc);
-    QXLInstance* qxl = common_graphics_channel_get_qxl(COMMON_GRAPHICS_CHANNEL(display_channel));
+    QXLInstance* qxl = display_channel->priv->qxl;
 
     SpiceMsgDisplayGlScanoutUnix *scanout = red_qxl_get_gl_scanout(qxl);
     if (scanout != NULL) {
diff --git a/server/dcc.c b/server/dcc.c
index e2dba2ae..3fb598ff 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -519,7 +519,7 @@ DisplayChannelClient *dcc_new(DisplayChannel *display,
     spice_debug("New display (client %p) dcc %p stream %p", client, dcc, stream);
     common_graphics_channel_set_during_target_migrate(COMMON_GRAPHICS_CHANNEL(display), mig_target);
     if (dcc) {
-        dcc->priv->id = common_graphics_channel_get_qxl(COMMON_GRAPHICS_CHANNEL(display))->id;
+        dcc->priv->id = display->priv->qxl->id;
     }
 
     return dcc;
diff --git a/server/display-channel-private.h b/server/display-channel-private.h
index fb5d6158..82a3e8c6 100644
--- a/server/display-channel-private.h
+++ b/server/display-channel-private.h
@@ -75,6 +75,8 @@ struct DisplayChannelPrivate
 {
     DisplayChannel *pub;
 
+    QXLInstance *qxl;
+
     uint32_t bits_unique;
 
     MonitorsConfig *monitors_config;
diff --git a/server/display-channel.c b/server/display-channel.c
index 076f6696..f7e36dbb 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -28,7 +28,8 @@ G_DEFINE_TYPE(DisplayChannel, display_channel, TYPE_COMMON_GRAPHICS_CHANNEL)
 enum {
     PROP0,
     PROP_N_SURFACES,
-    PROP_VIDEO_CODECS
+    PROP_VIDEO_CODECS,
+    PROP_QXL
 };
 
 static void
@@ -47,6 +48,9 @@ display_channel_get_property(GObject *object,
         case PROP_VIDEO_CODECS:
             g_value_set_static_boxed(value, self->priv->video_codecs);
             break;
+        case PROP_QXL:
+            g_value_set_pointer(value, self->priv->qxl);
+            break;
         default:
             G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
     }
@@ -68,6 +72,9 @@ display_channel_set_property(GObject *object,
         case PROP_VIDEO_CODECS:
             display_channel_set_video_codecs(self, g_value_get_boxed(value));
             break;
+        case PROP_QXL:
+            self->priv->qxl = g_value_get_pointer(value);
+            break;
         default:
             G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
     }
@@ -278,7 +285,7 @@ static void stop_streams(DisplayChannel *display)
 void display_channel_surface_unref(DisplayChannel *display, uint32_t surface_id)
 {
     RedSurface *surface = &display->priv->surfaces[surface_id];
-    QXLInstance *qxl = common_graphics_channel_get_qxl(COMMON_GRAPHICS_CHANNEL(display));
+    QXLInstance *qxl = display->priv->qxl;
     DisplayChannelClient *dcc;
 
     if (--surface->refs != 0) {
@@ -2381,12 +2388,10 @@ void display_channel_gl_scanout(DisplayChannel *display)
 
 static void set_gl_draw_async_count(DisplayChannel *display, int num)
 {
-    QXLInstance *qxl = common_graphics_channel_get_qxl(COMMON_GRAPHICS_CHANNEL(display));
-
     display->priv->gl_draw_async_count = num;
 
     if (num == 0) {
-        red_qxl_gl_draw_async_complete(qxl);
+        red_qxl_gl_draw_async_complete(display->priv->qxl);
     }
 }
 
@@ -2514,6 +2519,14 @@ display_channel_class_init(DisplayChannelClass *klass)
                                                        G_PARAM_CONSTRUCT_ONLY |
                                                        G_PARAM_READWRITE |
                                                        G_PARAM_STATIC_STRINGS));
+    g_object_class_install_property(object_class,
+                                    PROP_QXL,
+                                    g_param_spec_pointer("qxl",
+                                                         "qxl",
+                                                         "QXLInstance for this channel",
+                                                         G_PARAM_READWRITE |
+                                                         G_PARAM_CONSTRUCT_ONLY |
+                                                         G_PARAM_STATIC_STRINGS));
 }
 
 void display_channel_debug_oom(DisplayChannel *display, const char *msg)
commit 8e7d5ac58031baef4f18d6d9f7ff1e5dc642424d
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Wed Sep 6 17:52:18 2017 +0100

    cursor-channel: Remove dependency from QXL
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index fad90ad0..a844100a 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -232,7 +232,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, int id,
                                   const SpiceCoreInterfaceInternal *core)
 {
     spice_debug("create cursor channel");
@@ -240,9 +240,8 @@ 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,
                         NULL);
 }
diff --git a/server/cursor-channel.h b/server/cursor-channel.h
index f279aafc..50cf71f1 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, int id,
+                                  const SpiceCoreInterfaceInternal *core);
 
 void                 cursor_channel_reset       (CursorChannel *cursor);
 void                 cursor_channel_do_init     (CursorChannel *cursor);
diff --git a/server/red-worker.c b/server/red-worker.c
index 5756bfd8..b18e0546 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -1343,7 +1343,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->id,
                                                 &worker->core);
     channel = RED_CHANNEL(worker->cursor_channel);
     red_channel_init_stat_node(channel, &worker->stat, "cursor_channel");
commit 64f7fa3d0e72d6a7117c10020b5a5985dc8253bb
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Wed Sep 6 17:46:26 2017 +0100

    cursor-channel: Removed unused qxl field from RedCursorPipeItem
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index d61cf480..fad90ad0 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -30,7 +30,6 @@
 
 typedef struct RedCursorPipeItem {
     RedPipeItem base;
-    QXLInstance *qxl;
     RedCursorCmd *red_cursor;
 } RedCursorPipeItem;
 
@@ -55,7 +54,7 @@ G_DEFINE_TYPE(CursorChannel, cursor_channel, TYPE_COMMON_GRAPHICS_CHANNEL)
 
 static void cursor_pipe_item_free(RedPipeItem *pipe_item);
 
-static RedCursorPipeItem *cursor_pipe_item_new(QXLInstance *qxl, RedCursorCmd *cmd)
+static RedCursorPipeItem *cursor_pipe_item_new(RedCursorCmd *cmd)
 {
     RedCursorPipeItem *item = g_new0(RedCursorPipeItem, 1);
 
@@ -63,7 +62,6 @@ static RedCursorPipeItem *cursor_pipe_item_new(QXLInstance *qxl, RedCursorCmd *c
 
     red_pipe_item_init_full(&item->base, RED_PIPE_ITEM_TYPE_CURSOR,
                             cursor_pipe_item_free);
-    item->qxl = qxl;
     item->red_cursor = cmd;
 
     return item;
@@ -253,13 +251,11 @@ void cursor_channel_process_cmd(CursorChannel *cursor, RedCursorCmd *cursor_cmd)
 {
     RedCursorPipeItem *cursor_pipe_item;
     bool cursor_show = false;
-    QXLInstance *qxl;
 
     spice_return_if_fail(cursor);
     spice_return_if_fail(cursor_cmd);
 
-    qxl = common_graphics_channel_get_qxl(COMMON_GRAPHICS_CHANNEL(cursor));
-    cursor_pipe_item = cursor_pipe_item_new(qxl, cursor_cmd);
+    cursor_pipe_item = cursor_pipe_item_new(cursor_cmd);
 
     switch (cursor_cmd->type) {
     case QXL_CURSOR_SET:
commit 1c6e7cf73e08f98e0334fa278fe7d1c8a2c1d86c
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Tue Feb 28 15:19:05 2017 +0000

    Release cursor as soon as possible
    
    Cursor resources (basically the shape of it) was retained till
    it was used however it was copied so there were no reason to not release
    this resource.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index 8db3e86b..d61cf480 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -75,7 +75,6 @@ static void cursor_pipe_item_free(RedPipeItem *base)
     RedCursorPipeItem *pipe_item = SPICE_UPCAST(RedCursorPipeItem, base);
 
     cursor_cmd = pipe_item->red_cursor;
-    red_qxl_release_resource(pipe_item->qxl, cursor_cmd->release_info_ext);
     red_put_cursor_cmd(cursor_cmd);
     free(cursor_cmd);
 
diff --git a/server/red-worker.c b/server/red-worker.c
index 675c232e..5756bfd8 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -112,6 +112,7 @@ static gboolean red_process_cursor_cmd(RedWorker *worker, const QXLCommandExt *e
         free(cursor_cmd);
         return FALSE;
     }
+    red_qxl_release_resource(worker->qxl, cursor_cmd->release_info_ext);
     cursor_channel_process_cmd(worker->cursor_channel, cursor_cmd);
     return TRUE;
 }


More information about the Spice-commits mailing list