<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Depth-stencil clears trigger occlusion query object stalls"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=100622">100622</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Depth-stencil clears trigger occlusion query object stalls
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Mesa
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>17.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>x86-64 (AMD64)
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Drivers/DRI/i965
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>intel-3d-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>rsalminen@iki.fi
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>intel-3d-bugs@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=130759" name="attach_130759" title="Test case which clears a depth-stencil attachment">attachment 130759</a> <a href="attachment.cgi?id=130759&action=edit" title="Test case which clears a depth-stencil attachment">[details]</a></span>
Test case which clears a depth-stencil attachment

Attached: test application to reproduce bug (see
<a href="https://github.com/rikusalminen/querystall">https://github.com/rikusalminen/querystall</a> for build scripts, etc. needs c99
compiler and CFLAGS).

Clearing a depth-stencil buffer when occlusion query (GL_SAMPLES_PASSED) is
enabled causes the following GL debug message (via glDebugMessageCallback):
GL_DEBUG_SOURCE_API GL_DEBUG_TYPE_PERFORMANCE GL_DEBUG_SEVERITY_MEDIUM  id: 0xb
CPU mapping a busy query object BO stalled and took 2.003 ms.

Clearing GL_DEPTH_COMPONENT24 target (instead of GL_DEPTH24_STENCIL8) does not
cause this behavior.

GL_TIME_ELAPSED or GL_PRIMITIVES_GENERATED queries do not give this error.

Here are some helpful notes from #intel-gfx IRC log:

21:12 < Kayden> ugh.  the query code is fine.
21:13 < Kayden> you're hitting lunacy in meta
21:13 < Kayden>
<a href="https://cgit.freedesktop.org/mesa/mesa/commit/?h=bb77745681e179b53ea64da7bc1987b57643b7b0">https://cgit.freedesktop.org/mesa/mesa/commit/?h=bb77745681e179b53ea64da7bc1987b57643b7b0</a>
21:14 < Kayden> the clear isn't hitting our best-case scenario, and is falling
back to a meta use-GL-to-implement-GL path, that wants to disable occlusion
queries so our internal usage doesn't contribute fragments
21:14 < Kayden> and the way it does that stalls
21:14 < Kayden> we've been killing off this awful code for a while now, but
some bits are still left
21:21 < Kayden> wow, that's in a sorrier state than I thought :/
21:21 < Kayden> jekstrand: it looks like we always fall through to meta for
stencil clears
21:21 < Kayden> blorp only does color...
21:21 < Kayden> fast depth only does depth...
21:22 < Kayden> I don't know why we wouldn't be using blorp for stencil
21:23 < Kayden> erm
21:23 < Kayden> jekstrand: it looks like the GL driver is never using  
                blorp_clear_depth_stencil</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>