wayland_egl: Fix EGL_KHR_Partial_Update usage
authorDerek Foreman <derekf@osg.samsung.com>
Fri, 19 Aug 2016 19:22:46 +0000 (14:22 -0500)
committerDerek Foreman <derekf@osg.samsung.com>
Fri, 19 Aug 2016 21:26:32 +0000 (16:26 -0500)
Use the new damage region set callback to do partial updates that actually
work.  Fixes gl rendering on mali.

@fix

src/modules/evas/engines/wayland_egl/evas_engine.c
src/modules/evas/engines/wayland_egl/evas_wl_main.c

index 157dd2d..9d4260d 100644 (file)
@@ -591,7 +591,7 @@ eng_setup(Evas *evas, void *info)
                                                 eng_outbuf_rotation_get,
                                                 eng_outbuf_reconfigure,
                                                 eng_outbuf_region_first_rect,
-                                                NULL,
+                                                eng_outbuf_damage_region_set,
                                                 eng_outbuf_update_region_new,
                                                 eng_outbuf_update_region_push,
                                                 eng_outbuf_update_region_free,
index 710202f..b265d7f 100644 (file)
@@ -384,11 +384,10 @@ eng_outbuf_swap_mode_get(Outbuf *ob)
 
         if ((int)age != ob->prev_age) swap_mode = MODE_FULL;
         ob->prev_age = age;
+
         return swap_mode;
      }
 
-   if (ob->swap_mode == MODE_AUTO) return MODE_FULL;
    return ob->swap_mode;
 }
 
@@ -444,18 +443,24 @@ _convert_glcoords(int *result, Outbuf *ob, int x, int y, int w, int h)
      }
 }
 
-static void
-_damage_rect_set(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))))
-     return;
+   if (glsym_eglSetDamageRegionKHR)
+     {
+        Tilebuf_Rect *tr;
+        int *rect, *rects, count;
 
-   _convert_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_glcoords(rect, ob, tr->x, tr->y, tr->w, tr->h);
+             rect += 4;
+          }
+        glsym_eglSetDamageRegionKHR(ob->egl_disp, ob->egl_surface[0], rects, count);
+     }
 }
 
 void *
@@ -470,9 +475,6 @@ eng_outbuf_update_region_new(Outbuf *ob, int x, int y, int w, int h, int *cx EIN
         ob->gl_context->master_clip.y = y;
         ob->gl_context->master_clip.w = w;
         ob->gl_context->master_clip.h = h;
-
-        if (glsym_eglSetDamageRegionKHR)
-          _damage_rect_set(ob, x, y, w, h);
      }
 
    return ob->gl_context->def_surface;