From: Markus Fritsche Subject: [PATCH 1/4] widget/gtk: recognize V4L2 stateless fourccs in GfxInfo prober (S264 / S265 / VP9F) Date: 2026-04-27 Background ---------- Firefox's V4L2 prober in `widget/gtk/GfxInfo.cpp::V4L2ProbeDevice` parses `v4l2test`'s `V4L2_OUTPUT_FMTS` line and matches against the fourccs of stateful V4L2-M2M decoders (`H264`, `VP80`, `VP90`, `HEVC`). That's correct for Pi4 / Mediatek / vendor-MPP stateful decoders but silently skips every mainline-Linux Rockchip board: RK3399 `rkvdec`, RK3566 `hantro` (multiplanar), RK3588 `hantro` and `rkvdec2` all expose stateless fourccs only — `S264`, `S265`, `VP9F`. The probe binary itself enumerates these correctly (verified end-to-end on fresnel / Pinebook Pro / RK3399 with `v4l2test --device /dev/video1` showing `V4L2_OUTPUT_FMTS: S265 S264 VP9F` and `V4L2_SUPPORTED: TRUE`); the gap is purely in this string table. This patch adds the three sibling blocks for the stateless fourccs, each identical in shape to the existing stateful blocks except for setting a new `mV4L2IsStateless` member. The follow-up patches in this series (2/4, 3/4, 4/4) consume that member to route through the libavcodec v4l2_request hwaccel (`AV_HWDEVICE_TYPE_DRM`) instead of the v4l2m2m codec wrapper used for stateful boards. Bug 1969297. diff --git a/widget/gtk/GfxInfo.h b/widget/gtk/GfxInfo.h --- a/widget/gtk/GfxInfo.h +++ b/widget/gtk/GfxInfo.h @@ -127,6 +127,10 @@ mozilla::Maybe mIsVAAPISupported; int mVAAPISupportedCodecs = 0; mozilla::Maybe mIsV4L2Supported; + // firefox-fourier: true when probe matched at least one stateless + // V4L2 fourcc (S264 / S265 / VP9F). Drives libavcodec v4l2_request + // hwaccel routing in FFmpegVideoDecoder.cpp. + bool mV4L2IsStateless = false; int mV4L2SupportedCodecs = 0; static int sGLXTestPipe; diff --git a/widget/gtk/GfxInfo.cpp b/widget/gtk/GfxInfo.cpp --- a/widget/gtk/GfxInfo.cpp +++ b/widget/gtk/GfxInfo.cpp @@ -852,6 +852,29 @@ void GfxInfo::V4L2ProbeDevice(nsCString& dev) { media::MCSInfo::AddSupport(media::MediaCodecsSupport::HEVCHardwareDecode); mV4L2SupportedCodecs |= CODEC_HW_DEC_HEVC; } + // firefox-fourier: V4L2 stateless (request API) fourccs. Mainline + // Rockchip rkvdec / hantro / rkvdec2 expose these instead of the + // V4L2-M2M-stateful fourccs above. Decoding routes through + // libavcodec's v4l2_request hwaccel (AV_HWDEVICE_TYPE_DRM) rather + // than the *_v4l2m2m codec wrappers — see FFmpegVideoDecoder.cpp. + if (outFormats.Contains("S264")) { + mIsV4L2Supported = Some(true); + mV4L2IsStateless = true; + media::MCSInfo::AddSupport(media::MediaCodecsSupport::H264HardwareDecode); + mV4L2SupportedCodecs |= CODEC_HW_DEC_H264; + } + if (outFormats.Contains("S265")) { + mIsV4L2Supported = Some(true); + mV4L2IsStateless = true; + media::MCSInfo::AddSupport(media::MediaCodecsSupport::HEVCHardwareDecode); + mV4L2SupportedCodecs |= CODEC_HW_DEC_HEVC; + } + if (outFormats.Contains("VP9F")) { + mIsV4L2Supported = Some(true); + mV4L2IsStateless = true; + media::MCSInfo::AddSupport(media::MediaCodecsSupport::VP9HardwareDecode); + mV4L2SupportedCodecs |= CODEC_HW_DEC_VP9; + } } const nsTArray>& GfxInfo::GetGfxDriverInfo() {