From 136390514d0915a1706a0825650874375c67b9aa Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Thu, 11 Jun 2026 09:12:59 +0000 Subject: [PATCH] build: support FFmpeg 7.x and 8.x; fix RPM spec GPU link deps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit punktfunk-host builds unchanged against either FFmpeg 7.x (libavcodec 61) or 8.x (libavcodec 62) — ffmpeg-sys-next auto-detects the system version, and the host's ffmpeg FFI only touches long-stable APIs. Confirmed by building + running live on a Bazzite F43 box (FFmpeg 7.1.3): full gamescope capture → zero-copy dmabuf→CUDA → NVENC H.265 at 1280x720x60, p50 ~0.96 ms. Just doc/spec accuracy, no code change: - encode/linux.rs + CLAUDE.md: drop the "FFmpeg 8 only" claim; note 7.x/8.x both work. - rpm spec: add the missing zero-copy GPU build deps the link actually needs — pkgconfig(gl) + pkgconfig(gbm) (mesa) — and document that -lcuda needs libcuda.so at link time (NVIDIA host, or the CUDA toolkit stub on a headless COPR/koji builder). Tracked for a proper fix: make the cuda/gbm/GL FFI dlopen-based like khronos-egl so the RPM builds on a GPU-less host. Co-Authored-By: Claude Opus 4.8 (1M context) --- CLAUDE.md | 4 +++- crates/punktfunk-host/src/encode/linux.rs | 4 +++- packaging/rpm/punktfunk.spec | 10 ++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index e25a675..d00ea73 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -158,7 +158,9 @@ cargo run -rp punktfunk-client-rs -- --mode 1280x720x120 --out /tmp/a.h265 --inp ``` Pinned crate facts: `ashpd` 0.13 + `pipewire` 0.9 (must match ashpd's) + `ffmpeg-next` 8.x -(system FFmpeg 8 / libavcodec 62). Env knobs: `PUNKTFUNK_VIDEO_SOURCE=virtual|portal`, +(`ffmpeg-sys-next` auto-detects the system FFmpeg, so it builds against **FFmpeg 7.x/libavcodec 61 +or 8.x/libavcodec 62** — validated live on Ubuntu 26.04 (8) and Bazzite F43 (7.1); the zero-copy +FFI also link-needs `libGL`/`libgbm`/`libcuda` at build time). Env knobs: `PUNKTFUNK_VIDEO_SOURCE=virtual|portal`, `PUNKTFUNK_COMPOSITOR=kwin|gamescope|mutter`, `PUNKTFUNK_ZEROCOPY=1`, `PUNKTFUNK_GAMESCOPE_APP=...`, `PUNKTFUNK_INPUT_BACKEND=...`, `PUNKTFUNK_PERF=1` (per-stage timing), `PUNKTFUNK_VIDEO_DROP=N` (FEC test), `PUNKTFUNK_FEC_PCT=N`. diff --git a/crates/punktfunk-host/src/encode/linux.rs b/crates/punktfunk-host/src/encode/linux.rs index 384be78..a7469ed 100644 --- a/crates/punktfunk-host/src/encode/linux.rs +++ b/crates/punktfunk-host/src/encode/linux.rs @@ -1,4 +1,6 @@ -//! NVENC encoder via `ffmpeg-next` (binds the system FFmpeg 8.x / libavcodec 62). +//! NVENC encoder via `ffmpeg-next` (binds the system FFmpeg — `ffmpeg-sys-next` auto-detects the +//! installed version, so this builds against FFmpeg 7.x/libavcodec 61 *or* 8.x/libavcodec 62; +//! validated live on Ubuntu 26.04 (FFmpeg 8) and Bazzite F43 (FFmpeg 7.1)). //! //! Input is a packed RGB/BGR CPU frame; `*_nvenc` accepts `rgb0`/`bgr0`/`rgba`/`bgra` //! directly and does the RGB→YUV conversion on the GPU, so the host stays off the diff --git a/packaging/rpm/punktfunk.spec b/packaging/rpm/punktfunk.spec index 7149d7d..7c4f67d 100644 --- a/packaging/rpm/punktfunk.spec +++ b/packaging/rpm/punktfunk.spec @@ -47,9 +47,19 @@ BuildRequires: pkgconfig(wayland-client) BuildRequires: pkgconfig(xkbcommon) BuildRequires: pkgconfig(opus) # FFmpeg dev headers with NVENC — from RPM Fusion (ffmpeg-devel), NOT ffmpeg-free. +# Version-agnostic: ffmpeg-sys-next auto-detects the installed FFmpeg, so this builds +# against FFmpeg 7.x (libavcodec 61, e.g. Fedora 43 / Bazzite) or 8.x (libavcodec 62). BuildRequires: pkgconfig(libavcodec) BuildRequires: pkgconfig(libavformat) BuildRequires: pkgconfig(libavutil) +# Zero-copy GPU path: src/zerocopy/ links libGL + libgbm (mesa) via hand-rolled FFI. +BuildRequires: pkgconfig(gl) +BuildRequires: pkgconfig(gbm) +# It ALSO links the NVIDIA CUDA driver lib (-lcuda) via FFI, so libcuda.so must be present +# at LINK time. A normal NVIDIA host (or Bazzite -nvidia) has it; a headless COPR/koji builder +# without a GPU does NOT — point %build at the CUDA toolkit stub (…/stubs/libcuda.so) there, +# e.g. `ln -s $(rpm -ql cuda-cudart-devel | grep stubs/libcuda.so | head -1) /usr/lib64/`. +# (Proper fix tracked separately: make the cuda/gbm/GL FFI dlopen-based like khronos-egl.) # --- Runtime ----------------------------------------------------------------- Requires: pipewire