nvk: Add an NVK_DEBUG=coherent flag

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38163>
This commit is contained in:
Faith Ekstrand 2025-10-29 09:47:27 -04:00 committed by Marge Bot
parent 5a5862c025
commit f7412bd229
4 changed files with 10 additions and 0 deletions

View file

@ -72,6 +72,9 @@ specific to NVK:
views.
``gart``
Forces all memory to be allocated from system RAM (GART)
``coherent``
Forces all memory maps to be coherent with the CPU caches. This only
applies to Tegra devices.
.. envvar:: NVK_I_WANT_A_BROKEN_VULKAN_DRIVER

View file

@ -39,6 +39,9 @@ enum nvk_debug {
/* Force all memory allocations to go to GART */
NVK_DEBUG_FORCE_GART = 1ull << 7,
/* Force all memory allocations to go to GART */
NVK_DEBUG_FORCE_COHERENT = 1ull << 8,
};
#endif /* NVK_DEBUG_H */

View file

@ -89,6 +89,7 @@ nvk_init_debug_flags(struct nvk_instance *instance)
{ "no_cbuf", NVK_DEBUG_NO_CBUF },
{ "edb_bview", NVK_DEBUG_FORCE_EDB_BVIEW },
{ "gart", NVK_DEBUG_FORCE_GART },
{ "coherent", NVK_DEBUG_FORCE_COHERENT },
{ NULL, 0 },
};

View file

@ -135,6 +135,9 @@ nvkmd_nouveau_alloc_tiled_mem(struct nvkmd_dev *_dev,
nouveau_flags |= NOUVEAU_WS_BO_NO_SHARE;
if (dev->base.pdev->dev_info.type == NV_DEVICE_TYPE_SOC) {
if (dev->base.pdev->debug_flags & NVK_DEBUG_FORCE_COHERENT)
flags |= NVKMD_MEM_COHERENT;
/* On Tegra, we have to explicitly request coherent maps by putting the
* BO in NOUVEAU_GEM_DOMAIN_COHERENT.
*/