derekf pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=1809b3b9592f785bfd8345d4388c81c4eae8b0d1

commit 1809b3b9592f785bfd8345d4388c81c4eae8b0d1
Author: Derek Foreman <[email protected]>
Date:   Thu Oct 20 14:13:49 2016 -0500

    gl_x11: Do KHR Partial Damage properly
    
    KHR partial damage must be set once at the beginning of rendering with
    buffer damage for the entire scene to be rendered.  Doing otherwise can
    result in graphical anomalies on some GL implementations.
---
 src/modules/evas/engines/gl_x11/evas_engine.c |  4 ++++
 src/modules/evas/engines/gl_x11/evas_engine.h |  3 +++
 src/modules/evas/engines/gl_x11/evas_x_main.c | 30 +++++++++++++--------------
 3 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c 
b/src/modules/evas/engines/gl_x11/evas_engine.c
index 5685625..2d4fde9 100644
--- a/src/modules/evas/engines/gl_x11/evas_engine.c
+++ b/src/modules/evas/engines/gl_x11/evas_engine.c
@@ -1751,7 +1751,11 @@ eng_setup(Evas *eo_e, void *in)
                                                 eng_outbuf_get_rot,
                                                 eng_outbuf_reconfigure,
                                                 eng_outbuf_region_first_rect,
+#ifdef GL_GLES
+                                                eng_outbuf_damage_region_set,
+#else
                                                 NULL,
+#endif
                                                 
eng_outbuf_new_region_for_update,
                                                 eng_outbuf_push_updated_region,
                                                 
eng_outbuf_push_free_region_for_update,
diff --git a/src/modules/evas/engines/gl_x11/evas_engine.h 
b/src/modules/evas/engines/gl_x11/evas_engine.h
index fae6ad4..5f18dc6 100644
--- a/src/modules/evas/engines/gl_x11/evas_engine.h
+++ b/src/modules/evas/engines/gl_x11/evas_engine.h
@@ -187,6 +187,9 @@ void      eng_gl_context_use(Context_3D *context);
 void eng_outbuf_reconfigure(Outbuf *ob, int w, int h, int rot, Outbuf_Depth 
depth);
 int eng_outbuf_get_rot(Outbuf *ob);
 Render_Engine_Swap_Mode eng_outbuf_swap_mode(Outbuf *ob);
+#ifdef GL_GLES
+void eng_outbuf_damage_region_set(Outbuf *ob, Tilebuf_Rect *damage);
+#endif
 Eina_Bool eng_outbuf_region_first_rect(Outbuf *ob);
 void *eng_outbuf_new_region_for_update(Outbuf *ob,
                                        int x, int y, int w, int h,
diff --git a/src/modules/evas/engines/gl_x11/evas_x_main.c 
b/src/modules/evas/engines/gl_x11/evas_x_main.c
index 207cb06..612cb45 100644
--- a/src/modules/evas/engines/gl_x11/evas_x_main.c
+++ b/src/modules/evas/engines/gl_x11/evas_x_main.c
@@ -1479,20 +1479,24 @@ _convert_to_glcoords(int *result, Outbuf *ob, int x, 
int y, int w, int h)
      }
 }
 
-static void
-_set_damage_rect(Outbuf *ob, int x, int y, int w, int h)
+void
+eng_outbuf_damage_region_set(Outbuf *ob, Tilebuf_Rect *damage)
 {
-   int rects[4];
-
-   if ((x==0) && (y==0) &&
-       (((w == ob->gl_context->w) && (h == ob->gl_context->h))
-        || ((h == ob->gl_context->w) && (w == ob->gl_context->h))))
+   if (glsym_eglSetDamageRegionKHR)
      {
-        return;
-     }
+        Tilebuf_Rect *tr;
+        int *rect, *rects, count;
 
-   _convert_to_glcoords(rects, ob, x, y, w, h);
-   glsym_eglSetDamageRegionKHR(ob->egl_disp, ob->egl_surface[0], rects, 1);
+        count = eina_inlist_count(EINA_INLIST_GET(damage));
+        rects = alloca(sizeof(int) * 4 * count);
+        rect = rects;
+        EINA_INLIST_FOREACH(damage, tr)
+          {
+             _convert_to_glcoords(rect, ob, tr->x, tr->y, tr->w, tr->h);
+             rect += 4;
+          }
+        glsym_eglSetDamageRegionKHR(ob->egl_disp, ob->egl_surface[0], rects, 
count);
+     }
 }
 #endif
 
@@ -1513,10 +1517,6 @@ eng_outbuf_new_region_for_update(Outbuf *ob,
         ob->gl_context->master_clip.y = y;
         ob->gl_context->master_clip.w = w;
         ob->gl_context->master_clip.h = h;
-#ifdef GL_GLES
-        if (glsym_eglSetDamageRegionKHR)
-          _set_damage_rect(ob, x, y, w, h);
-#endif
      }
    return ob->gl_context->def_surface;
 }

-- 


Reply via email to