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

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


Add dri2_egl_display_vtbl::swap_buffers_with_damage, set it for each
platform, and let egl_dri2 dispatch eglSwapBuffersWithDamageEXT 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           | 11 +++++++++++
 src/egl/drivers/dri2/egl_dri2.h           |  5 +++++
 src/egl/drivers/dri2/egl_dri2_fallbacks.h |  8 ++++++++
 src/egl/drivers/dri2/platform_android.c   |  1 +
 src/egl/drivers/dri2/platform_wayland.c   |  2 +-
 src/egl/drivers/dri2/platform_x11.c       |  1 +
 6 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 60365ee..b6b84bd 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1028,6 +1028,16 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf)
 }
 
 static EGLBoolean
+dri2_swap_buffers_with_damage(_EGLDriver *drv, _EGLDisplay *dpy,
+                              _EGLSurface *surf,
+                              const EGLint *rects, EGLint n_rects)
+{
+   struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
+   return dri2_dpy->vtbl->swap_buffers_with_damage(drv, dpy, surf,
+                                                   rects, n_rects);
+}
+
+static EGLBoolean
 dri2_wait_client(_EGLDriver *drv, _EGLDisplay *disp, _EGLContext *ctx)
 {
    struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
@@ -2052,6 +2062,7 @@ _eglBuiltInDriverDRI2(const char *args)
    dri2_drv->base.API.ReleaseTexImage = dri2_release_tex_image;
    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.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 6c86c40..3ac8f28 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -94,6 +94,11 @@ 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);
 };
 
 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 e09a3b8..51c0a99 100644
--- a/src/egl/drivers/dri2/egl_dri2_fallbacks.h
+++ b/src/egl/drivers/dri2/egl_dri2_fallbacks.h
@@ -32,3 +32,11 @@ dri2_fallback_swap_interval(_EGLDriver *drv, _EGLDisplay *dpy,
 {
    return EGL_FALSE;
 }
+
+static inline EGLBoolean
+dri2_fallback_swap_buffers_with_damage(_EGLDriver *drv, _EGLDisplay *dpy,
+                                      _EGLSurface *surf,
+                                      const EGLint *rects, EGLint n_rects)
+{
+   return EGL_FALSE;
+}
diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index 7b4e0dc..d1e969d 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -656,6 +656,7 @@ static struct dri2_egl_display_vtbl droid_display_vtbl = {
    .authenticate = NULL,
    .swap_interval = dri2_fallback_swap_interval,
    .swap_buffers = droid_swap_buffers,
+   .swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage,
 };
 
 EGLBoolean
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index f62b77b..348a25d 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -960,6 +960,7 @@ static struct dri2_egl_display_vtbl dri2_wl_display_vtbl = {
    .authenticate = dri2_wl_authenticate,
    .swap_interval = dri2_wl_swap_interval,
    .swap_buffers = dri2_wl_swap_buffers,
+   .swap_buffers_with_damage = dri2_wl_swap_buffers_with_damage,
 };
 
 EGLBoolean
@@ -978,7 +979,6 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
 
    drv->API.CreateWindowSurface = dri2_wl_create_window_surface;
    drv->API.DestroySurface = dri2_wl_destroy_surface;
-   drv->API.SwapBuffersWithDamageEXT = dri2_wl_swap_buffers_with_damage;
    drv->API.Terminate = dri2_wl_terminate;
    drv->API.QueryBufferAge = dri2_wl_query_buffer_age;
 
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index 38e8669..28bfc82 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -1002,6 +1002,7 @@ static struct dri2_egl_display_vtbl dri2_x11_display_vtbl = {
    .authenticate = dri2_x11_authenticate,
    .swap_interval = dri2_x11_swap_interval,
    .swap_buffers = dri2_x11_swap_buffers,
+   .swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage,
 };
 
 static EGLBoolean
-- 
1.8.5.3



More information about the mesa-dev mailing list