Mesa (master): radv: only set BO metadata for the first plane

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jan 8 15:02:44 UTC 2021


Module: Mesa
Branch: master
Commit: 7ef2046065f1e8a073bc1cc17bc8a009053f5532
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7ef2046065f1e8a073bc1cc17bc8a009053f5532

Author: Simon Ser <contact at emersion.fr>
Date:   Fri Dec 11 12:56:28 2020 +0100

radv: only set BO metadata for the first plane

To properly support multi-planar images, we don't want to set metadata
on anything other than the first plane. To achieve this radv currently
checks for the image TILING and assumes LINEAR means it's not the first
plane.

However this doesn't account for images with a single LINEAR plane. We
still want to set metadata on those, e.g. to properly set the scanout
bit in the tiling flags.

Instead of checking for LINEAR, check if the offset is zero. Only the
first plane has a zero offset on AMD.

This mirrors the radeonsi logic [1].

While at it, move the metadata declaration into the if block.

[1]: https://gitlab.freedesktop.org/mesa/mesa/-/blob/6fecdc6dda6da15d616a31900508214c81cd256e/src/gallium/drivers/radeonsi/si_texture.c#L710

Signed-off-by: Simon Ser <contact at emersion.fr>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8086>

---

 src/amd/vulkan/radv_device.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index efa197ccb14..9c4ce0172d5 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -5191,9 +5191,9 @@ bool radv_get_memory_fd(struct radv_device *device,
 			struct radv_device_memory *memory,
 			int *pFD)
 {
-	struct radeon_bo_metadata metadata;
-
-	if (memory->image && memory->image->tiling != VK_IMAGE_TILING_LINEAR) {
+	/* Only set BO metadata for the first plane */
+	if (memory->image && memory->image->offset == 0) {
+		struct radeon_bo_metadata metadata;
 		radv_init_metadata(device, memory->image, &metadata);
 		device->ws->buffer_set_metadata(memory->bo, &metadata);
 	}



More information about the mesa-commit mailing list