Re: Wayland on FreeBSD

Jan Beich <[email protected]>
Newsgroups gmane.os.freebsd.devel.x11,gmane.os.freebsd.questions
Message-ID <[email protected]>
Tomasz CEDRO <[email protected]> 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---
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-x11
To unsubscribe, send any mail to "[email protected]"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.