[Spice-devel] [PATCH 10/10] worker: remove some useless counters

Frediano Ziglio fziglio at redhat.com
Fri Nov 6 03:31:04 PST 2015


> 
> From: Marc-André Lureau <marcandre.lureau at gmail.com>
> 
> ---
>  server/red_worker.c | 28 +++-------------------------
>  1 file changed, 3 insertions(+), 25 deletions(-)
> 
> diff --git a/server/red_worker.c b/server/red_worker.c
> index 20b72a3..47c1491 100644
> --- a/server/red_worker.c
> +++ b/server/red_worker.c
> @@ -338,7 +338,6 @@ typedef struct RedWorker {
>  
>      DisplayChannel *display_channel;
>      uint32_t display_poll_tries;
> -
>      CursorChannel *cursor_channel;
>      uint32_t cursor_poll_tries;
>  

unneeded change

> @@ -348,13 +347,7 @@ typedef struct RedWorker {
>  
>      uint32_t red_drawable_count;
>      uint32_t glz_drawable_count;
> -    uint32_t transparent_count;
> -
> -    uint32_t shadows_count;
> -    uint32_t containers_count;
> -
>      uint32_t bits_unique;
> -
>      RedMemSlotInfo mem_slots;
>  
>      SpiceImageCompression image_compression;
> @@ -363,18 +356,14 @@ typedef struct RedWorker {
>  
>      QuicData quic_data;
>      QuicContext *quic;
> -
>      LzData lz_data;
>      LzContext  *lz;
> -
>      JpegData jpeg_data;
>      JpegEncoderContext *jpeg;
> -
>  #ifdef USE_LZ4
>      Lz4Data lz4_data;
>      Lz4EncoderContext *lz4;
>  #endif
> -
>      ZlibData zlib_data;
>      ZlibEncoder *zlib;
>  

other space changes (to be removed)

> @@ -1082,7 +1071,7 @@ void display_channel_drawable_unref(DisplayChannel
> *display, Drawable *drawable)
>      display->drawable_count--;
>  }
>  
> -static inline void remove_shadow(RedWorker *worker, DrawItem *item)
> +static void remove_shadow(DisplayChannel *display, DrawItem *item)
>  {
>      Shadow *shadow;
>  

no reason for this change

> @@ -1095,13 +1084,11 @@ static inline void remove_shadow(RedWorker *worker,
> DrawItem *item)
>      region_destroy(&shadow->base.rgn);
>      region_destroy(&shadow->on_hold);
>      free(shadow);
> -    worker->shadows_count--;
>  }
>  
>  static inline void current_remove_container(RedWorker *worker, Container
>  *container)
>  {
>      spice_assert(ring_is_empty(&container->items));
> -    worker->containers_count--;
>      ring_remove(&container->base.siblings_link);
>      region_destroy(&container->base.rgn);
>      free(container);
> @@ -1165,12 +1152,8 @@ static inline void current_remove_drawable(RedWorker
> *worker, Drawable *item)
>  {
>      DisplayChannel *display = worker->display_channel;
>  
> -    if (item->tree_item.effect != QXL_EFFECT_OPAQUE) {
> -        worker->transparent_count--;
> -    }
> -
>      display_stream_trace_add_drawable(display, item);
> -    remove_shadow(worker, &item->tree_item);
> +    remove_shadow(display, &item->tree_item);
>      ring_remove(&item->tree_item.base.siblings_link);
>      ring_remove(&item->list_link);
>      ring_remove(&item->surface_list_link);

this change looks odd, compiler should complain before or after this change!

> @@ -2567,7 +2550,6 @@ static inline int red_current_add(RedWorker *worker,
> Ring *ring, Drawable *drawa
>                          region_destroy(&exclude_rgn);
>                          return FALSE;
>                      }
> -                    worker->containers_count++;
>                      item->base.container = container;
>                      ring = &container->items;
>                  }
> @@ -2614,7 +2596,7 @@ static void add_clip_rects(QRegion *rgn, SpiceClipRects
> *data)
>      }
>  }
>  
> -static inline int red_current_add_with_shadow(RedWorker *worker, Ring *ring,
> Drawable *item)
> +static int red_current_add_with_shadow(RedWorker *worker, Ring *ring,
> Drawable *item)
>  {
>      DisplayChannel *display = worker->display_channel;
>  #ifdef RED_WORKER_STAT

other change not related to this

> @@ -2633,7 +2615,6 @@ static inline int red_current_add_with_shadow(RedWorker
> *worker, Ring *ring, Dra
>          stat_add(&worker->add_stat, start_time);
>          return FALSE;
>      }
> -    worker->shadows_count++;
>      // item and his shadow must initially be placed in the same container.
>      // for now putting them on root.
>  
> @@ -3049,9 +3030,6 @@ static inline void red_process_draw(RedWorker *worker,
> RedDrawable *red_drawable
>      }
>  
>      if (red_add_drawable(worker, drawable)) {
> -        if (drawable->tree_item.effect != QXL_EFFECT_OPAQUE) {
> -            worker->transparent_count++;
> -        }
>          red_pipes_add_drawable(worker, drawable);
>      }
>  cleanup:
> --
> 2.4.3

I agree with the patch reasoning as these counters are only updated.

I'll:
- remove space changes from patch
- remove inline changes from patch
- split counters removal and shadow
- check why the shadow change.

Frediano


More information about the Spice-devel mailing list