From: Eric Anholt Date: Tue, 18 Sep 2007 22:46:16 +0000 (-0700) Subject: Add some error reporting and a couple of assertions to TTM bufmgr. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e3745dac59602a9d21b49d602646de5aef95075f;p=mesa.git Add some error reporting and a couple of assertions to TTM bufmgr. --- diff --git a/src/mesa/drivers/dri/common/dri_bufmgr_ttm.c b/src/mesa/drivers/dri/common/dri_bufmgr_ttm.c index 5128d953706..8c36502b855 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr_ttm.c +++ b/src/mesa/drivers/dri/common/dri_bufmgr_ttm.c @@ -220,6 +220,8 @@ dri_ttm_bo_map(dri_bo *buf, GLboolean write_enable) if (write_enable) flags |= DRM_BO_FLAG_WRITE; + assert(buf->virtual == NULL); + return drmBOMap(bufmgr_ttm->fd, &ttm_buf->drm_bo, flags, 0, &buf->virtual); } @@ -234,6 +236,8 @@ dri_ttm_bo_unmap(dri_bo *buf) bufmgr_ttm = (dri_bufmgr_ttm *)buf->bufmgr; + assert(buf->virtual != NULL); + buf->virtual = NULL; return drmBOUnmap(bufmgr_ttm->fd, &ttm_buf->drm_bo); @@ -264,6 +268,9 @@ dri_ttm_validate(dri_bo *buf, unsigned int flags) if (err == 0) { /* XXX: add to fence list for sanity checking */ + } else { + fprintf(stderr, "failed to validate buffer (%s): %s\n", + ttm_buf->name, strerror(err)); } buf->offset = ttm_buf->drm_bo.offset; @@ -294,6 +301,7 @@ dri_ttm_fence_validated(dri_bufmgr *bufmgr, const char *name, fence_ttm->fence.bufmgr = bufmgr; ret = drmFenceBuffers(bufmgr_ttm->fd, type, &fence_ttm->drm_fence); if (ret) { + fprintf(stderr, "failed to fence (%s): %s\n", name, strerror(ret)); free(fence_ttm); return NULL; }