bufmgr_ttm: hook up destroy function, track buffer names.
authorEric Anholt <eric@anholt.net>
Fri, 6 Jul 2007 19:01:33 +0000 (12:01 -0700)
committerEric Anholt <eric@anholt.net>
Fri, 6 Jul 2007 19:01:33 +0000 (12:01 -0700)
src/mesa/drivers/dri/common/dri_bufmgr_ttm.c

index fd432ba3f720a6334e913c7cca9430674094a4cd..4c3624382c73f783cee4632c74679aff1d86efb4 100644 (file)
@@ -56,6 +56,7 @@ typedef struct _dri_bo_ttm {
 
    int refcount;               /* Protected by bufmgr->mutex */
    drmBO drm_bo;
+   const char *name;
 } dri_bo_ttm;
 
 typedef struct _dri_fence_ttm
@@ -124,6 +125,7 @@ dri_ttm_alloc(dri_bufmgr *bufmgr, const char *name,
    ttm_buf->bo.offset = ttm_buf->drm_bo.offset;
    ttm_buf->bo.virtual = NULL;
    ttm_buf->bo.bufmgr = bufmgr;
+   ttm_buf->name = name;
    ttm_buf->refcount = 1;
 
    return &ttm_buf->bo;
@@ -165,6 +167,7 @@ dri_ttm_alloc_static(dri_bufmgr *bufmgr, const char *name,
    ttm_buf->bo.offset = ttm_buf->drm_bo.offset;
    ttm_buf->bo.virtual = virtual;
    ttm_buf->bo.bufmgr = bufmgr;
+   ttm_buf->name = name;
    ttm_buf->refcount = 1;
 
    return &ttm_buf->bo;
@@ -340,7 +343,7 @@ dri_ttm_fence_wait(dri_fence *fence)
 }
 
 static void
-dri_fake_destroy(dri_bufmgr *bufmgr)
+dri_bufmgr_ttm_destroy(dri_bufmgr *bufmgr)
 {
    dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)bufmgr;
 
@@ -381,6 +384,7 @@ dri_bufmgr_ttm_init(int fd, unsigned int fence_type,
    bufmgr_ttm->bufmgr.fence_reference = dri_ttm_fence_reference;
    bufmgr_ttm->bufmgr.fence_unreference = dri_ttm_fence_unreference;
    bufmgr_ttm->bufmgr.fence_wait = dri_ttm_fence_wait;
+   bufmgr_ttm->bufmgr.destroy = dri_bufmgr_ttm_destroy;
 
    /* Attempt an allocation to make sure that the DRM was actually set up for
     * TTM.