gl_x11: Do KHR Partial Damage properly

KHR partial damage must be set once at the beginning of rendering with
buffer damage for the entire scene to be rendered.  Doing otherwise can
result in graphical anomalies on some GL implementations.
This commit is contained in:
Derek Foreman 2016-10-20 14:13:49 -05:00
parent d29bb3bbec
commit 1809b3b959
3 changed files with 22 additions and 15 deletions

View File

@ -1751,7 +1751,11 @@ eng_setup(Evas *eo_e, void *in)
eng_outbuf_get_rot,
eng_outbuf_reconfigure,
eng_outbuf_region_first_rect,
#ifdef GL_GLES
eng_outbuf_damage_region_set,
#else
NULL,
#endif
eng_outbuf_new_region_for_update,
eng_outbuf_push_updated_region,
eng_outbuf_push_free_region_for_update,

View File

@ -187,6 +187,9 @@ void eng_gl_context_use(Context_3D *context);
void eng_outbuf_reconfigure(Outbuf *ob, int w, int h, int rot, Outbuf_Depth depth);
int eng_outbuf_get_rot(Outbuf *ob);
Render_Engine_Swap_Mode eng_outbuf_swap_mode(Outbuf *ob);
#ifdef GL_GLES
void eng_outbuf_damage_region_set(Outbuf *ob, Tilebuf_Rect *damage);
#endif
Eina_Bool eng_outbuf_region_first_rect(Outbuf *ob);
void *eng_outbuf_new_region_for_update(Outbuf *ob,
int x, int y, int w, int h,

View File

@ -1479,20 +1479,24 @@ _convert_to_glcoords(int *result, Outbuf *ob, int x, int y, int w, int h)
}
}
static void
_set_damage_rect(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))))
if (glsym_eglSetDamageRegionKHR)
{
return;
}
Tilebuf_Rect *tr;
int *rect, *rects, count;
_convert_to_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_to_glcoords(rect, ob, tr->x, tr->y, tr->w, tr->h);
rect += 4;
}
glsym_eglSetDamageRegionKHR(ob->egl_disp, ob->egl_surface[0], rects, count);
}
}
#endif
@ -1513,10 +1517,6 @@ 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;
}