diff options
author | Marek Olšák <[email protected]> | 2015-07-16 19:55:42 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2015-08-02 22:03:33 +0200 |
commit | 08fd736a45c98bd0acd96dfc1a61e6a695d2703c (patch) | |
tree | 1de58c3a2b11cb03b85eb1b4eed3b8c656b14b81 /src/gallium/drivers/radeonsi/si_hw_context.c | |
parent | 4d7e0fa8c731776ad5d630f37b36c535f1907371 (diff) |
radeonsi: flush if the memory usage for an IB is too high
Picked from the amdgpu branch.
Reviewed-by: Michel Dänzer <[email protected]>
Reviewed-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_hw_context.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_hw_context.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeonsi/si_hw_context.c b/src/gallium/drivers/radeonsi/si_hw_context.c index 1aef37b18b5..581b130caec 100644 --- a/src/gallium/drivers/radeonsi/si_hw_context.c +++ b/src/gallium/drivers/radeonsi/si_hw_context.c @@ -32,6 +32,19 @@ void si_need_cs_space(struct si_context *ctx, unsigned num_dw, { int i; + /* There are two memory usage counters in the winsys for all buffers + * that have been added (cs_add_reloc) and two counters in the pipe + * driver for those that haven't been added yet. + * */ + if (!ctx->b.ws->cs_memory_below_limit(ctx->b.rings.gfx.cs, ctx->b.vram, ctx->b.gtt)) { + ctx->b.gtt = 0; + ctx->b.vram = 0; + ctx->b.rings.gfx.flush(ctx, RADEON_FLUSH_ASYNC, NULL); + return; + } + ctx->b.gtt = 0; + ctx->b.vram = 0; + /* The number of dwords we already used in the CS so far. */ num_dw += ctx->b.rings.gfx.cs->cdw; |