[cogl] egl: support EGL_EXT_buffer_age
- From: Robert Bragg <rbragg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl] egl: support EGL_EXT_buffer_age
- Date: Wed, 23 Jan 2013 17:57:32 +0000 (UTC)
commit 92d869764c03d0bac6b51dac833510c22669ac4a
Author: Robert Bragg <robert linux intel com>
Date: Tue Jan 22 21:21:33 2013 +0000
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: Neil Roberts <neil linux intel com>
cogl/winsys/cogl-winsys-egl-feature-functions.h | 6 ++++++
cogl/winsys/cogl-winsys-egl-private.h | 3 ++-
cogl/winsys/cogl-winsys-egl.c | 23 +++++++++++++++++++++++
3 files changed, 31 insertions(+), 1 deletions(-)
---
diff --git a/cogl/winsys/cogl-winsys-egl-feature-functions.h b/cogl/winsys/cogl-winsys-egl-feature-functions.h
index 9016f8d..5068090 100644
--- a/cogl/winsys/cogl-winsys-egl-feature-functions.h
+++ b/cogl/winsys/cogl-winsys-egl-feature-functions.h
@@ -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
diff --git a/cogl/winsys/cogl-winsys-egl-private.h b/cogl/winsys/cogl-winsys-egl-private.h
index 13ce9a4..0d76065 100644
--- a/cogl/winsys/cogl-winsys-egl-private.h
+++ b/cogl/winsys/cogl-winsys-egl-private.h
@@ -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
diff --git a/cogl/winsys/cogl-winsys-egl.c b/cogl/winsys/cogl-winsys-egl.c
index cd6ae3a..a713bfb 100644
--- a/cogl/winsys/cogl-winsys-egl.c
+++ b/cogl/winsys/cogl-winsys-egl.c
@@ -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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]