Re: [PATCH 04/18] worker: move attach_stream

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 23, 2015 at 6:01 PM, Frediano Ziglio <fziglio@xxxxxxxxxx> wrote:
> From: Marc-André Lureau <marcandre.lureau@xxxxxxxxx>
>
> ---
>  server/red_worker.c | 56 -----------------------------------------------------
>  server/stream.c     | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  server/stream.h     |  1 -
>  3 files changed, 56 insertions(+), 57 deletions(-)
>
> diff --git a/server/red_worker.c b/server/red_worker.c
> index 443e00a..f64befa 100644
> --- a/server/red_worker.c
> +++ b/server/red_worker.c
> @@ -159,50 +159,6 @@ static void red_create_surface(DisplayChannel *display, uint32_t surface_id, uin
>                                 uint32_t height, int32_t stride, uint32_t format,
>                                 void *line_0, int data_is_valid, int send_client);
>
> -void attach_stream(DisplayChannel *display, Drawable *drawable, Stream *stream)
> -{
> -    DisplayChannelClient *dcc;
> -    RingItem *item, *next;
> -
> -    spice_assert(!drawable->stream && !stream->current);
> -    spice_assert(drawable && stream);
> -    stream->current = drawable;
> -    drawable->stream = stream;
> -    stream->last_time = drawable->creation_time;
> -
> -    uint64_t duration = drawable->creation_time - stream->input_fps_start_time;
> -    if (duration >= RED_STREAM_INPUT_FPS_TIMEOUT) {
> -        /* Round to the nearest integer, for instance 24 for 23.976 */
> -        stream->input_fps = ((uint64_t)stream->num_input_frames * 1000 * 1000 * 1000 + duration / 2) / duration;
> -        spice_debug("input-fps=%u", stream->input_fps);
> -        stream->num_input_frames = 0;
> -        stream->input_fps_start_time = drawable->creation_time;
> -    } else {
> -        stream->num_input_frames++;
> -    }
> -
> -    FOREACH_DCC(display, item, next, dcc) {
> -        StreamAgent *agent;
> -        QRegion clip_in_draw_dest;
> -
> -        agent = &dcc->stream_agents[get_stream_id(display, stream)];
> -        region_or(&agent->vis_region, &drawable->tree_item.base.rgn);
> -
> -        region_init(&clip_in_draw_dest);
> -        region_add(&clip_in_draw_dest, &drawable->red_drawable->bbox);
> -        region_and(&clip_in_draw_dest, &agent->clip);
> -
> -        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_stream_agent_clip(dcc, agent);
> -        }
> -#ifdef STREAM_STATS
> -        agent->stats.num_input_frames++;
> -#endif
> -    }
> -}
> -
>  QXLInstance* red_worker_get_qxl(RedWorker *worker)
>  {
>      spice_return_val_if_fail(worker != NULL, NULL);
> @@ -624,18 +580,6 @@ static void red_clear_surface_drawables_from_pipes(DisplayChannel *display,
>      }
>  }
>
> -void detach_stream(DisplayChannel *display, Stream *stream,
> -                   int detach_sized)
> -{
> -    spice_assert(stream->current && stream->current->stream);
> -    spice_assert(stream->current->stream == stream);
> -    stream->current->stream = NULL;
> -    if (detach_sized) {
> -        stream->current->sized_stream = NULL;
> -    }
> -    stream->current = NULL;
> -}
> -
>  static int red_display_drawable_is_in_pipe(DisplayChannelClient *dcc, Drawable *drawable)
>  {
>      DrawablePipeItem *dpi;
> diff --git a/server/stream.c b/server/stream.c
> index 518e2d8..8d16658 100644
> --- a/server/stream.c
> +++ b/server/stream.c
> @@ -258,6 +258,62 @@ static int is_next_stream_frame(DisplayChannel *display,
>      }
>  }
>
> +static void attach_stream(DisplayChannel *display, Drawable *drawable, Stream *stream)
> +{
> +    DisplayChannelClient *dcc;
> +    RingItem *item, *next;
> +
> +    spice_assert(!drawable->stream && !stream->current);
> +    spice_assert(drawable && stream);
> +    stream->current = drawable;
> +    drawable->stream = stream;
> +    stream->last_time = drawable->creation_time;
> +
> +    uint64_t duration = drawable->creation_time - stream->input_fps_start_time;
> +    if (duration >= RED_STREAM_INPUT_FPS_TIMEOUT) {
> +        /* Round to the nearest integer, for instance 24 for 23.976 */
> +        stream->input_fps = ((uint64_t)stream->num_input_frames * 1000 * 1000 * 1000 + duration / 2) / duration;
> +        spice_debug("input-fps=%u", stream->input_fps);
> +        stream->num_input_frames = 0;
> +        stream->input_fps_start_time = drawable->creation_time;
> +    } else {
> +        stream->num_input_frames++;
> +    }
> +
> +    FOREACH_DCC(display, item, next, dcc) {
> +        StreamAgent *agent;
> +        QRegion clip_in_draw_dest;
> +
> +        agent = &dcc->stream_agents[get_stream_id(display, stream)];
> +        region_or(&agent->vis_region, &drawable->tree_item.base.rgn);
> +
> +        region_init(&clip_in_draw_dest);
> +        region_add(&clip_in_draw_dest, &drawable->red_drawable->bbox);
> +        region_and(&clip_in_draw_dest, &agent->clip);
> +
> +        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_stream_agent_clip(dcc, agent);
> +        }
> +#ifdef STREAM_STATS
> +        agent->stats.num_input_frames++;
> +#endif
> +    }
> +}
> +
> +void detach_stream(DisplayChannel *display, Stream *stream,
> +                   int detach_sized)
> +{
> +    spice_assert(stream->current && stream->current->stream);
> +    spice_assert(stream->current->stream == stream);
> +    stream->current->stream = NULL;
> +    if (detach_sized) {
> +        stream->current->sized_stream = NULL;
> +    }
> +    stream->current = NULL;
> +}
> +
>  static void before_reattach_stream(DisplayChannel *display,
>                                     Stream *stream, Drawable *new_frame)
>  {
> diff --git a/server/stream.h b/server/stream.h
> index 65de2f4..7c589e4 100644
> --- a/server/stream.h
> +++ b/server/stream.h
> @@ -154,7 +154,6 @@ void                  stream_agent_unref                            (DisplayChan
>  void                  stream_agent_stats_print                      (StreamAgent *agent);
>  void                  stream_agent_stop                             (StreamAgent *agent);
>
> -void attach_stream(DisplayChannel *display, Drawable *drawable, Stream *stream);
>  void detach_stream(DisplayChannel *display, Stream *stream, int detach_sized);
>
>  #endif /* STREAM_H */
> --
> 2.4.3
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/spice-devel

Acked-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]