*
*/
-#include "util/hash_table.h"
#include "pan_bo.h"
#include "pan_pool.h"
struct panfrost_bo *bo = panfrost_bo_create(pool->dev, bo_sz,
pool->create_flags);
- uintptr_t flags = PAN_BO_ACCESS_PRIVATE |
- PAN_BO_ACCESS_RW |
- PAN_BO_ACCESS_VERTEX_TILER |
- PAN_BO_ACCESS_FRAGMENT;
-
- _mesa_hash_table_insert(pool->bos, bo, (void *) flags);
-
+ util_dynarray_append(&pool->bos, struct panfrost_bo *, bo);
pool->transient_bo = bo;
pool->transient_offset = 0;
memset(pool, 0, sizeof(*pool));
pool->dev = dev;
pool->create_flags = create_flags;
- pool->bos = _mesa_hash_table_create(memctx, _mesa_hash_pointer,
- _mesa_key_pointer_equal);
+ util_dynarray_init(&pool->bos, memctx);
if (prealloc)
panfrost_pool_alloc_backing(pool, TRANSIENT_SLAB_SIZE);
}
-static void delete_bo_entry(struct hash_entry *entry)
-{
- panfrost_bo_unreference((struct panfrost_bo *)entry->key);
-}
-
void
panfrost_pool_cleanup(struct pan_pool *pool)
{
- _mesa_hash_table_destroy(pool->bos, delete_bo_entry);
+ util_dynarray_foreach(&pool->bos, struct panfrost_bo *, bo)
+ panfrost_bo_unreference(*bo);
+
+ util_dynarray_fini(&pool->bos);
}
void
panfrost_pool_get_bo_handles(struct pan_pool *pool, uint32_t *handles)
{
unsigned idx = 0;
- hash_table_foreach(pool->bos, entry) {
- struct panfrost_bo *bo = (struct panfrost_bo *)entry->key;
-
- assert(bo->gem_handle > 0);
- handles[idx++] = bo->gem_handle;
+ util_dynarray_foreach(&pool->bos, struct panfrost_bo *, bo) {
+ assert((*bo)->gem_handle > 0);
+ handles[idx++] = (*bo)->gem_handle;
/* Update the BO access flags so that panfrost_bo_wait() knows
* about all pending accesses.
* We also preserve existing flags as this batch might not
* be the first one to access the BO.
*/
- bo->gpu_access |= PAN_BO_ACCESS_RW;
+ (*bo)->gpu_access |= PAN_BO_ACCESS_RW;
}
}
#include <stddef.h>
#include <midgard_pack.h>
+#include "util/u_dynarray.h"
+
/* Represents a pool of memory that can only grow, used to allocate objects
* with the same lifetime as the pool itself. In OpenGL, a pool is owned by the
* batch for transient structures. In Vulkan, it may be owned by e.g. the
/* Parent device for allocation */
struct panfrost_device *dev;
- /* panfrost_bo -> access_flags owned by the pool */
- struct hash_table *bos;
+ /* BOs allocated by this pool */
+ struct util_dynarray bos;
/* Current transient BO */
struct panfrost_bo *transient_bo;
static inline unsigned
panfrost_pool_num_bos(struct pan_pool *pool)
{
- return pool->bos->entries;
+ return util_dynarray_num_elements(&pool->bos, struct panfrost_bo *);
}
void