summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormythri.venugopal <mythri.venugopal@samsung.com>2015-07-29 23:12:35 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-08-04 17:34:30 +0200
commitd9ee48b01346241b21218eb52a42fcf39f840281 (patch)
treef85667d9ba4eb2f78f336cf9f13ba999d308e287
parent815ebc0b0eb513072ae35ac801304a3228f208e2 (diff)
evas gl: add support for new partial update extension.
Summary: If EGL_KHR_partial_update extension is implemented by the driver, set the damage region. This is done before the draw calls. @feature Reviewers: wonsik, spacegrapher, jpeg Reviewed By: spacegrapher Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2828 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--src/modules/evas/engines/gl_x11/evas_engine.c10
-rw-r--r--src/modules/evas/engines/gl_x11/evas_engine.h1
-rw-r--r--src/modules/evas/engines/gl_x11/evas_x_main.c99
3 files changed, 72 insertions, 38 deletions
diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c b/src/modules/evas/engines/gl_x11/evas_engine.c
index 23e00179c4..4bac452b43 100644
--- a/src/modules/evas/engines/gl_x11/evas_engine.c
+++ b/src/modules/evas/engines/gl_x11/evas_engine.c
@@ -97,6 +97,7 @@ void *(*glsym_eglCreateImage) (EGLDisplay a, EGLContext b, EGLe
97void (*glsym_eglDestroyImage) (EGLDisplay a, void *b) = NULL; 97void (*glsym_eglDestroyImage) (EGLDisplay a, void *b) = NULL;
98void (*glsym_glEGLImageTargetTexture2DOES) (int a, void *b) = NULL; 98void (*glsym_glEGLImageTargetTexture2DOES) (int a, void *b) = NULL;
99unsigned int (*glsym_eglSwapBuffersWithDamage) (EGLDisplay a, void *b, const EGLint *d, EGLint c) = NULL; 99unsigned int (*glsym_eglSwapBuffersWithDamage) (EGLDisplay a, void *b, const EGLint *d, EGLint c) = NULL;
100unsigned int (*glsym_eglSetDamageRegionKHR) (EGLDisplay a, EGLSurface b, EGLint *c, EGLint d) = NULL;
100 101
101#else 102#else
102 103
@@ -1345,6 +1346,7 @@ eng_gl_symbols(void)
1345 FINDSYM(glsym_eglSwapBuffersWithDamage, "eglSwapBuffersWithDamageEXT", glsym_func_uint); 1346 FINDSYM(glsym_eglSwapBuffersWithDamage, "eglSwapBuffersWithDamageEXT", glsym_func_uint);
1346 FINDSYM(glsym_eglSwapBuffersWithDamage, "eglSwapBuffersWithDamageINTEL", glsym_func_uint); 1347 FINDSYM(glsym_eglSwapBuffersWithDamage, "eglSwapBuffersWithDamageINTEL", glsym_func_uint);
1347 FINDSYM(glsym_eglSwapBuffersWithDamage, "eglSwapBuffersWithDamage", glsym_func_uint); 1348 FINDSYM(glsym_eglSwapBuffersWithDamage, "eglSwapBuffersWithDamage", glsym_func_uint);
1349 FINDSYM(glsym_eglSetDamageRegionKHR, "eglSetDamageRegionKHR", glsym_func_uint);
1348 1350
1349 1351
1350#else 1352#else
@@ -1409,10 +1411,16 @@ gl_extn_veto(Render_Engine *re)
1409 { 1411 {
1410 extn_have_buffer_age = 0; 1412 extn_have_buffer_age = 0;
1411 glsym_eglSwapBuffersWithDamage = NULL; 1413 glsym_eglSwapBuffersWithDamage = NULL;
1414 glsym_eglSetDamageRegionKHR = NULL;
1412 } 1415 }
1413 if (!strstr(str, "EGL_EXT_buffer_age")) 1416 if (!strstr(str, "EGL_EXT_buffer_age"))
1414 { 1417 {
1415 extn_have_buffer_age = 0; 1418 if (!strstr(str, "EGL_KHR_partial_update"))
1419 extn_have_buffer_age = 0;
1420 }
1421 if (!strstr(str, "EGL_KHR_partial_update"))
1422 {
1423 glsym_eglSetDamageRegionKHR = NULL;
1416 } 1424 }
1417 if (!strstr(str, "EGL_NOK_texture_from_pixmap")) 1425 if (!strstr(str, "EGL_NOK_texture_from_pixmap"))
1418 { 1426 {
diff --git a/src/modules/evas/engines/gl_x11/evas_engine.h b/src/modules/evas/engines/gl_x11/evas_engine.h
index 29171b0f22..66dfdc323c 100644
--- a/src/modules/evas/engines/gl_x11/evas_engine.h
+++ b/src/modules/evas/engines/gl_x11/evas_engine.h
@@ -148,6 +148,7 @@ extern Evas_GL_Preload_Render_Call glsym_evas_gl_preload_render_unlock;
148#endif 148#endif
149 149
150extern unsigned int (*glsym_eglSwapBuffersWithDamage) (EGLDisplay a, void *b, const EGLint *d, EGLint c); 150extern unsigned int (*glsym_eglSwapBuffersWithDamage) (EGLDisplay a, void *b, const EGLint *d, EGLint c);
151extern unsigned int (*glsym_eglSetDamageRegionKHR) (EGLDisplay a, EGLSurface b, EGLint *c, EGLint d);
151 152
152#else 153#else
153 154
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 4b1ebab032..91830a6d7e 100644
--- a/src/modules/evas/engines/gl_x11/evas_x_main.c
+++ b/src/modules/evas/engines/gl_x11/evas_x_main.c
@@ -1405,6 +1405,63 @@ eng_outbuf_region_first_rect(Outbuf *ob)
1405 return EINA_FALSE; 1405 return EINA_FALSE;
1406} 1406}
1407 1407
1408#ifdef GL_GLES
1409static void
1410_convert_to_glcoords(int *result, Outbuf *ob, int x, int y, int w, int h)
1411{
1412
1413 switch (ob->rot)
1414 {
1415 case 0:
1416 result[0] = x;
1417 result[1] = ob->gl_context->h - (y + h);
1418 result[2] = w;
1419 result[3] = h;
1420 break;
1421 case 90:
1422 result[0] = y;
1423 result[1] = x;
1424 result[2] = h;
1425 result[3] = w;
1426 break;
1427 case 180:
1428 result[0] = ob->gl_context->w - (x + w);
1429 result[1] = y;
1430 result[2] = w;
1431 result[3] = h;
1432 break;
1433 case 270:
1434 result[0] = ob->gl_context->h - (y + h);
1435 result[1] = ob->gl_context->w - (x + w);
1436 result[2] = h;
1437 result[3] = w;
1438 break;
1439 default:
1440 result[0] = x;
1441 result[1] = ob->gl_context->h - (y + h);
1442 result[2] = w;
1443 result[3] = h;
1444 break;
1445 }
1446}
1447
1448static void
1449_set_damage_rect(Outbuf *ob, int x, int y, int w, int h)
1450{
1451 int rects[4];
1452
1453 if ((x==0) && (y==0) &&
1454 (((w == ob->gl_context->w) && (h == ob->gl_context->h))
1455 || ((h == ob->gl_context->w) && (w == ob->gl_context->h))))
1456 {
1457 return;
1458 }
1459
1460 _convert_to_glcoords(rects, ob, x, y, w, h);
1461 glsym_eglSetDamageRegionKHR(ob->egl_disp, ob->egl_surface[0], rects, 1);
1462}
1463#endif
1464
1408void* 1465void*
1409eng_outbuf_new_region_for_update(Outbuf *ob, 1466eng_outbuf_new_region_for_update(Outbuf *ob,
1410 int x, int y, int w, int h, 1467 int x, int y, int w, int h,
@@ -1422,6 +1479,10 @@ eng_outbuf_new_region_for_update(Outbuf *ob,
1422 ob->gl_context->master_clip.y = y; 1479 ob->gl_context->master_clip.y = y;
1423 ob->gl_context->master_clip.w = w; 1480 ob->gl_context->master_clip.w = w;
1424 ob->gl_context->master_clip.h = h; 1481 ob->gl_context->master_clip.h = h;
1482#ifdef GL_GLES
1483 if (glsym_eglSetDamageRegionKHR)
1484 _set_damage_rect(ob, x, y, w, h);
1485#endif
1425 } 1486 }
1426 return ob->gl_context->def_surface; 1487 return ob->gl_context->def_surface;
1427} 1488}
@@ -1497,43 +1558,7 @@ eng_outbuf_flush(Outbuf *ob, Tilebuf_Rect *rects, Evas_Render_Mode render_mode)
1497 result = alloca(sizeof(EGLint) * 4 * num); 1558 result = alloca(sizeof(EGLint) * 4 * num);
1498 EINA_INLIST_FOREACH(EINA_INLIST_GET(rects), r) 1559 EINA_INLIST_FOREACH(EINA_INLIST_GET(rects), r)
1499 { 1560 {
1500 int gw, gh; 1561 _convert_to_glcoords(&result[i], ob, r->x, r->y, r->w, r->h);
1501
1502 gw = ob->gl_context->w;
1503 gh = ob->gl_context->h;
1504 switch (ob->rot)
1505 {
1506 case 0:
1507 result[i + 0] = r->x;
1508 result[i + 1] = gh - (r->y + r->h);
1509 result[i + 2] = r->w;
1510 result[i + 3] = r->h;
1511 break;
1512 case 90:
1513 result[i + 0] = r->y;
1514 result[i + 1] = r->x;
1515 result[i + 2] = r->h;
1516 result[i + 3] = r->w;
1517 break;
1518 case 180:
1519 result[i + 0] = gw - (r->x + r->w);
1520 result[i + 1] = r->y;
1521 result[i + 2] = r->w;
1522 result[i + 3] = r->h;
1523 break;
1524 case 270:
1525 result[i + 0] = gh - (r->y + r->h);
1526 result[i + 1] = gw - (r->x + r->w);
1527 result[i + 2] = r->h;
1528 result[i + 3] = r->w;
1529 break;
1530 default:
1531 result[i + 0] = r->x;
1532 result[i + 1] = gh - (r->y + r->h);
1533 result[i + 2] = r->w;
1534 result[i + 3] = r->h;
1535 break;
1536 }
1537 i += 4; 1562 i += 4;
1538 } 1563 }
1539 glsym_eglSwapBuffersWithDamage(ob->egl_disp, 1564 glsym_eglSwapBuffersWithDamage(ob->egl_disp,