[Spice-devel] [PATCH spice-server 4/4] common-graphics-channel: Move "qxl" property to DisplayChannel

Jonathon Jongsma jjongsma at redhat.com
Wed Sep 6 22:09:46 UTC 2017


Hardly any reason for the CommonGraphicsChannel anymore

Acked-by: Jonathon Jongsma <jjongsma at redhat.com>



On Wed, 2017-09-06 at 18:15 +0100, Frediano Ziglio wrote:
> Only DisplayChannel uses this property.
> 
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  server/common-graphics-channel.c | 62 ------------------------------
> ----------
>  server/common-graphics-channel.h |  1 -
>  server/dcc-send.c                |  2 +-
>  server/dcc.c                     |  2 +-
>  server/display-channel-private.h |  2 ++
>  server/display-channel.c         | 23 +++++++++++----
>  6 files changed, 22 insertions(+), 70 deletions(-)
> 
> diff --git a/server/common-graphics-channel.c b/server/common-
> graphics-channel.c
> index e8c18a523..a664f05d4 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",
> -                                                         "QXLInstanc
> e for this channel",
> -                                                         G_PARAM_REA
> DWRITE |
> -                                                         G_PARAM_CON
> STRUCT_ONLY |
> -                                                         G_PARAM_STA
> TIC_STRINGS));
>  }
>  
>  static void
> @@ -178,11 +121,6 @@ gboolean
> common_graphics_channel_get_during_target_migrate(CommonGraphicsChann
> el
>      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 c478b319a..d23f0c695 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(CommonGraphicsChann
> el *self, gboolean value);
>  gboolean
> common_graphics_channel_get_during_target_migrate(CommonGraphicsChann
> el *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 8e91b8fb9..18e226f0d 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_chann
> el));
> +    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 ec8b60747..1878492cd 100644
> --- a/server/dcc.c
> +++ b/server/dcc.c
> @@ -518,7 +518,7 @@ DisplayChannelClient *dcc_new(DisplayChannel
> *display,
>                           NULL);
>      spice_debug("New display (client %p) dcc %p stream %p", client,
> dcc, stream);
>      common_graphics_channel_set_during_target_migrate(COMMON_GRAPHIC
> S_CHANNEL(display), mig_target);
> -    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 fb5d6158e..82a3e8c69 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 076f6696f..f7e36dbb4 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_CONST
> RUCT_ONLY |
>                                                         G_PARAM_READW
> RITE |
>                                                         G_PARAM_STATI
> C_STRINGS));
> +    g_object_class_install_property(object_class,
> +                                    PROP_QXL,
> +                                    g_param_spec_pointer("qxl",
> +                                                         "qxl",
> +                                                         "QXLInstanc
> e for this channel",
> +                                                         G_PARAM_REA
> DWRITE |
> +                                                         G_PARAM_CON
> STRUCT_ONLY |
> +                                                         G_PARAM_STA
> TIC_STRINGS));
>  }
>  
>  void display_channel_debug_oom(DisplayChannel *display, const char
> *msg)
> -- 
> 2.13.5
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel


More information about the Spice-devel mailing list