diff --git a/src/gallium/drivers/zink/zink_descriptors.c b/src/gallium/drivers/zink/zink_descriptors.c index 731582497f2..2a3bfd2d3a1 100644 --- a/src/gallium/drivers/zink/zink_descriptors.c +++ b/src/gallium/drivers/zink/zink_descriptors.c @@ -1060,8 +1060,11 @@ enlarge_db(struct zink_context *ctx) struct zink_batch_state *bs = ctx->batch.state; /* ensure current db surives */ zink_batch_reference_resource(&ctx->batch, bs->dd.db); - /* rebinding a db mid-batch is extremely costly: scaling by 10x should ensure it never happens more than twice */ - ctx->dd.db.max_db_size *= 10; + /* rebinding a db mid-batch is extremely costly: if we start with a factor + * 16 and then half the factor with each new allocation. It shouldn't need to + * do this more than twice. */ + ctx->dd.db.max_db_size *= ctx->dd.db.size_enlarge_scale; + ctx->dd.db.size_enlarge_scale = MAX2(ctx->dd.db.size_enlarge_scale >> 1, 4); reinit_db(screen, bs); } @@ -1644,6 +1647,7 @@ zink_descriptors_init(struct zink_context *ctx) } /* start small */ ctx->dd.db.max_db_size = 250; + ctx->dd.db.size_enlarge_scale = 16; } return true; diff --git a/src/gallium/drivers/zink/zink_types.h b/src/gallium/drivers/zink/zink_types.h index 6d5169caf83..c05b3187aaa 100644 --- a/src/gallium/drivers/zink/zink_types.h +++ b/src/gallium/drivers/zink/zink_types.h @@ -449,6 +449,7 @@ struct zink_descriptor_data { struct pipe_transfer *bindless_db_xfer; uint32_t bindless_db_offsets[4]; unsigned max_db_size; + unsigned size_enlarge_scale; } db; };