egl/dri2: Dispatch eglSwapBuffers by display, not driver
authorChad Versace <chad.versace@linux.intel.com>
Wed, 29 Jan 2014 00:21:21 +0000 (16:21 -0800)
committerChad Versace <chad.versace@linux.intel.com>
Mon, 17 Mar 2014 22:36:03 +0000 (15:36 -0700)
Add dri2_egl_display_vtbl::swap_buffers, set it for each platform, and
let egl_dri2 dispatch eglSwapBuffers to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
src/egl/drivers/dri2/egl_dri2.c
src/egl/drivers/dri2/egl_dri2.h
src/egl/drivers/dri2/platform_android.c
src/egl/drivers/dri2/platform_drm.c
src/egl/drivers/dri2/platform_wayland.c
src/egl/drivers/dri2/platform_x11.c

index e1a8e1e449068cf35b7ee8adcd262bbc23805408..0b56c12d50c6ad641108c55745d9f35686bfb60e 100644 (file)
@@ -1021,6 +1021,13 @@ dri2_swap_interval(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
    return dri2_dpy->vtbl->swap_interval(drv, dpy, surf, interval);
 }
 
+static EGLBoolean
+dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf)
+{
+   struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
+   return dri2_dpy->vtbl->swap_buffers(drv, dpy, surf);
+}
+
 static EGLBoolean
 dri2_wait_client(_EGLDriver *drv, _EGLDisplay *disp, _EGLContext *ctx)
 {
@@ -2045,6 +2052,7 @@ _eglBuiltInDriverDRI2(const char *args)
    dri2_drv->base.API.BindTexImage = dri2_bind_tex_image;
    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.CreateImageKHR = dri2_create_image_khr;
    dri2_drv->base.API.DestroyImageKHR = dri2_destroy_image_khr;
 #ifdef HAVE_DRM_PLATFORM
index 9f785c1c9505fb3920ad7de897fed69f43cf2bc3..e4555621f6ea039e518a716fc8eecea461714449 100644 (file)
@@ -89,6 +89,9 @@ struct dri2_egl_display_vtbl {
 
    EGLBoolean (*swap_interval)(_EGLDriver *drv, _EGLDisplay *dpy,
                                _EGLSurface *surf, EGLint interval);
+
+   EGLBoolean (*swap_buffers)(_EGLDriver *drv, _EGLDisplay *dpy,
+                              _EGLSurface *surf);
 };
 
 struct dri2_egl_display
index c2786b0561729cac7f60208520d3b9be0e849a8e..e1963f51c08b0ca228a2562eafb195157d165bb8 100644 (file)
@@ -435,7 +435,6 @@ droid_init_driver_functions(_EGLDriver *drv)
    drv->API.CreatePixmapSurface = droid_create_pixmap_surface;
    drv->API.CreatePbufferSurface = droid_create_pbuffer_surface;
    drv->API.DestroySurface = droid_destroy_surface;
-   drv->API.SwapBuffers = droid_swap_buffers;
 
    drv->API.CreateImageKHR = droid_create_image_khr;
 }
@@ -656,6 +655,7 @@ droid_log(EGLint level, const char *msg)
 static struct dri2_egl_display_vtbl droid_display_vtbl = {
    .authenticate = NULL,
    .swap_interval = dri2_fallback_swap_interval,
+   .swap_buffers = droid_swap_buffers,
 };
 
 EGLBoolean
index 45f8ae6f630bd8d2755559d565cfcd49cbcd796c..c0999dc73dd560fb0163c80386bfe15d6faa54df 100644 (file)
@@ -444,6 +444,7 @@ dri2_drm_authenticate(_EGLDisplay *disp, uint32_t id)
 static struct dri2_egl_display_vtbl dri2_drm_display_vtbl = {
    .authenticate = dri2_drm_authenticate,
    .swap_interval = dri2_fallback_swap_interval,
+   .swap_buffers = dri2_drm_swap_buffers,
 };
 
 EGLBoolean
@@ -540,7 +541,6 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
 
    drv->API.CreateWindowSurface = dri2_drm_create_window_surface;
    drv->API.DestroySurface = dri2_drm_destroy_surface;
-   drv->API.SwapBuffers = dri2_drm_swap_buffers;
    drv->API.CreateImageKHR = dri2_drm_create_image_khr;
    drv->API.QueryBufferAge = dri2_drm_query_buffer_age;
 
index 518d0232adddfd47209907dbda5a42c1cdc28634..92cc5a3efcb0a93ee1747cf22ba47f8a76251788 100644 (file)
@@ -960,6 +960,7 @@ dri2_wl_setup_swap_interval(struct dri2_egl_display *dri2_dpy)
 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,
 };
 
 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.SwapBuffers = dri2_wl_swap_buffers;
    drv->API.SwapBuffersWithDamageEXT = dri2_wl_swap_buffers_with_damage;
    drv->API.Terminate = dri2_wl_terminate;
    drv->API.QueryBufferAge = dri2_wl_query_buffer_age;
index 9bc2afba830bb7c2c9605ef04ed7c365b0f8b017..38e86698072acf4c26bc9ac8daaee95c4a731de8 100644 (file)
@@ -995,11 +995,13 @@ dri2_x11_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp,
 static struct dri2_egl_display_vtbl dri2_x11_swrast_display_vtbl = {
    .authenticate = NULL,
    .swap_interval = dri2_fallback_swap_interval,
+   .swap_buffers = dri2_x11_swap_buffers,
 };
 
 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,
 };
 
 static EGLBoolean
@@ -1011,7 +1013,6 @@ dri2_initialize_x11_swrast(_EGLDriver *drv, _EGLDisplay *disp)
    drv->API.CreatePixmapSurface = dri2_x11_create_pixmap_surface;
    drv->API.CreatePbufferSurface = dri2_x11_create_pbuffer_surface;
    drv->API.DestroySurface = dri2_x11_destroy_surface;
-   drv->API.SwapBuffers = dri2_x11_swap_buffers;
    drv->API.CopyBuffers = dri2_x11_copy_buffers;
 
    drv->API.SwapBuffersRegionNOK = NULL;
@@ -1137,7 +1138,6 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp)
    drv->API.CreatePixmapSurface = dri2_x11_create_pixmap_surface;
    drv->API.CreatePbufferSurface = dri2_x11_create_pbuffer_surface;
    drv->API.DestroySurface = dri2_x11_destroy_surface;
-   drv->API.SwapBuffers = dri2_x11_swap_buffers;
    drv->API.CopyBuffers = dri2_x11_copy_buffers;
    drv->API.CreateImageKHR = dri2_x11_create_image_khr;
    drv->API.SwapBuffersRegionNOK = dri2_x11_swap_buffers_region;