summaryrefslogtreecommitdiff
path: root/src/egl/drivers
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2012-12-13 23:32:14 -0500
committerKristian Høgsberg <krh@bitplanet.net>2013-01-14 16:39:15 -0500
commit6d4d4b00ddfbd3257ecd129fec5b813be7e36fe9 (patch)
tree05ff897091a760799185363830336af2cfd97d8b /src/egl/drivers
parent90804e886de892cfedb8248a4f5700fd7422b94a (diff)
egl/wayland: Implement EGL_EXT_buffer_age
Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
Diffstat (limited to 'src/egl/drivers')
-rw-r--r--src/egl/drivers/dri2/platform_wayland.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 5b5c8490882..e9a66afb6ed 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -286,6 +286,7 @@ get_back_bo(struct dri2_egl_surface *dri2_surf, __DRIbuffer *buffer)
__DRI_BUFFER_BACK_LEFT, 32,
dri2_surf->base.Width,
dri2_surf->base.Height);
+ dri2_surf->back->age = 0;
}
if (dri2_surf->back->dri_buffer == NULL)
return -1;
@@ -445,7 +446,7 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
- int ret = 0;
+ int i, ret = 0;
while (dri2_surf->frame_callback && ret != -1)
ret = wl_display_dispatch_queue(dri2_dpy->wl_dpy, dri2_dpy->wl_queue);
@@ -458,6 +459,11 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
wl_proxy_set_queue((struct wl_proxy *) dri2_surf->frame_callback,
dri2_dpy->wl_queue);
+ for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++)
+ if (dri2_surf->color_buffers[i].age > 0)
+ dri2_surf->color_buffers[i].age++;
+
+ dri2_surf->back->age = 1;
dri2_surf->current = dri2_surf->back;
dri2_surf->back = NULL;
@@ -496,6 +502,21 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
return EGL_TRUE;
}
+static EGLint
+dri2_query_buffer_age(_EGLDriver *drv,
+ _EGLDisplay *disp, _EGLSurface *surface)
+{
+ struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surface);
+ __DRIbuffer buffer;
+
+ if (get_back_bo(dri2_surf, &buffer) < 0) {
+ _eglError(EGL_BAD_ALLOC, "dri2_query_buffer_age");
+ return 0;
+ }
+
+ return dri2_surf->back->age;
+}
+
static int
dri2_wayland_authenticate(_EGLDisplay *disp, uint32_t id)
{
@@ -633,6 +654,7 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
drv->API.DestroySurface = dri2_destroy_surface;
drv->API.SwapBuffers = dri2_swap_buffers;
drv->API.Terminate = dri2_terminate;
+ drv->API.QueryBufferAge = dri2_query_buffer_age;
dri2_dpy = calloc(1, sizeof *dri2_dpy);
if (!dri2_dpy)
@@ -697,6 +719,7 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
}
disp->Extensions.WL_bind_wayland_display = EGL_TRUE;
+ disp->Extensions.EXT_buffer_age = EGL_TRUE;
dri2_dpy->authenticate = dri2_wayland_authenticate;
/* we're supporting EGL 1.4 */