summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 029f29ad69..dda6e5a25e 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 3764027bff..b51086a638 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 5791f01ce1..3e0d818a0c 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.
*/