mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-23 09:30:36 +02:00
asahi: Allocate/free batch BOs as needed
Rather than hanging onto them across batches. This lets us free these BOs if the number of batches shrinks, which is pretty common if all 32 batches are used during a loading screen for glGenerateMipmap() and then the in-game portion drops to 1 or 2 batches only. Now that we have the BO cache wired up, this should not adversely affect performance. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19971>
This commit is contained in:
parent
04360a270e
commit
2baaff9cac
1 changed files with 8 additions and 15 deletions
|
|
@ -45,22 +45,12 @@ agx_batch_init(struct agx_context *ctx,
|
|||
memset(batch->bo_list.set, 0, batch->bo_list.word_count * sizeof(BITSET_WORD));
|
||||
}
|
||||
|
||||
if (!batch->encoder) {
|
||||
batch->encoder = agx_bo_create(dev, 0x80000, AGX_MEMORY_TYPE_FRAMEBUFFER, "Encoder");
|
||||
batch->encoder_current = batch->encoder->ptr.cpu;
|
||||
batch->encoder_end = batch->encoder_current + batch->encoder->size;
|
||||
} else {
|
||||
batch->encoder_current = batch->encoder->ptr.cpu;
|
||||
batch->encoder_end = batch->encoder_current + batch->encoder->size;
|
||||
}
|
||||
batch->encoder = agx_bo_create(dev, 0x80000, AGX_MEMORY_TYPE_FRAMEBUFFER, "Encoder");
|
||||
batch->encoder_current = batch->encoder->ptr.cpu;
|
||||
batch->encoder_end = batch->encoder_current + batch->encoder->size;
|
||||
|
||||
if (!batch->scissor.bo) {
|
||||
batch->scissor.bo = agx_bo_create(dev, 0x80000, AGX_MEMORY_TYPE_FRAMEBUFFER, "Scissors");
|
||||
}
|
||||
|
||||
if (!batch->depth_bias.bo) {
|
||||
batch->depth_bias.bo = agx_bo_create(dev, 0x80000, AGX_MEMORY_TYPE_FRAMEBUFFER, "Depth bias");
|
||||
}
|
||||
batch->scissor.bo = agx_bo_create(dev, 0x80000, AGX_MEMORY_TYPE_FRAMEBUFFER, "Scissors");
|
||||
batch->depth_bias.bo = agx_bo_create(dev, 0x80000, AGX_MEMORY_TYPE_FRAMEBUFFER, "Depth bias");
|
||||
|
||||
batch->clear = 0;
|
||||
batch->draw = 0;
|
||||
|
|
@ -108,6 +98,9 @@ agx_batch_cleanup(struct agx_context *ctx, struct agx_batch *batch)
|
|||
agx_bo_unreference(agx_lookup_bo(dev, handle));
|
||||
}
|
||||
|
||||
agx_bo_unreference(batch->scissor.bo);
|
||||
agx_bo_unreference(batch->depth_bias.bo);
|
||||
agx_bo_unreference(batch->encoder);
|
||||
agx_pool_cleanup(&batch->pool);
|
||||
agx_pool_cleanup(&batch->pipeline_pool);
|
||||
util_unreference_framebuffer_state(&batch->key);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue