Re: [PATCH 15/19] worker: move current_remove*

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

 



On Thu, Nov 26, 2015 at 10:52 AM, Fabiano Fidêncio <fidencio@xxxxxxxxxx> wrote:
> On Wed, Nov 25, 2015 at 4:27 PM, Frediano Ziglio <fziglio@xxxxxxxxxx> wrote:
>> From: Marc-André Lureau <marcandre.lureau@xxxxxxxxx>
>>
>> ---
>>  server/display-channel.c | 61 ++++++++++++++++++++++++++++++++++++
>>  server/display-channel.h |  3 --
>>  server/red_worker.c      | 80 ------------------------------------------------
>>  server/stream.c          | 19 ++++++++++++
>>  server/stream.h          |  2 ++
>>  5 files changed, 82 insertions(+), 83 deletions(-)
>>
>> diff --git a/server/display-channel.c b/server/display-channel.c
>> index ded306b..aa3e7fb 100644
>> --- a/server/display-channel.c
>> +++ b/server/display-channel.c
>> @@ -391,6 +391,67 @@ static void current_add_drawable(DisplayChannel *display,
>>      drawable->refs++;
>>  }
>>
>> +static void current_remove_drawable(DisplayChannel *display, Drawable *item)
>> +{
>> +    /* todo: move all to unref? */
>> +    stream_trace_add_drawable(display, item);
>> +    draw_item_remove_shadow(&item->tree_item);
>> +    ring_remove(&item->tree_item.base.siblings_link);
>> +    ring_remove(&item->list_link);
>> +    ring_remove(&item->surface_list_link);
>> +    display_channel_drawable_unref(display, item);
>> +    display->current_size--;
>> +}
>> +
>> +static void current_remove(DisplayChannel *display, TreeItem *item)
>> +{
>> +    TreeItem *now = item;
>> +
>> +    /* depth-first tree traversal, TODO: do a to tree_foreach()? */
>> +    for (;;) {
>> +        Container *container = now->container;
>> +        RingItem *ring_item;
>> +
>> +        if (now->type == TREE_ITEM_TYPE_DRAWABLE) {
>> +            Drawable *drawable = SPICE_CONTAINEROF(now, Drawable, tree_item);
>> +            ring_item = now->siblings_link.prev;
>> +            red_pipes_remove_drawable(drawable);
>> +            current_remove_drawable(display, drawable);
>> +        } else {
>> +            Container *container = (Container *)now;
>> +
>> +            spice_assert(now->type == TREE_ITEM_TYPE_CONTAINER);
>> +
>> +            if ((ring_item = ring_get_head(&container->items))) {
>> +                now = SPICE_CONTAINEROF(ring_item, TreeItem, siblings_link);
>> +                continue;
>> +            }
>> +            ring_item = now->siblings_link.prev;
>> +            container_free(container);
>> +        }
>> +        if (now == item) {
>> +            return;
>> +        }
>> +
>> +        if ((ring_item = ring_next(&container->items, ring_item))) {
>> +            now = SPICE_CONTAINEROF(ring_item, TreeItem, siblings_link);
>> +        } else {
>> +            now = (TreeItem *)container;
>> +        }
>> +    }
>> +}
>> +
>> +static void current_remove_all(DisplayChannel *display, int surface_id)
>> +{
>> +    Ring *ring = &display->surfaces[surface_id].current;
>> +    RingItem *ring_item;
>> +
>> +    while ((ring_item = ring_get_head(ring))) {
>> +        TreeItem *now = SPICE_CONTAINEROF(ring_item, TreeItem, siblings_link);
>> +        current_remove(display, now);
>> +    }
>> +}
>> +
>>  static int current_add_equal(DisplayChannel *display, DrawItem *item, TreeItem *other)
>>  {
>>      DrawItem *other_draw_item;
>> diff --git a/server/display-channel.h b/server/display-channel.h
>> index 05b0e0e..3f3c278 100644
>> --- a/server/display-channel.h
>> +++ b/server/display-channel.h
>> @@ -433,12 +433,9 @@ static inline void region_add_clip_rects(QRegion *rgn, SpiceClipRects *data)
>>  }
>>
>>  uint32_t generate_uid(DisplayChannel *display);
>> -void current_remove_drawable(DisplayChannel *display, Drawable *item);
>>  void red_pipes_remove_drawable(Drawable *drawable);
>> -void current_remove(DisplayChannel *display, TreeItem *item);
>>  void detach_streams_behind(DisplayChannel *display, QRegion *region, Drawable *drawable);
>>  void drawable_draw(DisplayChannel *display, Drawable *item);
>> -void current_remove_all(DisplayChannel *display, int surface_id);
>>  void drawables_init(DisplayChannel *display);
>>
>>  #endif /* DISPLAY_CHANNEL_H_ */
>> diff --git a/server/red_worker.c b/server/red_worker.c
>> index b308e97..eb4be25 100644
>> --- a/server/red_worker.c
>> +++ b/server/red_worker.c
>> @@ -186,86 +186,6 @@ void red_drawable_unref(RedWorker *worker, RedDrawable *red_drawable,
>>      free(red_drawable);
>>  }
>>
>> -static void display_stream_trace_add_drawable(DisplayChannel *display, Drawable *item)
>> -{
>> -    ItemTrace *trace;
>> -
>> -    if (item->stream || !item->streamable) {
>> -        return;
>> -    }
>> -
>> -    trace = &display->items_trace[display->next_item_trace++ & ITEMS_TRACE_MASK];
>> -    trace->time = item->creation_time;
>> -    trace->frames_count = item->frames_count;
>> -    trace->gradual_frames_count = item->gradual_frames_count;
>> -    trace->last_gradual_frame = item->last_gradual_frame;
>> -    SpiceRect* src_area = &item->red_drawable->u.copy.src_area;
>> -    trace->width = src_area->right - src_area->left;
>> -    trace->height = src_area->bottom - src_area->top;
>> -    trace->dest_area = item->red_drawable->bbox;
>> -}
>> -
>> -void current_remove_drawable(DisplayChannel *display, Drawable *item)
>> -{
>> -    /* todo: move all to unref? */
>> -    display_stream_trace_add_drawable(display, item);
>> -    draw_item_remove_shadow(&item->tree_item);
>> -    ring_remove(&item->tree_item.base.siblings_link);
>> -    ring_remove(&item->list_link);
>> -    ring_remove(&item->surface_list_link);
>> -    display_channel_drawable_unref(display, item);
>> -    display->current_size--;
>> -}
>> -
>> -void current_remove(DisplayChannel *display, TreeItem *item)
>> -{
>> -    TreeItem *now = item;
>> -
>> -    /* depth-first tree traversal, TODO: do a to tree_foreach()? */
>> -    for (;;) {
>> -        Container *container = now->container;
>> -        RingItem *ring_item;
>> -
>> -        if (now->type == TREE_ITEM_TYPE_DRAWABLE) {
>> -            Drawable *drawable = SPICE_CONTAINEROF(now, Drawable, tree_item);
>> -            ring_item = now->siblings_link.prev;
>> -            red_pipes_remove_drawable(drawable);
>> -            current_remove_drawable(display, drawable);
>> -        } else {
>> -            Container *container = (Container *)now;
>> -
>> -            spice_assert(now->type == TREE_ITEM_TYPE_CONTAINER);
>> -
>> -            if ((ring_item = ring_get_head(&container->items))) {
>> -                now = SPICE_CONTAINEROF(ring_item, TreeItem, siblings_link);
>> -                continue;
>> -            }
>> -            ring_item = now->siblings_link.prev;
>> -            container_free(container);
>> -        }
>> -        if (now == item) {
>> -            return;
>> -        }
>> -
>> -        if ((ring_item = ring_next(&container->items, ring_item))) {
>> -            now = SPICE_CONTAINEROF(ring_item, TreeItem, siblings_link);
>> -        } else {
>> -            now = (TreeItem *)container;
>> -        }
>> -    }
>> -}
>> -
>> -void current_remove_all(DisplayChannel *display, int surface_id)
>> -{
>> -    Ring *ring = &display->surfaces[surface_id].current;
>> -    RingItem *ring_item;
>> -
>> -    while ((ring_item = ring_get_head(ring))) {
>> -        TreeItem *now = SPICE_CONTAINEROF(ring_item, TreeItem, siblings_link);
>> -        current_remove(display, now);
>> -    }
>> -}
>> -
>>  static void red_process_draw(RedWorker *worker, RedDrawable *red_drawable,
>>                               uint32_t group_id)
>>  {
>> diff --git a/server/stream.c b/server/stream.c
>> index 08224d8..50881e5 100644
>> --- a/server/stream.c
>> +++ b/server/stream.c
>> @@ -904,3 +904,22 @@ void stream_timeout(DisplayChannel *display)
>>          }
>>      }
>>  }
>> +
>> +void stream_trace_add_drawable(DisplayChannel *display, Drawable *item)
>> +{
>> +    ItemTrace *trace;
>> +
>> +    if (item->stream || !item->streamable) {
>> +        return;
>> +    }
>> +
>> +    trace = &display->items_trace[display->next_item_trace++ & ITEMS_TRACE_MASK];
>> +    trace->time = item->creation_time;
>> +    trace->frames_count = item->frames_count;
>> +    trace->gradual_frames_count = item->gradual_frames_count;
>> +    trace->last_gradual_frame = item->last_gradual_frame;
>> +    SpiceRect* src_area = &item->red_drawable->u.copy.src_area;
>> +    trace->width = src_area->right - src_area->left;
>> +    trace->height = src_area->bottom - src_area->top;
>> +    trace->dest_area = item->red_drawable->bbox;
>> +}
>> diff --git a/server/stream.h b/server/stream.h
>> index 35cbf5f..b11b10f 100644
>> --- a/server/stream.h
>> +++ b/server/stream.h
>> @@ -157,6 +157,8 @@ void                  stream_maintenance                            (DisplayChan
>>                                                                       Drawable *prev);
>>  void                  stream_timeout                                (DisplayChannel *display);
>>  void                  stream_detach_and_stop                        (DisplayChannel *display);
>> +void                  stream_trace_add_drawable                     (DisplayChannel *display,
>> +                                                                     Drawable *item);
>>
>>  void                  stream_agent_unref                            (DisplayChannel *display,
>>                                                                       StreamAgent *agent);
>> --
>> 2.4.3
>>
>> _______________________________________________
>> Spice-devel mailing list
>> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
>> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>
> Be aware that this patch depends on changes on the first one ...

s/first/previous

> 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]