evas: Inline part of clip_dirty
authorJean-Philippe Andre <jp.andre@samsung.com>
Mon, 20 Feb 2017 14:14:38 +0000 (23:14 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Tue, 21 Feb 2017 02:23:07 +0000 (11:23 +0900)
clip_dirty is called A LOT. Unfortunately this patch does not
result in very measurable improvements.

**********************
Note about this merge:

After this series of patches, the CPU usage for a certain test
case has significantly gone down:

Based on c0e6a8d698c17fc16f9b67fc9 (upstream before git push):
NS since frame 2 = 28910806786 , 2937 frames = 9843652 / frame

After this patch:
NS since frame 2 = 19218592951 , 2928 frames = 6563727 / frame

1.18:
NS since 2 = 13105584220 , 2961 frames = 4426066 / frame

As we can see, 1.18 remains *much* better than 1.19. I'm still
struggling trying to figure out why (clip_recalc is called more,
but the call tree is hard to decypher).

The test case is:
EINA_FREEQ_BYPASS=1 ELM_TEST_AUTOBOUNCE=100 \
  elementary_test -to "Scroller 2"

EFL was compiled with GCC 6.3.1 with -O3 -g

@optimization

src/lib/evas/canvas/evas_clip.c
src/lib/evas/include/evas_inline.x
src/lib/evas/include/evas_private.h

index da761c3..6d9f267 100644 (file)
@@ -4,13 +4,11 @@
 static void _clip_unset(Eo *eo_obj, Evas_Object_Protected_Data *obj);
 
 void
-evas_object_clip_dirty(Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj)
+evas_object_clip_dirty_do(Evas_Object_Protected_Data *obj)
 {
    Evas_Object_Protected_Data *clipee;
    Eina_List *l;
 
-   if (obj->cur->cache.clip.dirty) return;
-
    EINA_COW_STATE_WRITE_BEGIN(obj, state_write, cur)
      {
        state_write->cache.clip.dirty = EINA_TRUE;
index ec53d6d..979f6ef 100644 (file)
@@ -289,6 +289,13 @@ evas_object_clip_recalc(Evas_Object_Protected_Data *obj)
 }
 
 static inline void
+evas_object_clip_dirty(Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj)
+{
+   if (obj->cur->cache.clip.dirty) return;
+   evas_object_clip_dirty_do(obj);
+}
+
+static inline void
 evas_object_async_block(Evas_Object_Protected_Data *obj)
 {
    if (EVAS_OBJECT_DATA_VALID(obj))
index 356f3be..eb9a1a0 100644 (file)
@@ -1615,7 +1615,7 @@ void evas_object_render_pre_effect_updates(Eina_Array *rects, Evas_Object *obj,
 void evas_rects_return_difference_rects(Eina_Array *rects, int x, int y, int w, int h, int xx, int yy, int ww, int hh);
 Evas_Object_Pointer_Data *_evas_object_pointer_data_get(Evas_Pointer_Data *evas_pdata, Evas_Object_Protected_Data *obj);
 
-void evas_object_clip_dirty(Evas_Object *obj, Evas_Object_Protected_Data *pd);
+void evas_object_clip_dirty_do(Evas_Object_Protected_Data *pd);
 void evas_object_recalc_clippees(Evas_Object_Protected_Data *pd);
 Evas_Layer *evas_layer_new(Evas *e);
 void _evas_layer_flush_removes(Evas_Layer *lay);