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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
This commit is contained in:
Iago Toral Quiroga
2020-05-11 08:05:59 +02:00
committed by Marge Bot
parent fe0ccdbc83
commit f1b1d5bb8e
+5 -5
View File
@@ -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