vulkan/wsi/wayland: Damage whole surface using wl_surface_damage_buffer()

Most compositors work with damage in the buffer local coordinate space.
This change spares the compositors some work converting the provided
INT32_MAX x INT32_MAX damage region to the buffer local coordinate
space. It has no significant performance impact, but it'd still be nice
to use wl_surface_damage_buffer() if possible.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34227>
This commit is contained in:
Vlad Zahorodnii 2025-03-27 10:42:58 +02:00 committed by Marge Bot
parent fd146d04d1
commit 0c943bbb64

View file

@ -2972,14 +2972,17 @@ wsi_wl_swapchain_queue_present(struct wsi_swapchain *wsi_chain,
assert(image_index < chain->base.image_count);
wl_surface_attach(wsi_wl_surface->surface, chain->images[image_index].buffer, 0, 0);
if (wl_surface_get_version(wsi_wl_surface->surface) >= 4 && damage &&
damage->pRectangles && damage->rectangleCount > 0) {
for (unsigned i = 0; i < damage->rectangleCount; i++) {
const VkRectLayerKHR *rect = &damage->pRectangles[i];
assert(rect->layer == 0);
wl_surface_damage_buffer(wsi_wl_surface->surface,
rect->offset.x, rect->offset.y,
rect->extent.width, rect->extent.height);
if (wl_surface_get_version(wsi_wl_surface->surface) >= WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION) {
if (damage && damage->pRectangles && damage->rectangleCount > 0) {
for (unsigned i = 0; i < damage->rectangleCount; i++) {
const VkRectLayerKHR *rect = &damage->pRectangles[i];
assert(rect->layer == 0);
wl_surface_damage_buffer(wsi_wl_surface->surface,
rect->offset.x, rect->offset.y,
rect->extent.width, rect->extent.height);
}
} else {
wl_surface_damage_buffer(wsi_wl_surface->surface, 0, 0, INT32_MAX, INT32_MAX);
}
} else {
wl_surface_damage(wsi_wl_surface->surface, 0, 0, INT32_MAX, INT32_MAX);