diff --git a/src/gallium/drivers/panfrost/pan_bo.c b/src/gallium/drivers/panfrost/pan_bo.c index 61f92c6135c..af85d3aeb5b 100644 --- a/src/gallium/drivers/panfrost/pan_bo.c +++ b/src/gallium/drivers/panfrost/pan_bo.c @@ -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