<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 - i965 miptree MCS aux_buf allocation failure with old kernels"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=110602">110602</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>i965 miptree MCS aux_buf allocation failure with old kernels
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>git
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </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>anssi.hannula@bitwise.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=144147" name="attach_144147" title="glxinfo">attachment 144147</a> <a href="attachment.cgi?id=144147&action=edit" title="glxinfo">[details]</a></span>
glxinfo

intel_miptree_choose_aux_usage() selects ISL_AUX_USAGE_MCS if
intel_miptree_supports_mcs() returns true.

This will cause callchain intel_miptree_alloc_aux() => intel_alloc_aux_buffer()
=> brw_bo_map(x,y,MAP_RAW|MAP_WRITE) => brw_bo_map_wc(), which checks
bufmgr->has_mmap_wc and returns NULL on !bufmgr->has_mmap_wc. There is no
fallback in brw_bo_map() for the MAP_RAW case.

This will cause intel_miptree_create() to fail which causes
intel_miptree_create_for_renderbuffer() to fail.

I guess either either the miptree creation should be retried without MCS or
intel_miptree_supports_mcs() should detect the missing mmap_wc support and
return false.

Attached is a quick hack patch that adds mmap_wc check in
intel_miptree_supports_mcs(), and it seems to fix the testcase I used
(mesa-issue-qt3d.cc).
Without the patch the testcase either crashes (git master) or flashes rapidly
(git master + two patches from <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - i965 renderbuffer miptree creation failure not properly handled"
   href="show_bug.cgi?id=110601">bug #110601</a> to workaround the crashes).

The testcase mesa-issue-qt3d.cc is also attached, plus an apitrace and glxinfo
with git master.

This was tested on a ValleyView Gen7 (8086:0f31) with kernel 3.10.35.</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>