diff mbox series

[meta-arago,scarthgap/master,2/5] meta-arago-distro: chromium: enable V4L2 stateful decoder

Message ID 20250813165148.220012-3-t-lannynd@ti.com
State Under Review
Delegated to: Ryan Eatmon
Headers show
Series Enable hardware acceleration on chromium | expand

Commit Message

Thorsten Lannynd Aug. 13, 2025, 4:51 p.m. UTC
Add patch that enables the V4L2 stateful decoder in Chromium
by making sure that Chromium is opening the right V4L2
device path for Linux.

Signed-off-by: Thorsten Lannynd <t-lannynd@ti.com>
---
 ...pu-v4l2-enable-V4L2-stateful-decoder.patch | 34 +++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 meta-arago-distro/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland-132.0.6834.83/0002-chromium-gpu-v4l2-enable-V4L2-stateful-decoder.patch

Comments

Andrew Davis Aug. 13, 2025, 6:26 p.m. UTC | #1
On 8/13/25 11:51 AM, Thorsten Lannynd via lists.yoctoproject.org wrote:
> Add patch that enables the V4L2 stateful decoder in Chromium
> by making sure that Chromium is opening the right V4L2
> device path for Linux.
> 
> Signed-off-by: Thorsten Lannynd <t-lannynd@ti.com>
> ---
>   ...pu-v4l2-enable-V4L2-stateful-decoder.patch | 34 +++++++++++++++++++
>   1 file changed, 34 insertions(+)
>   create mode 100644 meta-arago-distro/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland-132.0.6834.83/0002-chromium-gpu-v4l2-enable-V4L2-stateful-decoder.patch
> 
> diff --git a/meta-arago-distro/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland-132.0.6834.83/0002-chromium-gpu-v4l2-enable-V4L2-stateful-decoder.patch b/meta-arago-distro/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland-132.0.6834.83/0002-chromium-gpu-v4l2-enable-V4L2-stateful-decoder.patch
> new file mode 100644
> index 00000000..ca94d2ab
> --- /dev/null
> +++ b/meta-arago-distro/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland-132.0.6834.83/0002-chromium-gpu-v4l2-enable-V4L2-stateful-decoder.patch
> @@ -0,0 +1,34 @@
> +From c9a81537eb0bc1f11ea902cb9abe4d98b7be74a9 Mon Sep 17 00:00:00 2001
> +From: Thorsten Lannynd <t-lannynd@ti.com>
> +Date: Thu, 7 Aug 2025 14:48:31 -0500
> +Subject: [PATCH] chromium: gpu: v4l2: enable V4L2 stateful decoder
> +
> +Upstream-Status: Pending
> +
> +Setting the video device path to /dev/video0 for linux allows
> +Chromium to find the decoder and also check that it is stateful.
> +This patch setups the correct V4L2 pipeline.
> +
> +Signed-off-by: Thorsten Lannynd <t-lannynd@ti.com>
> +---
> + media/gpu/v4l2/v4l2_utils.cc | 4 ++++
> + 1 file changed, 4 insertions(+)
> +
> +diff --git a/media/gpu/v4l2/v4l2_utils.cc b/media/gpu/v4l2/v4l2_utils.cc
> +index 9646e8be73..8bc88e938f 100644
> +--- a/media/gpu/v4l2/v4l2_utils.cc
> ++++ b/media/gpu/v4l2/v4l2_utils.cc
> +@@ -633,7 +633,11 @@ std::optional<SupportedVideoDecoderConfigs> GetSupportedV4L2DecoderConfigs() {
> + }
> +
> + bool IsV4L2DecoderStateful() {
> ++#if BUILDFLAG(IS_LINUX)
> ++  constexpr char kVideoDeviceDriverPath[] = "/dev/video0";

/dev/video0 could just as easily be a USB webcam or something. Using
a name not normally created by the kernel such as /dev/video-dec0
works better as it allows userspace to use some better heuristic
to make that a symlink to the correct device (such as some udev
rule which you can add to Arago instead).

Andrew

> ++#else
> +   constexpr char kVideoDeviceDriverPath[] = "/dev/video-dec0";
> ++#endif
> +   base::ScopedFD device_fd(HANDLE_EINTR(
> +       open(kVideoDeviceDriverPath, O_RDWR | O_NONBLOCK | O_CLOEXEC)));
> +   if (!device_fd.is_valid()) {
> +--
> +2.34.1
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#16363): https://lists.yoctoproject.org/g/meta-arago/message/16363
> Mute This Topic: https://lists.yoctoproject.org/mt/114686887/3619733
> Group Owner: meta-arago+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/meta-arago/unsub [afd@ti.com]
> -=-=-=-=-=-=-=-=-=-=-=-
> 
>
diff mbox series

Patch

diff --git a/meta-arago-distro/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland-132.0.6834.83/0002-chromium-gpu-v4l2-enable-V4L2-stateful-decoder.patch b/meta-arago-distro/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland-132.0.6834.83/0002-chromium-gpu-v4l2-enable-V4L2-stateful-decoder.patch
new file mode 100644
index 00000000..ca94d2ab
--- /dev/null
+++ b/meta-arago-distro/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland-132.0.6834.83/0002-chromium-gpu-v4l2-enable-V4L2-stateful-decoder.patch
@@ -0,0 +1,34 @@ 
+From c9a81537eb0bc1f11ea902cb9abe4d98b7be74a9 Mon Sep 17 00:00:00 2001
+From: Thorsten Lannynd <t-lannynd@ti.com>
+Date: Thu, 7 Aug 2025 14:48:31 -0500
+Subject: [PATCH] chromium: gpu: v4l2: enable V4L2 stateful decoder
+
+Upstream-Status: Pending
+
+Setting the video device path to /dev/video0 for linux allows
+Chromium to find the decoder and also check that it is stateful.
+This patch setups the correct V4L2 pipeline.
+
+Signed-off-by: Thorsten Lannynd <t-lannynd@ti.com>
+---
+ media/gpu/v4l2/v4l2_utils.cc | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/media/gpu/v4l2/v4l2_utils.cc b/media/gpu/v4l2/v4l2_utils.cc
+index 9646e8be73..8bc88e938f 100644
+--- a/media/gpu/v4l2/v4l2_utils.cc
++++ b/media/gpu/v4l2/v4l2_utils.cc
+@@ -633,7 +633,11 @@ std::optional<SupportedVideoDecoderConfigs> GetSupportedV4L2DecoderConfigs() {
+ }
+
+ bool IsV4L2DecoderStateful() {
++#if BUILDFLAG(IS_LINUX)
++  constexpr char kVideoDeviceDriverPath[] = "/dev/video0";
++#else
+   constexpr char kVideoDeviceDriverPath[] = "/dev/video-dec0";
++#endif
+   base::ScopedFD device_fd(HANDLE_EINTR(
+       open(kVideoDeviceDriverPath, O_RDWR | O_NONBLOCK | O_CLOEXEC)));
+   if (!device_fd.is_valid()) {
+--
+2.34.1