sna: Improve the initialisation failure path for pinned batches
Simplify the later checks by always populating the lists with a single, albeit unpinned, bo in the case we fail to create pinned batches. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
52c8c9218c
commit
74bbf20e6e
|
|
@ -869,7 +869,6 @@ static bool kgem_init_pinned_batches(struct kgem *kgem)
|
|||
bo->presumed_offset = pin.offset;
|
||||
debug_alloc__bo(kgem, bo);
|
||||
list_add(&bo->list, &kgem->pinned_batches[n]);
|
||||
bo->refcnt = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -883,6 +882,25 @@ err:
|
|||
struct kgem_bo, list));
|
||||
}
|
||||
}
|
||||
|
||||
/* For simplicity populate the lists with a single unpinned bo */
|
||||
for (n = 0; n < ARRAY_SIZE(count); n++) {
|
||||
struct kgem_bo *bo;
|
||||
uint32_t handle;
|
||||
|
||||
handle = gem_create(kgem->fd, size[n]);
|
||||
if (handle == 0)
|
||||
break;
|
||||
|
||||
bo = __kgem_bo_alloc(handle, size[n]);
|
||||
if (bo == NULL) {
|
||||
gem_close(kgem->fd, handle);
|
||||
break;
|
||||
}
|
||||
|
||||
debug_alloc__bo(kgem, bo);
|
||||
list_add(&bo->list, &kgem->pinned_batches[n]);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue