From c85a184fd3cb77f7391dcf29fd54c78c5d0d405d Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Fri, 22 Feb 2013 16:40:28 -0500 Subject: [PATCH] r600g: r6xx deadlock workaround (v5) Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=50655 https://bugs.freedesktop.org/show_bug.cgi?id=47116 v2: flush along with workaround. v3: just need a flush v4: try WAIT_UNTIL v5: switch to PS partial flush Note: this is a candidate for the 9.1 branch. Signed-off-by: Alex Deucher --- src/gallium/drivers/r600/r600.h | 1 + src/gallium/drivers/r600/r600_hw_context.c | 5 +++++ src/gallium/drivers/r600/r600_state_common.c | 6 ++++++ 3 files changed, 12 insertions(+), 0 deletions(-) diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index 08b77e4..11dbb3b 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -151,6 +151,7 @@ struct r600_so_target { #define R600_CONTEXT_WAIT_CP_DMA_IDLE (1 << 3) #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) 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 f6dc418..09dc98b 100644 --- a/src/gallium/drivers/r600/r600_hw_context.c +++ b/src/gallium/drivers/r600/r600_hw_context.c @@ -624,6 +624,11 @@ void r600_flush_emit(struct r600_context *rctx) return; } + if (rctx->flags & R600_CONTEXT_PS_PARTIAL_FLUSH) { + cs->buf[cs->cdw++] = PKT3(PKT3_EVENT_WRITE, 0, 0); + cs->buf[cs->cdw++] = EVENT_TYPE(EVENT_TYPE_PS_PARTIAL_FLUSH) | EVENT_INDEX(4); + } + if (rctx->flags & R600_CONTEXT_WAIT_3D_IDLE) { wait_until |= S_008040_WAIT_3D_IDLE(1); } diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index c4bd758..1654233 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -1360,6 +1360,12 @@ static void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info rctx->vgt_state.atom.dirty = true; } + /* Workaround for hardware deadlock on certain R600 ASICs: write into a CB register. */ + if (rctx->chip_class == R600) { + rctx->flags |= R600_CONTEXT_PS_PARTIAL_FLUSH; + rctx->cb_misc_state.atom.dirty = true; + } + /* Emit states. */ r600_need_cs_space(rctx, ib.user_buffer ? 5 : 0, TRUE); r600_flush_emit(rctx); -- 1.7.7.5