• Home
  • Raw
  • Download

Lines Matching full:pool

32  * In "owned" mode, a single parent owns the entire pool, and the pool owns all
34 * panvk_pool_get_bo_handles. Freeing occurs at the level of an entire pool.
35 * This is useful for streaming uploads, where the batch owns the pool.
37 * In "unowned" mode, the pool is freestanding. It does not track created BOs
44 panvk_pool_alloc_backing(struct panvk_pool *pool, size_t bo_sz) in panvk_pool_alloc_backing() argument
48 /* If there's a free BO in our BO pool, let's pick it. */ in panvk_pool_alloc_backing()
49 if (pool->bo_pool && bo_sz == pool->base.slab_size && in panvk_pool_alloc_backing()
50 util_dynarray_num_elements(&pool->bo_pool->free_bos, struct panfrost_bo *)) { in panvk_pool_alloc_backing()
51 bo = util_dynarray_pop(&pool->bo_pool->free_bos, struct panfrost_bo *); in panvk_pool_alloc_backing()
59 bo = panfrost_bo_create(pool->base.dev, bo_sz, in panvk_pool_alloc_backing()
60 pool->base.create_flags, in panvk_pool_alloc_backing()
61 pool->base.label); in panvk_pool_alloc_backing()
64 if (bo->size == pool->base.slab_size) in panvk_pool_alloc_backing()
65 util_dynarray_append(&pool->bos, struct panfrost_bo *, bo); in panvk_pool_alloc_backing()
67 util_dynarray_append(&pool->big_bos, struct panfrost_bo *, bo); in panvk_pool_alloc_backing()
68 pool->transient_bo = bo; in panvk_pool_alloc_backing()
69 pool->transient_offset = 0; in panvk_pool_alloc_backing()
75 panvk_pool_alloc_aligned(struct panvk_pool *pool, size_t sz, unsigned alignment) in panvk_pool_alloc_aligned() argument
80 struct panfrost_bo *bo = pool->transient_bo; in panvk_pool_alloc_aligned()
81 unsigned offset = ALIGN_POT(pool->transient_offset, alignment); in panvk_pool_alloc_aligned()
84 if (unlikely(bo == NULL || (offset + sz) >= pool->base.slab_size)) { in panvk_pool_alloc_aligned()
85 bo = panvk_pool_alloc_backing(pool, in panvk_pool_alloc_aligned()
86 ALIGN_POT(MAX2(pool->base.slab_size, sz), in panvk_pool_alloc_aligned()
91 pool->transient_offset = offset + sz; in panvk_pool_alloc_aligned()
103 panvk_pool_init(struct panvk_pool *pool, in PAN_POOL_ALLOCATOR()
108 memset(pool, 0, sizeof(*pool)); in PAN_POOL_ALLOCATOR()
109 pan_pool_init(&pool->base, dev, create_flags, slab_size, label); in PAN_POOL_ALLOCATOR()
110 pool->bo_pool = bo_pool; in PAN_POOL_ALLOCATOR()
112 util_dynarray_init(&pool->bos, NULL); in PAN_POOL_ALLOCATOR()
113 util_dynarray_init(&pool->big_bos, NULL); in PAN_POOL_ALLOCATOR()
116 panvk_pool_alloc_backing(pool, pool->base.slab_size); in PAN_POOL_ALLOCATOR()
120 panvk_pool_reset(struct panvk_pool *pool) in panvk_pool_reset() argument
122 if (pool->bo_pool) { in panvk_pool_reset()
123 unsigned num_bos = panvk_pool_num_bos(pool); in panvk_pool_reset()
124 void *ptr = util_dynarray_grow(&pool->bo_pool->free_bos, in panvk_pool_reset()
126 memcpy(ptr, util_dynarray_begin(&pool->bos), in panvk_pool_reset()
129 util_dynarray_foreach(&pool->bos, struct panfrost_bo *, bo) in panvk_pool_reset()
133 util_dynarray_foreach(&pool->big_bos, struct panfrost_bo *, bo) in panvk_pool_reset()
136 util_dynarray_clear(&pool->bos); in panvk_pool_reset()
137 util_dynarray_clear(&pool->big_bos); in panvk_pool_reset()
138 pool->transient_bo = NULL; in panvk_pool_reset()
142 panvk_pool_cleanup(struct panvk_pool *pool) in panvk_pool_cleanup() argument
144 panvk_pool_reset(pool); in panvk_pool_cleanup()
145 util_dynarray_fini(&pool->bos); in panvk_pool_cleanup()
146 util_dynarray_fini(&pool->big_bos); in panvk_pool_cleanup()
150 panvk_pool_get_bo_handles(struct panvk_pool *pool, uint32_t *handles) in panvk_pool_get_bo_handles() argument
153 util_dynarray_foreach(&pool->bos, struct panfrost_bo *, bo) { in panvk_pool_get_bo_handles()