summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2007-11-30 18:17:12 -0800
committerEric Anholt <eric@anholt.net>2007-11-30 18:17:12 -0800
commit556cf9abff75eaa56c3ea11f1c59cb04d30c0b92 (patch)
tree49ca817a7040652918ebb3f32198b776edc4935d
parentd388cad74675b6ac9bde4aa1dbdd3f4b0138942d (diff)
[intel] Move batch bo_unmap from TTM code to shared, and add more asserts.
-rw-r--r--src/mesa/drivers/dri/common/dri_bufmgr_fake.c7
-rw-r--r--src/mesa/drivers/dri/intel/intel_batchbuffer.c1
-rw-r--r--src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c2
3 files changed, 8 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/common/dri_bufmgr_fake.c b/src/mesa/drivers/dri/common/dri_bufmgr_fake.c
index 029f29ad6..dda6e5a25 100644
--- a/src/mesa/drivers/dri/common/dri_bufmgr_fake.c
+++ b/src/mesa/drivers/dri/common/dri_bufmgr_fake.c
@@ -754,6 +754,7 @@ dri_fake_bo_unmap(dri_bo *bo)
return 0;
_glthread_LOCK_MUTEX(bufmgr_fake->mutex);
+ assert(bo_fake->map_count != 0);
if (--bo_fake->map_count != 0) {
_glthread_UNLOCK_MUTEX(bufmgr_fake->mutex);
return 0;
@@ -785,6 +786,12 @@ dri_fake_bo_validate(dri_bo *bo, uint64_t flags)
_glthread_LOCK_MUTEX(bufmgr_fake->mutex);
{
+ /* Sanity check: Buffers should be unmapped before being validated.
+ * This is not so much of a problem for bufmgr_fake, but TTM refuses,
+ * and the problem is harder to debug there.
+ */
+ assert(bo_fake->map_count == 0);
+
if (bo_fake->is_static) {
/* Add it to the needs-fence list */
bufmgr_fake->need_fence = 1;
diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
index 3764027bf..b51086a63 100644
--- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
@@ -131,6 +131,7 @@ do_flush_locked(struct intel_batchbuffer *batch,
void *start;
GLuint count;
+ dri_bo_unmap(batch->buf);
start = dri_process_relocs(batch->buf, &count);
batch->map = NULL;
diff --git a/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c b/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c
index 5791f01ce..3e0d818a0 100644
--- a/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c
+++ b/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c
@@ -825,8 +825,6 @@ dri_ttm_process_reloc(dri_bo *batch_buf, GLuint *count)
void *ptr;
int itemLoc;
- dri_bo_unmap(batch_buf);
-
/* Add the batch buffer to the validation list. There are no relocations
* pointing to it.
*/