Commit 92d86976 authored by Robert Bragg's avatar Robert Bragg
Browse files

egl: support EGL_EXT_buffer_age



This adds support for the EGL_EXT_buffer_age extension which is a
counterpart to the GLX_EXT_buffer_age extension.
Reviewed-by: default avatarNeil Roberts <neil@linux.intel.com>
parent 427b1038
......@@ -94,4 +94,10 @@ COGL_WINSYS_FEATURE_BEGIN (create_context,
COGL_EGL_WINSYS_FEATURE_CREATE_CONTEXT)
COGL_WINSYS_FEATURE_END ()
COGL_WINSYS_FEATURE_BEGIN (buffer_age,
"EXT\0",
"buffer_age\0",
COGL_EGL_WINSYS_FEATURE_BUFFER_AGE)
COGL_WINSYS_FEATURE_END ()
#endif
......@@ -69,7 +69,8 @@ typedef enum _CoglEGLWinsysFeature
COGL_EGL_WINSYS_FEATURE_SWAP_REGION =1L<<0,
COGL_EGL_WINSYS_FEATURE_EGL_IMAGE_FROM_X11_PIXMAP =1L<<1,
COGL_EGL_WINSYS_FEATURE_EGL_IMAGE_FROM_WAYLAND_BUFFER =1L<<2,
COGL_EGL_WINSYS_FEATURE_CREATE_CONTEXT =1L<<3
COGL_EGL_WINSYS_FEATURE_CREATE_CONTEXT =1L<<3,
COGL_EGL_WINSYS_FEATURE_BUFFER_AGE =1L<<4
} CoglEGLWinsysFeature;
typedef struct _CoglRendererEGL
......
......@@ -689,6 +689,28 @@ _cogl_winsys_onscreen_bind (CoglOnscreen *onscreen)
bind_onscreen (onscreen);
}
#ifndef EGL_BUFFER_AGE_EXT
#define EGL_BUFFER_AGE_EXT 0x313D
#endif
static int
_cogl_winsys_onscreen_get_buffer_age (CoglOnscreen *onscreen)
{
CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context;
CoglRenderer *renderer = context->display->renderer;
CoglRendererEGL *egl_renderer = renderer->winsys;
CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
EGLSurface surface = egl_onscreen->egl_surface;
int age;
if (!(egl_renderer->private_features & COGL_EGL_WINSYS_FEATURE_BUFFER_AGE))
return 0;
eglQuerySurface (egl_renderer->edpy, surface, EGL_BUFFER_AGE_EXT, &age);
return age;
}
static void
_cogl_winsys_onscreen_swap_region (CoglOnscreen *onscreen,
const int *user_rectangles,
......@@ -848,6 +870,7 @@ static CoglWinsysVtable _cogl_winsys_vtable =
.onscreen_bind = _cogl_winsys_onscreen_bind,
.onscreen_swap_buffers = _cogl_winsys_onscreen_swap_buffers,
.onscreen_swap_region = _cogl_winsys_onscreen_swap_region,
.onscreen_get_buffer_age = _cogl_winsys_onscreen_get_buffer_age,
.onscreen_update_swap_throttled =
_cogl_winsys_onscreen_update_swap_throttled,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment