Mesa (master): r600g: fix computing how much space is needed for a draw command
Marek Olšák
mareko at kemper.freedesktop.org
Thu Sep 13 18:18:57 UTC 2012
Module: Mesa
Branch: master
Commit: 51d839edc8def0a079033c94d15df83257c213c1
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=51d839edc8def0a079033c94d15df83257c213c1
Author: Marek Olšák <maraeo at gmail.com>
Date: Mon Sep 10 20:38:03 2012 +0200
r600g: fix computing how much space is needed for a draw command
Reviewed-by: Jerome Glisse <jglisse at redhat.com>
---
src/gallium/drivers/r600/r600_hw_context.c | 15 ++++++++++-----
src/gallium/drivers/r600/r600_hw_context_priv.h | 3 ++-
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c
index 7cf17d0..0722642 100644
--- a/src/gallium/drivers/r600/r600_hw_context.c
+++ b/src/gallium/drivers/r600/r600_hw_context.c
@@ -599,8 +599,8 @@ void r600_need_cs_space(struct r600_context *ctx, unsigned num_dw,
num_dw += ctx->pm4_dirty_cdwords;
- /* The upper-bound of how much a draw command would take. */
- num_dw += R600_MAX_DRAW_CS_DWORDS;
+ /* The upper-bound of how much space a draw command would take. */
+ num_dw += R600_MAX_FLUSH_CS_DWORDS + R600_MAX_DRAW_CS_DWORDS;
}
/* Count in queries_suspend. */
@@ -615,11 +615,16 @@ void r600_need_cs_space(struct r600_context *ctx, unsigned num_dw,
num_dw += 3;
}
+ /* SX_MISC */
+ if (ctx->chip_class <= R700) {
+ num_dw += 3;
+ }
+
/* Count in framebuffer cache flushes at the end of CS. */
- num_dw += 44; /* one SURFACE_SYNC and CACHE_FLUSH_AND_INV (r6xx-only) */
+ num_dw += R600_MAX_FLUSH_CS_DWORDS;
- /* Save 16 dwords for the fence mechanism. */
- num_dw += 16;
+ /* The fence at the end of CS. */
+ num_dw += 10;
/* Flush if there's not enough space. */
if (num_dw > RADEON_MAX_CMDBUF_DWORDS) {
diff --git a/src/gallium/drivers/r600/r600_hw_context_priv.h b/src/gallium/drivers/r600/r600_hw_context_priv.h
index 12a9750..71bfbd1 100644
--- a/src/gallium/drivers/r600/r600_hw_context_priv.h
+++ b/src/gallium/drivers/r600/r600_hw_context_priv.h
@@ -29,7 +29,8 @@
#include "r600_pipe.h"
/* the number of CS dwords for flushing and drawing */
-#define R600_MAX_DRAW_CS_DWORDS 64
+#define R600_MAX_FLUSH_CS_DWORDS 44
+#define R600_MAX_DRAW_CS_DWORDS 13
/* these flags are used in register flags and added into block flags */
#define REG_FLAG_NEED_BO 1
More information about the mesa-commit
mailing list