diff --git a/src/gallium/drivers/freedreno/freedreno_batch.h b/src/gallium/drivers/freedreno/freedreno_batch.h index e39a65cb846..0665872cf16 100644 --- a/src/gallium/drivers/freedreno/freedreno_batch.h +++ b/src/gallium/drivers/freedreno/freedreno_batch.h @@ -285,6 +285,7 @@ void fd_batch_check_size(struct fd_batch *batch) assert_dt; uint32_t fd_batch_key_hash(const void *_key); bool fd_batch_key_equals(const void *_a, const void *_b); +struct fd_batch_key * fd_batch_key_clone(void *mem_ctx, const struct fd_batch_key *key); /* not called directly: */ void __fd_batch_describe(char* buf, const struct fd_batch *batch) assert_dt; diff --git a/src/gallium/drivers/freedreno/freedreno_batch_cache.c b/src/gallium/drivers/freedreno/freedreno_batch_cache.c index 621862117f9..5c4b7d926e1 100644 --- a/src/gallium/drivers/freedreno/freedreno_batch_cache.c +++ b/src/gallium/drivers/freedreno/freedreno_batch_cache.c @@ -118,6 +118,15 @@ fd_batch_key_equals(const void *_a, const void *_b) (memcmp(a->surf, b->surf, sizeof(a->surf[0]) * a->num_surfs) == 0); } +struct fd_batch_key * +fd_batch_key_clone(void *mem_ctx, const struct fd_batch_key *key) +{ + unsigned sz = sizeof(struct fd_batch_key) + (sizeof(key->surf[0]) * key->num_surfs); + struct fd_batch_key *new_key = rzalloc_size(mem_ctx, sz); + memcpy(new_key, key, sz); + return new_key; +} + void fd_bc_init(struct fd_batch_cache *cache) {