From f3ffc27927cc9c063eda28ab098b73aaea5ab4a2 Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Thu, 19 Mar 2026 14:29:15 -0700 Subject: [PATCH] lvp: follow winsys handle size when imported with explicit layout Per plane size has been decided outside when imported with explicit layout. The unconditional alignup was added in the lvp sparse support, which doesn't interact with format modifier path at all. For later (in fear of breaking things): 1. We better validate against the must satisfied layout e.g. D/S tile load/store. For color attachment, unaligned loads are used if the alignment exceeds 16 bytes. 2. The additional alignment on the required size should have been applied inside the resource_create_unbacked from llvmpipe backend. 3. The alignment requirement better comes from the backend instead of a hard-coded value in the frontend. Reviewed-by: Lucas Fryzek Part-of: --- src/gallium/frontends/lavapipe/lvp_image.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gallium/frontends/lavapipe/lvp_image.c b/src/gallium/frontends/lavapipe/lvp_image.c index 52636feb4e6..c3a9c9b51e0 100644 --- a/src/gallium/frontends/lavapipe/lvp_image.c +++ b/src/gallium/frontends/lavapipe/lvp_image.c @@ -170,12 +170,11 @@ lvp_image_init(struct lvp_device *device, struct lvp_image *image, image->planes[p].bo = device->pscreen->resource_create_unbacked(device->pscreen, &template, &image->planes[p].size); + image->planes[p].size = align64(image->planes[p].size, image->alignment); } if (!image->planes[p].bo) return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY); - image->planes[p].size = align64(image->planes[p].size, image->alignment); - image->size += image->planes[p].size; }