summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2015-08-11 10:09:40 -0400
committerChris Michael <cp.michael@samsung.com>2015-08-11 10:09:40 -0400
commit26ee584fd7617edd86962d283dc3d099a9e35af3 (patch)
treeb731efb012b5138d5bf852fc3ad18791c0efb0d5
parentf8987ed5aa6794244fb71cfaf5cc48149a2f0274 (diff)
evas-wayland-egl: Add support for partial update extensiondevs/devilhorns/evas_wayland_shm
Summary: if EGL_KHR_partial_update extension is implemented in the driver, set damage region. This is done before the draw calls. Signed-off-by: Chris Michael <cp.michael@samsung.com>
-rw-r--r--src/modules/evas/engines/wayland_egl/evas_engine.c11
-rw-r--r--src/modules/evas/engines/wayland_egl/evas_engine.h1
-rw-r--r--src/modules/evas/engines/wayland_egl/evas_wl_main.c94
3 files changed, 68 insertions, 38 deletions
diff --git a/src/modules/evas/engines/wayland_egl/evas_engine.c b/src/modules/evas/engines/wayland_egl/evas_engine.c
index 47ac0e24ee..750d443db6 100644
--- a/src/modules/evas/engines/wayland_egl/evas_engine.c
+++ b/src/modules/evas/engines/wayland_egl/evas_engine.c
@@ -74,6 +74,7 @@ void *(*glsym_eglCreateImage) (EGLDisplay a, EGLContext b, EGLenum c, EGLClientB
74void (*glsym_eglDestroyImage) (EGLDisplay a, void *b) = NULL; 74void (*glsym_eglDestroyImage) (EGLDisplay a, void *b) = NULL;
75void (*glsym_glEGLImageTargetTexture2DOES) (int a, void *b) = NULL; 75void (*glsym_glEGLImageTargetTexture2DOES) (int a, void *b) = NULL;
76unsigned int (*glsym_eglSwapBuffersWithDamage) (EGLDisplay a, void *b, const EGLint *d, EGLint c) = NULL; 76unsigned int (*glsym_eglSwapBuffersWithDamage) (EGLDisplay a, void *b, const EGLint *d, EGLint c) = NULL;
77unsigned int (*glsym_eglSetDamageRegionKHR) (EGLDisplay a, EGLSurface b, EGLint *c, EGLint d) = NULL;
77 78
78/* local variables */ 79/* local variables */
79static Eina_Bool initted = EINA_FALSE; 80static Eina_Bool initted = EINA_FALSE;
@@ -167,6 +168,8 @@ gl_symbols(void)
167 glsym_func_uint); 168 glsym_func_uint);
168 FINDSYM(glsym_eglSwapBuffersWithDamage, "eglSwapBuffersWithDamage", 169 FINDSYM(glsym_eglSwapBuffersWithDamage, "eglSwapBuffersWithDamage",
169 glsym_func_uint); 170 glsym_func_uint);
171 FINDSYM(glsym_eglSetDamageRegionKHR, "eglSetDamageRegionKHR",
172 glsym_func_uint);
170 173
171 done = EINA_TRUE; 174 done = EINA_TRUE;
172} 175}
@@ -187,10 +190,16 @@ gl_extn_veto(Render_Engine *re)
187 { 190 {
188 extn_have_buffer_age = EINA_FALSE; 191 extn_have_buffer_age = EINA_FALSE;
189 glsym_eglSwapBuffersWithDamage = NULL; 192 glsym_eglSwapBuffersWithDamage = NULL;
193 glsym_eglSetDamageRegionKHR = NULL;
190 } 194 }
191 if (!strstr(str, "EGL_EXT_buffer_age")) 195 if (!strstr(str, "EGL_EXT_buffer_age"))
192 { 196 {
193 extn_have_buffer_age = EINA_FALSE; 197 if (!strstr(str, "EGL_KHR_partial_update"))
198 extn_have_buffer_age = EINA_FALSE;
199 }
200 if (!strstr(str, "EGL_KHR_partial_update"))
201 {
202 glsym_eglSetDamageRegionKHR = NULL;
194 } 203 }
195 if (!strstr(str, "EGL_NOK_texture_from_pixmap")) 204 if (!strstr(str, "EGL_NOK_texture_from_pixmap"))
196 { 205 {
diff --git a/src/modules/evas/engines/wayland_egl/evas_engine.h b/src/modules/evas/engines/wayland_egl/evas_engine.h
index 9815a160fc..a4ccbf8087 100644
--- a/src/modules/evas/engines/wayland_egl/evas_engine.h
+++ b/src/modules/evas/engines/wayland_egl/evas_engine.h
@@ -105,6 +105,7 @@ extern Evas_GL_Preload_Render_Call glsym_evas_gl_preload_render_lock;
105extern Evas_GL_Preload_Render_Call glsym_evas_gl_preload_render_unlock; 105extern Evas_GL_Preload_Render_Call glsym_evas_gl_preload_render_unlock;
106 106
107extern unsigned int (*glsym_eglSwapBuffersWithDamage) (EGLDisplay a, void *b, const EGLint *d, EGLint c); 107extern unsigned int (*glsym_eglSwapBuffersWithDamage) (EGLDisplay a, void *b, const EGLint *d, EGLint c);
108extern unsigned int (*glsym_eglSetDamageRegionKHR) (EGLDisplay a, EGLSurface b, EGLint *c, EGLint d);
108 109
109Outbuf *eng_window_new(Evas *evas, Evas_Engine_Info_Wayland_Egl *einfo, int w, int h, Render_Engine_Swap_Mode swap_mode); 110Outbuf *eng_window_new(Evas *evas, Evas_Engine_Info_Wayland_Egl *einfo, int w, int h, Render_Engine_Swap_Mode swap_mode);
110void eng_window_free(Outbuf *gw); 111void eng_window_free(Outbuf *gw);
diff --git a/src/modules/evas/engines/wayland_egl/evas_wl_main.c b/src/modules/evas/engines/wayland_egl/evas_wl_main.c
index a7dfff888d..ff94c53866 100644
--- a/src/modules/evas/engines/wayland_egl/evas_wl_main.c
+++ b/src/modules/evas/engines/wayland_egl/evas_wl_main.c
@@ -400,6 +400,59 @@ eng_outbuf_region_first_rect(Outbuf *ob)
400 return EINA_FALSE; 400 return EINA_FALSE;
401} 401}
402 402
403static void
404_convert_glcoords(int *result, Outbuf *ob, int x, int y, int w, int h)
405{
406
407 switch (ob->rot)
408 {
409 case 0:
410 result[0] = x;
411 result[1] = ob->gl_context->h - (y + h);
412 result[2] = w;
413 result[3] = h;
414 break;
415 case 90:
416 result[0] = y;
417 result[1] = x;
418 result[2] = h;
419 result[3] = w;
420 break;
421 case 180:
422 result[0] = ob->gl_context->w - (x + w);
423 result[1] = y;
424 result[2] = w;
425 result[3] = h;
426 break;
427 case 270:
428 result[0] = ob->gl_context->h - (y + h);
429 result[1] = ob->gl_context->w - (x + w);
430 result[2] = h;
431 result[3] = w;
432 break;
433 default:
434 result[0] = x;
435 result[1] = ob->gl_context->h - (y + h);
436 result[2] = w;
437 result[3] = h;
438 break;
439 }
440}
441
442static void
443_damage_rect_set(Outbuf *ob, int x, int y, int w, int h)
444{
445 int rects[4];
446
447 if ((x == 0) && (y == 0) &&
448 (((w == ob->gl_context->w) && (h == ob->gl_context->h)) ||
449 ((h == ob->gl_context->w) && (w == ob->gl_context->h))))
450 return;
451
452 _convert_glcoords(rects, ob, x, y, w, h);
453 glsym_eglSetDamageRegionKHR(ob->egl_disp, ob->egl_surface[0], rects, 1);
454}
455
403void * 456void *
404eng_outbuf_update_region_new(Outbuf *ob, int x, int y, int w, int h, int *cx EINA_UNUSED, int *cy EINA_UNUSED, int *cw EINA_UNUSED, int *ch EINA_UNUSED) 457eng_outbuf_update_region_new(Outbuf *ob, int x, int y, int w, int h, int *cx EINA_UNUSED, int *cy EINA_UNUSED, int *cw EINA_UNUSED, int *ch EINA_UNUSED)
405{ 458{
@@ -412,6 +465,9 @@ eng_outbuf_update_region_new(Outbuf *ob, int x, int y, int w, int h, int *cx EIN
412 ob->gl_context->master_clip.y = y; 465 ob->gl_context->master_clip.y = y;
413 ob->gl_context->master_clip.w = w; 466 ob->gl_context->master_clip.w = w;
414 ob->gl_context->master_clip.h = h; 467 ob->gl_context->master_clip.h = h;
468
469 if (glsym_eglSetDamageRegionKHR)
470 _damage_rect_set(ob, x, y, w, h);
415 } 471 }
416 472
417 return ob->gl_context->def_surface; 473 return ob->gl_context->def_surface;
@@ -465,43 +521,7 @@ eng_outbuf_flush(Outbuf *ob, Tilebuf_Rect *rects, Evas_Render_Mode render_mode)
465 result = alloca(sizeof(EGLint) * 4 * num); 521 result = alloca(sizeof(EGLint) * 4 * num);
466 EINA_INLIST_FOREACH(EINA_INLIST_GET(rects), r) 522 EINA_INLIST_FOREACH(EINA_INLIST_GET(rects), r)
467 { 523 {
468 int gw, gh; 524 _convert_glcoords(&result[i], ob, r->x, r->y, r->w, r->h);
469
470 gw = ob->gl_context->w;
471 gh = ob->gl_context->h;
472 switch (ob->rot)
473 {
474 case 0:
475 result[i + 0] = r->x;
476 result[i + 1] = gh - (r->y + r->h);
477 result[i + 2] = r->w;
478 result[i + 3] = r->h;
479 break;
480 case 90:
481 result[i + 0] = r->y;
482 result[i + 1] = r->x;
483 result[i + 2] = r->h;
484 result[i + 3] = r->w;
485 break;
486 case 180:
487 result[i + 0] = gw - (r->x + r->w);
488 result[i + 1] = r->y;
489 result[i + 2] = r->w;
490 result[i + 3] = r->h;
491 break;
492 case 270:
493 result[i + 0] = gh - (r->y + r->h);
494 result[i + 1] = gw - (r->x + r->w);
495 result[i + 2] = r->h;
496 result[i + 3] = r->w;
497 break;
498 default:
499 result[i + 0] = r->x;
500 result[i + 1] = gh - (r->y + r->h);
501 result[i + 2] = r->w;
502 result[i + 3] = r->h;
503 break;
504 }
505 i += 4; 525 i += 4;
506 } 526 }
507 glsym_eglSwapBuffersWithDamage(ob->egl_disp, ob->egl_surface[0], 527 glsym_eglSwapBuffersWithDamage(ob->egl_disp, ob->egl_surface[0],