From: Rafael Sadowski Subject: games/moonlight-qt: fix/enable drm To: ports@openbsd.org Cc: jsg@openbsd.org Date: Sat, 13 Dec 2025 16:39:07 +0100 This is an attempt to fix drm support in moonlight-qt. The patch below is form FreeBSD. I have no clue whether all these DMA_BUF_SYNC_* are correct on OpenBSD. OK, feedback? Index: Makefile =================================================================== RCS file: /cvs/ports/games/moonlight-qt/Makefile,v diff -u -p -r1.10 Makefile --- Makefile 21 Jul 2025 05:58:22 -0000 1.10 +++ Makefile 13 Dec 2025 15:33:51 -0000 @@ -5,6 +5,7 @@ PKGNAME = moonlight-qt-${V} DISTNAME = MoonlightSrc-${V} SITES = https://github.com/moonlight-stream/moonlight-qt/releases/download/v${V}/ +REVISION = 0 CATEGORIES = games @@ -14,15 +15,14 @@ HOMEPAGE = https://moonlight-stream.org PERMIT_PACKAGE = Yes WANTLIB += ${COMPILER_LIBCXX} EGL GL Qt6Core Qt6Gui Qt6Network -WANTLIB += Qt6OpenGL Qt6Qml Qt6QmlMeta Qt6QmlModels Qt6QmlWorkerScript -WANTLIB += Qt6Quick Qt6QuickControls2 Qt6Svg SDL2 SDL2_ttf X11 -WANTLIB += avcodec avutil c crypto m opus placebo ssl swscale -WANTLIB += va va-x11 wayland-client +WANTLIB += Qt6OpenGL Qt6Qml Qt6Quick Qt6QuickControls2 Qt6Svg +WANTLIB += SDL2 SDL2_ttf X11 avcodec avutil c crypto drm m opus +WANTLIB += placebo ssl swscale va va-drm va-x11 wayland-client MODULES = devel/qmake \ x11/qt6 -MODQMAKE_ARGS += CONFIG+='disable-libvdpau disable-libdrm' +MODQMAKE_ARGS += CONFIG+='disable-libvdpau' RUN_DEPENDS = x11/gtk+4,-guic \ devel/desktop-file-utils Index: patches/patch-app_streaming_video_ffmpeg-renderers_drm_cpp =================================================================== RCS file: patches/patch-app_streaming_video_ffmpeg-renderers_drm_cpp diff -N patches/patch-app_streaming_video_ffmpeg-renderers_drm_cpp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-app_streaming_video_ffmpeg-renderers_drm_cpp 13 Dec 2025 15:33:51 -0000 @@ -0,0 +1,28 @@ +Index: app/streaming/video/ffmpeg-renderers/drm.cpp +--- app/streaming/video/ffmpeg-renderers/drm.cpp.orig ++++ app/streaming/video/ffmpeg-renderers/drm.cpp +@@ -12,7 +12,24 @@ extern "C" { + } + + #include ++#ifdef __linux__ + #include ++#else //bundle on BSDs ++typedef uint64_t __u64; ++// From https://github.com/evadot/drm-subtree or https://reviews.freebsd.org/D23085 ++struct dma_buf_sync { ++ __u64 flags; ++}; ++#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_SYNC_VALID_FLAGS_MASK \ ++ (DMA_BUF_SYNC_RW | DMA_BUF_SYNC_END) ++#define DMA_BUF_BASE 'b' ++#define DMA_BUF_IOCTL_SYNC _IOW(DMA_BUF_BASE, 0, struct dma_buf_sync) ++#endif + + // Special Rockchip type + #ifndef DRM_FORMAT_NA12