From 51d839edc8def0a079033c94d15df83257c213c1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 10 Sep 2012 20:38:03 +0200 Subject: [PATCH] r600g: fix computing how much space is needed for a draw command Reviewed-by: Jerome Glisse --- 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 7cf17d0b4d1..07226424da0 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 12a9750e8b7..71bfbd18d1c 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 -- 2.30.2