diff options
-rw-r--r-- | src/sna/kgem.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c index f1682da5..90594cfa 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -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; } |