summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-11-23 00:38:44 +0100
committerMarek Olšák <[email protected]>2012-11-23 00:42:02 +0100
commitcff4c948ed2708a6eb4b090ae87443a707cbd67f (patch)
treefe570435be32198c41f8f72e14eeeb2081259098 /src/gallium/drivers
parentd172fa825b21ce3ff4f5cd83d0de7ef7f3a8d865 (diff)
r600g: fix broken streamout if streamout_begin caused a context flush
This fixes graphics corruption in the case where the DISCARD_RANGE flag is used to map a buffer. NOTE: This is a candidate for the stable branches.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/r600/r600_hw_context.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c
index 97c7d6d52c9..c8253018446 100644
--- a/src/gallium/drivers/r600/r600_hw_context.c
+++ b/src/gallium/drivers/r600/r600_hw_context.c
@@ -936,13 +936,14 @@ void r600_context_streamout_begin(struct r600_context *ctx)
unsigned *stride_in_dw = ctx->vs_shader->so.stride;
unsigned buffer_en, i, update_flags = 0;
uint64_t va;
+ unsigned num_cs_dw_streamout_end;
buffer_en = (ctx->num_so_targets >= 1 && t[0] ? 1 : 0) |
(ctx->num_so_targets >= 2 && t[1] ? 2 : 0) |
(ctx->num_so_targets >= 3 && t[2] ? 4 : 0) |
(ctx->num_so_targets >= 4 && t[3] ? 8 : 0);
- ctx->num_cs_dw_streamout_end =
+ num_cs_dw_streamout_end =
12 + /* flush_vgt_streamout */
util_bitcount(buffer_en) * 8 + /* STRMOUT_BUFFER_UPDATE */
3 /* set_streamout_enable(0) */;
@@ -956,7 +957,10 @@ void r600_context_streamout_begin(struct r600_context *ctx)
util_bitcount(buffer_en & ctx->streamout_append_bitmask) * 8 + /* STRMOUT_BUFFER_UPDATE */
util_bitcount(buffer_en & ~ctx->streamout_append_bitmask) * 6 + /* STRMOUT_BUFFER_UPDATE */
(ctx->family > CHIP_R600 && ctx->family < CHIP_RS780 ? 2 : 0) + /* SURFACE_BASE_UPDATE */
- ctx->num_cs_dw_streamout_end, TRUE);
+ num_cs_dw_streamout_end, TRUE);
+
+ /* This must be set after r600_need_cs_space. */
+ ctx->num_cs_dw_streamout_end = num_cs_dw_streamout_end;
if (ctx->chip_class >= EVERGREEN) {
evergreen_flush_vgt_streamout(ctx);