On Fri, 2017-03-03 at 14:46 +0000, Frediano Ziglio wrote: > This prepare for the next patch. > As network buffer should be specific to the specific > RedChannelClient we should have one. This second sentence is unclear to me. Alternate log suggestion: "The network recieve buffer should be per-client rather than per- channel. The following patch will make this change, but this common base class will allow the cursor client and the display client to share a common implementation." > > Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> > --- > server/common-graphics-channel.c | 12 ++++++++++++ > server/common-graphics-channel.h | 32 > ++++++++++++++++++++++++++++++++ > server/cursor-channel-client.c | 2 +- > server/cursor-channel-client.h | 5 ++--- > server/dcc.c | 2 +- > server/dcc.h | 12 +++++------- > 6 files changed, 53 insertions(+), 12 deletions(-) > > diff --git a/server/common-graphics-channel.c b/server/common- > graphics-channel.c > index bad6e8c..6faf1d7 100644 > --- a/server/common-graphics-channel.c > +++ b/server/common-graphics-channel.c > @@ -31,6 +31,8 @@ > > G_DEFINE_ABSTRACT_TYPE(CommonGraphicsChannel, > common_graphics_channel, RED_TYPE_CHANNEL) > > +G_DEFINE_TYPE(CommonGraphicsChannelClient, > common_graphics_channel_client, RED_TYPE_CHANNEL_CLIENT) > + Perhaps sometime in the future we should change this class to have a Red namespace. But since CommonGraphicsChannel doesn't have one either, this name is fine for now. > #define GRAPHICS_CHANNEL_PRIVATE(o) \ > (G_TYPE_INSTANCE_GET_PRIVATE((o), TYPE_COMMON_GRAPHICS_CHANNEL, > CommonGraphicsChannelPrivate)) > > @@ -188,3 +190,13 @@ QXLInstance* > common_graphics_channel_get_qxl(CommonGraphicsChannel *self) > { > return self->priv->qxl; > } > + > +static void > +common_graphics_channel_client_init(CommonGraphicsChannelClient > *self) > +{ > +} > + > +static void > +common_graphics_channel_client_class_init(CommonGraphicsChannelClien > tClass *klass) > +{ > +} > diff --git a/server/common-graphics-channel.h b/server/common- > graphics-channel.h > index 4d88148..bdcb2c8 100644 > --- a/server/common-graphics-channel.h > +++ b/server/common-graphics-channel.h > @@ -70,6 +70,38 @@ enum { > RED_PIPE_ITEM_TYPE_COMMON_LAST > }; > > +#define TYPE_COMMON_GRAPHICS_CHANNEL_CLIENT > common_graphics_channel_client_get_type() > + > +#define COMMON_GRAPHICS_CHANNEL_CLIENT(obj) \ > + (G_TYPE_CHECK_INSTANCE_CAST((obj), > TYPE_COMMON_GRAPHICS_CHANNEL_CLIENT, \ > + CommonGraphicsChannelClient)) > +#define COMMON_GRAPHICS_CHANNEL_CLIENT_CLASS(klass) \ > + (G_TYPE_CHECK_CLASS_CAST((klass), > TYPE_COMMON_GRAPHICS_CHANNEL_CLIENT, \ > + CommonGraphicsChannelClientClass)) > +#define COMMON_IS_GRAPHICS_CHANNEL_CLIENT(obj) \ > + (G_TYPE_CHECK_INSTANCE_TYPE((obj), > TYPE_COMMON_GRAPHICS_CHANNEL_CLIENT)) > +#define COMMON_IS_GRAPHICS_CHANNEL_CLIENT_CLASS(klass) \ > + (G_TYPE_CHECK_CLASS_TYPE((klass), > TYPE_COMMON_GRAPHICS_CHANNEL_CLIENT)) > +#define COMMON_GRAPHICS_CHANNEL_CLIENT_GET_CLASS(obj) \ > + (G_TYPE_INSTANCE_GET_CLASS((obj), > TYPE_COMMON_GRAPHICS_CHANNEL_CLIENT, \ > + CommonGraphicsChannelClientClass)) > + > +typedef struct CommonGraphicsChannelClient > CommonGraphicsChannelClient; > +typedef struct CommonGraphicsChannelClientClass > CommonGraphicsChannelClientClass; > +typedef struct CommonGraphicsChannelClientPrivate > CommonGraphicsChannelClientPrivate; > + > +struct CommonGraphicsChannelClient { > + RedChannelClient parent; > + > + CommonGraphicsChannelClientPrivate *priv; > +}; > + > +struct CommonGraphicsChannelClientClass { > + RedChannelClientClass parent_class; > +}; > + > +GType common_graphics_channel_client_get_type(void) G_GNUC_CONST; > + > G_END_DECLS > > #endif /* _COMMON_GRAPHICS_CHANNEL_H */ > diff --git a/server/cursor-channel-client.c b/server/cursor-channel- > client.c > index 1a05f73..db74bde 100644 > --- a/server/cursor-channel-client.c > +++ b/server/cursor-channel-client.c > @@ -35,7 +35,7 @@ > #define CURSOR_CACHE_HASH_KEY(id) ((id) & CURSOR_CACHE_HASH_MASK) > #define CURSOR_CLIENT_TIMEOUT 30000000000ULL //nano > > -G_DEFINE_TYPE(CursorChannelClient, cursor_channel_client, > RED_TYPE_CHANNEL_CLIENT) > +G_DEFINE_TYPE(CursorChannelClient, cursor_channel_client, > TYPE_COMMON_GRAPHICS_CHANNEL_CLIENT) > > #define CURSOR_CHANNEL_CLIENT_PRIVATE(o) \ > (G_TYPE_INSTANCE_GET_PRIVATE((o), TYPE_CURSOR_CHANNEL_CLIENT, > CursorChannelClientPrivate)) > diff --git a/server/cursor-channel-client.h b/server/cursor-channel- > client.h > index e2aa3a8..de2c9d6 100644 > --- a/server/cursor-channel-client.h > +++ b/server/cursor-channel-client.h > @@ -45,9 +45,8 @@ typedef struct CursorChannelClient > CursorChannelClient; > typedef struct CursorChannelClientClass CursorChannelClientClass; > typedef struct CursorChannelClientPrivate > CursorChannelClientPrivate; > > -struct CursorChannelClient > -{ > - RedChannelClient parent; > +struct CursorChannelClient { > + CommonGraphicsChannelClient parent; > > CursorChannelClientPrivate *priv; > }; > diff --git a/server/dcc.c b/server/dcc.c > index 898e074..01b90ba 100644 > --- a/server/dcc.c > +++ b/server/dcc.c > @@ -27,7 +27,7 @@ > #include "spice-server-enums.h" > #include "glib-compat.h" > > -G_DEFINE_TYPE(DisplayChannelClient, display_channel_client, > RED_TYPE_CHANNEL_CLIENT) > +G_DEFINE_TYPE(DisplayChannelClient, display_channel_client, > TYPE_COMMON_GRAPHICS_CHANNEL_CLIENT) > > #define DISPLAY_CLIENT_SHORT_TIMEOUT 15000000000ULL //nano > #define DISPLAY_FREE_LIST_DEFAULT_SIZE 128 > diff --git a/server/dcc.h b/server/dcc.h > index 71ac42c..31e25b5 100644 > --- a/server/dcc.h > +++ b/server/dcc.h > @@ -24,7 +24,7 @@ > #include "image-cache.h" > #include "pixmap-cache.h" > #include "display-limits.h" > -#include "red-channel-client.h" > +#include "common-graphics-channel.h" > > G_BEGIN_DECLS > > @@ -45,18 +45,16 @@ typedef struct DisplayChannelClient > DisplayChannelClient; > typedef struct DisplayChannelClientClass DisplayChannelClientClass; > typedef struct DisplayChannelClientPrivate > DisplayChannelClientPrivate; > > -struct DisplayChannelClient > -{ > - RedChannelClient parent; > +struct DisplayChannelClient { > + CommonGraphicsChannelClient parent; > > int is_low_bandwidth; > > DisplayChannelClientPrivate *priv; > }; > > -struct DisplayChannelClientClass > -{ > - RedChannelClientClass parent_class; > +struct DisplayChannelClientClass { > + CommonGraphicsChannelClientClass parent_class; > }; > > GType display_channel_client_get_type(void) G_GNUC_CONST; Ack with potential commit log rewording Acked-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx> _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel