diff --git a/src/panfrost/vulkan/panvk_device.h b/src/panfrost/vulkan/panvk_device.h index ead293f0503..258c8a2a044 100644 --- a/src/panfrost/vulkan/panvk_device.h +++ b/src/panfrost/vulkan/panvk_device.h @@ -147,6 +147,23 @@ static inline uint32_t panvk_device_adjust_bo_flags(const struct panvk_device *device, uint32_t bo_flags) { + struct panvk_physical_device *pdev = + to_panvk_physical_device(device->vk.physical); + + /* Dumping of GPU buffers messes up with CPU caches by loading buffers + * into cachelines which are sometimes assumed to be invalidated by the + * rest of the code. We could explicitly invalidate after a dump, but + * this is simpler to just disable cached-mappings when PANVK_DEBUG="dump". + * Tracing has the same fundamental issue, but we'll take care of that + * at the desc/CS pools level. + */ + const bool allow_wb_mmap = + (pdev->kmod.dev->props.supported_bo_flags & PAN_KMOD_BO_FLAG_WB_MMAP) && + !PANVK_DEBUG(DUMP); + + if (!allow_wb_mmap) + bo_flags &= ~PAN_KMOD_BO_FLAG_WB_MMAP; + if (PANVK_DEBUG(DUMP) || PANVK_DEBUG(TRACE)) bo_flags &= ~PAN_KMOD_BO_FLAG_NO_MMAP;