Created attachment 203295 [details] test case For libva DRM backend to reliably support headless transcoding I need a way to check if the opened device is a render node. drmGetNodeTypeFromFd() == DRM_NODE_RENDER appears to be the correct way but it doesn't work on FreeBSD. $ pkg install libdrm pkgconf $ cc test.c -o test $(pkg-config --cflags --libs libdrm) $ ./test unknown (-1) node
Nevermind. I've found a workaround. https://github.com/intel/libva/pull/292
Created attachment 203343 [details] fix Nah, libva cannot get rid of Linux-specific check without drmGetNodeTypeFromFd. Mesa also wants to check DRM_NODE_RENDER. https://gitlab.freedesktop.org/mesa/mesa/blob/mesa-18.3.2/src/egl/drivers/dri2/platform_wayland.c#L1135 https://gitlab.freedesktop.org/mesa/mesa/blob/mesa-18.3.2/src/egl/drivers/dri2/platform_wayland.c#L1409
Damn, this file is a mess for FreeBSD ... Anyway I would prefer to have strrchr instead of a for loop and strtok : int type = drmGetNodeType(strrchr(name, '/') + 1); Do you plan to submit that upstream ?
(In reply to Emmanuel Vadot from comment #3) > int type = drmGetNodeType(strrchr(name, '/') + 1); Works for me. > Do you plan to submit that upstream ? Where? drmGetNodeTypeFromFd doesn't support devfs-based systems upstream. https://gitlab.freedesktop.org/mesa/drm/blob/libdrm-2.4.96/xf86drm.c#L2784-2804 General libdrm upstreaming is outside of scope for this bug. Figuring it out is the maintainer's job. I'm only responsible for libva atm but even there slow upstream feedback doesn't look exciting.
Yeah I saw after that none of that is upstreamed yet. I may do it but not for now.
Created attachment 203347 [details] fix, v2 Switch to strrchr() per comment 3. Uploading mainly to avoid ambiguity what was tested.
Looks good to me, let's wait for X11 now.
A commit references this bug: Author: zeising Date: Sun Jun 30 17:39:05 UTC 2019 New revision: 505442 URL: https://svnweb.freebsd.org/changeset/ports/505442 Log: graphics/libdrm: fix drmGetNodeTypeFromFd Fix drmGetNodeTypeFromFd, this should have been part of r505441 PR: 236933 Submitted by: jbeich Reviewed by: manu Changes: head/graphics/libdrm/files/patch-xf86drm.c
Committed. No need to merge to quarterly, new branch tonight.