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>
This commit is contained in:
mythri.venugopal 2015-07-29 23:12:35 +02:00 committed by Cedric BAIL
parent 815ebc0b0e
commit d9ee48b013
3 changed files with 72 additions and 38 deletions

View File

@ -97,6 +97,7 @@ void *(*glsym_eglCreateImage) (EGLDisplay a, EGLContext b, EGLe
void (*glsym_eglDestroyImage) (EGLDisplay a, void *b) = NULL;
void (*glsym_glEGLImageTargetTexture2DOES) (int a, void *b) = NULL;
unsigned int (*glsym_eglSwapBuffersWithDamage) (EGLDisplay a, void *b, const EGLint *d, EGLint c) = NULL;
unsigned int (*glsym_eglSetDamageRegionKHR) (EGLDisplay a, EGLSurface b, EGLint *c, EGLint d) = NULL;
#else
@ -1345,6 +1346,7 @@ eng_gl_symbols(void)
FINDSYM(glsym_eglSwapBuffersWithDamage, "eglSwapBuffersWithDamageEXT", glsym_func_uint);
FINDSYM(glsym_eglSwapBuffersWithDamage, "eglSwapBuffersWithDamageINTEL", glsym_func_uint);
FINDSYM(glsym_eglSwapBuffersWithDamage, "eglSwapBuffersWithDamage", glsym_func_uint);
FINDSYM(glsym_eglSetDamageRegionKHR, "eglSetDamageRegionKHR", glsym_func_uint);
#else
@ -1409,10 +1411,16 @@ gl_extn_veto(Render_Engine *re)
{
extn_have_buffer_age = 0;
glsym_eglSwapBuffersWithDamage = NULL;
glsym_eglSetDamageRegionKHR = NULL;
}
if (!strstr(str, "EGL_EXT_buffer_age"))
{
extn_have_buffer_age = 0;
if (!strstr(str, "EGL_KHR_partial_update"))
extn_have_buffer_age = 0;
}
if (!strstr(str, "EGL_KHR_partial_update"))
{
glsym_eglSetDamageRegionKHR = NULL;
}
if (!strstr(str, "EGL_NOK_texture_from_pixmap"))
{

View File

@ -148,6 +148,7 @@ extern Evas_GL_Preload_Render_Call glsym_evas_gl_preload_render_unlock;
#endif
extern unsigned int (*glsym_eglSwapBuffersWithDamage) (EGLDisplay a, void *b, const EGLint *d, EGLint c);
extern unsigned int (*glsym_eglSetDamageRegionKHR) (EGLDisplay a, EGLSurface b, EGLint *c, EGLint d);
#else

View File

@ -1405,6 +1405,63 @@ eng_outbuf_region_first_rect(Outbuf *ob)
return EINA_FALSE;
}
#ifdef GL_GLES
static void
_convert_to_glcoords(int *result, Outbuf *ob, int x, int y, int w, int h)
{
switch (ob->rot)
{
case 0:
result[0] = x;
result[1] = ob->gl_context->h - (y + h);
result[2] = w;
result[3] = h;
break;
case 90:
result[0] = y;
result[1] = x;
result[2] = h;
result[3] = w;
break;
case 180:
result[0] = ob->gl_context->w - (x + w);
result[1] = y;
result[2] = w;
result[3] = h;
break;
case 270:
result[0] = ob->gl_context->h - (y + h);
result[1] = ob->gl_context->w - (x + w);
result[2] = h;
result[3] = w;
break;
default:
result[0] = x;
result[1] = ob->gl_context->h - (y + h);
result[2] = w;
result[3] = h;
break;
}
}
static void
_set_damage_rect(Outbuf *ob, int x, int y, int w, int h)
{
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;
}
_convert_to_glcoords(rects, ob, x, y, w, h);
glsym_eglSetDamageRegionKHR(ob->egl_disp, ob->egl_surface[0], rects, 1);
}
#endif
void*
eng_outbuf_new_region_for_update(Outbuf *ob,
int x, int y, int w, int h,
@ -1422,6 +1479,10 @@ 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;
}
@ -1497,43 +1558,7 @@ eng_outbuf_flush(Outbuf *ob, Tilebuf_Rect *rects, Evas_Render_Mode render_mode)
result = alloca(sizeof(EGLint) * 4 * num);
EINA_INLIST_FOREACH(EINA_INLIST_GET(rects), r)
{
int gw, gh;
gw = ob->gl_context->w;
gh = ob->gl_context->h;
switch (ob->rot)
{
case 0:
result[i + 0] = r->x;
result[i + 1] = gh - (r->y + r->h);
result[i + 2] = r->w;
result[i + 3] = r->h;
break;
case 90:
result[i + 0] = r->y;
result[i + 1] = r->x;
result[i + 2] = r->h;
result[i + 3] = r->w;
break;
case 180:
result[i + 0] = gw - (r->x + r->w);
result[i + 1] = r->y;
result[i + 2] = r->w;
result[i + 3] = r->h;
break;
case 270:
result[i + 0] = gh - (r->y + r->h);
result[i + 1] = gw - (r->x + r->w);
result[i + 2] = r->h;
result[i + 3] = r->w;
break;
default:
result[i + 0] = r->x;
result[i + 1] = gh - (r->y + r->h);
result[i + 2] = r->w;
result[i + 3] = r->h;
break;
}
_convert_to_glcoords(&result[i], ob, r->x, r->y, r->w, r->h);
i += 4;
}
glsym_eglSwapBuffersWithDamage(ob->egl_disp,