summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2014-01-28 17:03:03 -0800
committerChad Versace <[email protected]>2014-03-17 15:36:04 -0700
commit3fdfbd2572ea42f3ef71db032b31cc87ea274e11 (patch)
tree43872ded41051fe8ca2ca623c950eb00e64e33b8
parent958dd80c40dc87545b49d09cb2e4415a30746004 (diff)
egl/dri2: Dispatch API.QueryBufferAge by display, not driver
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 <[email protected]> Signed-off-by: Chad Versace <[email protected]>
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c8
-rw-r--r--src/egl/drivers/dri2/egl_dri2.h9
-rw-r--r--src/egl/drivers/dri2/egl_dri2_fallbacks.h7
-rw-r--r--src/egl/drivers/dri2/platform_android.c1
-rw-r--r--src/egl/drivers/dri2/platform_drm.c2
-rw-r--r--src/egl/drivers/dri2/platform_wayland.c2
-rw-r--r--src/egl/drivers/dri2/platform_x11.c2
7 files changed, 26 insertions, 5 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 2158a17ba19..9ee4e123b53 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -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
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 389c564a887..0d6dd419496 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -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
diff --git a/src/egl/drivers/dri2/egl_dri2_fallbacks.h b/src/egl/drivers/dri2/egl_dri2_fallbacks.h
index a4161575e35..f903998364e 100644
--- a/src/egl/drivers/dri2/egl_dri2_fallbacks.h
+++ b/src/egl/drivers/dri2/egl_dri2_fallbacks.h
@@ -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;
+}
diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index 3484af72c6b..69de23e2cb4 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -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
diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
index bef93fddc5b..b72c3b29572 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -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;
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index afafbedb1c2..c469860c791 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -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;
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index 6133c8b73ab..2427d6ae232 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -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