struct block *next, *prev;
struct mem_block *mem; /* BM_MEM_AGP */
- unsigned referenced:1;
unsigned on_hardware:1;
unsigned fenced:1;
unsigned buf_nr; /* for generating ids */
- struct block referenced; /* after bmBufferOffset */
struct block on_hardware; /* after bmValidateBuffers */
struct block fenced; /* after bmFenceBuffers (mi_flush, emit irq, write dword) */
/* then to bufmgr->lru or free() */
if (!block)
return;
- if (block->referenced) {
- _mesa_printf("tried to free block on referenced list\n");
- assert(0);
- }
- else if (block->on_hardware) {
+ if (block->on_hardware) {
block->bo = NULL;
}
else if (block->fenced) {
}
}
- /* Also check the referenced list:
- */
- foreach_s(block, tmp, &bufmgr_fake->referenced ) {
- if (block->fenced && _fence_test(bufmgr_fake, block->fence)) {
- block->fenced = 0;
- }
- }
-
DBG("%s: %d\n", __FUNCTION__, ret);
return ret;
}
move_to_tail(&bufmgr_fake->fenced, block);
}
- /* Also check the referenced list:
- */
- foreach_s (block, tmp, &bufmgr_fake->referenced) {
- if (block->on_hardware) {
- DBG("Fence block %p (sz 0x%x buf %p) with fence %d\n", block,
- block->mem->size, block->bo, fence);
-
- block->fence = fence;
- block->on_hardware = 0;
- block->fenced = 1;
- }
- }
-
assert(is_empty_list(&bufmgr_fake->on_hardware));
}
{
struct block *block, *tmp;
- assert(is_empty_list(&bufmgr_fake->referenced));
-
bufmgr_fake->need_fence = 1;
bufmgr_fake->fail = 0;
*/
dri_bufmgr_fake_wait_idle(bufmgr_fake);
+ /* Check that we hadn't released the lock without having fenced the last
+ * set of buffers.
+ */
assert(is_empty_list(&bufmgr_fake->fenced));
assert(is_empty_list(&bufmgr_fake->on_hardware));
assert(bo_fake->block);
assert(bo_fake->block->bo == &bo_fake->bo);
- DBG("Add buf %d:%s (block %p, dirty %d) to referenced list\n",
- bo_fake->id, bo_fake->name, bo_fake->block, bo_fake->dirty);
-
- move_to_tail(&bufmgr_fake->referenced, bo_fake->block);
- bo_fake->block->referenced = 1;
-
bo->offset = bo_fake->block->mem->ofs;
/* Upload the buffer contents if necessary */
dri_bufmgr_fake_wait_idle(bufmgr_fake);
memcpy(bo_fake->block->virtual, bo_fake->backing_store, bo->size);
-
- bo_fake->block->referenced = 0;
- bo_fake->block->on_hardware = 1;
- move_to_tail(&bufmgr_fake->on_hardware, bo_fake->block);
+ bo_fake->dirty = 0;
}
+ bo_fake->block->on_hardware = 1;
+ move_to_tail(&bufmgr_fake->on_hardware, bo_fake->block);
+
bufmgr_fake->need_fence = 1;
}
_glthread_UNLOCK_MUTEX(bufmgr_fake->mutex);
bufmgr_fake = calloc(1, sizeof(*bufmgr_fake));
/* Initialize allocator */
- make_empty_list(&bufmgr_fake->referenced);
make_empty_list(&bufmgr_fake->fenced);
make_empty_list(&bufmgr_fake->on_hardware);
make_empty_list(&bufmgr_fake->lru);