Re: Is support for DMA-BUF possible or planned?

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Tue, 27 Aug 2024 12:23:51 UTC
(redirecting from desktop@ list)

Vasily Postnicov <shamaz.mazum@gmail.com> writes:

> Hi! I maintain my own port of webkitgtk. In version 2.44.0 WebKit's
> developers broke WebGL support on systems which do not have DMA-BUF (all
> systems but Linux, maybe). Is support for DMA-BUF possible or planned in
> FreeBSD as a part of the Linux compatibility layer?

DMA-BUF works fine natively and required by DRI3, EGL + VA-API interop, Wayland.
Explicit sync isn't supported yet, see https://github.com/freebsd/drm-kmod/issues/278
Note, DMA-BUF on NVIDIA GPUs requires installing nvidia-drm-kmod package.

<dma-buf.h> header only provides *_SYNC and *_SYNC_FILE ioctls. Consumers
like Mesa usually bundle the header or the relevant macros like in
x11-wm/magpie/files/patch-cogl_cogl_cogl-dma-buf-handle.c (based on bug 271823).

*_SYNC may be broken per https://github.com/FreeBSDDesktop/kms-drm/issues/156
but nothing critical depends on it and likely obsoleted by *_SYNC_FILE, anyway.

Related:
https://github.com/dragonflybsd/dragonflybsd/tree/master/sys/dev/drm/linux_dma-buf.c
https://github.com/freebsd/drm-kmod/tree/master/drivers/dma-buf/dma-buf.c
https://github.com/evadot/drm-subtree/tree/master/drmkpi/drmcompat_dma_buf.c
https://github.com/NetBSD/src/blob/trunk/sys/external/bsd/drm2/linux/linux_dma_buf.c