engines: Add a damage_region_set callback
authorDerek Foreman <derekf@osg.samsung.com>
Fri, 19 Aug 2016 19:14:38 +0000 (14:14 -0500)
committerDerek Foreman <derekf@osg.samsung.com>
Fri, 19 Aug 2016 21:26:20 +0000 (16:26 -0500)
To properly implement EGL_KHR_partial_update we need to know the buffer
damage before any drawing operations take place.  Add a new callback to
software_generic that takes place after combining of surface damage and
swap mode when we actually have this available.

Note: This means the three copy pasta implementations of
EGL_KHR_partial_update scattered around the tree are all wrong.  bummer.

src/modules/evas/engines/buffer/evas_engine.c
src/modules/evas/engines/drm/evas_engine.c
src/modules/evas/engines/gl_drm/evas_engine.c
src/modules/evas/engines/gl_generic/Evas_Engine_GL_Generic.h
src/modules/evas/engines/gl_x11/evas_engine.c
src/modules/evas/engines/software_generic/Evas_Engine_Software_Generic.h
src/modules/evas/engines/software_generic/evas_engine.c
src/modules/evas/engines/software_x11/evas_engine.c
src/modules/evas/engines/wayland_egl/evas_engine.c
src/modules/evas/engines/wayland_egl/evas_engine.h
src/modules/evas/engines/wayland_shm/evas_engine.c

index 791be8b..021f7c5 100644 (file)
@@ -97,6 +97,7 @@ _output_setup(int w,
                                                  evas_buffer_outbuf_buf_rot_get,
                                                  evas_buffer_outbuf_reconfigure,
                                                  NULL,
+                                                 NULL,
                                                  evas_buffer_outbuf_buf_new_region_for_update,
                                                  evas_buffer_outbuf_buf_push_updated_region,
                                                  evas_buffer_outbuf_buf_free_region_for_update,
index 6aecbc6..0499a96 100644 (file)
@@ -26,6 +26,7 @@ _render_engine_setup(Evas_Engine_Info_Drm *info, int w, int h)
                                                  _outbuf_rotation_get,
                                                  _outbuf_reconfigure,
                                                  NULL,
+                                                 NULL,
                                                  _outbuf_update_region_new,
                                                  _outbuf_update_region_push,
                                                  _outbuf_update_region_free,
index 1b42497..fecbb87 100644 (file)
@@ -949,6 +949,7 @@ eng_setup(Evas *evas, void *in)
                                                 evas_outbuf_rot_get,
                                                 evas_outbuf_reconfigure,
                                                 evas_outbuf_update_region_first_rect,
+                                                NULL,
                                                 evas_outbuf_update_region_new,
                                                 evas_outbuf_update_region_push,
                                                 evas_outbuf_update_region_free,
index e5743ee..8118812 100644 (file)
@@ -45,6 +45,7 @@ evas_render_engine_gl_generic_init(Render_Engine_GL_Generic *re,
                                    Outbuf_Get_Rot outbuf_get_rot,
                                    Outbuf_Reconfigure outbuf_reconfigure,
                                    Outbuf_Region_First_Rect outbuf_region_first_rect,
+                                   Outbuf_Damage_Region_Set outbuf_damage_region_set,
                                    Outbuf_New_Region_For_Update outbuf_new_region_for_update,
                                    Outbuf_Push_Updated_Region outbuf_push_updated_region,
                                    Outbuf_Free_Region_For_Update outbuf_free_region_for_update,
@@ -64,6 +65,7 @@ evas_render_engine_gl_generic_init(Render_Engine_GL_Generic *re,
                                                  outbuf_get_rot,
                                                  outbuf_reconfigure,
                                                  outbuf_region_first_rect,
+                                                 outbuf_damage_region_set,
                                                  outbuf_new_region_for_update,
                                                  outbuf_push_updated_region,
                                                  outbuf_free_region_for_update,
index 093a025..8842a47 100644 (file)
@@ -1721,6 +1721,7 @@ eng_setup(Evas *eo_e, void *in)
                                                 eng_outbuf_get_rot,
                                                 eng_outbuf_reconfigure,
                                                 eng_outbuf_region_first_rect,
+                                                NULL,
                                                 eng_outbuf_new_region_for_update,
                                                 eng_outbuf_push_updated_region,
                                                 eng_outbuf_push_free_region_for_update,
index 179dae7..d3a3620 100644 (file)
@@ -46,6 +46,7 @@ typedef struct _Outbuf Outbuf;
 typedef Render_Engine_Swap_Mode (*Outbuf_Swap_Mode_Get)(Outbuf *ob);
 typedef void (*Outbuf_Reconfigure)(Outbuf *ob, int w, int h, int rot, Outbuf_Depth depth);
 typedef Eina_Bool (*Outbuf_Region_First_Rect)(Outbuf *ob);
+typedef void (*Outbuf_Damage_Region_Set)(Outbuf *ob, Tilebuf_Rect *rects);
 typedef void *(*Outbuf_New_Region_For_Update)(Outbuf *ob, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch);
 typedef void (*Outbuf_Push_Updated_Region)(Outbuf *ob, RGBA_Image *update, int x, int y, int w, int h);
 typedef void (*Outbuf_Idle_Flush)(Outbuf *ob);
@@ -66,6 +67,7 @@ struct _Render_Engine_Software_Generic
    Outbuf_Get_Rot outbuf_get_rot;
    Outbuf_Reconfigure outbuf_reconfigure;
    Outbuf_Region_First_Rect outbuf_region_first_rect;
+   Outbuf_Damage_Region_Set outbuf_damage_region_set;
    Outbuf_New_Region_For_Update outbuf_new_region_for_update;
    Outbuf_Push_Updated_Region outbuf_push_updated_region;
    Outbuf_Idle_Flush outbuf_idle_flush;
@@ -90,6 +92,7 @@ evas_render_engine_software_generic_init(Render_Engine_Software_Generic *re,
                                          Outbuf_Get_Rot outbuf_get_rot,
                                          Outbuf_Reconfigure outbuf_reconfigure,
                                          Outbuf_Region_First_Rect outbuf_region_first_rect,
+                                         Outbuf_Damage_Region_Set outbuf_damage_region_set,
                                          Outbuf_New_Region_For_Update outbuf_new_region_for_update,
                                          Outbuf_Push_Updated_Region outbuf_push_updated_region,
                                          Outbuf_Free_Region_For_Update outbuf_free_region_for_update,
@@ -105,6 +108,7 @@ evas_render_engine_software_generic_init(Render_Engine_Software_Generic *re,
    re->outbuf_get_rot = outbuf_get_rot;
    re->outbuf_reconfigure = outbuf_reconfigure;
    re->outbuf_region_first_rect = outbuf_region_first_rect;
+   re->outbuf_damage_region_set = outbuf_damage_region_set;
    re->outbuf_new_region_for_update = outbuf_new_region_for_update;
    re->outbuf_push_updated_region = outbuf_push_updated_region;
    re->outbuf_idle_flush = outbuf_idle_flush;
index 5821a4c..963b0e0 100644 (file)
@@ -3951,6 +3951,8 @@ eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, i
           }
         evas_common_tilebuf_clear(re->tb);
         re->cur_rect = EINA_INLIST_GET(re->rects);
+        if (re->cur_rect && re->outbuf_damage_region_set)
+          re->outbuf_damage_region_set(re->ob, re->rects);
      }
    if (!re->cur_rect) return NULL;
    rect = (Tilebuf_Rect *)re->cur_rect;
index 00691ae..dc926e6 100644 (file)
@@ -180,6 +180,7 @@ _output_xlib_setup(int w, int h, int rot, Display *disp, Drawable draw,
                                                  evas_software_xlib_outbuf_get_rot,
                                                  evas_software_xlib_outbuf_reconfigure,
                                                  NULL,
+                                                 NULL,
                                                  evas_software_xlib_outbuf_new_region_for_update,
                                                  evas_software_xlib_outbuf_push_updated_region,
                                                  evas_software_xlib_outbuf_free_region_for_update,
@@ -240,6 +241,7 @@ _output_swapbuf_setup(int w, int h, int rot, Display *disp, Drawable draw,
                                                  evas_software_xlib_swapbuf_get_rot,
                                                  evas_software_xlib_swapbuf_reconfigure,
                                                  NULL,
+                                                 NULL,
                                                  evas_software_xlib_swapbuf_new_region_for_update,
                                                  evas_software_xlib_swapbuf_push_updated_region,
                                                  evas_software_xlib_swapbuf_free_region_for_update,
@@ -297,6 +299,7 @@ _output_xcb_setup(int w, int h, int rot, xcb_connection_t *conn,
                                                  evas_software_xcb_outbuf_rotation_get,
                                                  evas_software_xcb_outbuf_reconfigure,
                                                  NULL,
+                                                 NULL,
                                                  evas_software_xcb_outbuf_new_region_for_update,
                                                  evas_software_xcb_outbuf_push_updated_region,
                                                  evas_software_xcb_outbuf_free_region_for_update,
index 8ccc4e1..157dd2d 100644 (file)
@@ -591,6 +591,7 @@ eng_setup(Evas *evas, void *info)
                                                 eng_outbuf_rotation_get,
                                                 eng_outbuf_reconfigure,
                                                 eng_outbuf_region_first_rect,
+                                                NULL,
                                                 eng_outbuf_update_region_new,
                                                 eng_outbuf_update_region_push,
                                                 eng_outbuf_update_region_free,
index a4ccbf8..c28b130 100644 (file)
@@ -117,6 +117,7 @@ void eng_outbuf_reconfigure(Outbuf *ob, int w, int h, int rot, Outbuf_Depth dept
 int eng_outbuf_rotation_get(Outbuf *ob);
 Render_Engine_Swap_Mode eng_outbuf_swap_mode_get(Outbuf *ob);
 Eina_Bool eng_outbuf_region_first_rect(Outbuf *ob);
+void eng_outbuf_damage_region_set(Outbuf *ob, Tilebuf_Rect *damage);
 void *eng_outbuf_update_region_new(Outbuf *ob, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch);
 void eng_outbuf_update_region_free(Outbuf *ob, RGBA_Image *update);
 void eng_outbuf_update_region_push(Outbuf *ob, RGBA_Image *update, int x, int y, int w, int h);
index 4a5849f..0c4abe2 100644 (file)
@@ -48,7 +48,8 @@ _render_engine_swapbuf_setup(int w, int h, Evas_Engine_Info_Wayland_Shm *einfo)
                                                  _evas_outbuf_swap_mode_get,
                                                  _evas_outbuf_rotation_get,
                                                  NULL,
-                                                 NULL, 
+                                                 NULL,
+                                                 NULL,
                                                  _evas_outbuf_update_region_new,
                                                  _evas_outbuf_update_region_push,
                                                  _evas_outbuf_update_region_free,