[Mesa-dev] [PATCH 3/8] r600: do SQ flush ES ring rolling workaround

Marek Olšák maraeo at gmail.com
Tue Nov 10 13:17:17 PST 2015


On Tue, Nov 10, 2015 at 5:10 AM, Dave Airlie <airlied at gmail.com> wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> Need to insert a SQ_NON_EVENT when ever geometry
> shaders are enabled.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  src/gallium/drivers/r600/r600_hw_context.c   | 5 +++++
>  src/gallium/drivers/r600/r600_pipe.h         | 1 +
>  src/gallium/drivers/r600/r600_state_common.c | 7 +++++++
>  src/gallium/drivers/r600/r600d.h             | 1 +
>  4 files changed, 14 insertions(+)
>
> diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c
> index 6f11366..2a181dc 100644
> --- a/src/gallium/drivers/r600/r600_hw_context.c
> +++ b/src/gallium/drivers/r600/r600_hw_context.c
> @@ -122,6 +122,11 @@ void r600_flush_emit(struct r600_context *rctx)
>                 }
>         }
>
> +       if (rctx->b.flags & R600_CONTEXT_GS_EXTRA_FLUSH) {
> +               cs->buf[cs->cdw++] = PKT3(PKT3_EVENT_WRITE, 0, 0);
> +               cs->buf[cs->cdw++] = EVENT_TYPE(EVENT_TYPE_SQ_NON_EVENT);
> +       }
> +
>         if (rctx->b.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);
> diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
> index 520b03f..5a4ad9e 100644
> --- a/src/gallium/drivers/r600/r600_pipe.h
> +++ b/src/gallium/drivers/r600/r600_pipe.h
> @@ -56,6 +56,7 @@
>  #define R600_CONTEXT_PS_PARTIAL_FLUSH          (R600_CONTEXT_PRIVATE_FLAG << 8)
>  #define R600_CONTEXT_WAIT_3D_IDLE              (R600_CONTEXT_PRIVATE_FLAG << 9)
>  #define R600_CONTEXT_WAIT_CP_DMA_IDLE          (R600_CONTEXT_PRIVATE_FLAG << 10)
> +#define R600_CONTEXT_GS_EXTRA_FLUSH            (R600_CONTEXT_PRIVATE_FLAG << 11)
>
>  /* the number of CS dwords for flushing and drawing */
>  #define R600_MAX_FLUSH_CS_DWORDS       16
> diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
> index 178005a..7d0c98f 100644
> --- a/src/gallium/drivers/r600/r600_state_common.c
> +++ b/src/gallium/drivers/r600/r600_state_common.c
> @@ -1584,6 +1584,13 @@ static void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info
>                 r600_mark_atom_dirty(rctx, &rctx->cb_misc_state.atom);
>         }
>
> +       /* ES ring rolling over at EOP */
> +       if (rctx->b.chip_class == R600) {
> +               /* GS scenario G - emit event initiator SQ_NON_EVENT */
> +               if (rctx->gs_shader)
> +                       rctx->b.flags |= R600_CONTEXT_GS_EXTRA_FLUSH;
> +       }

This should be done after the draw packet, not before. I suggest doing
this right after the draw packets in draw_vbo, not in r600_flush_emit,
and MAX_DRAW_CS_DWORDS should be updated after that.

Marek


More information about the mesa-dev mailing list