PKGBUILDs/extra/chromium/add-feature-to-allow-zero-copy-video-formats.patch

63 lines
2.7 KiB
Diff
Raw Normal View History

2024-09-15 13:56:41 +00:00
From fb42a91ffae45f6a7c1639ebf0f1622b7c346d1d Mon Sep 17 00:00:00 2001
From: Robert Mader <robert.mader@collabora.com>
Date: Thu, 5 Sep 2024 23:56:20 +0000
Subject: [PATCH] media: Add feature to allow zero-copy video formats with GL
on Linux
With EGL formats like NV12 can usually be imported directly from VA-API
and V4L2 decoders. Doing so can improve performance a lot - and in cases
where there is no PP to convert to RGB, not supporting it can break HW
decoding altogether.
Unfortunately allowing it unconditionally could cause regressions in
various scenarios - such as when using GLX or a driver that doesn't
support sampling NV12.
Thus introduce a feature - disabled by default for now - to make it easy
to enable these formats.
Note that on Wayland it might be required to disable overlay delegation
with `--disable-features=WaylandOverlayDelegation`.
Change-Id: I8ee396de5f6d4958278b0f0bd53bfa9a7007c8c7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5038617
Reviewed-by: Ted (Chromium) Meyer <tmathmeyer@chromium.org>
Reviewed-by: Andres Calderon Jaramillo <andrescj@chromium.org>
Commit-Queue: Andres Calderon Jaramillo <andrescj@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1351792}
---
media/mojo/services/gpu_mojo_media_client_linux.cc | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/media/mojo/services/gpu_mojo_media_client_linux.cc b/media/mojo/services/gpu_mojo_media_client_linux.cc
index c592c2e4c2c2..cd86a3253e07 100644
--- a/media/mojo/services/gpu_mojo_media_client_linux.cc
+++ b/media/mojo/services/gpu_mojo_media_client_linux.cc
@@ -18,6 +18,10 @@ namespace media {
namespace {
+BASE_FEATURE(kVaapiVideoDecodeLinuxZeroCopyGL,
+ "VaapiVideoDecodeLinuxZeroCopyGL",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+
VideoDecoderType GetPreferredLinuxDecoderImplementation() {
// VaapiVideoDecoder flag is required for VaapiVideoDecoder.
if (!base::FeatureList::IsEnabled(kVaapiVideoDecodeLinux)) {
@@ -50,8 +54,15 @@ std::vector<Fourcc> GetPreferredRenderableFourccs(
if (gpu_preferences.gr_context_type == gpu::GrContextType::kVulkan) {
renderable_fourccs.emplace_back(Fourcc::NV12);
renderable_fourccs.emplace_back(Fourcc::P010);
- }
+ } else
#endif // BUILDFLAG(ENABLE_VULKAN)
+ // Allow zero-copy formats with GL for testing or in controlled
+ // environments.
+ if (gpu_preferences.gr_context_type == gpu::GrContextType::kGL &&
+ base::FeatureList::IsEnabled(kVaapiVideoDecodeLinuxZeroCopyGL)) {
+ renderable_fourccs.emplace_back(Fourcc::NV12);
+ renderable_fourccs.emplace_back(Fourcc::P010);
+ }
// Support 1-copy argb textures.
//