From: Eric Engestrom Date: Fri, 10 Jul 2020 22:36:08 +0000 (+0200) Subject: egl: inline fallback for swap_buffers_with_damage X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7d5a13ebf31edab412a06c075b847fc9f0137da1;p=mesa.git egl: inline fallback for swap_buffers_with_damage Signed-off-by: Eric Engestrom Reviewed-by: Frank Binns Reviewed-by: Emil Velikov Part-of: --- diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 147244f774b..60e0db3c781 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -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. diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index d08af6fa7bf..f3bed345c63 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -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); diff --git a/src/egl/drivers/dri2/egl_dri2_fallbacks.h b/src/egl/drivers/dri2/egl_dri2_fallbacks.h index 10417cab472..7a268dd3843 100644 --- a/src/egl/drivers/dri2/egl_dri2_fallbacks.h +++ b/src/egl/drivers/dri2/egl_dri2_fallbacks.h @@ -30,15 +30,6 @@ 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, diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c index 1d9aebc95b6..6ea7d8ffc83 100644 --- a/src/egl/drivers/dri2/platform_android.c +++ b/src/egl/drivers/dri2/platform_android.c @@ -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, diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c index f1d02c8e041..ce0bd1b137f 100644 --- a/src/egl/drivers/dri2/platform_drm.c +++ b/src/egl/drivers/dri2/platform_drm.c @@ -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, diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index e9b79f8fb18..cfb777fc9a7 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -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, diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index ff5dc32c03a..340a7b5522b 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -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, diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c b/src/egl/drivers/dri2/platform_x11_dri3.c index ab137195a97..0275da31b44 100644 --- a/src/egl/drivers/dri2/platform_x11_dri3.c +++ b/src/egl/drivers/dri2/platform_x11_dri3.c @@ -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,