This should probably also be ported to function with the wayland-egl engine.
dh On 08/04/2015 11:34 AM, mythri.venugopal wrote: > cedric pushed a commit to branch master. > > http://git.enlightenment.org/core/efl.git/commit/?id=d9ee48b01346241b21218eb52a42fcf39f840281 > > commit d9ee48b01346241b21218eb52a42fcf39f840281 > Author: mythri.venugopal <[email protected]> > Date: Wed Jul 29 23:12:35 2015 +0200 > > 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 <[email protected]> > --- > src/modules/evas/engines/gl_x11/evas_engine.c | 10 ++- > src/modules/evas/engines/gl_x11/evas_engine.h | 1 + > src/modules/evas/engines/gl_x11/evas_x_main.c | 99 > +++++++++++++++++---------- > 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 23e0017..4bac452 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 > 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")) > { > diff --git a/src/modules/evas/engines/gl_x11/evas_engine.h > b/src/modules/evas/engines/gl_x11/evas_engine.h > index 29171b0..66dfdc3 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; > #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 > > 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 4b1ebab..91830a6 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) > 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, > ------------------------------------------------------------------------------ _______________________________________________ enlightenment-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
