egl/dri2: Dispatch eglPostSubBufferNV 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::post_sub_buffer, set it for each
platform, and let egl_dri2 dispatch eglPostSubBufferNV 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 f52e68e600a8f4d50fad13e6410d0d0d805376ea..9074a81f90b56b3bef3dc8230f8fad49facfbc13 100644 (file)
@@ -1081,6 +1081,14 @@ dri2_swap_buffers_region(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
    return dri2_dpy->vtbl->swap_buffers_region(drv, dpy, surf, numRects, rects);
 }
 
+static EGLBoolean
+dri2_post_sub_buffer(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
+                     EGLint x, EGLint y, EGLint width, EGLint height)
+{
+   struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
+   return dri2_dpy->vtbl->post_sub_buffer(drv, dpy, surf, x, y, width, height);
+}
+
 static EGLBoolean
 dri2_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
                   EGLNativePixmapType target)
@@ -2127,6 +2135,7 @@ _eglBuiltInDriverDRI2(const char *args)
    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.PostSubBufferNV = dri2_post_sub_buffer;
    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 167dd4e9d23b8835fb11e01a8d2a757215e99ea1..f43a08bb830b9522c5464f51d33d76534052c409 100644 (file)
@@ -118,6 +118,11 @@ struct dri2_egl_display_vtbl {
                                      _EGLSurface *surf, EGLint numRects,
                                      const EGLint *rects);
 
+   EGLBoolean (*post_sub_buffer)(_EGLDriver *drv, _EGLDisplay *dpy,
+                                 _EGLSurface *surf,
+                                 EGLint x, EGLint y,
+                                 EGLint width, EGLint height);
+
    EGLBoolean (*copy_buffers)(_EGLDriver *drv, _EGLDisplay *dpy,
                               _EGLSurface *surf, EGLNativePixmapType target);
 
index b5eb5b73ad3b7098ce0afaea279e4685a00761dc..00e955a5e966014ddbeae80c10bb0b2c8f4fa185 100644 (file)
@@ -66,6 +66,14 @@ dri2_fallback_swap_buffers_region(_EGLDriver *drv, _EGLDisplay *dpy,
    return EGL_FALSE;
 }
 
+static inline EGLBoolean
+dri2_fallback_post_sub_buffer(_EGLDriver *drv, _EGLDisplay *dpy,
+                              _EGLSurface *draw,
+                              EGLint x, EGLint y, EGLint width, EGLint height)
+{
+   return EGL_FALSE;
+}
+
 static inline EGLBoolean
 dri2_fallback_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy,
                            _EGLSurface *surf,
index 1fd6065283274574afd83c1cc8e87cf8816dcd82..5ff80d018e845c868d8a76fcd85efc47e4e29118 100644 (file)
@@ -649,6 +649,7 @@ static struct dri2_egl_display_vtbl droid_display_vtbl = {
    .swap_buffers = droid_swap_buffers,
    .swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage,
    .swap_buffers_region = dri2_fallback_swap_buffers_region,
+   .post_sub_buffer = dri2_fallback_post_sub_buffer,
    .copy_buffers = dri2_fallback_copy_buffers,
    .query_buffer_age = dri2_fallback_query_buffer_age,
 };
index b73e14055af40b1088f57a6ff7fa8aa579dc5bcb..b4e472d9142f1d28c6d4b4ec1875ad29d83416f5 100644 (file)
@@ -451,6 +451,7 @@ static struct dri2_egl_display_vtbl dri2_drm_display_vtbl = {
    .swap_buffers = dri2_drm_swap_buffers,
    .swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage,
    .swap_buffers_region = dri2_fallback_swap_buffers_region,
+   .post_sub_buffer = dri2_fallback_post_sub_buffer,
    .copy_buffers = dri2_fallback_copy_buffers,
    .query_buffer_age = dri2_drm_query_buffer_age,
 };
index 06de900d0cc14c19fef04835537d55a5ed2e1675..9110750ae9507f2a9d649e7442bae831cc9b64d7 100644 (file)
@@ -967,6 +967,7 @@ static struct dri2_egl_display_vtbl dri2_wl_display_vtbl = {
    .swap_buffers = dri2_wl_swap_buffers,
    .swap_buffers_with_damage = dri2_wl_swap_buffers_with_damage,
    .swap_buffers_region = dri2_fallback_swap_buffers_region,
+   .post_sub_buffer = dri2_fallback_post_sub_buffer,
    .copy_buffers = dri2_fallback_copy_buffers,
    .query_buffer_age = dri2_wl_query_buffer_age,
 };
index 7bf2c78742ebff8d4810b2ff91ad1f7312fde3e3..f5b17de73308106263fecf833f36b76a8610d755 100644 (file)
@@ -1001,6 +1001,7 @@ static struct dri2_egl_display_vtbl dri2_x11_swrast_display_vtbl = {
    .swap_interval = dri2_fallback_swap_interval,
    .swap_buffers = dri2_x11_swap_buffers,
    .swap_buffers_region = dri2_fallback_swap_buffers_region,
+   .post_sub_buffer = dri2_fallback_post_sub_buffer,
    .copy_buffers = dri2_x11_copy_buffers,
    .query_buffer_age = dri2_fallback_query_buffer_age,
 };
@@ -1015,6 +1016,7 @@ static struct dri2_egl_display_vtbl dri2_x11_display_vtbl = {
    .swap_buffers = dri2_x11_swap_buffers,
    .swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage,
    .swap_buffers_region = dri2_x11_swap_buffers_region,
+   .post_sub_buffer = dri2_x11_post_sub_buffer,
    .copy_buffers = dri2_x11_copy_buffers,
    .query_buffer_age = dri2_fallback_query_buffer_age,
 };
@@ -1143,7 +1145,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.PostSubBufferNV = dri2_x11_post_sub_buffer;
 
    dri2_dpy = calloc(1, sizeof *dri2_dpy);
    if (!dri2_dpy)