From 7395ae7494de5365fbf1ab78dd6b4c2e98a07c55 Mon Sep 17 00:00:00 2001 From: Valentine Burley Date: Fri, 22 May 2026 16:06:41 +0200 Subject: [PATCH] tu/kgsl: Fix memory type support detection for unsupported flags Stops incorrectly assuming cached-coherent memory is supported on hardware that does not support it, such as a610 and a619-holi. Fixes: 5a594109623 ("turnip: add cached and cached-coherent memory types") Signed-off-by: Valentine Burley Part-of: --- src/freedreno/vulkan/tu_knl_kgsl.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/freedreno/vulkan/tu_knl_kgsl.cc b/src/freedreno/vulkan/tu_knl_kgsl.cc index 97e301cf83b..4c6d9eca27f 100644 --- a/src/freedreno/vulkan/tu_knl_kgsl.cc +++ b/src/freedreno/vulkan/tu_knl_kgsl.cc @@ -561,11 +561,18 @@ kgsl_is_memory_type_supported(int fd, uint32_t flags) return false; } + /* The kernel echoes back the *actual* flags it used. Some KGSL + * versions silently strip unsupported flags (e.g. IOCOHERENT on + * GPUs that lack IO-coherence) instead of failing the ioctl. + * Detect this by checking the requested bits are still present. + */ + bool supported = (req_alloc.flags & flags) == flags; + struct kgsl_gpumem_free_id req_free = { .id = req_alloc.id }; safe_ioctl(fd, IOCTL_KGSL_GPUMEM_FREE_ID, &req_free); - return true; + return supported; } static bool