From 3799f13b32f36ad91985849cdcaf363d57b682b6 Mon Sep 17 00:00:00 2001 From: Lucas Fryzek Date: Tue, 17 Sep 2024 15:15:56 +0100 Subject: [PATCH] egl/dri/wl: Move swrast damage region from put to swap Pass application provided damage region to the compositor instead of damaging the entire display. This also gives us the possibility in the future to have put image only copy the parts of the framebuffer that were modified. Fixes: fa465e34cadacb7d29a664006b5d73bc2a8d9cf3 Acked-by: Mike Blumenkrantz Reviewed-by: Adam Jackson Part-of: (cherry picked from commit 32af15384de821269f9ec8b11effa0fc4961acee) --- .pick_status.json | 2 +- src/egl/drivers/dri2/platform_wayland.c | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index d29714768f3..57fab57448c 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -4154,7 +4154,7 @@ "description": "egl/dri/wl: Move swrast damage region from put to swap", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "fa465e34cadacb7d29a664006b5d73bc2a8d9cf3", "notes": null diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index 18817ad73d1..723be82a0b1 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -2660,12 +2660,6 @@ dri2_wl_swrast_put_image2(__DRIdrawable *draw, int op, int x, int y, int w, char *src, *dst; assert(copy_width <= stride); - if (wl_proxy_get_version((struct wl_proxy *)dri2_surf->wl_surface_wrapper) < - WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION) - wl_surface_damage(dri2_surf->wl_surface_wrapper, 0, 0, INT32_MAX, INT32_MAX); - else - wl_surface_damage_buffer(dri2_surf->wl_surface_wrapper, - x, y, w, h); dst = dri2_wl_swrast_get_backbuffer_data(dri2_surf); @@ -2747,6 +2741,13 @@ dri2_wl_swrast_swap_buffers_with_damage(_EGLDisplay *disp, _EGLSurface *draw, dri2_wl_swrast_attach_backbuffer(dri2_surf); + /* If the compositor doesn't support damage_buffer, we deliberately + * ignore the damage region and post maximum damage, due to + * https://bugs.freedesktop.org/78190 */ + if (!n_rects || !try_damage_buffer(dri2_surf, rects, n_rects)) + wl_surface_damage(dri2_surf->wl_surface_wrapper, 0, 0, INT32_MAX, + INT32_MAX); + /* guarantee full copy for partial update */ int w = n_rects == 1 ? (rects[2] - rects[0]) : 0; int copy_width = dri2_wl_swrast_get_stride_for_format(dri2_surf->format, w);