panfrost: make PAN_MESA_DEBUG=dump really show all GPU memory

The flag is advertised to dump all GPU memory, but really only dumps
mapped memory, so some significant pieces (like textures) are left out.
Change this by mapping as much as possible when the dump flag is given.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30411>
This commit is contained in:
Eric R. Smith
2024-07-29 09:21:16 -03:00
committed by Marge Bot
parent 801078cbf8
commit 21ac210ab2
+12
View File
@@ -368,6 +368,14 @@ panfrost_bo_create(struct panfrost_device *dev, size_t size, uint32_t flags,
{
struct panfrost_bo *bo;
if (dev->debug & PAN_DBG_DUMP) {
/* Make sure to CPU-map all BOs except growable ones, so that
we can dump them when PAN_MESA_DEBUG=dump. */
if (!(flags & PAN_BO_GROWABLE)) {
flags &= ~PAN_BO_INVISIBLE;
}
flags &= ~PAN_BO_DELAY_MMAP;
}
/* Kernel will fail (confusingly) with EPERM otherwise */
assert(size > 0);
@@ -499,6 +507,10 @@ panfrost_bo_import(struct panfrost_device *dev, int fd)
bo->ptr.gpu = vm_op.va.start;
bo->flags = PAN_BO_SHARED;
p_atomic_set(&bo->refcnt, 1);
/* mmap imported BOs when PAN_MESA_DEBUG=dump */
if (dev->debug & PAN_DBG_DUMP)
panfrost_bo_mmap(bo);
} else {
/* bo->refcnt == 0 can happen if the BO
* was being released but panfrost_bo_import() acquired the