<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 - gbm_bo_map fails on i915 when *map_data is not NULL before call"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=110855">110855</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>gbm_bo_map fails on i915 when *map_data is not NULL before call
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>19.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>trivial
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>lowest
          </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>freebugs@mstoeckl.com
          </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=144477" name="attach_144477" title="Test case, compile with gcc -lgbm">attachment 144477</a> <a href="attachment.cgi?id=144477&action=edit" title="Test case, compile with gcc -lgbm">[details]</a></span>
Test case, compile with gcc -lgbm

The documentation for the function gbm_bo_map in src/gbm/main/gbm.c states that
the argument void** map_data is a "Returned opaque ptr for the mapped region".
Contrary to convention for a return value, if *map_data is not NULL, and the
DRI i965 driver is used, then gbm_bo_map fails. 

The value of *map_data is checked by intel_map_image in
src/mesa/drivers/dri/i965/intel_screen.c (line 823 in today's git master).

Debugging this (see attached test program) was made slightly more complicated
by the fact that errno was set to ENODEV, after the syscall
DRM_IOCTL_I915_GEM_CONTEXT_CREATE failed on the first call to gbm_bo_map .
Reading kernel sources implies that this probably only happens for <gen6 intel
GPUs.</pre>
        </div>
      </p>


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

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