egl/dri2: Dispatch eglSwapBuffersRegionNOK by display, not driver
authorChad Versace <chad.versace@linux.intel.com>
Wed, 29 Jan 2014 01:03:03 +0000 (17:03 -0800)
committerChad Versace <chad.versace@linux.intel.com>
Mon, 17 Mar 2014 22:36:04 +0000 (15:36 -0700)
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 <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/egl_dri2_fallbacks.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 3bf96ba111cc405ff5f834df265bbfc1156b1ba6..f52e68e600a8f4d50fad13e6410d0d0d805376ea 100644 (file)
@@ -1073,6 +1073,14 @@ dri2_swap_buffers_with_damage(_EGLDriver *drv, _EGLDisplay *dpy,
                                                    rects, n_rects);
 }
 
+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;
index a835f8ed320f7a2d3c624c761b7b7f98ace4ea35..167dd4e9d23b8835fb11e01a8d2a757215e99ea1 100644 (file)
@@ -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);
 
index f9f1a551bdb3047313cbe4a271641222d74f6186..b5eb5b73ad3b7098ce0afaea279e4685a00761dc 100644 (file)
@@ -58,6 +58,14 @@ dri2_fallback_swap_buffers_with_damage(_EGLDriver *drv, _EGLDisplay *dpy,
    return EGL_FALSE;
 }
 
+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,
index 4aac5f6c3913f3ab4b5ec3b5bc70df1bf907f79c..1fd6065283274574afd83c1cc8e87cf8816dcd82 100644 (file)
@@ -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,
 };
index 22832f498f505d7ba01ee01fec92851553f7b188..b73e14055af40b1088f57a6ff7fa8aa579dc5bcb 100644 (file)
@@ -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,
 };
index bad696eae4e5d806c1bec8b13be48ee7263de8e8..06de900d0cc14c19fef04835537d55a5ed2e1675 100644 (file)
@@ -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,
 };
index 200d888461cb4a1ac5b530a411474e7bedaf1e4d..7bf2c78742ebff8d4810b2ff91ad1f7312fde3e3 100644 (file)
@@ -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);