Open jbeich opened 5 years ago
The invalid flags used by waypipe are something of a hack, for lack of an easier way to generically detect DMABUFs on Linux without trying to import with GBM or using driver-specific code.
Also, FYI, the Linux version is https://github.com/torvalds/linux/blob/master/drivers/dma-buf/dma-buf.c#L279.
Edit: The sample code tries the ioctl
on an fd for a render node, not for a DMABUF.
Can someone try reproducing using DMA-BUF reimplementation ? drm-subtree
doesn't seem to have i915 or amdgpu, so testing on amd64 is not currently possible.
For future reference: Waypipe no longer relies on this behavior on FreeBSD, since v0.8.0, which was released more than a year ago. As of recent git commits, it has also stopped using the EBADF hack on Linux.
EDIT: Description has been rewritten as the initial test case was incorrect.
Waypipe (package, workaround) relies on
DMA_BUF_IOCTL_SYNC
to check if a given file descripter is backed by DMABUF. On FreeBSD the ioctl always fails withEBADF
which is unexpected according to the implementation: https://github.com/FreeBSDDesktop/kms-drm/blob/e31e5fc502d190ad488baec4ba2658db945b95e3/linuxkpi/gplv2/src/linux_dmabuf.c#L215-L260Test case: https://gitlab.freedesktop.org/snippets/621