radv: only set BO metadata for the first plane
authorSimon Ser <contact@emersion.fr>
Fri, 11 Dec 2020 11:56:28 +0000 (12:56 +0100)
committerMarge Bot <eric+marge@anholt.net>
Fri, 8 Jan 2021 14:52:18 +0000 (14:52 +0000)
commit7ef2046065f1e8a073bc1cc17bc8a009053f5532
treeed7a6c6119d64b984ae796dd6731d1d9f12c2664
parent4e3e7f35f7eb4b923ea10e3208a3c4840757b855
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@emersion.fr>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8086>
src/amd/vulkan/radv_device.c