aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2015-06-27 14:49:34 +0200
committerMarek Olšák <[email protected]>2015-08-06 22:54:03 +0200
commit0615ad1c70777b515d00aa5b0c41b1073ad5a2d1 (patch)
tree226753ddeabaeff61e79fff9b966546bf43beede
parent6d6208a431f6a01a22f892c71258fd3567d969b6 (diff)
radeonsi: don't count the exact needed CS space if the CS is large enough
Reviewed-by: Alex Deucher <[email protected]>
-rw-r--r--src/gallium/drivers/radeonsi/si_hw_context.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/gallium/drivers/radeonsi/si_hw_context.c b/src/gallium/drivers/radeonsi/si_hw_context.c
index 3203ceb61fd..153d3d89f8c 100644
--- a/src/gallium/drivers/radeonsi/si_hw_context.c
+++ b/src/gallium/drivers/radeonsi/si_hw_context.c
@@ -30,8 +30,17 @@
void si_need_cs_space(struct si_context *ctx, unsigned num_dw,
boolean count_draw_in)
{
+ struct radeon_winsys_cs *cs = ctx->b.rings.gfx.cs;
int i;
+ /* If the CS is sufficiently large, don't count the space needed
+ * and just flush if there is less than 8096 dwords left. */
+ if (cs->max_dw >= 24 * 1024) {
+ if (cs->cdw > cs->max_dw - 8 * 1024)
+ ctx->b.rings.gfx.flush(ctx, RADEON_FLUSH_ASYNC, NULL);
+ return;
+ }
+
/* 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.
@@ -46,7 +55,7 @@ void si_need_cs_space(struct si_context *ctx, unsigned num_dw,
ctx->b.vram = 0;
/* The number of dwords we already used in the CS so far. */
- num_dw += ctx->b.rings.gfx.cs->cdw;
+ num_dw += cs->cdw;
if (count_draw_in) {
for (i = 0; i < SI_NUM_ATOMS(ctx); i++) {
@@ -86,7 +95,7 @@ void si_need_cs_space(struct si_context *ctx, unsigned num_dw,
#endif
/* Flush if there's not enough space. */
- if (num_dw > ctx->b.rings.gfx.cs->max_dw) {
+ if (num_dw > cs->max_dw) {
ctx->b.rings.gfx.flush(ctx, RADEON_FLUSH_ASYNC, NULL);
}
}