Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Apr 2020 14:53:15 +0200
From:      Jan Beich <jbeich@FreeBSD.org>
To:        Tomasz CEDRO <tomek@cedro.info>
Cc:        FreeBSD Questions Mailing List <freebsd-questions@freebsd.org>, freebsd-x11@freebsd.org
Subject:   Re: Wayland on FreeBSD
Message-ID:  <1roi-s4hw-wny@FreeBSD.org>
References:  <CAFYkXjmfyLZAi1HZe-RE3wLxa6GRNP6GkmtZG-4T2puRDOz0JA@mail.gmail.com> <CAFYkXjkFT7R0A-ZsH4p6C0_h8%2BqJ0-wWJ--tTJLtS0Pja0ZzSQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Tomasz CEDRO <tomek@cedro.info> writes:

> Enlightenment has and needs new Wayland support that is based on
> ecore_wl2 from EFL. Someone hardcoded Linux DMA code into
> src/lib/ecore_wl2/ecore_wl2_buffer.c and that part of EFL does not
> build anymore on FreeBSD (not mandatory to run on Xorg). The good news
> is that EFL builds with both old Wayland support (wl-deprecated
> switch) and new one required for Enlightenment (wl switch) when all
> linuxisms are commented out from ecore_wl2_buffer.c. This means if we
> find a FreeBSD specific replacement for those DMA transfers all should
> work fine..?
>
> https://github.com/Enlightenment/efl/blob/master/src/lib/ecore_wl2/ecore_wl2_buffer.c

Only graphics/drm-legacy-kmod doesn't support DMABUF. On X11 it is used
by multimedia/libva-intel-driver and DRI3 in graphics/mesa-dri.

Why Enlightment implements zwp_linux_dmabuf_v1 for each GPU vendor separately
instead of using GBM? How does it work on AMD GPUs? Maybe try

--8<---------------cut here---------------start------------->8---
--- src/lib/ecore_wl2/ecore_wl2_buffer.c.orig	2019-11-27 18:27:01 UTC
+++ src/lib/ecore_wl2/ecore_wl2_buffer.c
@@ -17,7 +17,20 @@
 #include <sys/mman.h>
 #include <sys/ioctl.h>
 
+#if defined(__DragonFly__) || defined(__FreeBSD__)
+/* kms-drm doesn't install any headers */
+#define DMA_BUF_SYNC_READ      (1 << 0)
+#define DMA_BUF_SYNC_WRITE     (2 << 0)
+#define DMA_BUF_SYNC_RW        (DMA_BUF_SYNC_READ | DMA_BUF_SYNC_WRITE)
+#define DMA_BUF_SYNC_START     (0 << 2)
+#define DMA_BUF_SYNC_END       (1 << 2)
+#define DMA_BUF_IOCTL_SYNC     _IOW('b', 0, struct dma_buf_sync)
+struct dma_buf_sync {
+	uint64_t flags;
+};
+#else
 #include <linux/dma-buf.h>
+#endif
 #include "linux-dmabuf-unstable-v1-client-protocol.h"
 
 #define SYM(lib, xx)               \
@@ -592,7 +605,12 @@ ecore_wl2_buffer_init(Ecore_Wl2_Display *ewd, Ecore_Wl
    buffer_manager = calloc(1, sizeof(Buffer_Manager));
    if (!buffer_manager) goto err_alloc;
 
+#if defined(__DragonFly__) || defined(__FreeBSD__)
+/* Disable by default due to https://github.com/FreeBSDDesktop/kms-drm/issues/156 */
+   if (getenv("EVAS_WAYLAND_SHM_ENABLE_DMABUF") && !getenv("EVAS_WAYLAND_SHM_DISABLE_DMABUF") && dmabuf)
+#else
    if (!getenv("EVAS_WAYLAND_SHM_DISABLE_DMABUF") && dmabuf)
+#endif
      {
         fd = open("/dev/dri/renderD128", O_RDWR | O_CLOEXEC);
         if (fd < 0)
--8<---------------cut here---------------end--------------->8---



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1roi-s4hw-wny>