r600g: flush FMASK and CMASK when changing colorbuffers on Evergreen
This fixes rare graphical corruption. NOTE: This is a candidate for the stable branches.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user