egl: inline fallback for swap_buffers_with_damage
authorEric Engestrom <eric@engestrom.ch>
Fri, 10 Jul 2020 22:36:08 +0000 (00:36 +0200)
committerMarge Bot <eric+marge@anholt.net>
Thu, 16 Jul 2020 22:11:25 +0000 (22:11 +0000)
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5861>

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
src/egl/drivers/dri2/platform_x11_dri3.c

index 147244f774bcd49f09e5b61be397364b06815893..60e0db3c7818c67583a49b70f516e0447eab0d72 100644 (file)
@@ -1991,8 +1991,11 @@ dri2_swap_buffers_with_damage(_EGLDriver *drv, _EGLDisplay *disp,
 
    if (ctx && surf)
       dri2_surf_update_fence_fd(ctx, disp, surf);
-   ret = dri2_dpy->vtbl->swap_buffers_with_damage(drv, disp, surf,
-                                                  rects, n_rects);
+   if (dri2_dpy->vtbl->swap_buffers_with_damage)
+      ret = dri2_dpy->vtbl->swap_buffers_with_damage(drv, disp, surf,
+                                                     rects, n_rects);
+   else
+      ret = dri2_dpy->vtbl->swap_buffers(drv, disp, surf);
 
    /* SwapBuffers marks the end of the frame; reset the damage region for
     * use again next time.
index d08af6fa7bf15a9469fd7b5366821dc1980801a4..f3bed345c63d4e7f091586cd3a339375b91ac1a5 100644 (file)
@@ -120,6 +120,7 @@ struct dri2_egl_display_vtbl {
    EGLBoolean (*swap_buffers)(_EGLDriver *drv, _EGLDisplay *disp,
                               _EGLSurface *surf);
 
+   /* optional - falls back to .swap_buffers */
    EGLBoolean (*swap_buffers_with_damage)(_EGLDriver *drv, _EGLDisplay *disp,
                                           _EGLSurface *surface,
                                           const EGLint *rects, EGLint n_rects);
index 10417cab472a822e56f3de8928b29ce3d600fe87..7a268dd3843c5f7366c72772f7b9fc6cfb868ef2 100644 (file)
 
 struct wl_buffer;
 
-static inline EGLBoolean
-dri2_fallback_swap_buffers_with_damage(_EGLDriver *drv, _EGLDisplay *disp,
-                                      _EGLSurface *surf,
-                                      const EGLint *rects, EGLint n_rects)
-{
-   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
-   return dri2_dpy->vtbl->swap_buffers(drv, disp, surf);
-}
-
 static inline EGLBoolean
 dri2_fallback_swap_buffers_region(_EGLDriver *drv, _EGLDisplay *disp,
                                   _EGLSurface *surf,
index 1d9aebc95b6d6699f09f4ca1159e217347de1d80..6ea7d8ffc83ded19b8bd4283317c5b7e3bc50df8 100644 (file)
@@ -1266,7 +1266,6 @@ static const struct dri2_egl_display_vtbl droid_display_vtbl = {
    .destroy_surface = droid_destroy_surface,
    .create_image = droid_create_image_khr,
    .swap_buffers = droid_swap_buffers,
-   .swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage, /* Android implements the function */
    .swap_buffers_region = dri2_fallback_swap_buffers_region,
    .swap_interval = droid_swap_interval,
    .post_sub_buffer = dri2_fallback_post_sub_buffer,
index f1d02c8e0416d6f1691d3a35bb2d4ae514de7cef..ce0bd1b137f2cc79d0c280cea8957e6ba0dc6f26 100644 (file)
@@ -678,7 +678,6 @@ static const struct dri2_egl_display_vtbl dri2_drm_display_vtbl = {
    .destroy_surface = dri2_drm_destroy_surface,
    .create_image = dri2_drm_create_image_khr,
    .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,
index e9b79f8fb185359ec193b93edde5ff6af738ad56..cfb777fc9a7bae6a8c345be6d3f40c5b1e696501 100644 (file)
@@ -2005,7 +2005,6 @@ static const struct dri2_egl_display_vtbl dri2_wl_swrast_display_vtbl = {
    .destroy_surface = dri2_wl_destroy_surface,
    .create_image = dri2_create_image_khr,
    .swap_buffers = dri2_wl_swrast_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,
index ff5dc32c03aa010e760bba8e363e9e968e9adc68..340a7b5522b45815712c6b3a51793fb03ec0dab0 100644 (file)
@@ -1201,7 +1201,6 @@ static const struct dri2_egl_display_vtbl dri2_x11_display_vtbl = {
    .create_image = dri2_x11_create_image_khr,
    .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,
    .post_sub_buffer = dri2_x11_post_sub_buffer,
    .copy_buffers = dri2_x11_copy_buffers,
index ab137195a97cb44f25474fc241dc24e2d09f9ad1..0275da31b440fe892ab43b203688f69690924d1e 100644 (file)
@@ -499,7 +499,6 @@ struct dri2_egl_display_vtbl dri3_x11_display_vtbl = {
    .create_image = dri3_create_image_khr,
    .swap_interval = dri3_set_swap_interval,
    .swap_buffers = dri3_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 = dri3_copy_buffers,