diff options
author | Marek Olšák <[email protected]> | 2012-09-25 03:11:22 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-09-27 19:14:44 +0200 |
commit | 933faae2b8669f459e7ab27d6bcbfb6f4136b6d5 (patch) | |
tree | 60fa5ecedd9856f708eb8f700470bacbede7b4f9 /src | |
parent | 9f5d6320f2ee1e8147866030212f9924c6b3bf60 (diff) |
r600g: flush FMASK and CMASK when changing colorbuffers on Evergreen
This fixes rare graphical corruption.
NOTE: This is a candidate for the stable branches.
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/r600/evergreen_state.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_hw_context.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_hw_context_priv.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_state.c | 5 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600d.h | 1 |
6 files changed, 18 insertions, 1 deletions
diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 98dbb2f5e69..7bedfec0503 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1458,6 +1458,10 @@ static void evergreen_set_framebuffer_state(struct pipe_context *ctx, if (rctx->framebuffer.state.nr_cbufs) { rctx->flags |= R600_CONTEXT_CB_FLUSH; + + if (rctx->framebuffer.state.cbufs[0]->texture->nr_samples > 1) { + rctx->flags |= R600_CONTEXT_FLUSH_AND_INV_CB_META; + } } if (rctx->framebuffer.state.zsbuf) { rctx->flags |= R600_CONTEXT_DB_FLUSH; diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index 83d21a42a92..7d434169d9e 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -190,6 +190,7 @@ struct r600_so_target { #define R600_CONTEXT_WAIT_IDLE (1 << 7) #define R600_CONTEXT_FLUSH_AND_INV (1 << 8) #define R600_CONTEXT_HTILE_ERRATA (1 << 9) +#define R600_CONTEXT_FLUSH_AND_INV_CB_META (1 << 10) struct r600_context; struct r600_screen; diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c index 38dd7b643ae..5b93d05573d 100644 --- a/src/gallium/drivers/r600/r600_hw_context.c +++ b/src/gallium/drivers/r600/r600_hw_context.c @@ -684,6 +684,12 @@ void r600_flush_emit(struct r600_context *rctx) cs->buf[cs->cdw++] = EVENT_TYPE(EVENT_TYPE_PS_PARTIAL_FLUSH) | EVENT_INDEX(4); } + if (rctx->chip_class >= R700 && + (rctx->flags & R600_CONTEXT_FLUSH_AND_INV_CB_META)) { + cs->buf[cs->cdw++] = PKT3(PKT3_EVENT_WRITE, 0, 0); + cs->buf[cs->cdw++] = EVENT_TYPE(EVENT_TYPE_FLUSH_AND_INV_CB_META) | EVENT_INDEX(0); + } + if (rctx->flags & R600_CONTEXT_FLUSH_AND_INV) { cs->buf[cs->cdw++] = PKT3(PKT3_EVENT_WRITE, 0, 0); cs->buf[cs->cdw++] = EVENT_TYPE(EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT) | EVENT_INDEX(0); diff --git a/src/gallium/drivers/r600/r600_hw_context_priv.h b/src/gallium/drivers/r600/r600_hw_context_priv.h index 83474b016f4..85fd74dce92 100644 --- a/src/gallium/drivers/r600/r600_hw_context_priv.h +++ b/src/gallium/drivers/r600/r600_hw_context_priv.h @@ -29,7 +29,7 @@ #include "r600_pipe.h" /* the number of CS dwords for flushing and drawing */ -#define R600_MAX_FLUSH_CS_DWORDS 44 +#define R600_MAX_FLUSH_CS_DWORDS 46 #define R600_MAX_DRAW_CS_DWORDS 34 /* these flags are used in register flags and added into block flags */ diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 1b7869c3e65..60c861fc8e0 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -1456,6 +1456,11 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx, if (rctx->framebuffer.state.nr_cbufs) { rctx->flags |= R600_CONTEXT_CB_FLUSH; + + if (rctx->chip_class >= R700 && + rctx->framebuffer.state.cbufs[0]->texture->nr_samples > 1) { + rctx->flags |= R600_CONTEXT_FLUSH_AND_INV_CB_META; + } } if (rctx->framebuffer.state.zsbuf) { rctx->flags |= R600_CONTEXT_DB_FLUSH; diff --git a/src/gallium/drivers/r600/r600d.h b/src/gallium/drivers/r600/r600d.h index cf0059a4b36..4b46bd7613a 100644 --- a/src/gallium/drivers/r600/r600d.h +++ b/src/gallium/drivers/r600/r600d.h @@ -119,6 +119,7 @@ #define EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT 0x16 #define EVENT_TYPE_SO_VGTSTREAMOUT_FLUSH 0x1f #define EVENT_TYPE_SAMPLE_STREAMOUTSTATS 0x20 +#define EVENT_TYPE_FLUSH_AND_INV_CB_META 46 /* supported on r700+ */ #define EVENT_TYPE(x) ((x) << 0) #define EVENT_INDEX(x) ((x) << 8) /* 0 - any non-TS event |