[Mesa-dev] [PATCH 14/25] egl/dri2: Dispatch eglSwapBuffersRegionNOK by display, not driver

Chad Versace chad.versace at linux.intel.com
Sun Feb 9 13:37:50 PST 2014


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.

Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
 src/egl/drivers/dri2/egl_dri2.c           | 9 +++++++++
 src/egl/drivers/dri2/egl_dri2.h           | 4 ++++
 src/egl/drivers/dri2/egl_dri2_fallbacks.h | 8 ++++++++
 src/egl/drivers/dri2/platform_android.c   | 1 +
 src/egl/drivers/dri2/platform_drm.c       | 1 +
 src/egl/drivers/dri2/platform_wayland.c   | 1 +
 src/egl/drivers/dri2/platform_x11.c       | 4 ++--
 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 1874db3..2a2525e 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1073,6 +1073,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)
 {
@@ -2117,6 +2125,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 3140b29..e7ac7a0 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -118,6 +118,10 @@ struct dri2_egl_display_vtbl {
                                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 f9f1a55..b5eb5b7 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 8b8cd11..dc6e2df 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 5f52332..e078ddf 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 0a7e628..0bec563 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -965,6 +965,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 200d888..7bf2c78 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);
-- 
1.8.5.3



More information about the mesa-dev mailing list