From 75912596741d1afe5827dab6913c3d810eda8788 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 20 Sep 2007 11:38:32 -0700 Subject: [PATCH] Add disabled-by-default tracing of TTM bufmgr operations. --- src/mesa/drivers/dri/common/dri_bufmgr_ttm.c | 34 ++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/mesa/drivers/dri/common/dri_bufmgr_ttm.c b/src/mesa/drivers/dri/common/dri_bufmgr_ttm.c index e264048b70b..f864b1bc892 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr_ttm.c +++ b/src/mesa/drivers/dri/common/dri_bufmgr_ttm.c @@ -42,6 +42,8 @@ #include "string.h" #include "imports.h" +#define BUFMGR_DEBUG 0 + typedef struct _dri_bufmgr_ttm { dri_bufmgr bufmgr; @@ -128,6 +130,10 @@ dri_ttm_alloc(dri_bufmgr *bufmgr, const char *name, ttm_buf->name = name; ttm_buf->refcount = 1; +#if BUFMGR_DEBUG + fprintf(stderr, "bo_create: %p (%s)\n", &ttm_buf->bo, ttm_buf->name); +#endif + return &ttm_buf->bo; } @@ -174,6 +180,11 @@ dri_ttm_bo_create_from_handle(dri_bufmgr *bufmgr, const char *name, ttm_buf->name = name; ttm_buf->refcount = 1; +#if BUFMGR_DEBUG + fprintf(stderr, "bo_create_from_handle: %p (%s)\n", &ttm_buf->bo, + ttm_buf->name); +#endif + return &ttm_buf->bo; } @@ -222,6 +233,10 @@ dri_ttm_bo_map(dri_bo *buf, GLboolean write_enable) assert(buf->virtual == NULL); +#if BUFMGR_DEBUG + fprintf(stderr, "bo_map: %p (%s)\n", &ttm_buf->bo, ttm_buf->name); +#endif + return drmBOMap(bufmgr_ttm->fd, &ttm_buf->drm_bo, flags, 0, &buf->virtual); } @@ -240,6 +255,10 @@ dri_ttm_bo_unmap(dri_bo *buf) buf->virtual = NULL; +#if BUFMGR_DEBUG + fprintf(stderr, "bo_unmap: %p (%s)\n", &ttm_buf->bo, ttm_buf->name); +#endif + return drmBOUnmap(bufmgr_ttm->fd, &ttm_buf->drm_bo); } @@ -275,6 +294,10 @@ dri_ttm_validate(dri_bo *buf, unsigned int flags) buf->offset = ttm_buf->drm_bo.offset; +#if BUFMGR_DEBUG + fprintf(stderr, "bo_validate: %p (%s)\n", &ttm_buf->bo, ttm_buf->name); +#endif + return err; } @@ -305,6 +328,12 @@ dri_ttm_fence_validated(dri_bufmgr *bufmgr, const char *name, free(fence_ttm); return NULL; } + +#if BUFMGR_DEBUG + fprintf(stderr, "fence_validated: %p (%s)\n", &fence_ttm->fence, + fence_ttm->name); +#endif + return &fence_ttm->fence; } @@ -354,6 +383,11 @@ dri_ttm_fence_wait(dri_fence *fence) __FILE__, __LINE__, ret, fence_ttm->name); abort(); } + +#if BUFMGR_DEBUG + fprintf(stderr, "fence_wait: %p (%s)\n", &fence_ttm->fence, + fence_ttm->name); +#endif } static void -- 2.30.2