mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 15:58:05 +02:00
asahi: Keep drawoverhead from OOMing itself
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
This commit is contained in:
parent
c363fcbe1e
commit
7f636a08c8
3 changed files with 7 additions and 0 deletions
|
|
@ -118,6 +118,7 @@ agx_batch_init(struct agx_context *ctx,
|
|||
batch->varyings = 0;
|
||||
batch->any_draws = false;
|
||||
batch->initialized = false;
|
||||
batch->draws = 0;
|
||||
|
||||
/* We need to emit prim state at the start. Max collides with all. */
|
||||
batch->reduced_prim = MESA_PRIM_COUNT;
|
||||
|
|
|
|||
|
|
@ -3182,12 +3182,17 @@ agx_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info,
|
|||
|
||||
assert(batch == agx_get_batch(ctx) && "batch should not change under us");
|
||||
|
||||
batch->draws++;
|
||||
|
||||
/* The scissor/zbias arrays are indexed with 16-bit integers, imposigin a
|
||||
* maximum of UINT16_MAX descriptors. Flush if the next draw would overflow
|
||||
*/
|
||||
if (unlikely((batch->scissor.size / AGX_SCISSOR_LENGTH) >= UINT16_MAX) ||
|
||||
(batch->depth_bias.size / AGX_DEPTH_BIAS_LENGTH) >= UINT16_MAX) {
|
||||
agx_flush_batch_for_reason(ctx, batch, "Scissor/depth bias overflow");
|
||||
} else if (unlikely(batch->draws > 100000)) {
|
||||
/* Mostly so drawoverhead doesn't OOM */
|
||||
agx_flush_batch_for_reason(ctx, batch, "Absurd number of draws");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -225,6 +225,7 @@ struct agx_batch {
|
|||
struct pipe_framebuffer_state key;
|
||||
uint64_t seqnum;
|
||||
uint32_t syncobj;
|
||||
uint32_t draws;
|
||||
|
||||
struct agx_tilebuffer_layout tilebuffer_layout;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue