summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-12-12 21:55:04 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-12-13 01:38:09 +0000
commit7472db8c8c9994798ea36de1ce2f51725d8b387a (patch)
tree09d2c08b9554a291496c34780ceb11ad3f44c692
parent0bbd6a08fe485c80bd5c9a1b7027618a03a26f84 (diff)
sna: Double-check that the submitted buffers were not purged
More paranoia is good for the soul. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 1a098491..3d2705c3 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -224,6 +224,8 @@ kgem_busy(struct kgem *kgem, int handle)
Bool kgem_bo_write(struct kgem *kgem, struct kgem_bo *bo,
const void *data, int length)
{
+ assert(bo->refcnt);
+ assert(!bo->purged);
assert(!kgem_busy(kgem, bo->handle));
if (gem_write(kgem->fd, bo->handle, 0, length, data))
@@ -817,6 +819,8 @@ static void kgem_commit(struct kgem *kgem)
struct kgem_bo *bo, *next;
list_for_each_entry_safe(bo, next, &rq->buffers, request) {
+ assert(!bo->purged);
+
bo->presumed_offset = bo->exec->offset;
bo->binding.offset = 0;
bo->exec = NULL;
@@ -1803,7 +1807,8 @@ uint32_t kgem_add_reloc(struct kgem *kgem,
{
int index;
- assert ((read_write_domain & 0x7fff) == 0 || bo != NULL);
+ assert(bo->refcnt);
+ assert((read_write_domain & 0x7fff) == 0 || bo != NULL);
index = kgem->nreloc++;
assert(index < ARRAY_SIZE(kgem->reloc));
@@ -1883,6 +1888,9 @@ void *kgem_bo_map(struct kgem *kgem, struct kgem_bo *bo, int prot)
{
void *ptr;
+ assert(bo->refcnt);
+ assert(!bo->purged);
+
if (IS_CPU_MAP(bo->map)) {
DBG(("%s: discarding CPU vma cache for %d\n",
__FUNCTION__, bo->handle));
@@ -1937,6 +1945,8 @@ void *kgem_bo_map__cpu(struct kgem *kgem, struct kgem_bo *bo)
struct drm_i915_gem_mmap mmap_arg;
DBG(("%s(handle=%d, size=%d)\n", __FUNCTION__, bo->handle, bo->size));
+ assert(bo->refcnt);
+ assert(!bo->purged);
if (IS_CPU_MAP(bo->map)) {
void *ptr = CPU_MAP(bo->map);