diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c index 5f67759..43fd87c 100644 --- a/src/gallium/drivers/r600/evergreen_compute.c +++ b/src/gallium/drivers/r600/evergreen_compute.c @@ -397,7 +397,8 @@ static void compute_emit_cs(struct r600_context *ctx, const uint *block_layout, */ r600_emit_command_buffer(cs, &ctx->start_compute_cs_cmd); - ctx->flags |= R600_CONTEXT_WAIT_3D_IDLE | R600_CONTEXT_FLUSH_AND_INV; + ctx->flags |= R600_CONTEXT_CS_PARTIAL_FLUSH | R600_CONTEXT_FLUSH_AND_INV; + /*ctx->flags |= R600_CONTEXT_CS_PARTIAL_FLUSH | R600_CONTEXT_INVAL_WRITE_CACHES; */ r600_flush_emit(ctx); /* Emit colorbuffers. */ diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c index 944b666..047278a 100644 --- a/src/gallium/drivers/r600/r600_hw_context.c +++ b/src/gallium/drivers/r600/r600_hw_context.c @@ -200,7 +200,7 @@ void r600_flush_emit(struct r600_context *rctx) if (wait_until) { /* Use of WAIT_UNTIL is deprecated on Cayman+ */ - if (rctx->family >= CHIP_CAYMAN) { + if (rctx->chip_class >= EVERGREEN) { /* emit a PS partial flush on Cayman/TN */ rctx->flags |= R600_CONTEXT_PS_PARTIAL_FLUSH; } @@ -211,6 +211,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 >= EVERGREEN) && + (rctx->flags & R600_CONTEXT_CS_PARTIAL_FLUSH)) { + cs->buf[cs->cdw++] = PKT3(PKT3_EVENT_WRITE, 0, 0); + cs->buf[cs->cdw++] = EVENT_TYPE(EVENT_TYPE_CS_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); @@ -235,6 +241,25 @@ void r600_flush_emit(struct r600_context *rctx) emit_flush = 1; } + if (rctx->flags & R600_CONTEXT_INVAL_WRITE_CACHES) { + cp_coher_cntl |= S_0085F0_CB_ACTION_ENA(1) | + S_0085F0_DB_ACTION_ENA(1) | + S_0085F0_CB0_DEST_BASE_ENA(1) | + S_0085F0_CB1_DEST_BASE_ENA(1) | + S_0085F0_CB2_DEST_BASE_ENA(1) | + S_0085F0_CB3_DEST_BASE_ENA(1) | + S_0085F0_CB4_DEST_BASE_ENA(1) | + S_0085F0_CB5_DEST_BASE_ENA(1) | + S_0085F0_CB6_DEST_BASE_ENA(1) | + S_0085F0_CB7_DEST_BASE_ENA(1); + if (rctx->chip_class >= EVERGREEN) + cp_coher_cntl |= S_0085F0_CB8_DEST_BASE_ENA(1) | + S_0085F0_CB9_DEST_BASE_ENA(1) | + S_0085F0_CB10_DEST_BASE_ENA(1) | + S_0085F0_CB11_DEST_BASE_ENA(1); + emit_flush = 1; + } + if (rctx->flags & R600_CONTEXT_STREAMOUT_FLUSH) { cp_coher_cntl |= S_0085F0_SO0_DEST_BASE_ENA(1) | S_0085F0_SO1_DEST_BASE_ENA(1) | @@ -254,7 +279,7 @@ void r600_flush_emit(struct r600_context *rctx) if (wait_until) { /* Use of WAIT_UNTIL is deprecated on Cayman+ */ - if (rctx->family < CHIP_CAYMAN) { + if (rctx->chip_class >= EVERGREEN) { /* wait for things to settle */ r600_write_config_reg(cs, R_008040_WAIT_UNTIL, wait_until); } diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index bb4e429..576e8f1 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -72,6 +72,8 @@ #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) +#define R600_CONTEXT_CS_PARTIAL_FLUSH (1 << 8) +#define R600_CONTEXT_INVAL_WRITE_CACHES (1 << 9) #define R600_QUERY_DRAW_CALLS (PIPE_QUERY_DRIVER_SPECIFIC + 0) #define R600_QUERY_REQUESTED_VRAM (PIPE_QUERY_DRIVER_SPECIFIC + 1) diff --git a/src/gallium/drivers/r600/r600d.h b/src/gallium/drivers/r600/r600d.h index 89b09dd..e73a8da 100644 --- a/src/gallium/drivers/r600/r600d.h +++ b/src/gallium/drivers/r600/r600d.h @@ -113,6 +113,7 @@ #define SURFACE_BASE_UPDATE_COLOR_NUM(x) (((1 << x) - 1) << 1) #define SURFACE_BASE_UPDATE_STRMOUT(x) (0x200 << (x)) +#define EVENT_TYPE_CS_PARTIAL_FLUSH 0x07 /* evergreen+ only */ #define EVENT_TYPE_PS_PARTIAL_FLUSH 0x10 #define EVENT_TYPE_CACHE_FLUSH_AND_INV_TS_EVENT 0x14 #define EVENT_TYPE_ZPASS_DONE 0x15