<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 - drm_get_device_name_for_fd is broken on FreeBSD"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=103283">103283</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>drm_get_device_name_for_fd is broken on FreeBSD
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>17.2
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>FreeBSD
          </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>EGL/Wayland
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>wayland-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>greg@unrelenting.technology
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>mesa-dev@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=134848" name="attach_134848" title="patch-src_loader_loader.c">attachment 134848</a> <a href="attachment.cgi?id=134848&action=edit" title="patch-src_loader_loader.c">[details]</a></span>
patch-src_loader_loader.c

The function drm_get_device_name_for_fd in src/loader/loader.c uses
dev_node_from_fd which uses Linux-specific major/minor stuff, which does not
work correctly on FreeBSD.

Because of this, Wayland EGL clients on FreeBSD receive /dev/dri/card408
instead of /dev/dri/card0 as the device path, and fall back to software
rendering :D

The attached patch replaces the code with a call to drmGetDeviceNameFromFd2,
which is patched in our packages to work correctly
(<a href="https://github.com/freebsd/freebsd-ports/blob/master/graphics/libdrm/files/patch-xf86drm.c">https://github.com/freebsd/freebsd-ports/blob/master/graphics/libdrm/files/patch-xf86drm.c</a>).
(dev_node_from_fd is probably dead code after this patch)

Why wasn't drmGetDeviceNameFromFd2 used in the first place? Why was libdrm's
functionality duplicated?</pre>
        </div>
      </p>


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

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