Wayland on FreeBSD

Tomasz CEDRO tomek at cedro.info
Mon Apr 20 19:25:50 UTC 2020

On Mon, Apr 20, 2020 at 11:59 AM Greg V wrote:
> There are no "Linux specific DMA transfers" in userspace applications :) DMA-BUF is basically a way to refer to GPU buffers from userspace, pass them around as file descriptors, and synchronize access to them. Of course it is supported, it's a very important part of the DRM stack.

Hmm, is it then normal to use on non-Linux code like this?

#include <linux/dma-buf.h>
#include "linux-dmabuf-unstable-v1-client-protocol.h"

struct zwp_linux_dmabuf_v1 *dmabuf;
struct zwp_linux_buffer_params_v1 *dp;

dmabuf = ecore_wl2_display_dmabuf_get(ewd);
dp = zwp_linux_dmabuf_v1_create_params(dmabuf);
zwp_linux_buffer_params_v1_add(dp, db->fd, 0, 0, db->stride, 0, 0);
buf = zwp_linux_buffer_params_v1_create_immed(dp, db->w, db->h,
format, flags);
wl_buffer_add_listener(buf, &buffer_listener, db);

static void
_create_succeeded(void *data EINA_UNUSED,
struct zwp_linux_buffer_params_v1 *params,
struct wl_buffer *new_buffer)

struct zwp_linux_buffer_params_v1 *dp;

dp = zwp_linux_dmabuf_v1_create_params(ewd->wl.dmabuf);
zwp_linux_buffer_params_v1_add(dp, buf->fd, 0, 0, buf->stride, 0, 0);
zwp_linux_buffer_params_v1_add_listener(dp, &params_listener, ewd);
zwp_linux_buffer_params_v1_create(dp, buf->w, buf->h,

Is this some sort of Linux KMS/DRM specification that keeps explict
"linux" name hardcoded and we have them too on FreeBSD named that way?
Never seen anything like this :-)

> Nothing currently installs the uapi header <linux/dma-buf.h> that contains some definitions for the sync ioctl, but the ioctl works:
> https://github.com/FreeBSDDesktop/kms-drm/blob/drm-v4.16/linuxkpi/gplv2/src/linux_dmabuf.c
> Chromium currently patches ifdefs to use the inlined copy of the header that's already there for older Linux installations:
> https://github.com/freebsd/freebsd-ports/blob/master/www/chromium/files/patch-ui_gfx_linux_client__native__pixmap__dmabuf.cc
> https://chromium.googlesource.com/chromium/src/+/refs/tags/84.0.4120.1/ui/gfx/linux/client_native_pixmap_dmabuf.cc
> But really we need a tiny port that installs that header already :)

Will look into this in a free moment and report back! Does this mean
we only put that header and things start workin? ;-)

Thank you Greg!! :-)

CeDeROM, SQ7MHZ, http://www.tomek.cedro.info

More information about the freebsd-questions mailing list