Created attachment 134848 [details] 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 (https://github.com/freebsd/freebsd-ports/blob/master/graphics/libdrm/files/patch-xf86drm.c). (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?
This seems to be some shared code in Mesa, not specific to the EGL Wayland platform, and I'm not sure it's specific to EGL even. Not sure any of the components match, so picking "other". The code in question was added by: commit 28e3ae344be1c49f50a521792966e0d98510075c Author: Jonathan Gray <jsg@jsg.id.au> Date: Mon Dec 21 16:39:55 2015 +1100 loader: add a libdrm case for loader_get_device_name_for_fd However, the very first appearance of drmGetDeviceNameFromFd2 in libdrm was: commit 37d790f7d449874d0bf199d9ca9871d12b4d599a Author: Emil Velikov <emil.velikov@collabora.com> Date: Thu Nov 10 17:26:50 2016 +0000 xf86drm: introduce drmGetDeviceNameFromFd2 I believe the answer to "why" is that the latter did not exist when the former was written. Thanks.
Precisely as Pekka said - former's been around in Mesa for ages, while the latter is a recent introduction. The goal is to have the platform specifics in a smallish piece of software. That plus you can simply bump libdrm requirement and keep using the same Mesa (say because newer one breaks A). Greg, please send patches to the list for review https://www.mesa3d.org/submittingpatches.html
Greg, when you have some time please go through the remaining FreeBSD patches [1] and send them upstream (with commit message, etc.). Thanks. [1] https://github.com/freebsd/freebsd-ports-graphics/tree/master/graphics/mesa-dri/files
Fixed by https://cgit.freedesktop.org/mesa/mesa/commit/?id=db8519a369261cdedda50852facc45616d4eba28
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.