From 21463414609ba9f96ad31d4f06a40fca536b9594 Mon Sep 17 00:00:00 2001 From: Markus Fritsche Date: Mon, 18 May 2026 17:41:17 +0000 Subject: [PATCH] daedalus_v4l2: meson option gate (default true) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a build-time switch so platforms that will never see a daedalus_v4l2 kernel module (Allwinner cedrus, RK without the shim, etc.) can opt out of the probe entry + dispatch branch. meson setup build # daedalus support on meson setup build-off -Ddaedalus_v4l2=false # off Implementation: - meson_options.txt: new boolean `daedalus_v4l2`, default true. - src/meson.build: when option is true, autoconfig.h gets `#define HAVE_DAEDALUS_V4L2 1`. - src/request.c: known_decoder_drivers[] entry, primary-driver detection branch, and post-probe log line all gated by #ifdef HAVE_DAEDALUS_V4L2. - src/request.h: struct daedalus fields kept UNCONDITIONAL. Two extra int per session and the struct layout stays stable across translation units regardless of option — avoids the ODR risk of every consumer of request.h needing to include autoconfig.h before request.h. Verified on hertz: both builds compile clean. build/src/autoconfig.h has HAVE_DAEDALUS_V4L2; .so contains "daedalus_v4l2" string + log message. build-off/src/autoconfig.h doesn't; .so contains no daedalus strings at all. Default-on build still passes vainfo end-to-end: vainfo: Driver version: v4l2-request vainfo: Supported profile and entrypoints VAProfileH264Main / High / ConstrainedBaseline / MultiviewHigh / StereoHigh : VAEntrypointVLD VAProfileVP9Profile0 : VAEntrypointVLD VAProfileAV1Profile0 : VAEntrypointVLD Co-Authored-By: Claude Opus 4.7 (1M context) --- meson_options.txt | 11 +++++++++++ src/meson.build | 3 +++ src/request.c | 6 ++++++ src/request.h | 6 ++++++ 4 files changed, 26 insertions(+) diff --git a/meson_options.txt b/meson_options.txt index d30bdfc..349ca39 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -4,3 +4,14 @@ option( value : '', description: 'Path to sanitized Linux Kernel headers' ) + +option( + 'daedalus_v4l2', + type : 'boolean', + value : true, + description: 'Enable probe + dispatch for the out-of-tree daedalus_v4l2 ' + + 'stateless decoder shim (Pi 5 / CM5 daemon-backed VP9/AV1/H264). ' + + 'Default true; disable on platforms where the daedalus_v4l2 ' + + 'kernel module will never be present to slim the probe array.' +) + diff --git a/src/meson.build b/src/meson.build index 6943ce2..e34c350 100644 --- a/src/meson.build +++ b/src/meson.build @@ -22,6 +22,9 @@ autoconf_data = configuration_data() autoconf_data.set('VA_DRIVER_INIT_FUNC', va_driver_init_func) +if get_option('daedalus_v4l2') + autoconf_data.set('HAVE_DAEDALUS_V4L2', 1) +endif autoconf = configure_file( output: 'autoconfig.h', diff --git a/src/request.c b/src/request.c index 2be3422..295f271 100644 --- a/src/request.c +++ b/src/request.c @@ -94,7 +94,9 @@ static const char * const known_decoder_drivers[] = { "rkvdec", "hantro-vpu", "rpi-hevc-dec", /* iter40: Pi 5 / CM5 stateless HEVC */ +#ifdef HAVE_DAEDALUS_V4L2 "daedalus_v4l2", /* phase 8.10: Pi 5 daemon-backed VP9/AV1/H264 */ +#endif "cedrus", "sun4i_csi", NULL @@ -703,6 +705,7 @@ VAStatus VA_DRIVER_INIT_FUNC(VADriverContextP context) alt_driver = NULL; driver_data->video_fd_rpi_hevc_dec = video_fd; driver_data->media_fd_rpi_hevc_dec = media_fd; +#ifdef HAVE_DAEDALUS_V4L2 } else if (strcmp(info.driver, "daedalus_v4l2") == 0) { /* phase 8.10: Pi 5 daemon-backed decoder. Sole * V4L2 stateless slot on this kernel; VP9 / AV1 / @@ -716,6 +719,7 @@ VAStatus VA_DRIVER_INIT_FUNC(VADriverContextP context) alt_driver = NULL; driver_data->video_fd_daedalus = video_fd; driver_data->media_fd_daedalus = media_fd; +#endif } } @@ -823,12 +827,14 @@ VAStatus VA_DRIVER_INIT_FUNC(VADriverContextP context) driver_data->video_fd_rpi_hevc_dec, driver_data->media_fd_rpi_hevc_dec); } +#ifdef HAVE_DAEDALUS_V4L2 if (driver_data->video_fd_daedalus >= 0) { request_log("phase 8.10: opened daedalus_v4l2 at video_fd=%d " "media_fd=%d (Pi 5 daemon-backed VP9/AV1/H264)\n", driver_data->video_fd_daedalus, driver_data->media_fd_daedalus); } +#endif status = VA_STATUS_SUCCESS; goto complete; diff --git a/src/request.h b/src/request.h index 023e071..2a670e9 100644 --- a/src/request.h +++ b/src/request.h @@ -105,6 +105,12 @@ struct request_data { * same media-controller probe + known_decoder_drivers[] entry * pattern as iter40 rpi-hevc-dec. Stays -1 on hosts without the * daedalus module loaded; HEVC routes to rpi-hevc-dec as before. + * + * Fields are unconditional (8 bytes per session) so the struct + * layout is stable regardless of meson option. The active + * probe + dispatch code in request.c is gated by + * HAVE_DAEDALUS_V4L2; when disabled the fields stay at their + * -1 init and no codepath touches them. */ int video_fd_daedalus; int media_fd_daedalus;