egl: Add extension infrastructure for EGL_EXT_buffer_age
authorKristian Høgsberg <krh@bitplanet.net>
Thu, 13 Dec 2012 20:59:24 +0000 (15:59 -0500)
committerKristian Høgsberg <krh@bitplanet.net>
Fri, 4 Jan 2013 16:20:12 +0000 (11:20 -0500)
src/egl/main/eglapi.h
src/egl/main/egldisplay.h
src/egl/main/eglmisc.c
src/egl/main/eglsurface.c

index ec3ad7ec973b290733944e760c9b5bd90ca39669..85b8f1a8db1818b93aa3d8dec394188e127a1388 100644 (file)
@@ -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 */
index ccb1fbc699258dbefc7b59e745c0c146bbe57ee8..4b33470151b7f6371a40fd5863904d2ec9f20b3a 100644 (file)
@@ -114,6 +114,7 @@ struct _egl_extensions
    EGLBoolean NV_post_sub_buffer;
 
    EGLBoolean EXT_create_context_robustness;
+   EGLBoolean EXT_buffer_age;
 };
 
 
index b7599d01794c4f5b0713adca77198faeb783964d..d445c41810c875ff40f366f420a030fa03479336 100644 (file)
@@ -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
index 52d85ef8b705e4739d718f2873ee55a155b355a0..9fc53674fd0908dc927f58bc7d469e9ea81ffe23 100644 (file)
@@ -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;