Files
marfrit-packages/arch/mpv-fourier/PKGBUILD
T
test0r 713a856cdc mpv-fourier: iter1 patch — explicit DMA_BUF_IOCTL_SYNC on import fds
Workaround for the dmabuf-wayland green-frames bug
(marfrit/dmabuf-modifier-triage#1). iter1 phase 2 source-read of
KWin 6.6.4 + Mesa 26.0.6 ruled out the original H1/H2 hypotheses
(panfrost offset handling and KWin wl_dmabuf import are clean) and
matched the green tone to BT.601 limited-range YUV(0,0,0) -> RGB(0,
135, 0). Conclusion: panfrost reads zero-fill memory despite hantro
having written real data — a cache-coherency / synchronization gap.

V4L2 doesn't attach implicit fences (dma_resv) to CAPTURE buffers
on VIDIOC_DQBUF; this gap is the same one our vb2_dma_resv RFC v2
addresses upstream. The userspace workaround is to issue
DMA_BUF_IOCTL_SYNC(SYNC_START|SYNC_RW) + SYNC_END(SYNC_RW) on each
EXPBUF fd before submitting to the compositor — invokes the producer
driver's begin_cpu_access / end_cpu_access path, which on most ARM
SoCs flushes write buffers and synchronizes coherent memory.

Patch covers BOTH vaapi_dmabuf_importer (the path our test exercises
via `mpv --hwdec=vaapi`) and drmprime_dmabuf_importer (for symmetry
when used via `--hwdec=drmprime`).

If this works, ship it; if it doesn't, hypothesis space narrows
further to GPU-side cache invalidation in panfrost's kernel-mode
dma_buf import path (H7).

pkgrel 8 -> 9. Patch sha256
6c929bea7636b8d81b63a1275ba1d8a471fe2f249fc23509043ace6cf9b076a7.
2026-05-08 22:03:26 +00:00

105 lines
3.9 KiB
Bash

# Maintainer: Markus Fritsche <fritsche.markus@gmail.com>
#
# mpv-fourier — mpv with the fourier-umbrella patches. The first patch
# slot exists for the vo_dmabuf_wayland plane-semantics fix per
# marfrit/dmabuf-modifier-triage#1: mpv currently constructs the
# zwp_linux_buffer_params_v1 wl_protocol message with internally
# inconsistent plane semantics on V4L2 stateless decoder dmabufs (per-
# plane fds combined with single-allocation offset for plane 1), causing
# KWin to read the UV chroma plane past-EOF and render solid dark green
# on ohm (RK3566 + hantro G1 + Mali-G52). The patch is not yet written —
# this scaffold prepares the shipping path for when iter1 lands.
#
# Build configuration mirrors stock arch's mpv PKGBUILD (which builds
# successfully). Key detail: --auto-features auto is required because
# arch-meson defaults to --auto-features enabled, which makes mpv's
# platform-specific features (win32-threads, etc.) required and fails
# the build on Linux.
#
# Campaign: ~/src/dmabuf-modifier-triage/ (Phase 0 closed 2026-05-08)
# Upstream: https://github.com/mpv-player/mpv
pkgname=mpv-fourier
_upstreampkg=mpv
epoch=1
pkgver=0.41.0
pkgrel=9
pkgdesc='mpv with fourier-umbrella patches (vo_dmabuf_wayland explicit cache-sync workaround)'
arch=('aarch64')
url='https://mpv.io/'
license=('GPL-2.0-or-later AND LGPL-2.1-or-later')
depends=(
alsa-lib desktop-file-utils ffmpeg-v4l2-request-fourier glibc hicolor-icon-theme
jack lcms2 libarchive libass libbluray libcdio
libcdio-paranoia libdisplay-info libdrm libdvdnav libdvdread libegl libgl
libglvnd libjpeg-turbo libplacebo libpulse libsixel libva
libvdpau libx11 libxext libxkbcommon libxpresent libxrandr
libxss libxv luajit mesa mujs libpipewire rubberband sdl2
openal uchardet vapoursynth vulkan-icd-loader wayland zlib
)
makedepends=(
git meson python-docutils ladspa wayland-protocols
vulkan-headers
)
optdepends=('yt-dlp: for video-sharing websites playback')
provides=("${_upstreampkg}=${pkgver}" 'libmpv.so')
conflicts=("${_upstreampkg}")
replaces=("${_upstreampkg}")
options=('!emptydirs')
source=(
"${_upstreampkg}-${pkgver}.tar.gz::https://github.com/mpv-player/${_upstreampkg}/archive/v${pkgver}/${_upstreampkg}-${pkgver}.tar.gz"
'0001-vo_dmabuf_wayland-explicit-cache-sync-on-import-fd.patch'
)
sha256sums=(
'ee21092a5ee427353392360929dc64645c54479aefdb5babc5cfbb5fad626209'
'6c929bea7636b8d81b63a1275ba1d8a471fe2f249fc23509043ace6cf9b076a7'
)
prepare() {
cd "${_upstreampkg}-${pkgver}"
# iter1 of dmabuf-modifier-triage — explicit DMA_BUF_IOCTL_SYNC on import
# fds in vaapi_dmabuf_importer + drmprime_dmabuf_importer. Workaround for
# missing implicit-fence on V4L2 stateless CAPTURE buffers; root cause is
# being addressed upstream via the vb2_dma_resv RFC.
patch -p1 < "${srcdir}/0001-vo_dmabuf_wayland-explicit-cache-sync-on-import-fd.patch"
}
build() {
local _meson_options=(
--auto-features auto
-Dlibmpv=true
-Dgl-x11=enabled
-Dcaca=disabled
-Dcdda=enabled
-Ddrm=enabled
-Ddvbin=enabled
-Ddvdnav=enabled
-Dlibarchive=enabled
-Dopenal=enabled
-Dsdl2-audio=enabled
-Dsdl2-video=enabled
-Dsdl2-gamepad=enabled
)
arch-meson "${_upstreampkg}-${pkgver}" build "${_meson_options[@]}"
meson compile -C build
}
package() {
meson install -C build --destdir "${pkgdir}"
# Drop private linkage entries (they only matter for static linking).
sed -i -e '/Requires.private/d' -e '/Libs.private/d' \
"${pkgdir}/usr/lib/pkgconfig/mpv.pc"
install -m0644 "${_upstreampkg}-${pkgver}/DOCS/encoding.rst" \
"${_upstreampkg}-${pkgver}/DOCS/tech-overview.txt" \
-t "${pkgdir}/usr/share/doc/mpv/"
install -m0644 "${_upstreampkg}-${pkgver}"/TOOLS/{umpv,mpv_identify.sh,stats-conv.py,idet.sh,lua/*} \
-D -t "${pkgdir}/usr/share/mpv/scripts/"
}