radeonsi: fix radeon_canonicalize_bo_flags domain handling

ffs(VRAM, GTT) returns the GTT bit as it's the smaller.

Simplify the code by explicitely selecting VRAM when both
domains are active, otherwise assert that only 1 bit is set.

Fixes: 593f72aa21 ("winsys/amdgpu-radeon: rework how we describe heaps")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31683>
This commit is contained in:
Pierre-Eric Pelloux-Prayer
2024-10-14 15:34:02 +02:00
parent bb08596645
commit 19fa5561be

View File

@@ -873,10 +873,10 @@ static void radeon_canonicalize_bo_flags(enum radeon_bo_domain *_domain,
unsigned flags = *_flags;
/* Only set 1 domain, e.g. ignore GTT if VRAM is set. */
if (domain)
domain = BITFIELD_BIT(ffs(domain) - 1);
else
if (domain == RADEON_DOMAIN_VRAM_GTT)
domain = RADEON_DOMAIN_VRAM;
else
assert(util_bitcount(domain) == 1);
switch (domain) {
case RADEON_DOMAIN_VRAM: