[Mesa-dev] [PATCH 1/3] i965/gen6: Set need_workaround_flush after each primitive

Paul Berry stereotype441 at gmail.com
Tue Jan 7 05:48:45 PST 2014


On 6 January 2014 17:05, Chad Versace <chad.versace at linux.intel.com> wrote:

> Set brw->need_workaround_flush immediately after each 3D_CMD_PRIM. This
> may prevent undiscovered difficult-to-diagnose gpu hangs, according to
> Ken.
>
> The art of emitting workaround flushes on Sandybridge is mysterious and
> not fully understood. Ken's intuition says that
> intel_emit_post_sync_nonzero_flush() is required after each 3D_CMD_PRIM.
>
> On gen6, there are two places where we emit 3D_CMD_PRIM: brw_emit_prim()
> and gen6_blorp_emit_primitive(). The former already sets
> need_workaround_flush, so this patch needs only to change the latter.
>
> There is no need to set need_workaround_flush in
> gen7_blorp_emit_primitive() because the workaround applies only to gen6.
>
> CC: mesa-stable at lists.freedesktop.org
> CC: Kenneth Graunke <kenneth at whitecape.org>
> CC: Paul Berry <stereotype441 at gmail.com>
> CC: Stéphane Marchesin <marcheu at chromium.org>
> Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
> ---
>  src/mesa/drivers/dri/i965/gen6_blorp.cpp | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/gen6_blorp.cpp
> b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
> index 441d61f..929d7b5 100644
> --- a/src/mesa/drivers/dri/i965/gen6_blorp.cpp
> +++ b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
> @@ -1010,6 +1010,9 @@ gen6_blorp_emit_primitive(struct brw_context *brw,
>     OUT_BATCH(0);
>     OUT_BATCH(0);
>     ADVANCE_BATCH();
> +
> +   /* Only used on Sandybridge; harmless to set elsewhere. */
> +   brw->batch.need_workaround_flush = true;
>

This is not strictly necessary, since we already set
brw->batch.need_workaround_flush in brw_blorp_exec() after running the
blorp operation.  However, doing it here in gen6_blorp_emit_primitive()
seems slightly better, since it makes the blorp codepath more similar to
the non-blorp codepath.

My personal preference would be to go ahead with this patch, but squash in
a removal of the code in brw_blorp_exec() that sets need_workaround_flush.
But I don't have a strong preference.  Either way the patch is:

Reviewed-by: Paul Berry <stereotype441 at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140107/71ca53c9/attachment.html>


More information about the mesa-dev mailing list