<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Ok, thanks for the pointers. Will take a look tomorrow (is 21:00
    here).<br>
    <br>
    Btw, what do you prefer? To fix it first on the texture barrier with
    a patch like this, and then import Vulkan's? or forget about fixing
    with the current status and go directly to import Vulkan's approach?<br>
    <br>
    BR<br>
    <br>
    <div class="moz-cite-prefix">On 30/06/16 16:04, Jason Ekstrand
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAOFGe95w8EVwgDqvK3Npfrf2a2jb+3o_FLsPZb81Dfg=zJxzHQ@mail.gmail.com"
      type="cite">
      <p dir="ltr">Fwiw, I very much like the way I did this in the
        Vulkan driver where it splits it into two pipe controls
        automatically based on the input bits.  (Look at
        genX_cmd_buffer.c cmd_buffer_apply_pipe_flushes.)  I very much
        doubt that this is the only place we have this problem in the GL
        driver.  We should probably fix it in brw_emit_pipe_control.</p>
      <div class="gmail_quote">On Jun 30, 2016 12:00 AM, "Alejandro
        Piñeiro" <<a moz-do-not-send="true"
          href="mailto:apinheiro@igalia.com">apinheiro@igalia.com</a>>
        wrote:<br type="attribution">
        <blockquote class="quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div class="quoted-text">Fixes:<br>
            GL44-CTS.texture_barrier_ARB.same-texel-rw-multipass<br>
            <br>
            On Haswell, Broadwell and Skylake (note that in order to
            execute that<br>
            test, it is needed to override GL and GLSL versions).<br>
            <br>
            On gen6 this test was already working without this change.
            It keeps<br>
            working after it.<br>
            <br>
            This commit replaces the call to brw_emit_mi_flush for gen6+
            with two<br>
            calls to brw_emit_pipe_control_flush:<br>
            <br>
             * The first one with RENDER_TARGET_FLUSH and CS_STALL set
            to initiate<br>
               a render cache flush after any concurrent rendering
            completes and<br>
               cause the CS to stop parsing commands until the render
            cache<br>
               becomes coherent with memory.<br>
            <br>
             * The second one have TEXTURE_CACHE_INVALIDATE set (and no
            CS stall)<br>
               to clean up any stale data from the sampler caches before
            rendering<br>
               continues.<br>
            <br>
            Didn't touch gen4-5, basically because I don't have a way to
            test<br>
            them.<br>
            <br>
            More info on commits:<br>
            0aa4f99f562a05880a779707cbcd46be459863bf<br>
            72473658c51d5e074ce219c1e6385a4cce29f467<br>
            <br>
            Thanks to Curro to help to tracking this down, as the root
            case was a<br>
            hw race condition.<br>
            <br>
          </div>
          v2: use two calls to pipe_control_flush instead of a
          combination of<br>
              gen7_emit_cs_stall_flush and brw_emit_mi_flush calls
          (Curro)<br>
          v3: no need to const cache invalidation (Curro)<br>
          ---<br>
          <br>
          FWIW: checked with the CTS tests, and the piglit series, and
          confirmed<br>
          that the const cache invalidation is not needed.<br>
          <br>
           src/mesa/drivers/dri/i965/intel_tex.c | 21
          ++++++++++++++++++++-<br>
           1 file changed, 20 insertions(+), 1 deletion(-)<br>
          <br>
          diff --git a/src/mesa/drivers/dri/i965/intel_tex.c
          b/src/mesa/drivers/dri/i965/intel_tex.c<br>
          index cac33ac..a802d5a 100644<br>
          <div class="quoted-text">---
            a/src/mesa/drivers/dri/i965/intel_tex.c<br>
            +++ b/src/mesa/drivers/dri/i965/intel_tex.c<br>
            @@ -9,6 +9,7 @@<br>
             #include "intel_mipmap_tree.h"<br>
             #include "intel_tex.h"<br>
             #include "intel_fbo.h"<br>
            +#include "intel_reg.h"<br>
            <br>
             #define FILE_DEBUG_FLAG DEBUG_TEXTURE<br>
            <br>
          </div>
          @@ -362,7 +363,25 @@ intel_texture_barrier(struct gl_context
          *ctx)<br>
          <div class="quoted-text"> {<br>
                struct brw_context *brw = brw_context(ctx);<br>
            <br>
            -   brw_emit_mi_flush(brw);<br>
            +   if (brw->gen >= 6) {<br>
            +      if (brw->gen == 6) {<br>
            +         /* [Dev-SNB{W/A}]: Before a PIPE_CONTROL with
            Write Cache<br>
            +          * Flush Enable = 1, a PIPE_CONTROL with any
            non-zero<br>
            +          * post-sync-op is required.<br>
            +          */<br>
            +         brw_emit_post_sync_nonzero_flush(brw);<br>
            +      }<br>
            +<br>
            +      brw_emit_pipe_control_flush(brw,<br>
            +                                 
            PIPE_CONTROL_DEPTH_CACHE_FLUSH |<br>
            +                                 
            PIPE_CONTROL_RENDER_TARGET_FLUSH |<br>
            +                                  PIPE_CONTROL_CS_STALL);<br>
            +<br>
            +      brw_emit_pipe_control_flush(brw,<br>
          </div>
          +                                 
          PIPE_CONTROL_TEXTURE_CACHE_INVALIDATE);<br>
          <div class="quoted-text">+   } else {<br>
            +      brw_emit_mi_flush(brw);<br>
            +   }<br>
             }<br>
            <br>
             void<br>
            --<br>
            2.7.4<br>
            <br>
          </div>
          <div class="elided-text">_______________________________________________<br>
            mesa-dev mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
            <a moz-do-not-send="true"
              href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev"
              rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
          </div>
        </blockquote>
      </div>
    </blockquote>
    <br>
  </body>
</html>