linuxOS_AP05/buildroot/package/qt5/qt5webengine/0003-Add-support-for-V4L2VDA-on-Linux.patch
2025-06-02 13:59:07 +08:00

571 lines
21 KiB
Diff

From 33faca0ec60d7e8dcc73c5a277246bd9ff546372 Mon Sep 17 00:00:00 2001
From: Maksim Sisov <msisov@igalia.com>
Date: Wed, 31 Jul 2019 09:56:24 +0300
Subject: [PATCH 03/12] Add support for V4L2VDA on Linux
This patch enables hardware assisted video decoding via the
Chromium V4L2VDA. Including changes when Linux is used. In
order to use this, use_linux_v4l2_only flag should be set
to true.
Signed-off-by: Ryo Kodama <ryo.kodama.vz@renesas.com>
fixup! avoid building not declared formats
"FRAME", "_SLICE", "V4L2_PIX_FMT_VP9" are not defined in mainline
Linux headers. This patch avoids building these formats.
Signed-off-by: Ryo Kodama <ryo.kodama.vz@renesas.com>
fixup! add V4L2_PIX_FMT_VP9 support back again as it is now
included in mainline Linux kernel. This allows VP9 codec
to work with upstream kernel and v4l2 vda. Tested on db820c
with Venus v4l2 driver.
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---
.../gpu_mjpeg_decode_accelerator_factory.cc | 3 +-
src/3rdparty/chromium/media/gpu/BUILD.gn | 1 +
src/3rdparty/chromium/media/gpu/args.gni | 4 ++
.../chromeos_video_decoder_factory.cc | 6 +--
.../chromium/media/gpu/chromeos/fourcc.cc | 4 ++
.../gpu_video_decode_accelerator_factory.cc | 8 +++
.../gpu_video_decode_accelerator_factory.h | 2 +
src/3rdparty/chromium/media/gpu/v4l2/BUILD.gn | 47 +++++++++--------
.../media/gpu/v4l2/generic_v4l2_device.cc | 4 ++
.../chromium/media/gpu/v4l2/v4l2_device.cc | 52 +++++++++++++++++++
.../chromium/media/gpu/v4l2/v4l2_device.h | 6 +++
.../gpu/v4l2/v4l2_video_decode_accelerator.cc | 3 ++
.../mojo/services/gpu_mojo_media_client.cc | 4 +-
13 files changed, 118 insertions(+), 26 deletions(-)
diff --git a/src/3rdparty/chromium/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc b/src/3rdparty/chromium/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc
index 6f319e88..4f8f0b7d 100644
--- a/src/3rdparty/chromium/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc
+++ b/src/3rdparty/chromium/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc
@@ -13,7 +13,8 @@
#include "media/base/media_switches.h"
#include "media/gpu/buildflags.h"
-#if BUILDFLAG(USE_V4L2_CODEC) && defined(ARCH_CPU_ARM_FAMILY)
+#if BUILDFLAG(USE_V4L2_CODEC) && defined(ARCH_CPU_ARM_FAMILY) && \
+ !BUILDFLAG(USE_LINUX_V4L2)
#define USE_V4L2_MJPEG_DECODE_ACCELERATOR
#endif
diff --git a/src/3rdparty/chromium/media/gpu/BUILD.gn b/src/3rdparty/chromium/media/gpu/BUILD.gn
index 0c0c3e81..dd14a2a9 100644
--- a/src/3rdparty/chromium/media/gpu/BUILD.gn
+++ b/src/3rdparty/chromium/media/gpu/BUILD.gn
@@ -18,6 +18,7 @@ buildflag_header("buildflags") {
"USE_VAAPI=$use_vaapi",
"USE_V4L2_CODEC=$use_v4l2_codec",
"USE_LIBV4L2=$use_v4lplugin",
+ "USE_LINUX_V4L2=$use_linux_v4l2_only",
]
}
diff --git a/src/3rdparty/chromium/media/gpu/args.gni b/src/3rdparty/chromium/media/gpu/args.gni
index 2a87b998..60f39fe2 100644
--- a/src/3rdparty/chromium/media/gpu/args.gni
+++ b/src/3rdparty/chromium/media/gpu/args.gni
@@ -14,6 +14,10 @@ declare_args() {
# platforms which have v4l2 hardware encoder
use_v4l2_codec_aml = false
+ # Indicates that only definitions available in the mainline linux kernel
+ # will be used.
+ use_linux_v4l2_only = false
+
# Indicates if VA-API-based hardware acceleration is to be used. This
# is typically the case on x86-based ChromeOS devices.
use_vaapi = false
diff --git a/src/3rdparty/chromium/media/gpu/chromeos/chromeos_video_decoder_factory.cc b/src/3rdparty/chromium/media/gpu/chromeos/chromeos_video_decoder_factory.cc
index b0c1595e..cfa9299f 100644
--- a/src/3rdparty/chromium/media/gpu/chromeos/chromeos_video_decoder_factory.cc
+++ b/src/3rdparty/chromium/media/gpu/chromeos/chromeos_video_decoder_factory.cc
@@ -17,7 +17,7 @@
#include "media/gpu/vaapi/vaapi_video_decoder.h"
#endif
-#if BUILDFLAG(USE_V4L2_CODEC)
+#if BUILDFLAG(USE_V4L2_CODEC) && !BUILDFLAG(USE_LINUX_V4L2)
#include "media/gpu/v4l2/v4l2_slice_video_decoder.h"
#endif
@@ -33,7 +33,7 @@ base::queue<VideoDecoderPipeline::CreateVDFunc> GetCreateVDFunctions(
&VaapiVideoDecoder::Create,
#endif // BUILDFLAG(USE_VAAPI)
-#if BUILDFLAG(USE_V4L2_CODEC)
+#if BUILDFLAG(USE_V4L2_CODEC) && !BUILDFLAG(USE_LINUX_V4L2)
&V4L2SliceVideoDecoder::Create,
#endif // BUILDFLAG(USE_V4L2_CODEC)
};
@@ -60,7 +60,7 @@ ChromeosVideoDecoderFactory::GetSupportedConfigs() {
configs.end());
#endif // BUILDFLAG(USE_VAAPI)
-#if BUILDFLAG(USE_V4L2_CODEC)
+#if BUILDFLAG(USE_V4L2_CODEC) && !BUILDFLAG(USE_LINUX_V4L2)
configs = V4L2SliceVideoDecoder::GetSupportedConfigs();
supported_configs.insert(supported_configs.end(), configs.begin(),
configs.end());
diff --git a/src/3rdparty/chromium/media/gpu/chromeos/fourcc.cc b/src/3rdparty/chromium/media/gpu/chromeos/fourcc.cc
index e8d514df..243b75b2 100644
--- a/src/3rdparty/chromium/media/gpu/chromeos/fourcc.cc
+++ b/src/3rdparty/chromium/media/gpu/chromeos/fourcc.cc
@@ -16,6 +16,10 @@
#include <va/va.h>
#endif // BUILDFLAG(USE_VAAPI)
+#ifndef V4L2_PIX_FMT_MT21C
+#define V4L2_PIX_FMT_MT21C v4l2_fourcc('M', 'T', '2', '1')
+#endif
+
namespace media {
Fourcc::Fourcc(Fourcc::Value fourcc) : value_(fourcc) {}
diff --git a/src/3rdparty/chromium/media/gpu/gpu_video_decode_accelerator_factory.cc b/src/3rdparty/chromium/media/gpu/gpu_video_decode_accelerator_factory.cc
index 3d519b99..cb44aecb 100644
--- a/src/3rdparty/chromium/media/gpu/gpu_video_decode_accelerator_factory.cc
+++ b/src/3rdparty/chromium/media/gpu/gpu_video_decode_accelerator_factory.cc
@@ -26,7 +26,9 @@
#endif
#if BUILDFLAG(USE_V4L2_CODEC)
#include "media/gpu/v4l2/v4l2_device.h"
+#if !BUILDFLAG(USE_LINUX_V4L2)
#include "media/gpu/v4l2/v4l2_slice_video_decode_accelerator.h"
+#endif
#include "media/gpu/v4l2/v4l2_video_decode_accelerator.h"
#include "ui/gl/gl_surface_egl.h"
#endif
@@ -63,10 +65,12 @@ gpu::VideoDecodeAcceleratorCapabilities GetDecoderCapabilitiesInternal(
vda_profiles = V4L2VideoDecodeAccelerator::GetSupportedProfiles();
GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles(
vda_profiles, &capabilities.supported_profiles);
+#if !BUILDFLAG(USE_LINUX_V4L2)
vda_profiles = V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles();
GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles(
vda_profiles, &capabilities.supported_profiles);
#endif
+#endif
#if BUILDFLAG(USE_VAAPI)
vda_profiles = VaapiVideoDecodeAccelerator::GetSupportedProfiles();
GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles(
@@ -173,8 +177,10 @@ GpuVideoDecodeAcceleratorFactory::CreateVDA(
#endif
#if BUILDFLAG(USE_V4L2_CODEC)
&GpuVideoDecodeAcceleratorFactory::CreateV4L2VDA,
+#if !BUILDFLAG(USE_LINUX_V4L2)
&GpuVideoDecodeAcceleratorFactory::CreateV4L2SVDA,
#endif
+#endif
#if defined(OS_MACOSX)
&GpuVideoDecodeAcceleratorFactory::CreateVTVDA,
#endif
@@ -222,6 +228,7 @@ GpuVideoDecodeAcceleratorFactory::CreateV4L2VDA(
return decoder;
}
+#if !BUILDFLAG(USE_LINUX_V4L2)
std::unique_ptr<VideoDecodeAccelerator>
GpuVideoDecodeAcceleratorFactory::CreateV4L2SVDA(
const gpu::GpuDriverBugWorkarounds& workarounds,
@@ -237,6 +244,7 @@ GpuVideoDecodeAcceleratorFactory::CreateV4L2SVDA(
return decoder;
}
#endif
+#endif
#if BUILDFLAG(USE_VAAPI)
std::unique_ptr<VideoDecodeAccelerator>
diff --git a/src/3rdparty/chromium/media/gpu/gpu_video_decode_accelerator_factory.h b/src/3rdparty/chromium/media/gpu/gpu_video_decode_accelerator_factory.h
index 74f10ebe..e779ef50 100644
--- a/src/3rdparty/chromium/media/gpu/gpu_video_decode_accelerator_factory.h
+++ b/src/3rdparty/chromium/media/gpu/gpu_video_decode_accelerator_factory.h
@@ -111,11 +111,13 @@ class MEDIA_GPU_EXPORT GpuVideoDecodeAcceleratorFactory {
const gpu::GpuDriverBugWorkarounds& workarounds,
const gpu::GpuPreferences& gpu_preferences,
MediaLog* media_log) const;
+#if !BUILDFLAG(USE_LINUX_V4L2)
std::unique_ptr<VideoDecodeAccelerator> CreateV4L2SVDA(
const gpu::GpuDriverBugWorkarounds& workarounds,
const gpu::GpuPreferences& gpu_preferences,
MediaLog* media_log) const;
#endif
+#endif
#if BUILDFLAG(USE_VAAPI)
std::unique_ptr<VideoDecodeAccelerator> CreateVaapiVDA(
const gpu::GpuDriverBugWorkarounds& workarounds,
diff --git a/src/3rdparty/chromium/media/gpu/v4l2/BUILD.gn b/src/3rdparty/chromium/media/gpu/v4l2/BUILD.gn
index 51814e19..7c0087e6 100644
--- a/src/3rdparty/chromium/media/gpu/v4l2/BUILD.gn
+++ b/src/3rdparty/chromium/media/gpu/v4l2/BUILD.gn
@@ -26,43 +26,48 @@ source_set("v4l2") {
sources = [
"generic_v4l2_device.cc",
"generic_v4l2_device.h",
- "v4l2_decode_surface.cc",
- "v4l2_decode_surface.h",
- "v4l2_decode_surface_handler.h",
"v4l2_device.cc",
"v4l2_device.h",
"v4l2_device_poller.cc",
"v4l2_device_poller.h",
- "v4l2_h264_accelerator.cc",
- "v4l2_h264_accelerator.h",
- "v4l2_h264_accelerator_legacy.cc",
- "v4l2_h264_accelerator_legacy.h",
"v4l2_image_processor_backend.cc",
"v4l2_image_processor_backend.h",
- "v4l2_slice_video_decode_accelerator.cc",
- "v4l2_slice_video_decode_accelerator.h",
- "v4l2_slice_video_decoder.cc",
- "v4l2_slice_video_decoder.h",
- "v4l2_stateful_workaround.cc",
- "v4l2_stateful_workaround.h",
"v4l2_vda_helpers.cc",
"v4l2_vda_helpers.h",
"v4l2_video_decode_accelerator.cc",
"v4l2_video_decode_accelerator.h",
"v4l2_video_decoder_backend.cc",
"v4l2_video_decoder_backend.h",
- "v4l2_video_decoder_backend_stateless.cc",
- "v4l2_video_decoder_backend_stateless.h",
"v4l2_video_encode_accelerator.cc",
"v4l2_video_encode_accelerator.h",
- "v4l2_vp8_accelerator.cc",
- "v4l2_vp8_accelerator.h",
- "v4l2_vp8_accelerator_legacy.cc",
- "v4l2_vp8_accelerator_legacy.h",
- "v4l2_vp9_accelerator.cc",
- "v4l2_vp9_accelerator.h",
]
+ if (!use_linux_v4l2_only) {
+ sources += [
+ "v4l2_decode_surface.cc",
+ "v4l2_decode_surface.h",
+ "v4l2_decode_surface_handler.h",
+ "v4l2_h264_accelerator.cc",
+ "v4l2_h264_accelerator.h",
+ "v4l2_h264_accelerator_legacy.cc",
+ "v4l2_h264_accelerator_legacy.h",
+ "v4l2_slice_video_decode_accelerator.cc",
+ "v4l2_slice_video_decode_accelerator.h",
+ "v4l2_slice_video_decoder.cc",
+ "v4l2_slice_video_decoder.h",
+ "v4l2_stateful_workaround.cc",
+ "v4l2_stateful_workaround.h",
+ "v4l2_video_decoder_backend_stateless.cc",
+ "v4l2_video_decoder_backend_stateless.h",
+ "v4l2_vp8_accelerator.cc",
+ "v4l2_vp8_accelerator.h",
+ "v4l2_vp8_accelerator_legacy.cc",
+ "v4l2_vp8_accelerator_legacy.h",
+ "v4l2_vp9_accelerator.cc",
+ "v4l2_vp9_accelerator.h",
+ ]
+ }
+
libs = [
"EGL",
"GLESv2",
diff --git a/src/3rdparty/chromium/media/gpu/v4l2/generic_v4l2_device.cc b/src/3rdparty/chromium/media/gpu/v4l2/generic_v4l2_device.cc
index 6742dc14..f0f10345 100644
--- a/src/3rdparty/chromium/media/gpu/v4l2/generic_v4l2_device.cc
+++ b/src/3rdparty/chromium/media/gpu/v4l2/generic_v4l2_device.cc
@@ -415,7 +415,11 @@ bool GenericV4L2Device::OpenDevicePath(const std::string& path, Type type) {
return false;
#if BUILDFLAG(USE_LIBV4L2)
+#if BUILDFLAG(USE_LINUX_V4L2)
+ if (
+#else
if (type == Type::kEncoder &&
+#endif
HANDLE_EINTR(v4l2_fd_open(device_fd_.get(), V4L2_DISABLE_CONVERSION)) !=
-1) {
DVLOGF(3) << "Using libv4l2 for " << path;
diff --git a/src/3rdparty/chromium/media/gpu/v4l2/v4l2_device.cc b/src/3rdparty/chromium/media/gpu/v4l2/v4l2_device.cc
index ee5c4430..c4a5f9fc 100644
--- a/src/3rdparty/chromium/media/gpu/v4l2/v4l2_device.cc
+++ b/src/3rdparty/chromium/media/gpu/v4l2/v4l2_device.cc
@@ -701,7 +701,9 @@ void V4L2WritableBufferRef::SetConfigStore(uint32_t config_store) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(buffer_data_);
+#if !BUILDFLAG(USE_LINUX_V4L2)
buffer_data_->v4l2_buffer_.config_store = config_store;
+#endif
}
V4L2ReadableBuffer::V4L2ReadableBuffer(const struct v4l2_buffer& v4l2_buffer,
@@ -835,10 +837,12 @@ V4L2Queue::V4L2Queue(scoped_refptr<V4L2Device> dev,
return;
}
+#if !BUILDFLAG(USE_LINUX_V4L2)
if (reqbufs.capabilities & V4L2_BUF_CAP_SUPPORTS_REQUESTS) {
supports_requests_ = true;
DVLOGF(4) << "Queue supports request API.";
}
+#endif
}
V4L2Queue::~V4L2Queue() {
@@ -1242,20 +1246,32 @@ scoped_refptr<V4L2Device> V4L2Device::Create() {
uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile,
bool slice_based) {
if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) {
+#if !BUILDFLAG(USE_LINUX_V4L2)
if (slice_based)
return V4L2_PIX_FMT_H264_SLICE;
else
return V4L2_PIX_FMT_H264;
+#else
+ return V4L2_PIX_FMT_H264;
+#endif
} else if (profile >= VP8PROFILE_MIN && profile <= VP8PROFILE_MAX) {
+#if !BUILDFLAG(USE_LINUX_V4L2)
if (slice_based)
return V4L2_PIX_FMT_VP8_FRAME;
else
return V4L2_PIX_FMT_VP8;
+#else
+ return V4L2_PIX_FMT_VP8;
+#endif
} else if (profile >= VP9PROFILE_MIN && profile <= VP9PROFILE_MAX) {
+#if !BUILDFLAG(USE_LINUX_V4L2)
if (slice_based)
return V4L2_PIX_FMT_VP9_FRAME;
else
return V4L2_PIX_FMT_VP9;
+#else
+ return V4L2_PIX_FMT_VP9;
+#endif
} else {
LOG(ERROR) << "Unknown profile: " << GetProfileName(profile);
return 0;
@@ -1279,6 +1295,7 @@ VideoCodecProfile V4L2Device::V4L2ProfileToVideoCodecProfile(VideoCodec codec,
return H264PROFILE_HIGH;
}
break;
+#if !BUILDFLAG(USE_LINUX_V4L2)
case kCodecVP8:
switch (profile) {
case V4L2_MPEG_VIDEO_VP8_PROFILE_0:
@@ -1300,6 +1317,7 @@ VideoCodecProfile V4L2Device::V4L2ProfileToVideoCodecProfile(VideoCodec codec,
return VP9PROFILE_PROFILE3;
}
break;
+#endif
default:
VLOGF(2) << "Unknown codec: " << codec;
}
@@ -1318,12 +1336,14 @@ std::vector<VideoCodecProfile> V4L2Device::V4L2PixFmtToVideoCodecProfiles(
case kCodecH264:
query_id = V4L2_CID_MPEG_VIDEO_H264_PROFILE;
break;
+#if !BUILDFLAG(USE_LINUX_V4L2)
case kCodecVP8:
query_id = V4L2_CID_MPEG_VIDEO_VP8_PROFILE;
break;
case kCodecVP9:
query_id = V4L2_CID_MPEG_VIDEO_VP9_PROFILE;
break;
+#endif
default:
return false;
}
@@ -1351,7 +1371,9 @@ std::vector<VideoCodecProfile> V4L2Device::V4L2PixFmtToVideoCodecProfiles(
std::vector<VideoCodecProfile> profiles;
switch (pix_fmt) {
case V4L2_PIX_FMT_H264:
+#if !BUILDFLAG(USE_LINUX_V4L2)
case V4L2_PIX_FMT_H264_SLICE:
+#endif
if (!get_supported_profiles(kCodecH264, &profiles)) {
DLOG(WARNING) << "Driver doesn't support QUERY H264 profiles, "
<< "use default values, Base, Main, High";
@@ -1363,11 +1385,15 @@ std::vector<VideoCodecProfile> V4L2Device::V4L2PixFmtToVideoCodecProfiles(
}
break;
case V4L2_PIX_FMT_VP8:
+#if !BUILDFLAG(USE_LINUX_V4L2)
case V4L2_PIX_FMT_VP8_FRAME:
+#endif
profiles = {VP8PROFILE_ANY};
break;
case V4L2_PIX_FMT_VP9:
+#if !BUILDFLAG(USE_LINUX_V4L2)
case V4L2_PIX_FMT_VP9_FRAME:
+#endif
if (!get_supported_profiles(kCodecVP9, &profiles)) {
DLOG(WARNING) << "Driver doesn't support QUERY VP9 profiles, "
<< "use default values, Profile0";
@@ -1402,6 +1428,12 @@ uint32_t V4L2Device::V4L2PixFmtToDrmFormat(uint32_t format) {
case V4L2_PIX_FMT_RGB32:
return DRM_FORMAT_ARGB8888;
+ case V4L2_PIX_FMT_MT21C:
+#if !BUILDFLAG(USE_LINUX_V4L2)
+ case V4L2_PIX_FMT_MT21:
+ return DRM_FORMAT_MT21;
+#endif
+
default:
DVLOGF(1) << "Unrecognized format " << FourccToString(format);
return 0;
@@ -2037,6 +2069,7 @@ bool V4L2Request::ApplyCtrls(struct v4l2_ext_controls* ctrls) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK_NE(ctrls, nullptr);
+#if !BUILDFLAG(USE_LINUX_V4L2)
if (!request_fd_.is_valid()) {
VPLOGF(1) << "Invalid request";
return false;
@@ -2046,12 +2079,16 @@ bool V4L2Request::ApplyCtrls(struct v4l2_ext_controls* ctrls) {
ctrls->request_fd = request_fd_.get();
return true;
+#else
+ return false;
+#endif
}
bool V4L2Request::ApplyQueueBuffer(struct v4l2_buffer* buffer) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK_NE(buffer, nullptr);
+#if !BUILDFLAG(USE_LINUX_V4L2)
if (!request_fd_.is_valid()) {
VPLOGF(1) << "Invalid request";
return false;
@@ -2061,6 +2098,9 @@ bool V4L2Request::ApplyQueueBuffer(struct v4l2_buffer* buffer) {
buffer->request_fd = request_fd_.get();
return true;
+#else
+ return false;
+#endif
}
bool V4L2Request::Submit() {
@@ -2071,7 +2111,11 @@ bool V4L2Request::Submit() {
return false;
}
+#if !BUILDFLAG(USE_LINUX_V4L2)
return HANDLE_EINTR(ioctl(request_fd_.get(), MEDIA_REQUEST_IOC_QUEUE)) == 0;
+#else
+ return false;
+#endif
}
bool V4L2Request::IsCompleted() {
@@ -2114,6 +2158,7 @@ bool V4L2Request::Reset() {
return false;
}
+#if !BUILDFLAG(USE_LINUX_V4L2)
// Reinit the request to make sure we can use it for a new submission.
if (HANDLE_EINTR(ioctl(request_fd_.get(), MEDIA_REQUEST_IOC_REINIT)) < 0) {
VPLOGF(1) << "Failed to reinit request.";
@@ -2121,6 +2166,9 @@ bool V4L2Request::Reset() {
}
return true;
+#else
+ return false;
+#endif
}
V4L2RequestRefBase::V4L2RequestRefBase(V4L2RequestRefBase&& req_base) {
@@ -2195,6 +2243,7 @@ V4L2RequestsQueue::~V4L2RequestsQueue() {
base::Optional<base::ScopedFD> V4L2RequestsQueue::CreateRequestFD() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+#if !BUILDFLAG(USE_LINUX_V4L2)
int request_fd;
int ret = HANDLE_EINTR(
ioctl(media_fd_.get(), MEDIA_IOC_REQUEST_ALLOC, &request_fd));
@@ -2204,6 +2253,9 @@ base::Optional<base::ScopedFD> V4L2RequestsQueue::CreateRequestFD() {
}
return base::ScopedFD(request_fd);
+#else
+ return base::nullopt;
+#endif
}
base::Optional<V4L2RequestRef> V4L2RequestsQueue::GetFreeRequest() {
diff --git a/src/3rdparty/chromium/media/gpu/v4l2/v4l2_device.h b/src/3rdparty/chromium/media/gpu/v4l2/v4l2_device.h
index 346ec0c9..7ab77f46 100644
--- a/src/3rdparty/chromium/media/gpu/v4l2/v4l2_device.h
+++ b/src/3rdparty/chromium/media/gpu/v4l2/v4l2_device.h
@@ -40,6 +40,12 @@
#ifndef V4L2_PIX_FMT_JPEG_RAW
#define V4L2_PIX_FMT_JPEG_RAW v4l2_fourcc('J', 'P', 'G', 'R')
#endif
+#ifndef V4L2_PIX_FMT_VP9
+#define V4L2_PIX_FMT_VP9 v4l2_fourcc('V', 'P', '9', '0')
+#endif
+#ifndef V4L2_PIX_FMT_MT21C
+#define V4L2_PIX_FMT_MT21C v4l2_fourcc('M', 'T', '2', '1')
+#endif
#ifndef V4L2_CID_JPEG_LUMA_QUANTIZATION
#define V4L2_CID_JPEG_LUMA_QUANTIZATION (V4L2_CID_JPEG_CLASS_BASE + 5)
#endif
diff --git a/src/3rdparty/chromium/media/gpu/v4l2/v4l2_video_decode_accelerator.cc b/src/3rdparty/chromium/media/gpu/v4l2/v4l2_video_decode_accelerator.cc
index 7147d9f8..454bda07 100644
--- a/src/3rdparty/chromium/media/gpu/v4l2/v4l2_video_decode_accelerator.cc
+++ b/src/3rdparty/chromium/media/gpu/v4l2/v4l2_video_decode_accelerator.cc
@@ -31,6 +31,7 @@
#include "media/base/unaligned_shared_memory.h"
#include "media/base/video_frame_layout.h"
#include "media/base/video_types.h"
+#include "media/gpu/buildflags.h"
#include "media/gpu/chromeos/fourcc.h"
#include "media/gpu/chromeos/platform_video_frame_utils.h"
#include "media/gpu/macros.h"
@@ -306,8 +307,10 @@ bool V4L2VideoDecodeAccelerator::CheckConfig(const Config& config) {
return false;
}
+#if !BUILDFLAG(USE_LINUX_V4L2)
workarounds_ =
CreateV4L2StatefulWorkarounds(V4L2Device::Type::kDecoder, config.profile);
+#endif
output_mode_ = config.output_mode;
diff --git a/src/3rdparty/chromium/media/mojo/services/gpu_mojo_media_client.cc b/src/3rdparty/chromium/media/mojo/services/gpu_mojo_media_client.cc
index 5074b435..f5a1ecfe 100644
--- a/src/3rdparty/chromium/media/mojo/services/gpu_mojo_media_client.cc
+++ b/src/3rdparty/chromium/media/mojo/services/gpu_mojo_media_client.cc
@@ -167,7 +167,8 @@ GpuMojoMediaClient::GetSupportedVideoDecoderConfigs() {
*d3d11_supported_configs_;
}
-#elif BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION)
+#elif defined(OS_CHROMEOS)
+#if BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION)
if (IsNewAcceleratedVideoDecoderUsed(gpu_preferences_)) {
if (!cros_supported_configs_) {
cros_supported_configs_ =
@@ -178,6 +179,7 @@ GpuMojoMediaClient::GetSupportedVideoDecoderConfigs() {
return supported_config_map;
}
#endif
+#endif
#if defined(OS_WIN)
if (gpu_workarounds_.disable_dxva_video_decoder) {
--
2.20.1