aboutsummaryrefslogtreecommitdiffstats
path: root/src/egl/drivers/dri2
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
commit75d398ed9309c0cb8179380bd317d8f935618df7 (patch)
treeb9bbe1cfed4653be0874c7283bc8d57d0eb82141 /src/egl/drivers/dri2
parentbc2cbc0951ded883dc610672a6f6d4cca5d99502 (diff)
egl/dri2: Dispatch eglSwapBuffersRegionNOK by display, not driver
Add dri2_egl_display_vtbl::swap_buffers_region, set it for each platform, and let egl_dri2 dispatch eglSwapBuffersRegionNOK to that. This prepares for the EGL platform extensions. Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/egl/drivers/dri2')
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c9
-rw-r--r--src/egl/drivers/dri2/egl_dri2.h4
-rw-r--r--src/egl/drivers/dri2/egl_dri2_fallbacks.h8
-rw-r--r--src/egl/drivers/dri2/platform_android.c1
-rw-r--r--src/egl/drivers/dri2/platform_drm.c1
-rw-r--r--src/egl/drivers/dri2/platform_wayland.c1
-rw-r--r--src/egl/drivers/dri2/platform_x11.c4
7 files changed, 26 insertions, 2 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 3bf96ba111c..f52e68e600a 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1074,6 +1074,14 @@ dri2_swap_buffers_with_damage(_EGLDriver *drv, _EGLDisplay *dpy,
}
static EGLBoolean
+dri2_swap_buffers_region(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
+ EGLint numRects, const EGLint *rects)
+{
+ struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
+ return dri2_dpy->vtbl->swap_buffers_region(drv, dpy, surf, numRects, rects);
+}
+
+static EGLBoolean
dri2_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
EGLNativePixmapType target)
{
@@ -2118,6 +2126,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.SwapBuffersRegionNOK = dri2_swap_buffers_region;
dri2_drv->base.API.CopyBuffers = dri2_copy_buffers,
dri2_drv->base.API.QueryBufferAge = dri2_query_buffer_age;
dri2_drv->base.API.CreateImageKHR = dri2_create_image_khr;
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index a835f8ed320..167dd4e9d23 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -114,6 +114,10 @@ struct dri2_egl_display_vtbl {
_EGLSurface *surface,
const EGLint *rects, EGLint n_rects);
+ EGLBoolean (*swap_buffers_region)(_EGLDriver *drv, _EGLDisplay *dpy,
+ _EGLSurface *surf, EGLint numRects,
+ const EGLint *rects);
+
EGLBoolean (*copy_buffers)(_EGLDriver *drv, _EGLDisplay *dpy,
_EGLSurface *surf, EGLNativePixmapType target);
diff --git a/src/egl/drivers/dri2/egl_dri2_fallbacks.h b/src/egl/drivers/dri2/egl_dri2_fallbacks.h
index f9f1a551bdb..b5eb5b73ad3 100644
--- a/src/egl/drivers/dri2/egl_dri2_fallbacks.h
+++ b/src/egl/drivers/dri2/egl_dri2_fallbacks.h
@@ -59,6 +59,14 @@ dri2_fallback_swap_buffers_with_damage(_EGLDriver *drv, _EGLDisplay *dpy,
}
static inline EGLBoolean
+dri2_fallback_swap_buffers_region(_EGLDriver *drv, _EGLDisplay *dpy,
+ _EGLSurface *surf,
+ EGLint numRects, const EGLint *rects)
+{
+ return EGL_FALSE;
+}
+
+static inline EGLBoolean
dri2_fallback_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy,
_EGLSurface *surf,
EGLNativePixmapType target)
diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index 4aac5f6c391..1fd60652832 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,
+ .swap_buffers_region = dri2_fallback_swap_buffers_region,
.copy_buffers = dri2_fallback_copy_buffers,
.query_buffer_age = dri2_fallback_query_buffer_age,
};
diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
index 22832f498f5..b73e14055af 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,
+ .swap_buffers_region = dri2_fallback_swap_buffers_region,
.copy_buffers = dri2_fallback_copy_buffers,
.query_buffer_age = dri2_drm_query_buffer_age,
};
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index bad696eae4e..06de900d0cc 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,
+ .swap_buffers_region = dri2_fallback_swap_buffers_region,
.copy_buffers = dri2_fallback_copy_buffers,
.query_buffer_age = dri2_wl_query_buffer_age,
};
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index 200d888461c..7bf2c78742e 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,
+ .swap_buffers_region = dri2_fallback_swap_buffers_region,
.copy_buffers = dri2_x11_copy_buffers,
.query_buffer_age = dri2_fallback_query_buffer_age,
};
@@ -1013,6 +1014,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,
+ .swap_buffers_region = dri2_x11_swap_buffers_region,
.copy_buffers = dri2_x11_copy_buffers,
.query_buffer_age = dri2_fallback_query_buffer_age,
};
@@ -1022,7 +1024,6 @@ dri2_initialize_x11_swrast(_EGLDriver *drv, _EGLDisplay *disp)
{
struct dri2_egl_display *dri2_dpy;
- drv->API.SwapBuffersRegionNOK = NULL;
drv->API.CreateImageKHR = NULL;
drv->API.DestroyImageKHR = NULL;
drv->API.CreateDRMImageMESA = NULL;
@@ -1142,7 +1143,6 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp)
struct dri2_egl_display *dri2_dpy;
drv->API.CreateImageKHR = dri2_x11_create_image_khr;
- drv->API.SwapBuffersRegionNOK = dri2_x11_swap_buffers_region;
drv->API.PostSubBufferNV = dri2_x11_post_sub_buffer;
dri2_dpy = calloc(1, sizeof *dri2_dpy);