From f1b1d5bb8e7a4cbcbc0ab8bcba30d9c36b68f5d4 Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Mon, 11 May 2020 08:05:59 +0200 Subject: [PATCH] v3dv: only require 4-byte alignment for linear images The page alignment requirement is for UIF images only, and for linear images it is actually useful to use a 4-byte alignment so we can use them to write images to linear buffers at arbitrary positions, which we will need when copying subrects of an image to a buffer. Part-of: --- src/broadcom/vulkan/v3dv_image.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/broadcom/vulkan/v3dv_image.c b/src/broadcom/vulkan/v3dv_image.c index c0fc31f5bd2..6830289d89e 100644 --- a/src/broadcom/vulkan/v3dv_image.c +++ b/src/broadcom/vulkan/v3dv_image.c @@ -225,13 +225,13 @@ v3d_setup_slices(struct v3dv_image *image) * * We additionally align to 4k, which improves UIF XOR performance. */ - image->alignment = 4096; - uint32_t page_align_offset = + image->alignment = image->tiling == VK_IMAGE_TILING_LINEAR ? 4 : 4096; + uint32_t align_offset = align(image->slices[0].offset, image->alignment) - image->slices[0].offset; - if (page_align_offset) { - image->size += page_align_offset; + if (align_offset) { + image->size += align_offset; for (int i = 0; i < image->levels; i++) - image->slices[i].offset += page_align_offset; + image->slices[i].offset += align_offset; } /* Arrays and cube textures have a stride which is the distance from