diff options
author | Marek Olšák <[email protected]> | 2013-02-26 22:31:03 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2013-03-01 13:46:32 +0100 |
commit | e5a250fdf9487bae8d88fd7362ddb86e35978f1e (patch) | |
tree | 9d2b9f02724f967ed661e35eb4d37a50fbffb35b /src/gallium/drivers/r600 | |
parent | 6f25de6711491bbcfc906cd8804f30acc6534b2d (diff) |
r600g: flush and invalidate htile cache when appropriate
Tested-by: Andreas Boll <[email protected]>
NOTE: This is a candidate for the 9.1 branch.
Diffstat (limited to 'src/gallium/drivers/r600')
-rw-r--r-- | src/gallium/drivers/r600/evergreen_state.c | 5 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_hw_context.c | 8 | ||||
-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, 21 insertions, 1 deletions
diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index b601f1430ce..0a3372a7622 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1710,6 +1710,11 @@ static void evergreen_set_framebuffer_state(struct pipe_context *ctx, } if (rctx->framebuffer.state.zsbuf) { rctx->flags |= R600_CONTEXT_WAIT_3D_IDLE | R600_CONTEXT_FLUSH_AND_INV; + + rtex = (struct r600_texture*)rctx->framebuffer.state.zsbuf->texture; + if (rtex->htile) { + rctx->flags |= R600_CONTEXT_FLUSH_AND_INV_DB_META; + } } util_copy_framebuffer_state(&rctx->framebuffer.state, state); diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index dfd18b81a92..d018ebb0298 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -152,6 +152,7 @@ struct r600_so_target { #define R600_CONTEXT_FLUSH_AND_INV (1 << 4) #define R600_CONTEXT_FLUSH_AND_INV_CB_META (1 << 5) #define R600_CONTEXT_PS_PARTIAL_FLUSH (1 << 6) +#define R600_CONTEXT_FLUSH_AND_INV_DB_META (1 << 7) 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 78b5b293060..da0b02fb023 100644 --- a/src/gallium/drivers/r600/r600_hw_context.c +++ b/src/gallium/drivers/r600/r600_hw_context.c @@ -652,6 +652,12 @@ void r600_flush_emit(struct r600_context *rctx) cs->buf[cs->cdw++] = EVENT_TYPE(EVENT_TYPE_FLUSH_AND_INV_CB_META) | EVENT_INDEX(0); } + if (rctx->chip_class >= R700 && + (rctx->flags & R600_CONTEXT_FLUSH_AND_INV_DB_META)) { + cs->buf[cs->cdw++] = PKT3(PKT3_EVENT_WRITE, 0, 0); + cs->buf[cs->cdw++] = EVENT_TYPE(EVENT_TYPE_FLUSH_AND_INV_DB_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); @@ -747,6 +753,7 @@ void r600_context_flush(struct r600_context *ctx, unsigned flags) */ ctx->flags |= R600_CONTEXT_FLUSH_AND_INV | R600_CONTEXT_FLUSH_AND_INV_CB_META | + R600_CONTEXT_FLUSH_AND_INV_DB_META | R600_CONTEXT_WAIT_3D_IDLE | R600_CONTEXT_WAIT_CP_DMA_IDLE; @@ -1099,6 +1106,7 @@ void r600_cp_dma_copy_buffer(struct r600_context *rctx, rctx->flags |= R600_CONTEXT_INVAL_READ_CACHES | R600_CONTEXT_FLUSH_AND_INV | R600_CONTEXT_FLUSH_AND_INV_CB_META | + R600_CONTEXT_FLUSH_AND_INV_DB_META | R600_CONTEXT_STREAMOUT_FLUSH | R600_CONTEXT_WAIT_3D_IDLE; diff --git a/src/gallium/drivers/r600/r600_hw_context_priv.h b/src/gallium/drivers/r600/r600_hw_context_priv.h index 692e6ec60fd..3b50f682486 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 12 +#define R600_MAX_FLUSH_CS_DWORDS 16 #define R600_MAX_DRAW_CS_DWORDS 34 #define R600_TRACE_CS_DWORDS 7 diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 6f49eed4376..c0384e82814 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -1556,6 +1556,11 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx, } if (rctx->framebuffer.state.zsbuf) { rctx->flags |= R600_CONTEXT_WAIT_3D_IDLE | R600_CONTEXT_FLUSH_AND_INV; + + rtex = (struct r600_texture*)rctx->framebuffer.state.zsbuf->texture; + if (rctx->chip_class >= R700 && rtex->htile) { + rctx->flags |= R600_CONTEXT_FLUSH_AND_INV_DB_META; + } } /* Set the new state. */ diff --git a/src/gallium/drivers/r600/r600d.h b/src/gallium/drivers/r600/r600d.h index 621e7a10e78..81e5a6c6e1d 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_DB_META 0x2c /* supported on r700+ */ #define EVENT_TYPE_FLUSH_AND_INV_CB_META 46 /* supported on r700+ */ #define EVENT_TYPE(x) ((x) << 0) #define EVENT_INDEX(x) ((x) << 8) |