[Mesa-dev] [PATCH 2/8] egl: Add extension infrastructure for EGL_EXT_buffer_age

Kristian Høgsberg krh at bitplanet.net
Thu Dec 13 21:04:58 PST 2012


---
 src/egl/main/eglapi.h     |    6 ++++++
 src/egl/main/egldisplay.h |    1 +
 src/egl/main/eglmisc.c    |    1 +
 src/egl/main/eglsurface.c |    8 ++++++++
 4 files changed, 16 insertions(+)

diff --git a/src/egl/main/eglapi.h b/src/egl/main/eglapi.h
index ec3ad7e..85b8f1a 100644
--- a/src/egl/main/eglapi.h
+++ b/src/egl/main/eglapi.h
@@ -128,6 +128,10 @@ typedef EGLBoolean (*QueryWaylandBufferWL_t)(_EGLDriver *drv, _EGLDisplay *displ
 
 typedef EGLBoolean (*PostSubBufferNV_t)(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surface, EGLint x, EGLint y, EGLint width, EGLint height);
 
+typedef EGLint (*QueryBufferAge_t)(_EGLDriver *drv,
+                                   _EGLDisplay *dpy, _EGLSurface *surface);
+
+
 /**
  * The API dispatcher jumps through these functions
  */
@@ -204,6 +208,8 @@ struct _egl_api
 #endif
 
    PostSubBufferNV_t PostSubBufferNV;
+
+   QueryBufferAge_t QueryBufferAge;
 };
 
 #endif /* EGLAPI_INCLUDED */
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index ccb1fbc..4b33470 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -114,6 +114,7 @@ struct _egl_extensions
    EGLBoolean NV_post_sub_buffer;
 
    EGLBoolean EXT_create_context_robustness;
+   EGLBoolean EXT_buffer_age;
 };
 
 
diff --git a/src/egl/main/eglmisc.c b/src/egl/main/eglmisc.c
index b7599d0..d445c41 100644
--- a/src/egl/main/eglmisc.c
+++ b/src/egl/main/eglmisc.c
@@ -116,6 +116,7 @@ _eglUpdateExtensionsString(_EGLDisplay *dpy)
    _EGL_CHECK_EXTENSION(ANDROID_image_native_buffer);
 
    _EGL_CHECK_EXTENSION(EXT_create_context_robustness);
+   _EGL_CHECK_EXTENSION(EXT_buffer_age);
 
    _EGL_CHECK_EXTENSION(NV_post_sub_buffer);
 #undef _EGL_CHECK_EXTENSION
diff --git a/src/egl/main/eglsurface.c b/src/egl/main/eglsurface.c
index 52d85ef..9fc5367 100644
--- a/src/egl/main/eglsurface.c
+++ b/src/egl/main/eglsurface.c
@@ -37,6 +37,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "egldisplay.h"
+#include "egldriver.h"
 #include "eglcontext.h"
 #include "eglconfig.h"
 #include "eglcurrent.h"
@@ -409,6 +410,13 @@ _eglQuerySurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface,
    case EGL_POST_SUB_BUFFER_SUPPORTED_NV:
       *value = surface->PostSubBufferSupportedNV;
       break;
+   case EGL_BUFFER_AGE_EXT:
+      if (!dpy->Extensions.EXT_buffer_age) {
+         _eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface");
+         return EGL_FALSE;
+      }
+      *value = drv->API.QueryBufferAge(drv, dpy, surface);
+      break;
    default:
       _eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface");
       return EGL_FALSE;
-- 
1.7.10.2



More information about the mesa-dev mailing list