egl/dri2: Dispatch API.QueryBufferAge by display, not driver
authorChad Versace <chad.versace@linux.intel.com>
Wed, 29 Jan 2014 01:03:03 +0000 (17:03 -0800)
committerChad Versace <chad.versace@linux.intel.com>
Mon, 17 Mar 2014 22:36:04 +0000 (15:36 -0700)
Add dri2_egl_display_vtbl::query_buffer_age, set it for each
platform, and let egl_dri2 dispatch API.QueryBufferAge to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
src/egl/drivers/dri2/egl_dri2.c
src/egl/drivers/dri2/egl_dri2.h
src/egl/drivers/dri2/egl_dri2_fallbacks.h
src/egl/drivers/dri2/platform_android.c
src/egl/drivers/dri2/platform_drm.c
src/egl/drivers/dri2/platform_wayland.c
src/egl/drivers/dri2/platform_x11.c

index 2158a17ba194a4e236fd871cb6f03f91cb5aa828..9ee4e123b534f636ad5930e6d6dd243230ddcc47 100644 (file)
@@ -1073,6 +1073,13 @@ dri2_swap_buffers_with_damage(_EGLDriver *drv, _EGLDisplay *dpy,
                                                    rects, n_rects);
 }
 
+static EGLint
+dri2_query_buffer_age(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf)
+{
+   struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
+   return dri2_dpy->vtbl->query_buffer_age(drv, dpy, surf);
+}
+
 static EGLBoolean
 dri2_wait_client(_EGLDriver *drv, _EGLDisplay *disp, _EGLContext *ctx)
 {
@@ -2103,6 +2110,7 @@ _eglBuiltInDriverDRI2(const char *args)
    dri2_drv->base.API.SwapInterval = dri2_swap_interval;
    dri2_drv->base.API.SwapBuffers = dri2_swap_buffers;
    dri2_drv->base.API.SwapBuffersWithDamageEXT = dri2_swap_buffers_with_damage;
+   dri2_drv->base.API.QueryBufferAge = dri2_query_buffer_age;
    dri2_drv->base.API.CreateImageKHR = dri2_create_image_khr;
    dri2_drv->base.API.DestroyImageKHR = dri2_destroy_image_khr;
 #ifdef HAVE_DRM_PLATFORM
index 389c564a887752502f7ff1a48a03af20796a7a3f..0d6dd4194964e671ed562f318c60a507789e711a 100644 (file)
@@ -110,9 +110,12 @@ struct dri2_egl_display_vtbl {
    EGLBoolean (*swap_buffers)(_EGLDriver *drv, _EGLDisplay *dpy,
                               _EGLSurface *surf);
 
-   EGLBoolean (*swap_buffers_with_damage)(_EGLDriver *drv, _EGLDisplay *dpy,
-                                          _EGLSurface *surface,
-                                          const EGLint *rects, EGLint n_rects);
+   EGLBoolean (*swap_buffers_with_damage)(_EGLDriver *drv, _EGLDisplay *dpy,     
+                                          _EGLSurface *surface,                  
+                                          const EGLint *rects, EGLint n_rects);  
+
+   EGLint (*query_buffer_age)(_EGLDriver *drv, _EGLDisplay *dpy,
+                              _EGLSurface *surf);
 };
 
 struct dri2_egl_display
index a4161575e3578a354b24d5254f03b00715575a1a..f903998364e7af54314061430cbfc1d040c5a7ed 100644 (file)
@@ -57,3 +57,10 @@ dri2_fallback_swap_buffers_with_damage(_EGLDriver *drv, _EGLDisplay *dpy,
 {
    return EGL_FALSE;
 }
+
+static inline EGLint
+dri2_fallback_query_buffer_age(_EGLDriver *drv, _EGLDisplay *dpy,
+                               _EGLSurface *surf)
+{
+   return 0;
+}
index 3484af72c6be74fd0994bb17a197a949b3a5dbd5..69de23e2cb4b9b4d1aa9d1afa3088d4afaae69e1 100644 (file)
@@ -648,6 +648,7 @@ static struct dri2_egl_display_vtbl droid_display_vtbl = {
    .swap_interval = dri2_fallback_swap_interval,
    .swap_buffers = droid_swap_buffers,
    .swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage,
+   .query_buffer_age = dri2_fallback_query_buffer_age,
 };
 
 EGLBoolean
index bef93fddc5ba15d80072d48adb3d4f9d877626cc..b72c3b295723a3388010f780cc6244f9d2a270d7 100644 (file)
@@ -450,6 +450,7 @@ static struct dri2_egl_display_vtbl dri2_drm_display_vtbl = {
    .swap_interval = dri2_fallback_swap_interval,
    .swap_buffers = dri2_drm_swap_buffers,
    .swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage,
+   .query_buffer_age = dri2_drm_query_buffer_age,
 };
 
 EGLBoolean
@@ -545,7 +546,6 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
    }
 
    drv->API.CreateImageKHR = dri2_drm_create_image_khr;
-   drv->API.QueryBufferAge = dri2_drm_query_buffer_age;
 
    disp->Extensions.EXT_buffer_age = EGL_TRUE;
 
index afafbedb1c24f87b938ed653ca0c7cf0d3a63c28..c469860c79126ba5f1663d729cf51686d08c48d4 100644 (file)
@@ -966,6 +966,7 @@ static struct dri2_egl_display_vtbl dri2_wl_display_vtbl = {
    .swap_interval = dri2_wl_swap_interval,
    .swap_buffers = dri2_wl_swap_buffers,
    .swap_buffers_with_damage = dri2_wl_swap_buffers_with_damage,
+   .query_buffer_age = dri2_wl_query_buffer_age,
 };
 
 EGLBoolean
@@ -983,7 +984,6 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
    loader_set_logger(_eglLog);
 
    drv->API.Terminate = dri2_wl_terminate;
-   drv->API.QueryBufferAge = dri2_wl_query_buffer_age;
 
    drv->API.CreateWaylandBufferFromImageWL =
       dri2_wl_create_wayland_buffer_from_image_wl;
index 6133c8b73ab16222ae091076c628ec7293de18f8..2427d6ae232e0f7a36f672d49e5782b7cd85122e 100644 (file)
@@ -1000,6 +1000,7 @@ static struct dri2_egl_display_vtbl dri2_x11_swrast_display_vtbl = {
    .destroy_surface = dri2_x11_destroy_surface,
    .swap_interval = dri2_fallback_swap_interval,
    .swap_buffers = dri2_x11_swap_buffers,
+   .query_buffer_age = dri2_fallback_query_buffer_age,
 };
 
 static struct dri2_egl_display_vtbl dri2_x11_display_vtbl = {
@@ -1011,6 +1012,7 @@ static struct dri2_egl_display_vtbl dri2_x11_display_vtbl = {
    .swap_interval = dri2_x11_swap_interval,
    .swap_buffers = dri2_x11_swap_buffers,
    .swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage,
+   .query_buffer_age = dri2_fallback_query_buffer_age,
 };
 
 static EGLBoolean