[Spice-devel] [PATCH 04/11] Move dcc_push_stream_agent_clip() to display channel

Pavel Grunt pgrunt at redhat.com
Mon Nov 16 03:47:03 PST 2015


On Mon, 2015-11-16 at 11:06 +0000, Frediano Ziglio wrote:
> From: Jonathon Jongsma <jjongsma at redhat.com>
> 
> rename to dcc_add_stream_agent_clip()
> ---
>  server/display-channel.c | 15 +++++++++++++++
>  server/display-channel.h |  2 ++
>  server/red_worker.c      | 22 +++-------------------
>  3 files changed, 20 insertions(+), 19 deletions(-)
> 
> diff --git a/server/display-channel.c b/server/display-channel.c
> index 824f601..1d5d8d3 100644
> --- a/server/display-channel.c
> +++ b/server/display-channel.c
> @@ -148,6 +148,21 @@ DisplayChannelClient *dcc_new(DisplayChannel *display,
>      return dcc;
>  }
>  
> +void dcc_add_stream_agent_clip(DisplayChannelClient* dcc, StreamAgent *agent)
> +{
> +    StreamClipItem *item = stream_clip_item_new(dcc, agent);
> +    int n_rects;
> +
> +    item->clip_type = SPICE_CLIP_TYPE_RECTS;
> +
> +    n_rects = pixman_region32_n_rects(&agent->clip);
> +    item->rects = spice_malloc_n_m(n_rects, sizeof(SpiceRect),
> sizeof(SpiceClipRects));
> +    item->rects->num_rects = n_rects;
> +    region_ret_rects(&agent->clip, item->rects->rects, n_rects);
> +
> +    red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), (PipeItem *)item);
> +}
> +
>  MonitorsConfig* monitors_config_ref(MonitorsConfig *monitors_config)
>  {
>      monitors_config->refs++;
> diff --git a/server/display-channel.h b/server/display-channel.h
> index f2c46e0..2fdcd97 100644
> --- a/server/display-channel.h
> +++ b/server/display-channel.h
> @@ -250,6 +250,8 @@
> DisplayChannelClient*      dcc_new                                   (DisplayC
> ha
>  void                       dcc_push_monitors_config                  (Display
> ChannelClient *dcc);
>  void                       dcc_push_destroy_surface                  (Display
> ChannelClient *dcc,
>                                                                        uint32_
> t surface_id);
> +void                       dcc_add_stream_agent_clip                 (Display
> ChannelClient* dcc,
> +                                                                      StreamA
> gent *agent);
>  
>  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 e376be7..bffe517 100644
> --- a/server/red_worker.c
> +++ b/server/red_worker.c
> @@ -326,22 +326,6 @@ static void display_stream_clip_unref(DisplayChannel
> *display, StreamClipItem *i
>      free(item);
>  }
>  
> -static void dcc_push_stream_agent_clip(DisplayChannelClient* dcc, StreamAgent
> *agent)
> -{
> -    StreamClipItem *item = stream_clip_item_new(dcc, agent);
> -    int n_rects;
> -
> -    item->clip_type = SPICE_CLIP_TYPE_RECTS;
> -
> -    n_rects = pixman_region32_n_rects(&agent->clip);
> -    item->rects = spice_malloc_n_m(n_rects, sizeof(SpiceRect),
> sizeof(SpiceClipRects));
> -    item->rects->num_rects = n_rects;
> -    region_ret_rects(&agent->clip, item->rects->rects, n_rects);
> -
> -    red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), (PipeItem *)item);
> -}
> -
> -
>  void attach_stream(DisplayChannel *display, Drawable *drawable, Stream
> *stream)
>  {
>      DisplayChannelClient *dcc;
> @@ -378,7 +362,7 @@ void attach_stream(DisplayChannel *display, Drawable
> *drawable, Stream *stream)
>          if (!region_is_equal(&clip_in_draw_dest, &drawable-
> >tree_item.base.rgn)) {
>              region_remove(&agent->clip, &drawable->red_drawable->bbox);
>              region_or(&agent->clip, &drawable->tree_item.base.rgn);
> -            dcc_push_stream_agent_clip(dcc, agent);
> +            dcc_add_stream_agent_clip(dcc, agent);
>          }
>  #ifdef STREAM_STATS
>          agent->stats.num_input_frames++;
> @@ -1234,7 +1218,7 @@ static void
> dcc_detach_stream_gracefully(DisplayChannelClient *dcc,
>  
>      /* stopping the client from playing older frames at once*/
>      region_clear(&agent->clip);
> -    dcc_push_stream_agent_clip(dcc, agent);
> +    dcc_add_stream_agent_clip(dcc, agent);
>  
>      if (region_is_empty(&agent->vis_region)) {
>          spice_debug("stream %d: vis region empty", stream_id);
> @@ -1383,7 +1367,7 @@ static void streams_update_visible_region(DisplayChannel
> *display, Drawable *dra
>              if (region_intersects(&agent->vis_region, &drawable-
> >tree_item.base.rgn)) {
>                  region_exclude(&agent->vis_region, &drawable-
> >tree_item.base.rgn);
>                  region_exclude(&agent->clip, &drawable->tree_item.base.rgn);
> -                dcc_push_stream_agent_clip(dcc, agent);
> +                dcc_add_stream_agent_clip(dcc, agent);
>              }
>          }
>      }

Ack,

Pavel



More information about the Spice-devel mailing list