Mesa (master): egl/dri2: Dispatch eglDestroySurface by display, not driver

Chad Versace chadversary at kemper.freedesktop.org
Mon Mar 17 22:38:43 UTC 2014


Module: Mesa
Branch: master
Commit: 958dd80c40dc87545b49d09cb2e4415a30746004
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=958dd80c40dc87545b49d09cb2e4415a30746004

Author: Chad Versace <chad.versace at linux.intel.com>
Date:   Tue Jan 28 17:03:03 2014 -0800

egl/dri2: Dispatch eglDestroySurface by display, not driver

Add dri2_egl_display_vtbl::destroy_surface, set it for each
platform, and let egl_dri2 dispatch eglDestroySurface to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>

---

 src/egl/drivers/dri2/egl_dri2.c         |    8 ++++++++
 src/egl/drivers/dri2/egl_dri2.h         |    3 +++
 src/egl/drivers/dri2/platform_android.c |    3 +--
 src/egl/drivers/dri2/platform_drm.c     |    2 +-
 src/egl/drivers/dri2/platform_wayland.c |    2 +-
 src/egl/drivers/dri2/platform_x11.c     |    4 ++--
 6 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 18b1c71..2158a17 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1042,6 +1042,13 @@ dri2_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *dpy,
 }
 
 static EGLBoolean
+dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf)
+{
+   struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
+   return dri2_dpy->vtbl->destroy_surface(drv, dpy, surf);
+}
+
+static EGLBoolean
 dri2_swap_interval(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
                    EGLint interval)
 {
@@ -2087,6 +2094,7 @@ _eglBuiltInDriverDRI2(const char *args)
    dri2_drv->base.API.CreateWindowSurface = dri2_create_window_surface;
    dri2_drv->base.API.CreatePixmapSurface = dri2_create_pixmap_surface;
    dri2_drv->base.API.CreatePbufferSurface = dri2_create_pbuffer_surface;
+   dri2_drv->base.API.DestroySurface = dri2_destroy_surface;
    dri2_drv->base.API.GetProcAddress = dri2_get_proc_address;
    dri2_drv->base.API.WaitClient = dri2_wait_client;
    dri2_drv->base.API.WaitNative = dri2_wait_native;
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 0b08414..389c564 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -101,6 +101,9 @@ struct dri2_egl_display_vtbl {
                                           _EGLConfig *config,
                                           const EGLint *attrib_list);
 
+   EGLBoolean (*destroy_surface)(_EGLDriver *drv, _EGLDisplay *dpy,
+                                 _EGLSurface *surface);
+
    EGLBoolean (*swap_interval)(_EGLDriver *drv, _EGLDisplay *dpy,
                                _EGLSurface *surf, EGLint interval);
 
diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index f2c8f61..3484af7 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -423,8 +423,6 @@ droid_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp,
 static void
 droid_init_driver_functions(_EGLDriver *drv)
 {
-   drv->API.DestroySurface = droid_destroy_surface;
-
    drv->API.CreateImageKHR = droid_create_image_khr;
 }
 
@@ -646,6 +644,7 @@ static struct dri2_egl_display_vtbl droid_display_vtbl = {
    .create_window_surface = droid_create_window_surface,
    .create_pixmap_surface = dri2_fallback_pixmap_surface,
    .create_pbuffer_surface = droid_create_pbuffer_surface,
+   .destroy_surface = droid_destroy_surface,
    .swap_interval = dri2_fallback_swap_interval,
    .swap_buffers = droid_swap_buffers,
    .swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage,
diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
index 4761bbf..bef93fd 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -446,6 +446,7 @@ static struct dri2_egl_display_vtbl dri2_drm_display_vtbl = {
    .create_window_surface = dri2_drm_create_window_surface,
    .create_pixmap_surface = dri2_fallback_create_pixmap_surface,
    .create_pbuffer_surface = dri2_fallback_create_pbuffer_surface,
+   .destroy_surface = dri2_drm_destroy_surface,
    .swap_interval = dri2_fallback_swap_interval,
    .swap_buffers = dri2_drm_swap_buffers,
    .swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage,
@@ -543,7 +544,6 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
                       i + 1, EGL_WINDOW_BIT, attr_list, NULL);
    }
 
-   drv->API.DestroySurface = dri2_drm_destroy_surface;
    drv->API.CreateImageKHR = dri2_drm_create_image_khr;
    drv->API.QueryBufferAge = dri2_drm_query_buffer_age;
 
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 42a01f7..afafbed 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -962,6 +962,7 @@ static struct dri2_egl_display_vtbl dri2_wl_display_vtbl = {
    .create_window_surface = dri2_wl_create_window_surface,
    .create_pixmap_surface = dri2_fallback_create_pixmap_surface,
    .create_pbuffer_surface = dri2_fallback_create_pbuffer_surface,
+   .destroy_surface = dri2_wl_destroy_surface,
    .swap_interval = dri2_wl_swap_interval,
    .swap_buffers = dri2_wl_swap_buffers,
    .swap_buffers_with_damage = dri2_wl_swap_buffers_with_damage,
@@ -981,7 +982,6 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
 
    loader_set_logger(_eglLog);
 
-   drv->API.DestroySurface = dri2_wl_destroy_surface;
    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 1ef7b02..6133c8b 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -997,6 +997,7 @@ static struct dri2_egl_display_vtbl dri2_x11_swrast_display_vtbl = {
    .create_window_surface = dri2_x11_create_window_surface,
    .create_pixmap_surface = dri2_x11_create_pixmap_surface,
    .create_pbuffer_surface = dri2_x11_create_pbuffer_surface,
+   .destroy_surface = dri2_x11_destroy_surface,
    .swap_interval = dri2_fallback_swap_interval,
    .swap_buffers = dri2_x11_swap_buffers,
 };
@@ -1006,6 +1007,7 @@ static struct dri2_egl_display_vtbl dri2_x11_display_vtbl = {
    .create_window_surface = dri2_x11_create_window_surface,
    .create_pixmap_surface = dri2_x11_create_pixmap_surface,
    .create_pbuffer_surface = dri2_x11_create_pbuffer_surface,
+   .destroy_surface = dri2_x11_destroy_surface,
    .swap_interval = dri2_x11_swap_interval,
    .swap_buffers = dri2_x11_swap_buffers,
    .swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage,
@@ -1016,7 +1018,6 @@ dri2_initialize_x11_swrast(_EGLDriver *drv, _EGLDisplay *disp)
 {
    struct dri2_egl_display *dri2_dpy;
 
-   drv->API.DestroySurface = dri2_x11_destroy_surface;
    drv->API.CopyBuffers = dri2_x11_copy_buffers;
 
    drv->API.SwapBuffersRegionNOK = NULL;
@@ -1138,7 +1139,6 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp)
 {
    struct dri2_egl_display *dri2_dpy;
 
-   drv->API.DestroySurface = dri2_x11_destroy_surface;
    drv->API.CopyBuffers = dri2_x11_copy_buffers;
    drv->API.CreateImageKHR = dri2_x11_create_image_khr;
    drv->API.SwapBuffersRegionNOK = dri2_x11_swap_buffers_region;




More information about the mesa-commit mailing list