[Spice-devel] [PATCH 09/10] worker: move MonitorsConfig to display channel

Frediano Ziglio fziglio at redhat.com
Thu Nov 5 04:42:34 PST 2015


> 
> On Thu, Nov 5, 2015 at 10:15 AM, Frediano Ziglio <fziglio at redhat.com> wrote:
> > From: Marc-André Lureau <marcandre.lureau at gmail.com>
> >
> > ---
> >  server/display-channel.c | 40 ++++++++++++++++++++++++++++++++++++++++
> >  server/display-channel.h |  1 +
> >  server/red_worker.c      | 41 -----------------------------------------
> >  3 files changed, 41 insertions(+), 41 deletions(-)
> >
> > diff --git a/server/display-channel.c b/server/display-channel.c
> > index c7cb3df..3dc5a94 100644
> > --- a/server/display-channel.c
> > +++ b/server/display-channel.c
> > @@ -81,3 +81,43 @@ MonitorsConfig* monitors_config_new(QXLHead *heads,
> > ssize_t nheads, ssize_t max)
> >
> >      return mc;
> >  }
> > +
> > +static MonitorsConfigItem *monitors_config_item_new(RedChannel* channel,
> > +                                                    MonitorsConfig
> > *monitors_config)
> > +{
> > +    MonitorsConfigItem *mci;
> > +
> > +    mci = (MonitorsConfigItem *)spice_malloc(sizeof(*mci));
> 
> Just a comment as I know the code was already as it is ... but no need
> to cast ...
> Better to have a later patch removing useless casts everywhere ...
> 
> > +    mci->monitors_config = monitors_config;
> > +
> > +    red_channel_pipe_item_init(channel,
> > +                               &mci->pipe_item,
> > PIPE_ITEM_TYPE_MONITORS_CONFIG);
> > +    return mci;
> > +}
> > +
> > +static inline void red_monitors_config_item_add(DisplayChannelClient *dcc)
> > +{
> > +    DisplayChannel *dc = DCC_TO_DC(dcc);
> > +    MonitorsConfigItem *mci;
> > +
> > +    mci = monitors_config_item_new(dcc->common.base.channel,
> > +
> > monitors_config_ref(dc->monitors_config));
> > +    red_channel_client_pipe_add(&dcc->common.base, &mci->pipe_item);
> > +}
> > +
> > +void dcc_push_monitors_config(DisplayChannelClient *dcc)
> > +{
> > +    MonitorsConfig *monitors_config = DCC_TO_DC(dcc)->monitors_config;
> > +
> > +    if (monitors_config == NULL) {
> > +        spice_warning("monitors_config is NULL");
> > +        return;
> > +    }
> > +
> > +    if (!red_channel_client_test_remote_cap(&dcc->common.base,
> > +
> > SPICE_DISPLAY_CAP_MONITORS_CONFIG))
> > {
> > +        return;
> > +    }
> > +    red_monitors_config_item_add(dcc);
> > +    red_channel_client_push(&dcc->common.base);
> > +}
> > diff --git a/server/display-channel.h b/server/display-channel.h
> > index 48e28a6..d6d65e0 100644
> > --- a/server/display-channel.h
> > +++ b/server/display-channel.h
> > @@ -296,6 +296,7 @@ DisplayChannelClient*      dcc_new
> > (DisplayCha
> >                                                                        int
> >                                                                        num_common_caps,
> >                                                                        uint32_t
> >                                                                        *caps,
> >                                                                        int
> >                                                                        num_caps);
> > +void                       dcc_push_monitors_config
> > (DisplayChannelClient *dcc);
> >
> >  typedef struct DrawablePipeItem {
> >      RingItem base;  /* link for a list of pipe items held by Drawable */
> > diff --git a/server/red_worker.c b/server/red_worker.c
> > index 40ae8b3..b7de808 100644
> > --- a/server/red_worker.c
> > +++ b/server/red_worker.c
> > @@ -537,7 +537,6 @@ static void
> > display_channel_client_release_item_before_push(DisplayChannelClient
> >                                                              PipeItem
> >                                                              *item);
> >  static void
> >  display_channel_client_release_item_after_push(DisplayChannelClient *dcc,
> >                                                             PipeItem
> >                                                             *item);
> > -static void dcc_push_monitors_config(DisplayChannelClient *dcc);
> >
> >  /*
> >   * Macros to make iterating over stuff easier
> > @@ -9479,29 +9478,6 @@ void handle_dev_destroy_surfaces(void *opaque, void
> > *payload)
> >      dev_destroy_surfaces(worker);
> >  }
> >
> > -static MonitorsConfigItem *monitors_config_item_new(
> > -    RedChannel* channel, MonitorsConfig *monitors_config)
> > -{
> > -    MonitorsConfigItem *mci;
> > -
> > -    mci = (MonitorsConfigItem *)spice_malloc(sizeof(*mci));
> > -    mci->monitors_config = monitors_config;
> > -
> > -    red_channel_pipe_item_init(channel,
> > -            &mci->pipe_item, PIPE_ITEM_TYPE_MONITORS_CONFIG);
> > -    return mci;
> > -}
> > -
> > -static inline void red_monitors_config_item_add(DisplayChannelClient *dcc)
> > -{
> > -    DisplayChannel *dc = DCC_TO_DC(dcc);
> > -    MonitorsConfigItem *mci;
> > -
> > -    mci = monitors_config_item_new(dcc->common.base.channel,
> > -
> > monitors_config_ref(dc->monitors_config));
> > -    red_channel_client_pipe_add(&dcc->common.base, &mci->pipe_item);
> > -}
> > -
> >  static void display_update_monitors_config(DisplayChannel *display,
> >                                             QXLMonitorsConfig *config,
> >                                             uint16_t count, uint16_t
> >                                             max_allowed)
> > @@ -9514,23 +9490,6 @@ static void
> > display_update_monitors_config(DisplayChannel *display,
> >          monitors_config_new(config->heads, count, max_allowed);
> >  }
> >
> > -static void dcc_push_monitors_config(DisplayChannelClient *dcc)
> > -{
> > -    MonitorsConfig *monitors_config = DCC_TO_DC(dcc)->monitors_config;
> > -
> > -    if (monitors_config == NULL) {
> > -        spice_warning("monitors_config is NULL");
> > -        return;
> > -    }
> > -
> > -    if (!red_channel_client_test_remote_cap(&dcc->common.base,
> > -
> > SPICE_DISPLAY_CAP_MONITORS_CONFIG))
> > {
> > -        return;
> > -    }
> > -    red_monitors_config_item_add(dcc);
> > -    red_channel_client_push(&dcc->common.base);
> > -}
> > -
> >  static void red_worker_push_monitors_config(RedWorker *worker)
> >  {
> >      DisplayChannelClient *dcc;
> > --
> > 2.4.3
> 
> ACK!
> 

Merged

Can/want to post a patch for the casts?

Frediano


More information about the Spice-devel mailing list