Module: Mesa Branch: main Commit: a93c0e18606eaa0dc535b46179d2bc5f9fd83a18 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a93c0e18606eaa0dc535b46179d2bc5f9fd83a18
Author: Guido Günther <[email protected]> Date: Tue Apr 27 11:43:11 2021 +0200 etnaviv/drm: Add some bo debug output This makes it simpler to trace BO usage. Signed-off-by: Guido Günther <[email protected]> Reviewed-by: Christian Gmeiner <[email protected]> Acked-by: Lucas Stach <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10546> --- src/etnaviv/drm/etnaviv_bo.c | 4 ++++ src/etnaviv/drm/etnaviv_priv.h | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/etnaviv/drm/etnaviv_bo.c b/src/etnaviv/drm/etnaviv_bo.c index 86c0e9afb4f..38b56953c32 100644 --- a/src/etnaviv/drm/etnaviv_bo.c +++ b/src/etnaviv/drm/etnaviv_bo.c @@ -46,6 +46,7 @@ static void set_name(struct etna_bo *bo, uint32_t name) /* Called under etna_drm_table_lock */ void _etna_bo_del(struct etna_bo *bo) { + DEBUG_BO("Del bo:", bo); VG_BO_FREE(bo); simple_mtx_assert_locked(&etna_drm_table_lock); @@ -150,6 +151,7 @@ struct etna_bo *etna_bo_new(struct etna_device *dev, uint32_t size, bo->reuse = 1; simple_mtx_unlock(&etna_drm_table_lock); + DEBUG_BO("New bo:", bo); VG_BO_ALLOC(bo); return bo; @@ -210,6 +212,7 @@ struct etna_bo *etna_bo_from_name(struct etna_device *dev, bo = bo_from_handle(dev, req.size, req.handle, 0); if (bo) { set_name(bo, name); + DEBUG_BO("New from name:", bo); VG_BO_ALLOC(bo); } @@ -251,6 +254,7 @@ struct etna_bo *etna_bo_from_dmabuf(struct etna_device *dev, int fd) bo = bo_from_handle(dev, size, handle, 0); + DEBUG_BO("New from dmabuf:", bo); VG_BO_ALLOC(bo); out_unlock: diff --git a/src/etnaviv/drm/etnaviv_priv.h b/src/etnaviv/drm/etnaviv_priv.h index 880d6194e21..e4666aee181 100644 --- a/src/etnaviv/drm/etnaviv_priv.h +++ b/src/etnaviv/drm/etnaviv_priv.h @@ -205,6 +205,11 @@ extern int etna_mesa_debug; do { debug_printf("[E] " fmt " (%s:%d)\n", \ ##__VA_ARGS__, __FUNCTION__, __LINE__); } while (0) +#define DEBUG_BO(msg, bo) \ + DEBUG_MSG("%s %p, va: 0x%.8x, size: 0x%.8x, flags: 0x%.8x, " \ + "refcnt: %d, handle: 0x%.8x, name: 0x%.8x", \ + msg, bo, bo->va, bo->size, bo->flags, bo->refcnt, bo->handle, bo->name); + #define VOID2U64(x) ((uint64_t)(unsigned long)(x)) static inline void get_abs_timeout(struct drm_etnaviv_timespec *tv, uint64_t ns)
