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)