Compare commits

...

2 Commits

Author SHA1 Message Date
Chris Michael 26ee584fd7 evas-wayland-egl: Add support for partial update extension
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>
2015-08-11 10:09:40 -04:00
Chris Michael f8987ed5aa Add experimental implementation of custom animator ticks
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-08-06 09:53:27 -04:00
7 changed files with 91 additions and 54 deletions

View File

@ -779,6 +779,8 @@ _ecore_wl_animator_tick_cb_begin(void *data EINA_UNUSED)
{
Eina_Hash *windows;
fprintf(stderr, "ECORE_WL ANIMATOR TICK BEGIN\n");
_ecore_wl_animator_busy = EINA_TRUE;
windows = _ecore_wl_window_hash_get();
@ -788,6 +790,7 @@ _ecore_wl_animator_tick_cb_begin(void *data EINA_UNUSED)
static void
_ecore_wl_animator_tick_cb_end(void *data EINA_UNUSED)
{
fprintf(stderr, "ECORE_WL ANIMATOR TICK END\n");
_ecore_wl_animator_busy = EINA_FALSE;
}
@ -798,6 +801,8 @@ _ecore_wl_animator_callback(void *data, struct wl_callback *callback, uint32_t s
if (!(win = data)) return;
fprintf(stderr, "ECORE_WL ANIMATOR CALLBACK\n");
ecore_animator_custom_tick();
wl_callback_destroy(callback);

View File

@ -231,7 +231,7 @@ ecore_wl_window_commit(Ecore_Wl_Window *win)
if (!win) return;
if ((win->surface) && (win->has_buffer))
if ((win->surface))// && (win->has_buffer))
wl_surface_commit(win->surface);
}

View File

@ -245,6 +245,8 @@ ecore_evas_wayland_shm_new_internal(const char *disp_name, unsigned int parent,
goto err;
}
ecore_wl_animator_source_set(ECORE_ANIMATOR_SOURCE_CUSTOM);
ecore_evas_callback_pre_free_set(ee, _ecore_evas_wl_common_pre_free);
if (ee->prop.draw_frame)

View File

@ -74,6 +74,7 @@ void *(*glsym_eglCreateImage) (EGLDisplay a, EGLContext b, EGLenum c, EGLClientB
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;
/* local variables */
static Eina_Bool initted = EINA_FALSE;
@ -167,6 +168,8 @@ gl_symbols(void)
glsym_func_uint);
FINDSYM(glsym_eglSwapBuffersWithDamage, "eglSwapBuffersWithDamage",
glsym_func_uint);
FINDSYM(glsym_eglSetDamageRegionKHR, "eglSetDamageRegionKHR",
glsym_func_uint);
done = EINA_TRUE;
}
@ -187,10 +190,16 @@ gl_extn_veto(Render_Engine *re)
{
extn_have_buffer_age = EINA_FALSE;
glsym_eglSwapBuffersWithDamage = NULL;
glsym_eglSetDamageRegionKHR = NULL;
}
if (!strstr(str, "EGL_EXT_buffer_age"))
{
extn_have_buffer_age = EINA_FALSE;
if (!strstr(str, "EGL_KHR_partial_update"))
extn_have_buffer_age = EINA_FALSE;
}
if (!strstr(str, "EGL_KHR_partial_update"))
{
glsym_eglSetDamageRegionKHR = NULL;
}
if (!strstr(str, "EGL_NOK_texture_from_pixmap"))
{

View File

@ -105,6 +105,7 @@ extern Evas_GL_Preload_Render_Call glsym_evas_gl_preload_render_lock;
extern Evas_GL_Preload_Render_Call glsym_evas_gl_preload_render_unlock;
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);
Outbuf *eng_window_new(Evas *evas, Evas_Engine_Info_Wayland_Egl *einfo, int w, int h, Render_Engine_Swap_Mode swap_mode);
void eng_window_free(Outbuf *gw);

View File

@ -400,6 +400,59 @@ eng_outbuf_region_first_rect(Outbuf *ob)
return EINA_FALSE;
}
static void
_convert_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
_damage_rect_set(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_glcoords(rects, ob, x, y, w, h);
glsym_eglSetDamageRegionKHR(ob->egl_disp, ob->egl_surface[0], rects, 1);
}
void *
eng_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)
{
@ -412,6 +465,9 @@ eng_outbuf_update_region_new(Outbuf *ob, int x, int y, int w, int h, int *cx EIN
ob->gl_context->master_clip.y = y;
ob->gl_context->master_clip.w = w;
ob->gl_context->master_clip.h = h;
if (glsym_eglSetDamageRegionKHR)
_damage_rect_set(ob, x, y, w, h);
}
return ob->gl_context->def_surface;
@ -465,43 +521,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_glcoords(&result[i], ob, r->x, r->y, r->w, r->h);
i += 4;
}
glsym_eglSwapBuffersWithDamage(ob->egl_disp, ob->egl_surface[0],

View File

@ -134,22 +134,22 @@ _shm_pool_reset(Shm_Pool *pool)
pool->used = 0;
}
static void
_shm_frame_release(void *data, struct wl_callback *callback, uint32_t timestamp EINA_UNUSED)
{
Shm_Surface *surf;
/* static void */
/* _shm_frame_release(void *data, struct wl_callback *callback, uint32_t timestamp EINA_UNUSED) */
/* { */
/* Shm_Surface *surf; */
LOGFN(__FILE__, __LINE__, __FUNCTION__);
/* LOGFN(__FILE__, __LINE__, __FUNCTION__); */
if (!(surf = data)) return;
/* if (!(surf = data)) return; */
wl_callback_destroy(callback);
}
/* wl_callback_destroy(callback); */
/* } */
static const struct wl_callback_listener _shm_frame_listener =
{
_shm_frame_release
};
/* static const struct wl_callback_listener _shm_frame_listener = */
/* { */
/* _shm_frame_release */
/* }; */
static Shm_Data *
_shm_data_create_from_pool(Shm_Pool *pool, int w, int h, Eina_Bool alpha)
@ -488,7 +488,7 @@ _evas_shm_surface_data_get(Shm_Surface *surface, int *w, int *h)
void
_evas_shm_surface_post(Shm_Surface *surface, Eina_Rectangle *rects, unsigned int count)
{
struct wl_callback *frame_cb;
/* struct wl_callback *frame_cb; */
Shm_Leaf *leaf;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -512,8 +512,8 @@ _evas_shm_surface_post(Shm_Surface *surface, Eina_Rectangle *rects, unsigned int
else
wl_surface_damage(surface->surface, 0, 0, leaf->w, leaf->h);
frame_cb = wl_surface_frame(surface->surface);
wl_callback_add_listener(frame_cb, &_shm_frame_listener, surface);
/* frame_cb = wl_surface_frame(surface->surface); */
/* wl_callback_add_listener(frame_cb, &_shm_frame_listener, surface); */
wl_surface_commit(surface->surface);