From 0aa6d727c99bd0bda45d12c56a3447283928300b Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Sun, 15 Mar 2026 15:33:55 -0700 Subject: [PATCH] llvmpipe: follow winsys handle attributes when imported with explicit layout TILE_SIZE round up can conflict with explicit plane size, which assumes a smaller alignment e.g. sw YV12 Reviewed-by: Lucas Fryzek Part-of: --- src/gallium/drivers/llvmpipe/lp_texture.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c index 04dc1beeaba..b3d23389a9c 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.c +++ b/src/gallium/drivers/llvmpipe/lp_texture.c @@ -1718,11 +1718,20 @@ llvmpipe_resource_bind_backing(struct pipe_screen *pscreen, winsys->displaytarget_destroy(winsys, lpr->dt); } if (pmem) { - /* Round up the surface size to a multiple of the tile size to - * avoid tile clipping. + /* For import alloc with explicit layout, follow the provided + * attributes since the layout has been decided externally. + * + * For export alloc, round up the surface size to a multiple of the + * tile size to avoid tile clipping. */ - const unsigned width = MAX2(1, align(lpr->base.width0, TILE_SIZE)); - const unsigned height = MAX2(1, align(lpr->base.height0, TILE_SIZE)); + unsigned width, height; + if (lpr->backable) { + width = lpr->base.width0; + height = lpr->base.height0; + } else { + width = MAX2(1, align(lpr->base.width0, TILE_SIZE)); + height = MAX2(1, align(lpr->base.height0, TILE_SIZE)); + } lpr->dt = winsys->displaytarget_create_mapped(winsys, lpr->base.bind,