mirror of
https://github.com/nxp-imx/meta-imx.git
synced 2025-10-22 23:32:16 +02:00
chromium-ozone-wayland: Refresh VPU patches for chromium 129.0.6668.100 [YOCIMX-8352]
Signed-off-by: Neena Busireddy <neenareddy.busireddy@nxp.com>
This commit is contained in:
parent
ed7a5573f4
commit
dc179197e2
|
@ -1,9 +1,9 @@
|
|||
From 0d40e29f85a5feb12a5a591763972115bf6da113 Mon Sep 17 00:00:00 2001
|
||||
From fb1763465e8720cd090a9787ef52376611064337 Mon Sep 17 00:00:00 2001
|
||||
From: Hou Qi <qi.hou@nxp.com>
|
||||
Date: Wed, 1 Nov 2023 18:55:31 +0900
|
||||
Subject: [PATCH 02/19] GenericV4L2Device: Correct v4l2 decoder device path
|
||||
Date: Fri, 13 Sep 2024 22:18:54 +0900
|
||||
Subject: [PATCH 01/19] V4L2Device: Correct v4l2 codec device path
|
||||
|
||||
Change decoder device pattern to /dev/video, and select one
|
||||
Change codec device pattern to /dev/video, and select one
|
||||
correct device path /dev/videox where x is an integer.
|
||||
|
||||
Upstream-Status: Inappropriate [NXP specific]
|
||||
|
@ -12,10 +12,10 @@ Upstream-Status: Inappropriate [NXP specific]
|
|||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/media/gpu/v4l2/v4l2_device.cc b/media/gpu/v4l2/v4l2_device.cc
|
||||
index a7adc8812e4f8..40e463cbed435 100644
|
||||
index 39c16611c76f3..ebbf240a3c5e7 100644
|
||||
--- a/media/gpu/v4l2/v4l2_device.cc
|
||||
+++ b/media/gpu/v4l2/v4l2_device.cc
|
||||
@@ -907,8 +907,8 @@ void V4L2Device::CloseDevice() {
|
||||
@@ -852,8 +852,8 @@ void V4L2Device::CloseDevice() {
|
||||
}
|
||||
|
||||
void V4L2Device::EnumerateDevicesForType(Type type) {
|
|
@ -1,35 +0,0 @@
|
|||
From e52fe9f92e3e063b45b37a1990b99df363e86e5d Mon Sep 17 00:00:00 2001
|
||||
From: Hou Qi <qi.hou@nxp.com>
|
||||
Date: Wed, 17 Aug 2022 16:57:11 +0800
|
||||
Subject: [PATCH 01/19] V4L2VDA: Switch to use VDA instead of direct
|
||||
VideoDecoder
|
||||
|
||||
commit b7f3a9e8058f593d7d88b6b6cafa71957aa3f1a1 aims to default
|
||||
enable "direct VideoDecoder" support on Linux. So need to switch
|
||||
to use VDA path iff:
|
||||
|
||||
1. kVaapiVideoDecodeLinux is enabled (disabled by default);
|
||||
2. kUseChromeOSDirectVideoDecoder is disabled (enabled by default);
|
||||
3. GL is used;
|
||||
|
||||
Upstream-Status: Inappropriate [NXP specific]
|
||||
---
|
||||
media/base/media_switches.cc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc
|
||||
index bb277d181b482..f99e39ec25fae 100644
|
||||
--- a/media/base/media_switches.cc
|
||||
+++ b/media/base/media_switches.cc
|
||||
@@ -1134,7 +1134,7 @@ BASE_FEATURE(kChromeOSHWVBREncoding,
|
||||
// TODO(b/159825227): remove when the direct video decoder is fully launched.
|
||||
BASE_FEATURE(kUseChromeOSDirectVideoDecoder,
|
||||
"UseChromeOSDirectVideoDecoder",
|
||||
- base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
+ base::FEATURE_DISABLED_BY_DEFAULT);
|
||||
|
||||
// Limit the number of concurrent hardware decoder instances on ChromeOS.
|
||||
BASE_FEATURE(kLimitConcurrentDecoderInstances,
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -1,18 +1,17 @@
|
|||
From a82cb9e7bfa9171f0a9194db894264b0861bbe7c Mon Sep 17 00:00:00 2001
|
||||
From 6d4413788f248814f498981d97d78d92e0dc85f3 Mon Sep 17 00:00:00 2001
|
||||
From: Hou Qi <qi.hou@nxp.com>
|
||||
Date: Fri, 2 Sep 2022 13:18:34 +0800
|
||||
Subject: [PATCH 03/19] V4L2VDA: Add macro use_linux_v4l2
|
||||
Date: Fri, 13 Sep 2024 22:31:51 +0900
|
||||
Subject: [PATCH 02/19] V4L2VideoDecoder: Add macro use_linux_v4l2
|
||||
|
||||
Upstream-Status: Inappropriate [NXP specific]
|
||||
---
|
||||
.../gpu_mjpeg_decode_accelerator_factory.cc | 3 +-
|
||||
media/gpu/BUILD.gn | 1 +
|
||||
media/gpu/args.gni | 4 +++
|
||||
.../gpu_video_decode_accelerator_factory.h | 2 ++
|
||||
media/gpu/v4l2/BUILD.gn | 15 +++++++---
|
||||
media/gpu/v4l2/v4l2_utils.cc | 28 +++++++++++++++++++
|
||||
media/gpu/v4l2/v4l2_video_decoder.cc | 8 ++++++
|
||||
7 files changed, 56 insertions(+), 5 deletions(-)
|
||||
media/gpu/v4l2/BUILD.gn | 15 ++++++----
|
||||
media/gpu/v4l2/v4l2_utils.cc | 30 ++++++++++++++++++-
|
||||
media/gpu/v4l2/v4l2_video_decoder.cc | 8 +++++
|
||||
6 files changed, 54 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc b/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc
|
||||
index 8e8ad4a84875c..156b6bd25674e 100644
|
||||
|
@ -29,22 +28,22 @@ index 8e8ad4a84875c..156b6bd25674e 100644
|
|||
#endif
|
||||
|
||||
diff --git a/media/gpu/BUILD.gn b/media/gpu/BUILD.gn
|
||||
index c52af7123b2ca..30d53159eb009 100644
|
||||
index 727cbedee37a3..4843c717966b9 100644
|
||||
--- a/media/gpu/BUILD.gn
|
||||
+++ b/media/gpu/BUILD.gn
|
||||
@@ -21,6 +21,7 @@ buildflag_header("buildflags") {
|
||||
@@ -22,6 +22,7 @@ buildflag_header("buildflags") {
|
||||
"USE_VAAPI_IMAGE_CODECS=$use_vaapi_image_codecs",
|
||||
"USE_V4L2_CODEC=$use_v4l2_codec",
|
||||
"USE_LIBV4L2=$use_v4lplugin",
|
||||
+ "USE_LINUX_V4L2=$use_linux_v4l2_only",
|
||||
"USE_VAAPI_X11=$use_vaapi_x11",
|
||||
]
|
||||
}
|
||||
|
||||
diff --git a/media/gpu/args.gni b/media/gpu/args.gni
|
||||
index 6a3dcef82e8a7..7976b1d7dd966 100644
|
||||
index 37751112e34a7..49939b896e699 100644
|
||||
--- a/media/gpu/args.gni
|
||||
+++ b/media/gpu/args.gni
|
||||
@@ -21,6 +21,10 @@ declare_args() {
|
||||
@@ -14,6 +14,10 @@ declare_args() {
|
||||
use_v4l2_codec =
|
||||
is_chromeos_lacros && (target_cpu == "arm" || target_cpu == "arm64")
|
||||
|
||||
|
@ -54,45 +53,27 @@ index 6a3dcef82e8a7..7976b1d7dd966 100644
|
|||
+
|
||||
# Indicates if VA-API-based hardware acceleration is to be used. This
|
||||
# is typically the case on x86-based ChromeOS devices.
|
||||
# VA-API should also be compiled by default on x11-using linux devices
|
||||
diff --git a/media/gpu/gpu_video_decode_accelerator_factory.h b/media/gpu/gpu_video_decode_accelerator_factory.h
|
||||
index 27ed3a8c90502..27c06e2506c1b 100644
|
||||
--- a/media/gpu/gpu_video_decode_accelerator_factory.h
|
||||
+++ b/media/gpu/gpu_video_decode_accelerator_factory.h
|
||||
@@ -94,11 +94,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> CreateV4L2SliceVDA(
|
||||
const gpu::GpuDriverBugWorkarounds& workarounds,
|
||||
const gpu::GpuPreferences& gpu_preferences,
|
||||
MediaLog* media_log) const;
|
||||
#endif
|
||||
+#endif
|
||||
#if BUILDFLAG(IS_APPLE)
|
||||
std::unique_ptr<VideoDecodeAccelerator> CreateVTVDA(
|
||||
const gpu::GpuDriverBugWorkarounds& workarounds,
|
||||
# VA-API should also be compiled by default on x11/wayland linux devices
|
||||
diff --git a/media/gpu/v4l2/BUILD.gn b/media/gpu/v4l2/BUILD.gn
|
||||
index f939bd52ec164..50b3beecc090e 100644
|
||||
index bd5d25000cfcb..0aa466ba9cec5 100644
|
||||
--- a/media/gpu/v4l2/BUILD.gn
|
||||
+++ b/media/gpu/v4l2/BUILD.gn
|
||||
@@ -20,9 +20,6 @@ source_set("v4l2") {
|
||||
"legacy/v4l2_stateful_workaround.h",
|
||||
"legacy/v4l2_video_decode_accelerator.cc",
|
||||
"legacy/v4l2_video_decode_accelerator.h",
|
||||
"legacy/v4l2_video_decoder_backend_stateful.cc",
|
||||
"legacy/v4l2_video_decoder_backend_stateful.h",
|
||||
- "v4l2_decode_surface.cc",
|
||||
- "v4l2_decode_surface.h",
|
||||
- "v4l2_decode_surface_handler.h",
|
||||
"v4l2_device.cc",
|
||||
"v4l2_device.h",
|
||||
"v4l2_device_poller.cc",
|
||||
@@ -47,6 +44,15 @@ source_set("v4l2") {
|
||||
@@ -43,6 +40,15 @@ source_set("v4l2") {
|
||||
"v4l2_video_decoder.h",
|
||||
"v4l2_video_decoder_backend.cc",
|
||||
"v4l2_video_decoder_backend.h",
|
||||
"v4l2_video_decoder_backend_stateful.cc",
|
||||
"v4l2_video_decoder_backend_stateful.h",
|
||||
+ "v4l2_video_encode_accelerator.cc",
|
||||
+ "v4l2_video_encode_accelerator.h",
|
||||
+ "v4l2_vp9_helpers.cc",
|
||||
+ "v4l2_vp9_helpers.h",
|
||||
+ ]
|
||||
+
|
||||
+ if (!use_linux_v4l2_only) {
|
||||
|
@ -103,21 +84,22 @@ index f939bd52ec164..50b3beecc090e 100644
|
|||
"v4l2_video_decoder_backend_stateless.cc",
|
||||
"v4l2_video_decoder_backend_stateless.h",
|
||||
"v4l2_video_decoder_delegate_h264.cc",
|
||||
@@ -55,7 +61,8 @@ source_set("v4l2") {
|
||||
@@ -51,9 +57,8 @@ source_set("v4l2") {
|
||||
"v4l2_video_decoder_delegate_vp8.h",
|
||||
"v4l2_video_decoder_delegate_vp9.cc",
|
||||
"v4l2_video_decoder_delegate_vp9.h",
|
||||
- ]
|
||||
+ ]
|
||||
- "v4l2_vp9_helpers.cc",
|
||||
- "v4l2_vp9_helpers.h",
|
||||
]
|
||||
+ }
|
||||
|
||||
if (enable_hevc_parser_and_hw_decoder) {
|
||||
sources += [
|
||||
diff --git a/media/gpu/v4l2/v4l2_utils.cc b/media/gpu/v4l2/v4l2_utils.cc
|
||||
index 2703e9f8ea73e..44b46026045e0 100644
|
||||
index 1455996823334..bb3ffb4f4642b 100644
|
||||
--- a/media/gpu/v4l2/v4l2_utils.cc
|
||||
+++ b/media/gpu/v4l2/v4l2_utils.cc
|
||||
@@ -299,15 +299,23 @@ using v4l2_enum_type = decltype(V4L2_PIX_FMT_H264);
|
||||
@@ -317,15 +317,23 @@ using v4l2_enum_type = decltype(V4L2_PIX_FMT_H264);
|
||||
static const std::map<v4l2_enum_type, v4l2_enum_type>
|
||||
kV4L2CodecPixFmtToProfileCID = {
|
||||
{V4L2_PIX_FMT_H264, V4L2_CID_MPEG_VIDEO_H264_PROFILE},
|
||||
|
@ -141,10 +123,11 @@ index 2703e9f8ea73e..44b46026045e0 100644
|
|||
#if BUILDFLAG(IS_CHROMEOS)
|
||||
{V4L2_PIX_FMT_AV1, V4L2_CID_MPEG_VIDEO_AV1_PROFILE},
|
||||
{V4L2_PIX_FMT_AV1_FRAME, V4L2_CID_MPEG_VIDEO_AV1_PROFILE},
|
||||
@@ -459,7 +467,27 @@ uint32_t VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile,
|
||||
@@ -537,7 +545,27 @@ uint32_t VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile,
|
||||
<< "Unsupported profile: " << GetProfileName(profile);
|
||||
|
||||
const auto& v4l2_pix_fmt = kVideoCodecProfileToV4L2CodecPixFmt.at(profile);
|
||||
- return slice_based ? v4l2_pix_fmt.first : v4l2_pix_fmt.second;
|
||||
+#if BUILDFLAG(USE_LINUX_V4L2)
|
||||
+ if (slice_based) {
|
||||
+ LOG(ERROR) << "Unsupported slice";
|
||||
|
@ -164,26 +147,26 @@ index 2703e9f8ea73e..44b46026045e0 100644
|
|||
+ return 0;
|
||||
+ }
|
||||
+#else
|
||||
return slice_based ? v4l2_pix_fmt.first : v4l2_pix_fmt.second;
|
||||
+ return slice_based ? v4l2_pix_fmt.first : v4l2_pix_fmt.second;
|
||||
+#endif
|
||||
}
|
||||
|
||||
} // namespace media
|
||||
base::TimeDelta TimeValToTimeDelta(const struct timeval& timeval) {
|
||||
diff --git a/media/gpu/v4l2/v4l2_video_decoder.cc b/media/gpu/v4l2/v4l2_video_decoder.cc
|
||||
index 1b00851805d90..741b66930036f 100644
|
||||
index 601f57fe0e6d0..5765761592344 100644
|
||||
--- a/media/gpu/v4l2/v4l2_video_decoder.cc
|
||||
+++ b/media/gpu/v4l2/v4l2_video_decoder.cc
|
||||
@@ -30,7 +30,9 @@
|
||||
@@ -32,7 +32,9 @@
|
||||
#include "media/gpu/v4l2/legacy/v4l2_video_decoder_backend_stateful.h"
|
||||
#include "media/gpu/v4l2/v4l2_status.h"
|
||||
#include "media/gpu/v4l2/v4l2_utils.h"
|
||||
#include "media/gpu/v4l2/v4l2_video_decoder_backend_stateful.h"
|
||||
+#if !BUILDFLAG(USE_LINUX_V4L2)
|
||||
#include "media/gpu/v4l2/v4l2_video_decoder_backend_stateless.h"
|
||||
+#endif
|
||||
#include "mojo/public/cpp/bindings/callback_helpers.h"
|
||||
|
||||
namespace media {
|
||||
|
||||
@@ -48,6 +50,7 @@ constexpr size_t kInputBufferMaxSizeFor4k = 4 * kInputBufferMaxSizeFor1080p;
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
@@ -68,6 +70,7 @@ constexpr size_t kInputBufferMaxSizeFor4k = 2 * kInputBufferMaxSizeFor1080p;
|
||||
// Input format V4L2 fourccs this class supports.
|
||||
const std::vector<uint32_t> kSupportedInputFourccs = {
|
||||
// V4L2 stateless formats
|
||||
|
@ -191,14 +174,15 @@ index 1b00851805d90..741b66930036f 100644
|
|||
V4L2_PIX_FMT_H264_SLICE,
|
||||
#if BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)
|
||||
V4L2_PIX_FMT_HEVC_SLICE,
|
||||
@@ -56,13 +59,16 @@ const std::vector<uint32_t> kSupportedInputFourccs = {
|
||||
@@ -75,6 +78,7 @@ const std::vector<uint32_t> kSupportedInputFourccs = {
|
||||
V4L2_PIX_FMT_VP8_FRAME,
|
||||
V4L2_PIX_FMT_VP9_FRAME,
|
||||
V4L2_PIX_FMT_AV1_FRAME,
|
||||
// V4L2 stateful formats
|
||||
+#endif
|
||||
// V4L2 stateful formats
|
||||
V4L2_PIX_FMT_H264,
|
||||
#if BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)
|
||||
V4L2_PIX_FMT_HEVC,
|
||||
@@ -82,7 +86,9 @@ const std::vector<uint32_t> kSupportedInputFourccs = {
|
||||
#endif // BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)
|
||||
V4L2_PIX_FMT_VP8,
|
||||
V4L2_PIX_FMT_VP9,
|
||||
|
@ -208,18 +192,18 @@ index 1b00851805d90..741b66930036f 100644
|
|||
};
|
||||
|
||||
// These values are logged to UMA. Entries should not be renumbered and numeric
|
||||
@@ -366,6 +372,7 @@ V4L2Status V4L2VideoDecoder::InitializeBackend() {
|
||||
<< " and fourcc: " << FourccToString(input_format_fourcc);
|
||||
@@ -471,6 +477,7 @@ V4L2Status V4L2VideoDecoder::InitializeBackend() {
|
||||
<< " and fourcc: " << FourccToString(input_format_fourcc_);
|
||||
backend_ = std::make_unique<V4L2StatefulVideoDecoderBackend>(
|
||||
this, device_, profile_, color_space_, decoder_task_runner_);
|
||||
+#if !BUILDFLAG(USE_LINUX_V4L2)
|
||||
} else {
|
||||
DCHECK_EQ(preferred_api_and_format.first, kStateless);
|
||||
VLOGF(1) << "Using a stateless API for profile: "
|
||||
@@ -373,6 +380,7 @@ V4L2Status V4L2VideoDecoder::InitializeBackend() {
|
||||
<< " and fourcc: " << FourccToString(input_format_fourcc);
|
||||
@@ -479,6 +486,7 @@ V4L2Status V4L2VideoDecoder::InitializeBackend() {
|
||||
backend_ = std::make_unique<V4L2StatelessVideoDecoderBackend>(
|
||||
this, device_, profile_, color_space_, decoder_task_runner_);
|
||||
this, device_, profile_, color_space_, decoder_task_runner_,
|
||||
cdm_context_ref_ ? cdm_context_ref_->GetCdmContext() : nullptr);
|
||||
+#endif
|
||||
}
|
||||
|
|
@ -1,69 +1,19 @@
|
|||
From 65d0565e830b6ca00347d38a54521a1c7e4febf9 Mon Sep 17 00:00:00 2001
|
||||
From c175fe907f93f5db9327ca1030820cdba8df137c Mon Sep 17 00:00:00 2001
|
||||
From: Hou Qi <qi.hou@nxp.com>
|
||||
Date: Wed, 1 Nov 2023 23:20:47 +0900
|
||||
Subject: [PATCH 04/19] V4L2VDA: Create single/multi plane queues
|
||||
Date: Fri, 13 Sep 2024 22:36:04 +0900
|
||||
Subject: [PATCH 03/19] V4L2VideoDecoder: Create single/multi plane queues
|
||||
|
||||
Decide to create single-plane queue or multi-plane queue according to
|
||||
the capabilities returned by VIDIOC_QUERYCAP.
|
||||
|
||||
Upstream-Status: Inappropriate [NXP specific]
|
||||
---
|
||||
.../legacy/v4l2_video_decode_accelerator.cc | 28 +++++++++++++-----
|
||||
media/gpu/v4l2/v4l2_device.cc | 29 ++++++++++++++-----
|
||||
2 files changed, 42 insertions(+), 15 deletions(-)
|
||||
media/gpu/v4l2/v4l2_device.cc | 29 ++++++++++++++++++++--------
|
||||
media/gpu/v4l2/v4l2_video_decoder.cc | 27 ++++++++++++++++++--------
|
||||
2 files changed, 40 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc b/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc
|
||||
index 99adb3de8f367..a1b6fce057aea 100644
|
||||
--- a/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc
|
||||
+++ b/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc
|
||||
@@ -327,24 +327,38 @@ bool V4L2VideoDecodeAccelerator::CheckConfig(const Config& config) {
|
||||
|
||||
// Capabilities check.
|
||||
struct v4l2_capability caps;
|
||||
- const __u32 kCapsRequired = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING;
|
||||
- IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_QUERYCAP, &caps);
|
||||
- if ((caps.capabilities & kCapsRequired) != kCapsRequired) {
|
||||
- VLOGF(1) << "ioctl() failed: VIDIOC_QUERYCAP"
|
||||
- << ", caps check failed: 0x" << std::hex << caps.capabilities;
|
||||
+ unsigned int device_caps;
|
||||
+ enum v4l2_buf_type input_type, output_type;
|
||||
+ if (device_->Ioctl(VIDIOC_QUERYCAP, &caps) != 0) {
|
||||
+ VPLOGF(1) << "ioctl() failed: VIDIOC_QUERYCAP"
|
||||
+ << ", caps check failed: 0x" << std::hex << caps.capabilities;
|
||||
return false;
|
||||
}
|
||||
|
||||
+ if (caps.capabilities & V4L2_CAP_DEVICE_CAPS)
|
||||
+ device_caps = caps.device_caps;
|
||||
+ else
|
||||
+ device_caps = caps.capabilities;
|
||||
+
|
||||
+ if (device_caps & (V4L2_CAP_VIDEO_OUTPUT_MPLANE | V4L2_CAP_VIDEO_M2M_MPLANE))
|
||||
+ input_type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
|
||||
+ else
|
||||
+ input_type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
|
||||
+ if (device_caps & (V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_VIDEO_M2M_MPLANE))
|
||||
+ output_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
|
||||
+ else
|
||||
+ output_type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
+
|
||||
workarounds_ =
|
||||
CreateV4L2StatefulWorkarounds(V4L2Device::Type::kDecoder, config.profile);
|
||||
|
||||
output_mode_ = config.output_mode;
|
||||
|
||||
- input_queue_ = device_->GetQueue(V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
|
||||
+ input_queue_ = device_->GetQueue(input_type);
|
||||
if (!input_queue_)
|
||||
return false;
|
||||
|
||||
- output_queue_ = device_->GetQueue(V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
|
||||
+ output_queue_ = device_->GetQueue(output_type);
|
||||
if (!output_queue_)
|
||||
return false;
|
||||
|
||||
diff --git a/media/gpu/v4l2/v4l2_device.cc b/media/gpu/v4l2/v4l2_device.cc
|
||||
index 40e463cbed435..c06a57a6f0df7 100644
|
||||
index ebbf240a3c5e7..c04873fe2ae84 100644
|
||||
--- a/media/gpu/v4l2/v4l2_device.cc
|
||||
+++ b/media/gpu/v4l2/v4l2_device.cc
|
||||
@@ -92,6 +92,8 @@ scoped_refptr<V4L2Queue> V4L2Device::GetQueue(enum v4l2_buf_type type) {
|
||||
|
@ -75,7 +25,7 @@ index 40e463cbed435..c06a57a6f0df7 100644
|
|||
break;
|
||||
default:
|
||||
VLOGF(1) << "Unsupported V4L2 queue type: " << type;
|
||||
@@ -598,9 +600,17 @@ V4L2Device::EnumerateSupportedDecodeProfiles(
|
||||
@@ -538,9 +540,17 @@ V4L2Device::EnumerateSupportedDecodeProfiles(
|
||||
const std::vector<uint32_t>& pixelformats) {
|
||||
VideoDecodeAccelerator::SupportedProfiles profiles;
|
||||
|
||||
|
@ -95,7 +45,7 @@ index 40e463cbed435..c06a57a6f0df7 100644
|
|||
|
||||
for (uint32_t pixelformat : v4l2_codecs_as_pix_fmts) {
|
||||
if (!base::Contains(pixelformats, pixelformat)) {
|
||||
@@ -914,27 +924,28 @@ void V4L2Device::EnumerateDevicesForType(Type type) {
|
||||
@@ -859,27 +869,28 @@ void V4L2Device::EnumerateDevicesForType(Type type) {
|
||||
static const std::string kJpegEncoderDevicePattern = "/dev/jpeg-enc";
|
||||
|
||||
std::string device_pattern;
|
||||
|
@ -130,15 +80,15 @@ index 40e463cbed435..c06a57a6f0df7 100644
|
|||
break;
|
||||
}
|
||||
|
||||
@@ -954,6 +965,7 @@ void V4L2Device::EnumerateDevicesForType(Type type) {
|
||||
@@ -899,6 +910,7 @@ void V4L2Device::EnumerateDevicesForType(Type type) {
|
||||
|
||||
Devices devices;
|
||||
for (const auto& path : candidate_paths) {
|
||||
+ for (const auto& buf_type : candidate_buf_types){
|
||||
if (!OpenDevicePath(path, type)) {
|
||||
if (!OpenDevicePath(path)) {
|
||||
continue;
|
||||
}
|
||||
@@ -967,6 +979,7 @@ void V4L2Device::EnumerateDevicesForType(Type type) {
|
||||
@@ -912,6 +924,7 @@ void V4L2Device::EnumerateDevicesForType(Type type) {
|
||||
|
||||
CloseDevice();
|
||||
}
|
||||
|
@ -146,6 +96,47 @@ index 40e463cbed435..c06a57a6f0df7 100644
|
|||
|
||||
DCHECK_EQ(devices_by_type_.count(type), 0u);
|
||||
devices_by_type_[type] = devices;
|
||||
diff --git a/media/gpu/v4l2/v4l2_video_decoder.cc b/media/gpu/v4l2/v4l2_video_decoder.cc
|
||||
index 5765761592344..857576ae56d6a 100644
|
||||
--- a/media/gpu/v4l2/v4l2_video_decoder.cc
|
||||
+++ b/media/gpu/v4l2/v4l2_video_decoder.cc
|
||||
@@ -454,17 +454,28 @@ V4L2Status V4L2VideoDecoder::InitializeBackend() {
|
||||
#endif // BUILDFLAG(USE_CHROMEOS_PROTECTED_MEDIA)
|
||||
|
||||
struct v4l2_capability caps;
|
||||
- const __u32 kCapsRequired = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING;
|
||||
- if (device_->Ioctl(VIDIOC_QUERYCAP, &caps) ||
|
||||
- (caps.capabilities & kCapsRequired) != kCapsRequired) {
|
||||
- VLOGF(1) << "ioctl() failed: VIDIOC_QUERYCAP, "
|
||||
- << "caps check failed: 0x" << std::hex << caps.capabilities;
|
||||
+ unsigned int device_caps;
|
||||
+ enum v4l2_buf_type input_type, output_type;
|
||||
+ if (device_->Ioctl(VIDIOC_QUERYCAP, &caps) != 0)
|
||||
return V4L2Status::Codes::kFailedFileCapabilitiesCheck;
|
||||
- }
|
||||
+
|
||||
+ if (caps.capabilities & V4L2_CAP_DEVICE_CAPS)
|
||||
+ device_caps = caps.device_caps;
|
||||
+ else
|
||||
+ device_caps = caps.capabilities;
|
||||
+
|
||||
+ if (device_caps & (V4L2_CAP_VIDEO_OUTPUT_MPLANE | V4L2_CAP_VIDEO_M2M_MPLANE))
|
||||
+ input_type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
|
||||
+ else
|
||||
+ input_type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
|
||||
+ if (device_caps & (V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_VIDEO_M2M_MPLANE))
|
||||
+ output_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
|
||||
+ else
|
||||
+ output_type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
|
||||
// Create Input/Output V4L2Queue
|
||||
- input_queue_ = device_->GetQueue(V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
|
||||
- output_queue_ = device_->GetQueue(V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
|
||||
+ input_queue_ = device_->GetQueue(input_type);
|
||||
+ output_queue_ = device_->GetQueue(output_type);
|
||||
if (!input_queue_ || !output_queue_) {
|
||||
VLOGF(1) << "Failed to create V4L2 queue.";
|
||||
return V4L2Status::Codes::kFailedResourceAllocation;
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
From 248ca1e752826bde9f44a6c30d82f2158852311f Mon Sep 17 00:00:00 2001
|
||||
From 1dec452c446aaa8ab37c75bf0bcae9f8ea8b3fea Mon Sep 17 00:00:00 2001
|
||||
From: Hou Qi <qi.hou@nxp.com>
|
||||
Date: Wed, 1 Nov 2023 23:27:25 +0900
|
||||
Subject: [PATCH 05/19] V4L2Buffer: Allocate correct v4l2 buffers for queues
|
||||
Date: Fri, 13 Sep 2024 22:39:10 +0900
|
||||
Subject: [PATCH 04/19] V4L2Buffer: Allocate correct v4l2 buffers for queues
|
||||
|
||||
For single plane queue, need to fill v4l2_planes_[0] with
|
||||
correct size quried from v4l2 driver.
|
||||
|
@ -12,10 +12,10 @@ Upstream-Status: Inappropriate [NXP specific]
|
|||
1 file changed, 27 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/media/gpu/v4l2/v4l2_queue.cc b/media/gpu/v4l2/v4l2_queue.cc
|
||||
index 742e046ad2126..c368e2a80e0e5 100644
|
||||
index 4851e5b5255c0..8bcf8101f3a20 100644
|
||||
--- a/media/gpu/v4l2/v4l2_queue.cc
|
||||
+++ b/media/gpu/v4l2/v4l2_queue.cc
|
||||
@@ -224,24 +224,28 @@ V4L2Buffer::V4L2Buffer(const IoctlAsCallback& ioctl_cb,
|
||||
@@ -237,24 +237,28 @@ V4L2Buffer::V4L2Buffer(const IoctlAsCallback& ioctl_cb,
|
||||
DCHECK(V4L2_TYPE_IS_MULTIPLANAR(type));
|
||||
DCHECK_LE(format.fmt.pix_mp.num_planes, std::size(v4l2_planes_));
|
||||
|
||||
|
@ -53,7 +53,7 @@ index 742e046ad2126..c368e2a80e0e5 100644
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -254,6 +258,13 @@ bool V4L2Buffer::Query() {
|
||||
@@ -268,6 +272,13 @@ bool V4L2Buffer::Query() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ index 742e046ad2126..c368e2a80e0e5 100644
|
|||
DCHECK(plane_mappings_.size() == v4l2_buffer_.length);
|
||||
|
||||
return true;
|
||||
@@ -277,9 +288,13 @@ void* V4L2Buffer::GetPlaneMapping(const size_t plane) {
|
||||
@@ -291,9 +302,13 @@ void* V4L2Buffer::GetPlaneMapping(const size_t plane) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ index 742e046ad2126..c368e2a80e0e5 100644
|
|||
if (p == MAP_FAILED) {
|
||||
VPLOGF(1) << "mmap() failed: ";
|
||||
return nullptr;
|
||||
@@ -1121,7 +1136,7 @@ size_t V4L2Queue::AllocateBuffers(size_t count,
|
||||
@@ -1177,7 +1192,7 @@ size_t V4L2Queue::AllocateBuffers(size_t count,
|
||||
VQLOGF(1) << "Cannot get format.";
|
||||
return 0;
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ index 742e046ad2126..c368e2a80e0e5 100644
|
|||
+ planes_count_ = V4L2_TYPE_IS_MULTIPLANAR(format->type) ? format->fmt.pix_mp.num_planes : 1;
|
||||
DCHECK_LE(planes_count_, static_cast<size_t>(VIDEO_MAX_PLANES));
|
||||
|
||||
const __u8 coherency = incoherent ? V4L2_MEMORY_FLAG_NON_COHERENT : 0;
|
||||
__u8 flags = incoherent ? V4L2_MEMORY_FLAG_NON_COHERENT : 0;
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
From 8f6f7419a49150f5fee8b7748f5622ce2429f32c Mon Sep 17 00:00:00 2001
|
||||
From 41cb3357eeace1686fa453ec3c18c01c879f58c9 Mon Sep 17 00:00:00 2001
|
||||
From: Hou Qi <qi.hou@nxp.com>
|
||||
Date: Wed, 1 Nov 2023 23:41:23 +0900
|
||||
Subject: [PATCH 06/19] V4L2VDA: Create videoframe according to v4l2buffer
|
||||
Date: Fri, 13 Sep 2024 22:43:15 +0900
|
||||
Subject: [PATCH 05/19] V4L2VideoDecoder: Create videoframe according to
|
||||
v4l2buffer
|
||||
|
||||
Upstream-Status: Inappropriate [NXP specific]
|
||||
---
|
||||
|
@ -10,10 +11,10 @@ Upstream-Status: Inappropriate [NXP specific]
|
|||
2 files changed, 48 insertions(+), 22 deletions(-)
|
||||
|
||||
diff --git a/media/gpu/v4l2/v4l2_queue.cc b/media/gpu/v4l2/v4l2_queue.cc
|
||||
index c368e2a80e0e5..aa7848d1be5a1 100644
|
||||
index 8bcf8101f3a20..ffa94c3d2c9f8 100644
|
||||
--- a/media/gpu/v4l2/v4l2_queue.cc
|
||||
+++ b/media/gpu/v4l2/v4l2_queue.cc
|
||||
@@ -320,7 +320,7 @@ scoped_refptr<VideoFrame> V4L2Buffer::CreateVideoFrame() {
|
||||
@@ -334,7 +334,7 @@ scoped_refptr<FrameResource> V4L2Buffer::CreateFrame() {
|
||||
}
|
||||
|
||||
std::vector<base::ScopedFD> dmabuf_fds = GetDmabufsForV4L2Buffer(
|
||||
|
@ -22,7 +23,7 @@ index c368e2a80e0e5..aa7848d1be5a1 100644
|
|||
static_cast<enum v4l2_buf_type>(v4l2_buffer_.type));
|
||||
if (dmabuf_fds.empty()) {
|
||||
VLOGF(1) << "Failed to get DMABUFs of V4L2 buffer";
|
||||
@@ -347,7 +347,10 @@ scoped_refptr<VideoFrame> V4L2Buffer::CreateVideoFrame() {
|
||||
@@ -361,7 +361,10 @@ scoped_refptr<FrameResource> V4L2Buffer::CreateFrame() {
|
||||
dmabuf_fds.emplace_back(duped_fd);
|
||||
}
|
||||
|
||||
|
@ -32,20 +33,20 @@ index c368e2a80e0e5..aa7848d1be5a1 100644
|
|||
+ else
|
||||
+ gfx::Size size(format_.fmt.pix.width, format_.fmt.pix.height);
|
||||
|
||||
return VideoFrame::WrapExternalDmabufs(
|
||||
return NativePixmapFrameResource::Create(
|
||||
*layout, gfx::Rect(size), size, std::move(dmabuf_fds), base::TimeDelta());
|
||||
diff --git a/media/gpu/v4l2/v4l2_utils.cc b/media/gpu/v4l2/v4l2_utils.cc
|
||||
index 44b46026045e0..d20746d6a8a2d 100644
|
||||
index bb3ffb4f4642b..06b4329764b3f 100644
|
||||
--- a/media/gpu/v4l2/v4l2_utils.cc
|
||||
+++ b/media/gpu/v4l2/v4l2_utils.cc
|
||||
@@ -201,13 +201,9 @@ size_t GetNumPlanesOfV4L2PixFmt(uint32_t pix_fmt) {
|
||||
@@ -219,13 +219,9 @@ size_t GetNumPlanesOfV4L2PixFmt(uint32_t pix_fmt) {
|
||||
|
||||
absl::optional<VideoFrameLayout> V4L2FormatToVideoFrameLayout(
|
||||
std::optional<VideoFrameLayout> V4L2FormatToVideoFrameLayout(
|
||||
const struct v4l2_format& format) {
|
||||
- if (!V4L2_TYPE_IS_MULTIPLANAR(format.type)) {
|
||||
- VLOGF(1) << "v4l2_buf_type is not multiplanar: " << std::hex << "0x"
|
||||
- << format.type;
|
||||
- return absl::nullopt;
|
||||
- return std::nullopt;
|
||||
- }
|
||||
const v4l2_pix_format_mplane& pix_mp = format.fmt.pix_mp;
|
||||
- const uint32_t& pix_fmt = pix_mp.pixelformat;
|
||||
|
@ -54,8 +55,8 @@ index 44b46026045e0..d20746d6a8a2d 100644
|
|||
const auto video_fourcc = Fourcc::FromV4L2PixFmt(pix_fmt);
|
||||
if (!video_fourcc) {
|
||||
VLOGF(1) << "Failed to convert pixel format to VideoPixelFormat: "
|
||||
@@ -215,7 +211,7 @@ absl::optional<VideoFrameLayout> V4L2FormatToVideoFrameLayout(
|
||||
return absl::nullopt;
|
||||
@@ -233,7 +229,7 @@ std::optional<VideoFrameLayout> V4L2FormatToVideoFrameLayout(
|
||||
return std::nullopt;
|
||||
}
|
||||
const VideoPixelFormat video_format = video_fourcc->ToVideoPixelFormat();
|
||||
- const size_t num_buffers = pix_mp.num_planes;
|
||||
|
@ -63,7 +64,7 @@ index 44b46026045e0..d20746d6a8a2d 100644
|
|||
const size_t num_color_planes = VideoFrame::NumPlanes(video_format);
|
||||
if (num_color_planes == 0) {
|
||||
VLOGF(1) << "Unsupported video format for NumPlanes(): "
|
||||
@@ -233,9 +229,17 @@ absl::optional<VideoFrameLayout> V4L2FormatToVideoFrameLayout(
|
||||
@@ -251,9 +247,17 @@ std::optional<VideoFrameLayout> V4L2FormatToVideoFrameLayout(
|
||||
std::vector<ColorPlaneLayout> planes;
|
||||
planes.reserve(num_color_planes);
|
||||
for (size_t i = 0; i < num_buffers; ++i) {
|
||||
|
@ -84,7 +85,7 @@ index 44b46026045e0..d20746d6a8a2d 100644
|
|||
}
|
||||
// For the case that #color planes > #buffers, it fills stride of color
|
||||
// plane which does not map to buffer.
|
||||
@@ -249,8 +253,12 @@ absl::optional<VideoFrameLayout> V4L2FormatToVideoFrameLayout(
|
||||
@@ -267,8 +271,12 @@ std::optional<VideoFrameLayout> V4L2FormatToVideoFrameLayout(
|
||||
case V4L2_PIX_FMT_NV12:
|
||||
// The stride of UV is the same as Y in NV12.
|
||||
// The height is half of Y plane.
|
||||
|
@ -99,7 +100,7 @@ index 44b46026045e0..d20746d6a8a2d 100644
|
|||
DCHECK_EQ(2u, planes.size());
|
||||
break;
|
||||
case V4L2_PIX_FMT_YUV420:
|
||||
@@ -258,13 +266,18 @@ absl::optional<VideoFrameLayout> V4L2FormatToVideoFrameLayout(
|
||||
@@ -276,13 +284,18 @@ std::optional<VideoFrameLayout> V4L2FormatToVideoFrameLayout(
|
||||
// The spec claims that two Cx rows (including padding) is exactly as
|
||||
// long as one Y row (including padding). So stride of Y must be even
|
||||
// number.
|
||||
|
@ -107,12 +108,12 @@ index 44b46026045e0..d20746d6a8a2d 100644
|
|||
+ if (V4L2_TYPE_IS_MULTIPLANAR(format.type) && (y_stride % 2 != 0 || pix_mp.height % 2 != 0)) {
|
||||
VLOGF(1) << "Plane-Y stride and height should be even; stride: "
|
||||
<< y_stride << ", height: " << pix_mp.height;
|
||||
return absl::nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
+ else if (!V4L2_TYPE_IS_MULTIPLANAR(format.type) && (y_stride % 2 != 0 || pix.height % 2 != 0)){
|
||||
+ VLOGF(1) << "Plane-Y stride and height should be even; stride: "
|
||||
+ << y_stride << ", height: " << pix.height;
|
||||
+ return absl::nullopt;
|
||||
+ return std::nullopt;
|
||||
+ }
|
||||
const int32_t half_stride = y_stride / 2;
|
||||
- const size_t plane_0_area = y_stride_abs * pix_mp.height;
|
||||
|
@ -120,7 +121,7 @@ index 44b46026045e0..d20746d6a8a2d 100644
|
|||
const size_t plane_1_area = plane_0_area / 4;
|
||||
planes.emplace_back(half_stride, plane_0_area, plane_1_area);
|
||||
planes.emplace_back(half_stride, plane_0_area + plane_1_area,
|
||||
@@ -283,13 +296,23 @@ absl::optional<VideoFrameLayout> V4L2FormatToVideoFrameLayout(
|
||||
@@ -301,13 +314,23 @@ std::optional<VideoFrameLayout> V4L2FormatToVideoFrameLayout(
|
||||
// such devices individually, so set this as a video frame layout property.
|
||||
constexpr size_t buffer_alignment = 0x1000;
|
||||
if (num_buffers == 1) {
|
|
@ -0,0 +1,114 @@
|
|||
From 7efe2eff075518ed1c7342ab35ea084fb8754b54 Mon Sep 17 00:00:00 2001
|
||||
From: Hou Qi <qi.hou@nxp.com>
|
||||
Date: Fri, 13 Sep 2024 22:46:22 +0900
|
||||
Subject: [PATCH 06/19] V4L2VideoDecoder: Add function IsMultiQueue for S_FMT
|
||||
and G_FMT
|
||||
|
||||
Function IsMultiQueue() is used to set correct fotmat type for
|
||||
8M and 8Q.
|
||||
|
||||
Upstream-Status: Inappropriate [NXP specific]
|
||||
---
|
||||
media/gpu/v4l2/v4l2_queue.cc | 36 +++++++++++++++++++++-------
|
||||
media/gpu/v4l2/v4l2_queue.h | 1 +
|
||||
media/gpu/v4l2/v4l2_video_decoder.cc | 4 ++--
|
||||
3 files changed, 31 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/media/gpu/v4l2/v4l2_queue.cc b/media/gpu/v4l2/v4l2_queue.cc
|
||||
index ffa94c3d2c9f8..5eae387499eec 100644
|
||||
--- a/media/gpu/v4l2/v4l2_queue.cc
|
||||
+++ b/media/gpu/v4l2/v4l2_queue.cc
|
||||
@@ -41,11 +41,18 @@ struct v4l2_format BuildV4L2Format(const enum v4l2_buf_type type,
|
||||
struct v4l2_format format;
|
||||
memset(&format, 0, sizeof(format));
|
||||
format.type = type;
|
||||
- format.fmt.pix_mp.pixelformat = fourcc;
|
||||
- format.fmt.pix_mp.width = size.width();
|
||||
- format.fmt.pix_mp.height = size.height();
|
||||
- format.fmt.pix_mp.num_planes = GetNumPlanesOfV4L2PixFmt(fourcc);
|
||||
- format.fmt.pix_mp.plane_fmt[0].sizeimage = buffer_size;
|
||||
+ if (V4L2_TYPE_IS_MULTIPLANAR(type)) {
|
||||
+ format.fmt.pix_mp.pixelformat = fourcc;
|
||||
+ format.fmt.pix_mp.width = size.width();
|
||||
+ format.fmt.pix_mp.height = size.height();
|
||||
+ format.fmt.pix_mp.num_planes = GetNumPlanesOfV4L2PixFmt(fourcc);
|
||||
+ format.fmt.pix_mp.plane_fmt[0].sizeimage = buffer_size;
|
||||
+ } else {
|
||||
+ format.fmt.pix.pixelformat = fourcc;
|
||||
+ format.fmt.pix.width = size.width();
|
||||
+ format.fmt.pix.height = size.height();
|
||||
+ format.fmt.pix.sizeimage = buffer_size;
|
||||
+ }
|
||||
|
||||
return format;
|
||||
}
|
||||
@@ -506,9 +513,13 @@ V4L2BufferRefBase::V4L2BufferRefBase(const struct v4l2_buffer& v4l2_buffer,
|
||||
DCHECK(return_to_);
|
||||
|
||||
memcpy(&v4l2_buffer_, &v4l2_buffer, sizeof(v4l2_buffer_));
|
||||
- memcpy(v4l2_planes_, v4l2_buffer.m.planes,
|
||||
- sizeof(struct v4l2_plane) * v4l2_buffer.length);
|
||||
- v4l2_buffer_.m.planes = v4l2_planes_;
|
||||
+ if (V4L2_TYPE_IS_MULTIPLANAR(v4l2_buffer.type)) {
|
||||
+ memcpy(v4l2_planes_, v4l2_buffer.m.planes,
|
||||
+ sizeof(struct v4l2_plane) * v4l2_buffer.length);
|
||||
+ v4l2_buffer_.m.planes = v4l2_planes_;
|
||||
+ } else {
|
||||
+ memcpy(&v4l2_planes_[0].m, &v4l2_buffer.m, sizeof(v4l2_buffer.m));
|
||||
+ }
|
||||
}
|
||||
|
||||
V4L2BufferRefBase::~V4L2BufferRefBase() {
|
||||
@@ -1566,6 +1577,15 @@ bool V4L2Queue::Streamoff() {
|
||||
return true;
|
||||
}
|
||||
|
||||
+bool V4L2Queue::IsMultiQueue() {
|
||||
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
+
|
||||
+ if (type_ == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE || type_ == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
|
||||
+ return true;
|
||||
+ else
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
size_t V4L2Queue::AllocatedBuffersCount() const {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
|
||||
diff --git a/media/gpu/v4l2/v4l2_queue.h b/media/gpu/v4l2/v4l2_queue.h
|
||||
index 4713ea3eebcfd..85c7920417935 100644
|
||||
--- a/media/gpu/v4l2/v4l2_queue.h
|
||||
+++ b/media/gpu/v4l2/v4l2_queue.h
|
||||
@@ -534,6 +534,7 @@ class MEDIA_GPU_EXPORT V4L2Queue
|
||||
// still be using them.
|
||||
[[nodiscard]] bool Streamoff();
|
||||
|
||||
+ [[nodiscard]] bool IsMultiQueue();
|
||||
// Returns the number of buffers currently allocated for this queue.
|
||||
[[nodiscard]] size_t AllocatedBuffersCount() const;
|
||||
// Returns the number of currently free buffers on this queue.
|
||||
diff --git a/media/gpu/v4l2/v4l2_video_decoder.cc b/media/gpu/v4l2/v4l2_video_decoder.cc
|
||||
index 857576ae56d6a..4a2591f092f42 100644
|
||||
--- a/media/gpu/v4l2/v4l2_video_decoder.cc
|
||||
+++ b/media/gpu/v4l2/v4l2_video_decoder.cc
|
||||
@@ -608,7 +608,7 @@ bool V4L2VideoDecoder::SetupInputFormat() {
|
||||
// Check if the format is supported.
|
||||
const auto v4l2_codecs_as_pix_fmts = EnumerateSupportedPixFmts(
|
||||
base::BindRepeating(&V4L2Device::Ioctl, device_),
|
||||
- V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
|
||||
+ input_queue_->IsMultiQueue() ? V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE : V4L2_BUF_TYPE_VIDEO_OUTPUT);
|
||||
if (!base::Contains(v4l2_codecs_as_pix_fmts, input_format_fourcc_)) {
|
||||
DVLOGF(1) << FourccToString(input_format_fourcc_)
|
||||
<< " not recognised, skipping...";
|
||||
@@ -677,7 +677,7 @@ CroStatus V4L2VideoDecoder::SetupOutputFormat(const gfx::Size& size,
|
||||
|
||||
const auto v4l2_pix_fmts = EnumerateSupportedPixFmts(
|
||||
base::BindRepeating(&V4L2Device::Ioctl, device_),
|
||||
- V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
|
||||
+ output_queue_->IsMultiQueue() ? V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE : V4L2_BUF_TYPE_VIDEO_CAPTURE);
|
||||
|
||||
std::vector<PixelLayoutCandidate> candidates;
|
||||
for (const uint32_t& pixfmt : v4l2_pix_fmts) {
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -1,183 +0,0 @@
|
|||
From 33f42541cfe6d9cf2a904e8ff5a95a6f3daae592 Mon Sep 17 00:00:00 2001
|
||||
From: Hou Qi <qi.hou@nxp.com>
|
||||
Date: Wed, 1 Nov 2023 23:47:31 +0900
|
||||
Subject: [PATCH 07/19] V4L2VDA: Add function IsMultiQueue for S_FMT and G_FMT
|
||||
|
||||
Function IsMultiQueue() is used to set correct fotmat type for
|
||||
8M and 8Q.
|
||||
|
||||
Upstream-Status: Inappropriate [NXP specific]
|
||||
---
|
||||
.../legacy/v4l2_video_decode_accelerator.cc | 49 +++++++++++++++----
|
||||
media/gpu/v4l2/v4l2_queue.cc | 36 +++++++++++---
|
||||
media/gpu/v4l2/v4l2_queue.h | 1 +
|
||||
3 files changed, 68 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc b/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc
|
||||
index a1b6fce057aea..674e81432fc6f 100644
|
||||
--- a/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc
|
||||
+++ b/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc
|
||||
@@ -2193,12 +2193,30 @@ bool V4L2VideoDecodeAccelerator::GetFormatInfo(struct v4l2_format* format,
|
||||
}
|
||||
|
||||
// Make sure we are still getting the format we set on initialization.
|
||||
- if (format->fmt.pix_mp.pixelformat != output_format_fourcc_->ToV4L2PixFmt()) {
|
||||
+ unsigned int pixelformat = V4L2_TYPE_IS_MULTIPLANAR(format->type) ?
|
||||
+ format->fmt.pix_mp.pixelformat : format->fmt.pix.pixelformat;
|
||||
+ if (pixelformat != output_format_fourcc_->ToV4L2PixFmt()) {
|
||||
VLOGF(1) << "Unexpected format from G_FMT on output";
|
||||
return false;
|
||||
}
|
||||
|
||||
- gfx::Size coded_size(format->fmt.pix_mp.width, format->fmt.pix_mp.height);
|
||||
+ int width, height;
|
||||
+ if (V4L2_TYPE_IS_MULTIPLANAR(format->type)) {
|
||||
+ width = format->fmt.pix_mp.width;
|
||||
+ height = format->fmt.pix_mp.height;
|
||||
+ if ((format->fmt.pix_mp.width == 0) && (format->fmt.pix_mp.height == 0))
|
||||
+ {
|
||||
+ *again = true;
|
||||
+ VLOG(1)<<"As got width=height=0 again";
|
||||
+ } else {
|
||||
+ VLOG(1)<<"format wxh" << format->fmt.pix_mp.width << "x" << format->fmt.pix_mp.height;
|
||||
+ }
|
||||
+ } else {
|
||||
+ width = format->fmt.pix.width;
|
||||
+ height = format->fmt.pix.height;
|
||||
+ }
|
||||
+
|
||||
+ gfx::Size coded_size(width, height);
|
||||
if (visible_size != nullptr)
|
||||
*visible_size = GetVisibleSize(coded_size);
|
||||
|
||||
@@ -2305,7 +2323,7 @@ bool V4L2VideoDecodeAccelerator::SetupFormats() {
|
||||
|
||||
struct v4l2_fmtdesc fmtdesc;
|
||||
memset(&fmtdesc, 0, sizeof(fmtdesc));
|
||||
- fmtdesc.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
|
||||
+ fmtdesc.type = input_queue_->IsMultiQueue() ? V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE : V4L2_BUF_TYPE_VIDEO_OUTPUT;
|
||||
bool is_format_supported = false;
|
||||
while (device_->Ioctl(VIDIOC_ENUM_FMT, &fmtdesc) == 0) {
|
||||
if (fmtdesc.pixelformat == input_format_fourcc_) {
|
||||
@@ -2323,10 +2341,16 @@ bool V4L2VideoDecodeAccelerator::SetupFormats() {
|
||||
|
||||
struct v4l2_format format;
|
||||
memset(&format, 0, sizeof(format));
|
||||
- format.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
|
||||
- format.fmt.pix_mp.pixelformat = input_format_fourcc_;
|
||||
- format.fmt.pix_mp.plane_fmt[0].sizeimage = input_size;
|
||||
- format.fmt.pix_mp.num_planes = 1;
|
||||
+ if (input_queue_->IsMultiQueue()) {
|
||||
+ format.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
|
||||
+ format.fmt.pix_mp.pixelformat = input_format_fourcc_;
|
||||
+ format.fmt.pix_mp.plane_fmt[0].sizeimage = input_size;
|
||||
+ format.fmt.pix_mp.num_planes = 1;
|
||||
+ } else {
|
||||
+ format.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
|
||||
+ format.fmt.pix.pixelformat = input_format_fourcc_;
|
||||
+ format.fmt.pix.sizeimage = input_size;
|
||||
+ }
|
||||
IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_S_FMT, &format);
|
||||
DCHECK_EQ(format.fmt.pix_mp.pixelformat, input_format_fourcc_);
|
||||
|
||||
@@ -2334,7 +2358,7 @@ bool V4L2VideoDecodeAccelerator::SetupFormats() {
|
||||
// changing it once we start streaming; whether it can support our chosen
|
||||
// output format or not may depend on the input format.
|
||||
memset(&fmtdesc, 0, sizeof(fmtdesc));
|
||||
- fmtdesc.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
|
||||
+ fmtdesc.type = output_queue_->IsMultiQueue() ? V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE : V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
while (device_->Ioctl(VIDIOC_ENUM_FMT, &fmtdesc) == 0) {
|
||||
auto fourcc = Fourcc::FromV4L2PixFmt(fmtdesc.pixelformat);
|
||||
if (fourcc && device_->CanCreateEGLImageFrom(*fourcc)) {
|
||||
@@ -2381,8 +2405,13 @@ bool V4L2VideoDecodeAccelerator::SetupFormats() {
|
||||
// Just set the fourcc for output; resolution, etc., will come from the
|
||||
// driver once it extracts it from the stream.
|
||||
memset(&format, 0, sizeof(format));
|
||||
- format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
|
||||
- format.fmt.pix_mp.pixelformat = output_format_fourcc_->ToV4L2PixFmt();
|
||||
+ if (output_queue_->IsMultiQueue()) {
|
||||
+ format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
|
||||
+ format.fmt.pix_mp.pixelformat = output_format_fourcc_->ToV4L2PixFmt();
|
||||
+ } else {
|
||||
+ format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
+ format.fmt.pix.pixelformat = output_format_fourcc_->ToV4L2PixFmt();
|
||||
+ }
|
||||
IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_S_FMT, &format);
|
||||
DCHECK_EQ(format.fmt.pix_mp.pixelformat,
|
||||
output_format_fourcc_->ToV4L2PixFmt());
|
||||
diff --git a/media/gpu/v4l2/v4l2_queue.cc b/media/gpu/v4l2/v4l2_queue.cc
|
||||
index aa7848d1be5a1..5394b21e5ff1d 100644
|
||||
--- a/media/gpu/v4l2/v4l2_queue.cc
|
||||
+++ b/media/gpu/v4l2/v4l2_queue.cc
|
||||
@@ -36,11 +36,18 @@ struct v4l2_format BuildV4L2Format(const enum v4l2_buf_type type,
|
||||
struct v4l2_format format;
|
||||
memset(&format, 0, sizeof(format));
|
||||
format.type = type;
|
||||
- format.fmt.pix_mp.pixelformat = fourcc;
|
||||
- format.fmt.pix_mp.width = size.width();
|
||||
- format.fmt.pix_mp.height = size.height();
|
||||
- format.fmt.pix_mp.num_planes = GetNumPlanesOfV4L2PixFmt(fourcc);
|
||||
- format.fmt.pix_mp.plane_fmt[0].sizeimage = buffer_size;
|
||||
+ if (V4L2_TYPE_IS_MULTIPLANAR(type)) {
|
||||
+ format.fmt.pix_mp.pixelformat = fourcc;
|
||||
+ format.fmt.pix_mp.width = size.width();
|
||||
+ format.fmt.pix_mp.height = size.height();
|
||||
+ format.fmt.pix_mp.num_planes = GetNumPlanesOfV4L2PixFmt(fourcc);
|
||||
+ format.fmt.pix_mp.plane_fmt[0].sizeimage = buffer_size;
|
||||
+ } else {
|
||||
+ format.fmt.pix.pixelformat = fourcc;
|
||||
+ format.fmt.pix.width = size.width();
|
||||
+ format.fmt.pix.height = size.height();
|
||||
+ format.fmt.pix.sizeimage = buffer_size;
|
||||
+ }
|
||||
|
||||
return format;
|
||||
}
|
||||
@@ -492,9 +499,13 @@ V4L2BufferRefBase::V4L2BufferRefBase(const struct v4l2_buffer& v4l2_buffer,
|
||||
DCHECK(return_to_);
|
||||
|
||||
memcpy(&v4l2_buffer_, &v4l2_buffer, sizeof(v4l2_buffer_));
|
||||
- memcpy(v4l2_planes_, v4l2_buffer.m.planes,
|
||||
- sizeof(struct v4l2_plane) * v4l2_buffer.length);
|
||||
- v4l2_buffer_.m.planes = v4l2_planes_;
|
||||
+ if (V4L2_TYPE_IS_MULTIPLANAR(v4l2_buffer.type)) {
|
||||
+ memcpy(v4l2_planes_, v4l2_buffer.m.planes,
|
||||
+ sizeof(struct v4l2_plane) * v4l2_buffer.length);
|
||||
+ v4l2_buffer_.m.planes = v4l2_planes_;
|
||||
+ } else {
|
||||
+ memcpy(&v4l2_planes_[0].m, &v4l2_buffer.m, sizeof(v4l2_buffer.m));
|
||||
+ }
|
||||
}
|
||||
|
||||
V4L2BufferRefBase::~V4L2BufferRefBase() {
|
||||
@@ -1457,6 +1468,15 @@ bool V4L2Queue::Streamoff() {
|
||||
return true;
|
||||
}
|
||||
|
||||
+bool V4L2Queue::IsMultiQueue() {
|
||||
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
+
|
||||
+ if (type_ == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE || type_ == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
|
||||
+ return true;
|
||||
+ else
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
size_t V4L2Queue::AllocatedBuffersCount() const {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
|
||||
diff --git a/media/gpu/v4l2/v4l2_queue.h b/media/gpu/v4l2/v4l2_queue.h
|
||||
index c9642a4124475..c45735a58f074 100644
|
||||
--- a/media/gpu/v4l2/v4l2_queue.h
|
||||
+++ b/media/gpu/v4l2/v4l2_queue.h
|
||||
@@ -520,6 +520,7 @@ class MEDIA_GPU_EXPORT V4L2Queue
|
||||
// still be using them.
|
||||
[[nodiscard]] bool Streamoff();
|
||||
|
||||
+ [[nodiscard]] bool IsMultiQueue();
|
||||
// Returns the number of buffers currently allocated for this queue.
|
||||
[[nodiscard]] size_t AllocatedBuffersCount() const;
|
||||
// Returns the number of currently free buffers on this queue.
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
From 7a139ec891eab944b6ac834bc96331f99fc6b7c2 Mon Sep 17 00:00:00 2001
|
||||
From 90edd752075e29ac990da5ac52ccd5721c15853a Mon Sep 17 00:00:00 2001
|
||||
From: Hou Qi <qi.hou@nxp.com>
|
||||
Date: Wed, 1 Nov 2023 23:53:06 +0900
|
||||
Subject: [PATCH 09/19] V4L2VDA: Use correct plane size and bytesused
|
||||
Date: Fri, 13 Sep 2024 22:48:10 +0900
|
||||
Subject: [PATCH 07/19] V4L2VideoDecoder: Use correct plane size and bytesused
|
||||
|
||||
Upstream-Status: Inappropriate [NXP specific]
|
||||
---
|
||||
|
@ -9,10 +9,10 @@ Upstream-Status: Inappropriate [NXP specific]
|
|||
1 file changed, 16 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/media/gpu/v4l2/v4l2_queue.cc b/media/gpu/v4l2/v4l2_queue.cc
|
||||
index 5394b21e5ff1d..ab044ab03c7e7 100644
|
||||
index 5eae387499eec..afa5d91ddb4b4 100644
|
||||
--- a/media/gpu/v4l2/v4l2_queue.cc
|
||||
+++ b/media/gpu/v4l2/v4l2_queue.cc
|
||||
@@ -814,7 +814,10 @@ size_t V4L2WritableBufferRef::GetPlaneSize(const size_t plane) const {
|
||||
@@ -851,7 +851,10 @@ size_t V4L2WritableBufferRef::GetPlaneSize(const size_t plane) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ index 5394b21e5ff1d..ab044ab03c7e7 100644
|
|||
}
|
||||
|
||||
void V4L2WritableBufferRef::SetPlaneSize(const size_t plane,
|
||||
@@ -874,7 +877,10 @@ void V4L2WritableBufferRef::SetPlaneBytesUsed(const size_t plane,
|
||||
@@ -911,7 +914,10 @@ void V4L2WritableBufferRef::SetPlaneBytesUsed(const size_t plane,
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ index 5394b21e5ff1d..ab044ab03c7e7 100644
|
|||
}
|
||||
|
||||
size_t V4L2WritableBufferRef::GetPlaneBytesUsed(const size_t plane) const {
|
||||
@@ -886,7 +892,10 @@ size_t V4L2WritableBufferRef::GetPlaneBytesUsed(const size_t plane) const {
|
||||
@@ -923,7 +929,10 @@ size_t V4L2WritableBufferRef::GetPlaneBytesUsed(const size_t plane) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ index 5394b21e5ff1d..ab044ab03c7e7 100644
|
|||
}
|
||||
|
||||
void V4L2WritableBufferRef::SetPlaneDataOffset(const size_t plane,
|
||||
@@ -993,7 +1002,10 @@ size_t V4L2ReadableBuffer::GetPlaneBytesUsed(const size_t plane) const {
|
||||
@@ -1029,7 +1038,10 @@ size_t V4L2ReadableBuffer::GetPlaneBytesUsed(const size_t plane) const {
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
From 5d0d8c163f546fa71ca4e1f9472ab4e5dcf149cf Mon Sep 17 00:00:00 2001
|
||||
From: Hou Qi <qi.hou@nxp.com>
|
||||
Date: Wed, 1 Nov 2023 23:48:55 +0900
|
||||
Subject: [PATCH 08/19] V4L2VDA: Use correct size to allocate CAPTURE buffer
|
||||
|
||||
Upstream-Status: Inappropriate [NXP specific]
|
||||
---
|
||||
media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc | 9 ++++++---
|
||||
1 file changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc b/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc
|
||||
index 674e81432fc6f..4dd4508a63107 100644
|
||||
--- a/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc
|
||||
+++ b/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc
|
||||
@@ -2229,7 +2229,10 @@ bool V4L2VideoDecodeAccelerator::CreateBuffersForFormat(
|
||||
DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread());
|
||||
size_t egl_image_planes_count;
|
||||
|
||||
- coded_size_.SetSize(format.fmt.pix_mp.width, format.fmt.pix_mp.height);
|
||||
+ if (V4L2_TYPE_IS_MULTIPLANAR(format.type))
|
||||
+ coded_size_.SetSize(format.fmt.pix_mp.width, format.fmt.pix_mp.height);
|
||||
+ else
|
||||
+ coded_size_.SetSize(format.fmt.pix.width, format.fmt.pix.height);
|
||||
visible_size_ = visible_size;
|
||||
egl_image_size_ = coded_size_;
|
||||
if (image_processor_device_) {
|
||||
@@ -2247,11 +2250,11 @@ bool V4L2VideoDecodeAccelerator::CreateBuffersForFormat(
|
||||
// In practice, this applies to all Image Processors, i.e. Mediatek devices.
|
||||
DCHECK_EQ(coded_size_, output_size);
|
||||
} else {
|
||||
- egl_image_planes_count = format.fmt.pix_mp.num_planes;
|
||||
+ egl_image_planes_count = V4L2_TYPE_IS_MULTIPLANAR(format.type) ? format.fmt.pix_mp.num_planes : 1;
|
||||
}
|
||||
VLOGF(2) << "new resolution: " << coded_size_.ToString()
|
||||
<< ", visible size: " << visible_size_.ToString()
|
||||
- << ", decoder output planes count: " << format.fmt.pix_mp.num_planes
|
||||
+ << ", decoder output planes count: " << egl_image_planes_count
|
||||
<< ", EGLImage size: " << egl_image_size_.ToString()
|
||||
<< ", EGLImage plane count: " << egl_image_planes_count;
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -1,46 +1,33 @@
|
|||
From 214c8c31f4b9adbe8715f742635670094d3bdcac Mon Sep 17 00:00:00 2001
|
||||
From d297967d980eb8fa6f67ee723a625f35cec403ee Mon Sep 17 00:00:00 2001
|
||||
From: Hou Qi <qi.hou@nxp.com>
|
||||
Date: Thu, 2 Nov 2023 00:03:11 +0900
|
||||
Subject: [PATCH 10/19] V4L2VDA: Add hevc format support
|
||||
Date: Fri, 13 Sep 2024 22:50:43 +0900
|
||||
Subject: [PATCH 08/19] V4L2VideoDecoder: Add hevc format support
|
||||
|
||||
Upstream-Status: Inappropriate [NXP specific]
|
||||
---
|
||||
media/base/supported_types.cc | 2 +-
|
||||
media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc | 1 +
|
||||
media/gpu/v4l2/v4l2_utils.cc | 4 +++-
|
||||
media/media_options.gni | 2 +-
|
||||
4 files changed, 6 insertions(+), 3 deletions(-)
|
||||
media/base/supported_types.cc | 2 +-
|
||||
media/gpu/v4l2/v4l2_utils.cc | 4 +++-
|
||||
media/media_options.gni | 2 +-
|
||||
3 files changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/media/base/supported_types.cc b/media/base/supported_types.cc
|
||||
index ec5e5df9760ad..733732133efde 100644
|
||||
index de9d4be3b92e8..11ef3357e2376 100644
|
||||
--- a/media/base/supported_types.cc
|
||||
+++ b/media/base/supported_types.cc
|
||||
@@ -359,7 +359,7 @@ bool IsDefaultSupportedVideoType(const VideoType& type) {
|
||||
@@ -387,7 +387,7 @@ bool IsDefaultSupportedVideoType(const VideoType& type) {
|
||||
case VideoCodec::kVP9:
|
||||
return IsVp9ProfileSupported(type);
|
||||
case VideoCodec::kHEVC:
|
||||
- return IsHevcProfileSupported(type);
|
||||
+ return true;
|
||||
case VideoCodec::kMPEG4:
|
||||
return IsMPEG4Supported();
|
||||
case VideoCodec::kDolbyVision:
|
||||
diff --git a/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc b/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc
|
||||
index 4dd4508a63107..89a8976eb457d 100644
|
||||
--- a/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc
|
||||
+++ b/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc
|
||||
@@ -90,6 +90,7 @@ static const std::vector<uint32_t> kSupportedInputFourCCs = {
|
||||
V4L2_PIX_FMT_H264,
|
||||
V4L2_PIX_FMT_VP8,
|
||||
V4L2_PIX_FMT_VP9,
|
||||
+ V4L2_PIX_FMT_HEVC,
|
||||
};
|
||||
|
||||
// static
|
||||
return IsDolbyVisionProfileSupported(type);
|
||||
case VideoCodec::kUnknown:
|
||||
diff --git a/media/gpu/v4l2/v4l2_utils.cc b/media/gpu/v4l2/v4l2_utils.cc
|
||||
index d20746d6a8a2d..3b9264318c6f0 100644
|
||||
index 06b4329764b3f..8fbd4cfa10561 100644
|
||||
--- a/media/gpu/v4l2/v4l2_utils.cc
|
||||
+++ b/media/gpu/v4l2/v4l2_utils.cc
|
||||
@@ -459,7 +459,7 @@ void GetSupportedResolution(const IoctlAsCallback& ioctl_cb,
|
||||
@@ -537,7 +537,7 @@ void GetSupportedResolution(const IoctlAsCallback& ioctl_cb,
|
||||
uint32_t pixelformat,
|
||||
gfx::Size* min_resolution,
|
||||
gfx::Size* max_resolution) {
|
||||
|
@ -49,7 +36,7 @@ index d20746d6a8a2d..3b9264318c6f0 100644
|
|||
*max_resolution = kDefaultMaxCodedSize;
|
||||
constexpr gfx::Size kDefaultMinCodedSize(16, 16);
|
||||
*min_resolution = kDefaultMinCodedSize;
|
||||
@@ -502,6 +502,8 @@ uint32_t VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile,
|
||||
@@ -580,6 +580,8 @@ uint32_t VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile,
|
||||
return V4L2_PIX_FMT_VP8;
|
||||
} else if (profile >= VP9PROFILE_MIN && profile <= VP9PROFILE_MAX) {
|
||||
return V4L2_PIX_FMT_VP9;
|
||||
|
@ -59,10 +46,10 @@ index d20746d6a8a2d..3b9264318c6f0 100644
|
|||
return V4L2_PIX_FMT_HEVC;
|
||||
} else {
|
||||
diff --git a/media/media_options.gni b/media/media_options.gni
|
||||
index 40bad1426693a..5683f1988b572 100644
|
||||
index 1924017f9e7dd..0f1be96bf308e 100644
|
||||
--- a/media/media_options.gni
|
||||
+++ b/media/media_options.gni
|
||||
@@ -131,7 +131,7 @@ declare_args() {
|
||||
@@ -138,7 +138,7 @@ declare_args() {
|
||||
# applies to video-capable devices.
|
||||
enable_platform_hevc =
|
||||
proprietary_codecs && (enable_hevc_parser_and_hw_decoder ||
|
|
@ -1,7 +1,7 @@
|
|||
From 4467bd6a54593357a593a17ea9703395641c4eba Mon Sep 17 00:00:00 2001
|
||||
From ac51e4353acbe44ec8beef3f36715faa9568231c Mon Sep 17 00:00:00 2001
|
||||
From: Hou Qi <qi.hou@nxp.com>
|
||||
Date: Thu, 2 Nov 2023 11:26:12 +0900
|
||||
Subject: [PATCH 12/19] V4L2VDA: Add fps in SkiaOutputSurfaceImplOnGpu by
|
||||
Date: Fri, 11 Oct 2024 18:16:14 +0900
|
||||
Subject: [PATCH 09/19] display: Add fps in SkiaOutputSurfaceImplOnGpu by
|
||||
VLOG(1)
|
||||
|
||||
Upstream-Status: Inappropriate [NXP specific]
|
||||
|
@ -11,18 +11,18 @@ Upstream-Status: Inappropriate [NXP specific]
|
|||
2 files changed, 19 insertions(+)
|
||||
|
||||
diff --git a/components/viz/service/display_embedder/skia_output_surface_impl_on_gpu.cc b/components/viz/service/display_embedder/skia_output_surface_impl_on_gpu.cc
|
||||
index 2d82ab0f062c9..db11a0b994073 100644
|
||||
index 1ad55916b42a5..227173cd9bc76 100644
|
||||
--- a/components/viz/service/display_embedder/skia_output_surface_impl_on_gpu.cc
|
||||
+++ b/components/viz/service/display_embedder/skia_output_surface_impl_on_gpu.cc
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <string>
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
+#include <sys/time.h>
|
||||
|
||||
#include "base/debug/crash_logging.h"
|
||||
#include "base/debug/dump_without_crashing.h"
|
||||
@@ -131,6 +132,15 @@
|
||||
@@ -138,6 +139,15 @@
|
||||
#include "components/viz/service/display_embedder/output_presenter_fuchsia.h"
|
||||
#endif
|
||||
|
||||
|
@ -38,7 +38,7 @@ index 2d82ab0f062c9..db11a0b994073 100644
|
|||
namespace viz {
|
||||
|
||||
namespace {
|
||||
@@ -330,6 +340,7 @@ SkiaOutputSurfaceImplOnGpu::SkiaOutputSurfaceImplOnGpu(
|
||||
@@ -341,6 +351,7 @@ SkiaOutputSurfaceImplOnGpu::SkiaOutputSurfaceImplOnGpu(
|
||||
async_read_result_lock_(base::MakeRefCounted<AsyncReadResultLock>()) {
|
||||
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
|
||||
|
||||
|
@ -46,7 +46,7 @@ index 2d82ab0f062c9..db11a0b994073 100644
|
|||
weak_ptr_ = weak_ptr_factory_.GetWeakPtr();
|
||||
buffer_presented_callback_ = CreateSafeRepeatingCallback(
|
||||
weak_ptr_, std::move(buffer_presented_callback));
|
||||
@@ -599,7 +610,13 @@ void SkiaOutputSurfaceImplOnGpu::SwapBuffers(OutputSurfaceFrame frame) {
|
||||
@@ -595,7 +606,13 @@ void SkiaOutputSurfaceImplOnGpu::SwapBuffers(OutputSurfaceFrame frame) {
|
||||
TRACE_EVENT0("viz", "SkiaOutputSurfaceImplOnGpu::SwapBuffers");
|
||||
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
|
||||
|
||||
|
@ -59,23 +59,23 @@ index 2d82ab0f062c9..db11a0b994073 100644
|
|||
+ VLOG(1) << "total showed " << swap_buffers_number_ << " frames, total time " << (stop_time - start_time) << " ms, fps is " << swap_buffers_number_*1e6/(stop_time - start_time) << std::endl;
|
||||
}
|
||||
|
||||
void SkiaOutputSurfaceImplOnGpu::EnsureMinNumberOfBuffers(int n) {
|
||||
@@ -1888,6 +1905,7 @@ bool SkiaOutputSurfaceImplOnGpu::Initialize() {
|
||||
if (context_state_)
|
||||
context_state_->AddContextLostObserver(this);
|
||||
void SkiaOutputSurfaceImplOnGpu::SetDependenciesResolvedTimings(
|
||||
@@ -1938,6 +1955,7 @@ bool SkiaOutputSurfaceImplOnGpu::Initialize() {
|
||||
// allow neither to be set in the offscreen case.
|
||||
DCHECK(!(gl_surface_ != nullptr && presenter_ != nullptr));
|
||||
|
||||
+ start_time = NowMicros();
|
||||
return true;
|
||||
}
|
||||
|
||||
diff --git a/components/viz/service/display_embedder/skia_output_surface_impl_on_gpu.h b/components/viz/service/display_embedder/skia_output_surface_impl_on_gpu.h
|
||||
index 8c13e3f5855ce..e75d4e5b74af1 100644
|
||||
index b82de4041e78a..532866bc30297 100644
|
||||
--- a/components/viz/service/display_embedder/skia_output_surface_impl_on_gpu.h
|
||||
+++ b/components/viz/service/display_embedder/skia_output_surface_impl_on_gpu.h
|
||||
@@ -500,6 +500,7 @@ class SkiaOutputSurfaceImplOnGpu
|
||||
@@ -498,6 +498,7 @@ class SkiaOutputSurfaceImplOnGpu
|
||||
ScheduleGpuTaskCallback schedule_gpu_task_;
|
||||
GpuVSyncCallback gpu_vsync_callback_;
|
||||
AddChildWindowToBrowserCallback add_child_window_to_browser_callback_;
|
||||
SkiaOutputDevice::ReleaseOverlaysCallback release_overlays_callback_;
|
||||
+ size_t swap_buffers_number_;
|
||||
|
||||
// ImplOnGpu::CopyOutput can create SharedImages via ImplOnGpu's
|
|
@ -1,7 +1,7 @@
|
|||
From 59111da72cc0b930446ccb7fc51e6c0ad4061e6e Mon Sep 17 00:00:00 2001
|
||||
From 8eb371e7afe04e86469ac605afbc5b8069bd8811 Mon Sep 17 00:00:00 2001
|
||||
From: Hou Qi <qi.hou@nxp.com>
|
||||
Date: Thu, 2 Nov 2023 14:31:34 +0900
|
||||
Subject: [PATCH 13/19] V4L2VDA: Comment some unused ioctl
|
||||
Date: Fri, 13 Sep 2024 22:57:00 +0900
|
||||
Subject: [PATCH 10/19] V4L2VideoDecoder: Comment some unused ioctl
|
||||
|
||||
Upstream-Status: Inappropriate [NXP specific]
|
||||
---
|
||||
|
@ -9,10 +9,10 @@ Upstream-Status: Inappropriate [NXP specific]
|
|||
1 file changed, 22 insertions(+)
|
||||
|
||||
diff --git a/media/gpu/v4l2/v4l2_queue.cc b/media/gpu/v4l2/v4l2_queue.cc
|
||||
index ab044ab03c7e7..5f6001275ae80 100644
|
||||
index afa5d91ddb4b4..de74d0da308c3 100644
|
||||
--- a/media/gpu/v4l2/v4l2_queue.cc
|
||||
+++ b/media/gpu/v4l2/v4l2_queue.cc
|
||||
@@ -1048,10 +1048,12 @@ V4L2Queue::V4L2Queue(const IoctlAsCallback& ioctl_cb,
|
||||
@@ -1101,10 +1101,12 @@ V4L2Queue::V4L2Queue(const IoctlAsCallback& ioctl_cb,
|
||||
weak_this_factory_(this) {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
|
||||
|
@ -25,7 +25,7 @@ index ab044ab03c7e7..5f6001275ae80 100644
|
|||
|
||||
// Stateful backends for example do not support requests.
|
||||
VPLOG_IF(4, supports_requests_)
|
||||
@@ -1623,10 +1625,14 @@ bool V4L2Request::ApplyCtrls(struct v4l2_ext_controls* ctrls) {
|
||||
@@ -1754,10 +1756,14 @@ bool V4L2Request::ApplyCtrls(struct v4l2_ext_controls* ctrls) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ index ab044ab03c7e7..5f6001275ae80 100644
|
|||
}
|
||||
|
||||
bool V4L2Request::ApplyQueueBuffer(struct v4l2_buffer* buffer) {
|
||||
@@ -1638,10 +1644,14 @@ bool V4L2Request::ApplyQueueBuffer(struct v4l2_buffer* buffer) {
|
||||
@@ -1769,10 +1775,14 @@ bool V4L2Request::ApplyQueueBuffer(struct v4l2_buffer* buffer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ index ab044ab03c7e7..5f6001275ae80 100644
|
|||
}
|
||||
|
||||
bool V4L2Request::Submit() {
|
||||
@@ -1652,12 +1662,16 @@ bool V4L2Request::Submit() {
|
||||
@@ -1783,12 +1793,16 @@ bool V4L2Request::Submit() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ index ab044ab03c7e7..5f6001275ae80 100644
|
|||
}
|
||||
|
||||
bool V4L2Request::IsCompleted() {
|
||||
@@ -1699,6 +1713,7 @@ bool V4L2Request::Reset() {
|
||||
@@ -1830,6 +1844,7 @@ bool V4L2Request::Reset() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ index ab044ab03c7e7..5f6001275ae80 100644
|
|||
// 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) {
|
||||
RecordMediaIoctlUMA(MediaIoctlRequests::kMediaRequestIocReinit);
|
||||
@@ -1707,6 +1722,9 @@ bool V4L2Request::Reset() {
|
||||
@@ -1838,6 +1853,9 @@ bool V4L2Request::Reset() {
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -90,24 +90,24 @@ index ab044ab03c7e7..5f6001275ae80 100644
|
|||
}
|
||||
|
||||
V4L2RequestRefBase::V4L2RequestRefBase(V4L2RequestRefBase&& req_base) {
|
||||
@@ -1783,6 +1801,7 @@ V4L2RequestsQueue::~V4L2RequestsQueue() {
|
||||
absl::optional<base::ScopedFD> V4L2RequestsQueue::CreateRequestFD() {
|
||||
@@ -1914,6 +1932,7 @@ V4L2RequestsQueue::~V4L2RequestsQueue() {
|
||||
std::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));
|
||||
@@ -1793,6 +1812,9 @@ absl::optional<base::ScopedFD> V4L2RequestsQueue::CreateRequestFD() {
|
||||
@@ -1924,6 +1943,9 @@ std::optional<base::ScopedFD> V4L2RequestsQueue::CreateRequestFD() {
|
||||
}
|
||||
|
||||
return base::ScopedFD(request_fd);
|
||||
+#else
|
||||
+ return absl::nullopt;
|
||||
+ return std::nullopt;
|
||||
+#endif
|
||||
}
|
||||
|
||||
absl::optional<V4L2RequestRef> V4L2RequestsQueue::GetFreeRequest() {
|
||||
std::optional<V4L2RequestRef> V4L2RequestsQueue::GetFreeRequest() {
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
From cff69cd29ff316a7ac38e7e84db105d0841c5fcb Mon Sep 17 00:00:00 2001
|
||||
From: Hou Qi <qi.hou@nxp.com>
|
||||
Date: Thu, 18 Aug 2022 12:20:33 +0800
|
||||
Subject: [PATCH 11/19] V4L2VDA: fix vp9 crash caused by
|
||||
DequeueResolutionChangeEvent
|
||||
|
||||
Handle source change event only when decoder receives driver reported
|
||||
source change event.
|
||||
|
||||
Upstream-Status: Inappropriate [NXP specific]
|
||||
---
|
||||
media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc b/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc
|
||||
index 89a8976eb457d..e6edbcd97a896 100644
|
||||
--- a/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc
|
||||
+++ b/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc
|
||||
@@ -1276,8 +1276,7 @@ void V4L2VideoDecodeAccelerator::ServiceDeviceTask(bool event_pending) {
|
||||
gfx::Size visible_size;
|
||||
bool again;
|
||||
if (GetFormatInfo(&format, &visible_size, &again) && !again) {
|
||||
- resolution_change_pending = true;
|
||||
- DequeueResolutionChangeEvent();
|
||||
+ resolution_change_pending = DequeueResolutionChangeEvent();
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
From fe9d852a4f33d4efdcbf52e761a9c32c76970517 Mon Sep 17 00:00:00 2001
|
||||
From: Hou Qi <qi.hou@nxp.com>
|
||||
Date: Fri, 13 Sep 2024 22:59:46 +0900
|
||||
Subject: [PATCH 11/19] V4L2VideoDecoder: Add V4L2_PIX_FMT_NV12M_8L128 format
|
||||
for amphion
|
||||
|
||||
Upstream-Status: Inappropriate [NXP specific]
|
||||
---
|
||||
media/gpu/chromeos/fourcc.cc | 2 ++
|
||||
media/gpu/chromeos/fourcc.h | 4 ++++
|
||||
media/gpu/v4l2/v4l2_device.cc | 1 +
|
||||
media/gpu/v4l2/v4l2_device.h | 6 ++++++
|
||||
4 files changed, 13 insertions(+)
|
||||
|
||||
diff --git a/media/gpu/chromeos/fourcc.cc b/media/gpu/chromeos/fourcc.cc
|
||||
index 5b7444a7b6319..6236034447322 100644
|
||||
--- a/media/gpu/chromeos/fourcc.cc
|
||||
+++ b/media/gpu/chromeos/fourcc.cc
|
||||
@@ -24,6 +24,7 @@ std::optional<Fourcc> Fourcc::FromUint32(uint32_t fourcc) {
|
||||
case YM12:
|
||||
case YM21:
|
||||
case YUYV:
|
||||
+ case NA12:
|
||||
case NV12:
|
||||
case NV21:
|
||||
case NM12:
|
||||
@@ -172,6 +173,7 @@ VideoPixelFormat Fourcc::ToVideoPixelFormat() const {
|
||||
return PIXEL_FORMAT_YUY2;
|
||||
case NV12:
|
||||
case NM12:
|
||||
+ case NA12:
|
||||
return PIXEL_FORMAT_NV12;
|
||||
case NV21:
|
||||
case NM21:
|
||||
diff --git a/media/gpu/chromeos/fourcc.h b/media/gpu/chromeos/fourcc.h
|
||||
index 6f08dba1de919..12b71cbb8f394 100644
|
||||
--- a/media/gpu/chromeos/fourcc.h
|
||||
+++ b/media/gpu/chromeos/fourcc.h
|
||||
@@ -69,6 +69,10 @@ class MEDIA_GPU_EXPORT Fourcc {
|
||||
// Maps to PIXEL_FORMAT_NV21, V4L2_PIX_FMT_NV21M.
|
||||
NM21 = ComposeFourcc('N', 'M', '2', '1'),
|
||||
|
||||
+ // Tiled YUV formats, non contiguous planes.
|
||||
+ // Maps to V4L2_PIX_FMT_NV12M_8L128.
|
||||
+ NA12 = ComposeFourcc('N', 'A', '1', '2'),
|
||||
+
|
||||
// YUV422 single-planar format.
|
||||
// https://linuxtv.org/downloads/v4l-dvb-apis-new/userspace-api/v4l/pixfmt-yuv422p.html
|
||||
// Maps to PIXEL_FORMAT_I422, V4L2_PIX_FMT_YUV422P.
|
||||
diff --git a/media/gpu/v4l2/v4l2_device.cc b/media/gpu/v4l2/v4l2_device.cc
|
||||
index c04873fe2ae84..08a3fe203cb81 100644
|
||||
--- a/media/gpu/v4l2/v4l2_device.cc
|
||||
+++ b/media/gpu/v4l2/v4l2_device.cc
|
||||
@@ -42,6 +42,7 @@ uint32_t V4L2PixFmtToDrmFormat(uint32_t format) {
|
||||
switch (format) {
|
||||
case V4L2_PIX_FMT_NV12:
|
||||
case V4L2_PIX_FMT_NV12M:
|
||||
+ case V4L2_PIX_FMT_NV12M_8L128:
|
||||
return DRM_FORMAT_NV12;
|
||||
|
||||
case V4L2_PIX_FMT_YUV420:
|
||||
diff --git a/media/gpu/v4l2/v4l2_device.h b/media/gpu/v4l2/v4l2_device.h
|
||||
index 2d2800f3925f5..34e1b4d9380b2 100644
|
||||
--- a/media/gpu/v4l2/v4l2_device.h
|
||||
+++ b/media/gpu/v4l2/v4l2_device.h
|
||||
@@ -63,6 +63,12 @@
|
||||
v4l2_fourcc('Q', '1', '0', 'C') /* Qualcomm 10-bit compressed */
|
||||
#endif
|
||||
|
||||
+/* Tiled YUV formats, non contiguous planes */
|
||||
+#ifndef V4L2_PIX_FMT_NV12M_8L128
|
||||
+#define V4L2_PIX_FMT_NV12M_8L128 \
|
||||
+ v4l2_fourcc('N', 'A', '1', '2') /* Y/CbCr 4:2:0 8x128 tiles */
|
||||
+#endif
|
||||
+
|
||||
#define V4L2_PIX_FMT_INVALID v4l2_fourcc('0', '0', '0', '0')
|
||||
|
||||
namespace media {
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -1,20 +1,21 @@
|
|||
From 5b086374612ab4d19fcb038f3c52e6cff930d8d8 Mon Sep 17 00:00:00 2001
|
||||
From 591913ea8a59426be9902599cec129445804c8d7 Mon Sep 17 00:00:00 2001
|
||||
From: Hou Qi <qi.hou@nxp.com>
|
||||
Date: Thu, 2 Nov 2023 15:29:30 +0900
|
||||
Subject: [PATCH 16/19] V4L2VDA: Support tile to linear transform for amphion
|
||||
Date: Fri, 13 Sep 2024 23:09:35 +0900
|
||||
Subject: [PATCH 12/19] V4L2VideoDecoder: Support tile to linear transform for
|
||||
amphion
|
||||
|
||||
Upstream-Status: Inappropriate [NXP specific]
|
||||
---
|
||||
media/gpu/v4l2/BUILD.gn | 1 +
|
||||
media/gpu/v4l2/v4l2_queue.cc | 189 ++++++++++++++++++++++++++++++++++-
|
||||
media/gpu/v4l2/v4l2_queue.cc | 211 ++++++++++++++++++++++++++++++++++-
|
||||
media/gpu/v4l2/v4l2_queue.h | 1 +
|
||||
3 files changed, 186 insertions(+), 5 deletions(-)
|
||||
3 files changed, 209 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/media/gpu/v4l2/BUILD.gn b/media/gpu/v4l2/BUILD.gn
|
||||
index 50b3beecc090e..0e4e85232b9a2 100644
|
||||
index 0aa466ba9cec5..836ee0bc7504c 100644
|
||||
--- a/media/gpu/v4l2/BUILD.gn
|
||||
+++ b/media/gpu/v4l2/BUILD.gn
|
||||
@@ -96,6 +96,7 @@ source_set("v4l2") {
|
||||
@@ -92,6 +92,7 @@ source_set("v4l2") {
|
||||
"EGL",
|
||||
"GLESv2",
|
||||
]
|
||||
|
@ -23,10 +24,10 @@ index 50b3beecc090e..0e4e85232b9a2 100644
|
|||
configs += [ "//third_party/libyuv:libyuv_config" ]
|
||||
|
||||
diff --git a/media/gpu/v4l2/v4l2_queue.cc b/media/gpu/v4l2/v4l2_queue.cc
|
||||
index 5f6001275ae80..fa7c7daaa1e46 100644
|
||||
index de74d0da308c3..945e7a7df9b93 100644
|
||||
--- a/media/gpu/v4l2/v4l2_queue.cc
|
||||
+++ b/media/gpu/v4l2/v4l2_queue.cc
|
||||
@@ -18,6 +18,11 @@
|
||||
@@ -20,6 +20,11 @@
|
||||
#include "media/gpu/chromeos/platform_video_frame_utils.h"
|
||||
#include "media/gpu/macros.h"
|
||||
|
||||
|
@ -38,10 +39,10 @@ index 5f6001275ae80..fa7c7daaa1e46 100644
|
|||
namespace media {
|
||||
|
||||
namespace {
|
||||
@@ -181,6 +186,11 @@ class V4L2Buffer {
|
||||
@@ -189,6 +194,11 @@ class V4L2Buffer {
|
||||
size_t GetMemoryUsage() const;
|
||||
const struct v4l2_buffer& v4l2_buffer() const { return v4l2_buffer_; }
|
||||
scoped_refptr<VideoFrame> GetVideoFrame();
|
||||
const scoped_refptr<FrameResource>& GetFrameResource();
|
||||
+ std::pair<int, int> GetSavedmafd();
|
||||
+ std::pair<unsigned int, unsigned int> GetSavedphys();
|
||||
+ std::pair<int, int> Getg2dbufphys();
|
||||
|
@ -50,7 +51,7 @@ index 5f6001275ae80..fa7c7daaa1e46 100644
|
|||
|
||||
private:
|
||||
V4L2Buffer(const IoctlAsCallback& ioctl_cb,
|
||||
@@ -195,6 +205,12 @@ class V4L2Buffer {
|
||||
@@ -203,6 +213,13 @@ class V4L2Buffer {
|
||||
const IoctlAsCallback ioctl_cb_;
|
||||
const MmapAsCallback mmap_cb_;
|
||||
std::vector<void*> plane_mappings_;
|
||||
|
@ -60,20 +61,102 @@ index 5f6001275ae80..fa7c7daaa1e46 100644
|
|||
+ unsigned long phys_1;
|
||||
+ struct g2d_buf *g2dbuf_p0;
|
||||
+ struct g2d_buf *g2dbuf_p1;
|
||||
+ std::vector<base::ScopedFD> g2dbufs_fds;
|
||||
|
||||
// V4L2 data as queried by QUERYBUF.
|
||||
struct v4l2_buffer v4l2_buffer_;
|
||||
@@ -244,6 +260,9 @@ V4L2Buffer::V4L2Buffer(const IoctlAsCallback& ioctl_cb,
|
||||
@@ -257,6 +274,90 @@ V4L2Buffer::V4L2Buffer(const IoctlAsCallback& ioctl_cb,
|
||||
v4l2_buffer_.type = type;
|
||||
v4l2_buffer_.memory = memory;
|
||||
plane_mappings_.resize(V4L2_TYPE_IS_MULTIPLANAR(type) ? v4l2_buffer_.length : 1);
|
||||
+ dmafd0 = dmafd1 = -1;
|
||||
+ phys_0 = phys_1 = 0;
|
||||
+ g2dbuf_p0 = g2dbuf_p1 = NULL;
|
||||
+
|
||||
+ if (V4L2_TYPE_IS_MULTIPLANAR(v4l2_buffer_.type) &&
|
||||
+ format_.fmt.pix_mp.pixelformat == V4L2_PIX_FMT_NV12M_8L128) {
|
||||
+ VLOGF(3) << "Map physical address";
|
||||
+
|
||||
+ std::vector<base::ScopedFD> dmabuf_fds = GetDmabufsForV4L2Buffer(
|
||||
+ ioctl_cb_, v4l2_buffer_.index, V4L2_TYPE_IS_MULTIPLANAR(v4l2_buffer_.type) ? v4l2_buffer_.length : 1,
|
||||
+ static_cast<enum v4l2_buf_type>(v4l2_buffer_.type));
|
||||
+ if (dmabuf_fds.empty()) {
|
||||
+ LOG(ERROR) << "Failed to get DMABUFs of V4L2 buffer";
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // DMA buffer fds should not be invalid
|
||||
+ for (const auto& dmabuf_fd : dmabuf_fds) {
|
||||
+ if (!dmabuf_fd.is_valid()) {
|
||||
+ LOG(ERROR) << "Fail to get DMABUFs of V4L2 buffer - invalid fd";
|
||||
+ return;
|
||||
+ }
|
||||
+ if(dmafd0 == -1)
|
||||
+ dmafd0 = dmabuf_fd.get();
|
||||
+ else
|
||||
+ dmafd1 = dmabuf_fd.get();
|
||||
+ }
|
||||
+
|
||||
+ struct dma_buf_phys{
|
||||
+ unsigned long phys;
|
||||
+ };
|
||||
+ #define DMA_BUF_IOCTL_PHYS _IOW(DMA_BUF_BASE, 10, struct dma_buf_phys)
|
||||
+ struct dma_buf_phys query0, query1;
|
||||
+ int ret = ioctl(dmafd0, DMA_BUF_IOCTL_PHYS, &query0);
|
||||
+ if(ret != 0) {
|
||||
+ LOG(ERROR)<< "DMA_BUF_IOCTL_PHYS failed at dmafd" << dmafd0;
|
||||
+ return;
|
||||
+ }
|
||||
+ else {
|
||||
+ phys_0 = query0.phys;
|
||||
+ }
|
||||
+
|
||||
+ ret = ioctl(dmafd1, DMA_BUF_IOCTL_PHYS, &query1);
|
||||
+ if(ret != 0) {
|
||||
+ LOG(ERROR)<< "DMA_BUF_IOCTL_PHYS failed at dmafd" << dmafd1;
|
||||
+ return;
|
||||
+ }
|
||||
+ else {
|
||||
+ phys_1 = query1.phys;
|
||||
+ }
|
||||
+
|
||||
+ if (g2d_alloc) {
|
||||
+ g2dbuf_p0 = g2d_alloc(format_.fmt.pix_mp.width * format_.fmt.pix_mp.height, 0);
|
||||
+ g2dbuf_p1 = g2d_alloc(format_.fmt.pix_mp.width * format_.fmt.pix_mp.height / 2, 0);
|
||||
+ }
|
||||
+ if((!g2dbuf_p0) || (!g2dbuf_p1)){
|
||||
+ LOG(ERROR)<<"g2d buf alloc failed";
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ int tmpfd = -1;
|
||||
+ if (g2d_buf_export_fd)
|
||||
+ tmpfd = g2d_buf_export_fd(g2dbuf_p0);
|
||||
+ tmpfd = dup(tmpfd);
|
||||
+ if(tmpfd > 0)
|
||||
+ g2dbufs_fds.push_back(base::ScopedFD(tmpfd));
|
||||
+ else if(tmpfd == -1)
|
||||
+ {
|
||||
+ LOG(ERROR) << "Failed duplicating g2d fd";
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (g2d_buf_export_fd)
|
||||
+ tmpfd = g2d_buf_export_fd(g2dbuf_p1);
|
||||
+ tmpfd = dup(tmpfd);
|
||||
+ if(tmpfd>0)
|
||||
+ g2dbufs_fds.push_back(base::ScopedFD(tmpfd));
|
||||
+ else if(tmpfd == -1)
|
||||
+ {
|
||||
+ LOG(ERROR) << "Failed duplicating g2d fd";
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
}
|
||||
|
||||
V4L2Buffer::~V4L2Buffer() {
|
||||
@@ -256,6 +275,32 @@ V4L2Buffer::~V4L2Buffer() {
|
||||
@@ -269,6 +370,32 @@ V4L2Buffer::~V4L2Buffer() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -106,96 +189,30 @@ index 5f6001275ae80..fa7c7daaa1e46 100644
|
|||
}
|
||||
|
||||
bool V4L2Buffer::Query() {
|
||||
@@ -340,6 +385,66 @@ scoped_refptr<VideoFrame> V4L2Buffer::CreateVideoFrame() {
|
||||
DLOG(ERROR) << "Fail to get DMABUFs of V4L2 buffer - invalid fd";
|
||||
return nullptr;
|
||||
}
|
||||
+ if(dmafd0 == -1)
|
||||
+ dmafd0 = dmabuf_fd.get();
|
||||
+ else
|
||||
+ dmafd1 = dmabuf_fd.get();
|
||||
+ }
|
||||
+
|
||||
+ std::vector<base::ScopedFD> g2dbufs_fds;
|
||||
+ if (V4L2_TYPE_IS_MULTIPLANAR(v4l2_buffer_.type)) {
|
||||
+ struct dma_buf_phys{
|
||||
+ unsigned long phys;
|
||||
+ };
|
||||
+ #define DMA_BUF_IOCTL_PHYS _IOW(DMA_BUF_BASE, 10, struct dma_buf_phys)
|
||||
+ struct dma_buf_phys query0, query1;
|
||||
+ int ret = ioctl(dmafd0, DMA_BUF_IOCTL_PHYS, &query0);
|
||||
+ if(ret != 0) {
|
||||
+ DLOG(ERROR)<< "DMA_BUF_IOCTL_PHYS failed at dmafd" << dmafd0;
|
||||
+ return nullptr;
|
||||
+ }
|
||||
+ else
|
||||
+ phys_0 = query0.phys;
|
||||
+
|
||||
+ ret = ioctl(dmafd1, DMA_BUF_IOCTL_PHYS, &query1);
|
||||
+ if(ret != 0) {
|
||||
+ DLOG(ERROR)<< "DMA_BUF_IOCTL_PHYS failed at dmafd" << dmafd1;
|
||||
+ return nullptr;
|
||||
+ }
|
||||
+ else
|
||||
+ phys_1 = query1.phys;
|
||||
+
|
||||
+ if (g2d_alloc) {
|
||||
+ g2dbuf_p0 = g2d_alloc(format_.fmt.pix_mp.width * format_.fmt.pix_mp.height, 0);
|
||||
+ g2dbuf_p1 = g2d_alloc(format_.fmt.pix_mp.width * format_.fmt.pix_mp.height / 2, 0);
|
||||
+ }
|
||||
+ if((!g2dbuf_p0) || (!g2dbuf_p1)){
|
||||
+ DLOG(ERROR)<<"g2d buf alloc failed";
|
||||
+ return nullptr;
|
||||
+ }
|
||||
+
|
||||
+ int tmpfd = -1;
|
||||
+ if (g2d_buf_export_fd)
|
||||
+ tmpfd = g2d_buf_export_fd(g2dbuf_p0);
|
||||
+ tmpfd = dup(tmpfd);
|
||||
+ if(tmpfd > 0)
|
||||
+ g2dbufs_fds.push_back(base::ScopedFD(tmpfd));
|
||||
+ else if(tmpfd == -1)
|
||||
+ {
|
||||
+ DLOG(ERROR) << "Failed duplicating g2d fd";
|
||||
+ return nullptr;
|
||||
+ }
|
||||
+
|
||||
+ if (g2d_buf_export_fd)
|
||||
+ tmpfd = g2d_buf_export_fd(g2dbuf_p1);
|
||||
+ tmpfd = dup(tmpfd);
|
||||
+ if(tmpfd>0)
|
||||
+ g2dbufs_fds.push_back(base::ScopedFD(tmpfd));
|
||||
+ else if(tmpfd == -1)
|
||||
+ {
|
||||
+ DLOG(ERROR) << "Failed duplicating g2d fd";
|
||||
+ return nullptr;
|
||||
+ }
|
||||
}
|
||||
|
||||
// Duplicate the fd of the last v4l2 plane until the number of fds are the
|
||||
@@ -354,13 +459,16 @@ scoped_refptr<VideoFrame> V4L2Buffer::CreateVideoFrame() {
|
||||
@@ -368,13 +495,18 @@ scoped_refptr<FrameResource> V4L2Buffer::CreateFrame() {
|
||||
dmabuf_fds.emplace_back(duped_fd);
|
||||
}
|
||||
|
||||
- if (V4L2_TYPE_IS_MULTIPLANAR(v4l2_buffer_.type))
|
||||
+ if (V4L2_TYPE_IS_MULTIPLANAR(v4l2_buffer_.type)) {
|
||||
+ if (V4L2_TYPE_IS_MULTIPLANAR(v4l2_buffer_.type) &&
|
||||
+ format_.fmt.pix_mp.pixelformat == V4L2_PIX_FMT_NV12M_8L128) {
|
||||
gfx::Size size(format_.fmt.pix_mp.width, format_.fmt.pix_mp.height);
|
||||
- else
|
||||
+ return VideoFrame::WrapExternalDmabufs(
|
||||
+ return NativePixmapFrameResource::Create(
|
||||
+ *layout, gfx::Rect(size), size, std::move(g2dbufs_fds), base::TimeDelta());
|
||||
+ }
|
||||
+ else {
|
||||
gfx::Size size(format_.fmt.pix.width, format_.fmt.pix.height);
|
||||
-
|
||||
- return VideoFrame::WrapExternalDmabufs(
|
||||
|
||||
- return NativePixmapFrameResource::Create(
|
||||
- *layout, gfx::Rect(size), size, std::move(dmabuf_fds), base::TimeDelta());
|
||||
+ return VideoFrame::WrapExternalDmabufs(
|
||||
+ return NativePixmapFrameResource::Create(
|
||||
+ *layout, gfx::Rect(size), size, std::move(dmabuf_fds), base::TimeDelta());
|
||||
+ }
|
||||
}
|
||||
|
||||
scoped_refptr<VideoFrame> V4L2Buffer::GetVideoFrame() {
|
||||
@@ -1059,6 +1167,10 @@ V4L2Queue::V4L2Queue(const IoctlAsCallback& ioctl_cb,
|
||||
const scoped_refptr<FrameResource>& V4L2Buffer::GetFrameResource() {
|
||||
@@ -1112,6 +1244,10 @@ V4L2Queue::V4L2Queue(const IoctlAsCallback& ioctl_cb,
|
||||
VPLOG_IF(4, supports_requests_)
|
||||
<< "This queue does " << (supports_requests_ ? "" : "not")
|
||||
<< " support requests.";
|
||||
|
@ -206,7 +223,7 @@ index 5f6001275ae80..fa7c7daaa1e46 100644
|
|||
}
|
||||
|
||||
V4L2Queue::~V4L2Queue() {
|
||||
@@ -1074,6 +1186,9 @@ V4L2Queue::~V4L2Queue() {
|
||||
@@ -1127,6 +1263,9 @@ V4L2Queue::~V4L2Queue() {
|
||||
VQLOGF(1) << "Failed to deallocate queue buffers";
|
||||
}
|
||||
|
||||
|
@ -216,16 +233,16 @@ index 5f6001275ae80..fa7c7daaa1e46 100644
|
|||
std::move(destroy_cb_).Run();
|
||||
}
|
||||
|
||||
@@ -1115,6 +1230,8 @@ std::pair<absl::optional<struct v4l2_format>, int> V4L2Queue::GetFormat() {
|
||||
@@ -1170,6 +1309,8 @@ std::pair<std::optional<struct v4l2_format>, int> V4L2Queue::GetFormat() {
|
||||
VPQLOGF(2) << "Failed to get format";
|
||||
return std::make_pair(absl::nullopt, errno);
|
||||
return std::make_pair(std::nullopt, errno);
|
||||
}
|
||||
+ if (type_ == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
|
||||
+ format.fmt.pix_mp.width = format.fmt.pix_mp.plane_fmt[0].bytesperline;
|
||||
|
||||
return std::make_pair(format, 0);
|
||||
}
|
||||
@@ -1426,6 +1543,68 @@ std::pair<bool, V4L2ReadableBufferRef> V4L2Queue::DequeueBuffer() {
|
||||
@@ -1529,6 +1670,68 @@ std::pair<bool, V4L2ReadableBufferRef> V4L2Queue::DequeueBuffer() {
|
||||
}
|
||||
|
||||
DCHECK(free_buffers_);
|
||||
|
@ -295,11 +312,11 @@ index 5f6001275ae80..fa7c7daaa1e46 100644
|
|||
v4l2_buffer, weak_this_factory_.GetWeakPtr(),
|
||||
std::move(queued_frame)));
|
||||
diff --git a/media/gpu/v4l2/v4l2_queue.h b/media/gpu/v4l2/v4l2_queue.h
|
||||
index c45735a58f074..3e8a7df978738 100644
|
||||
index 85c7920417935..1cc22fff58277 100644
|
||||
--- a/media/gpu/v4l2/v4l2_queue.h
|
||||
+++ b/media/gpu/v4l2/v4l2_queue.h
|
||||
@@ -561,6 +561,7 @@ class MEDIA_GPU_EXPORT V4L2Queue
|
||||
absl::optional<struct v4l2_format> current_format_;
|
||||
@@ -584,6 +584,7 @@ class MEDIA_GPU_EXPORT V4L2Queue
|
||||
std::optional<struct v4l2_format> current_format_;
|
||||
|
||||
std::vector<std::unique_ptr<V4L2Buffer>> buffers_;
|
||||
+ void* g2d_handle;
|
|
@ -1,7 +1,7 @@
|
|||
From 27df324953c16b75a384b7a0ebec4e2b4cf58295 Mon Sep 17 00:00:00 2001
|
||||
From 44d6b2c7ec8fc21cb3151688008384bf5fad39dc Mon Sep 17 00:00:00 2001
|
||||
From: Hou Qi <qi.hou@nxp.com>
|
||||
Date: Thu, 2 Nov 2023 17:41:28 +0900
|
||||
Subject: [PATCH 18/19] V4L2VDA: Use dlopen to dynamically use g2d api
|
||||
Date: Fri, 13 Sep 2024 23:13:36 +0900
|
||||
Subject: [PATCH 13/19] V4L2VideoDecoder: Use dlopen to dynamically use g2d api
|
||||
|
||||
Upstream-Status: Inappropriate [NXP specific]
|
||||
---
|
||||
|
@ -10,10 +10,10 @@ Upstream-Status: Inappropriate [NXP specific]
|
|||
2 files changed, 181 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/media/gpu/v4l2/BUILD.gn b/media/gpu/v4l2/BUILD.gn
|
||||
index 0e4e85232b9a2..50b3beecc090e 100644
|
||||
index 836ee0bc7504c..0aa466ba9cec5 100644
|
||||
--- a/media/gpu/v4l2/BUILD.gn
|
||||
+++ b/media/gpu/v4l2/BUILD.gn
|
||||
@@ -96,7 +96,6 @@ source_set("v4l2") {
|
||||
@@ -92,7 +92,6 @@ source_set("v4l2") {
|
||||
"EGL",
|
||||
"GLESv2",
|
||||
]
|
||||
|
@ -22,10 +22,10 @@ index 0e4e85232b9a2..50b3beecc090e 100644
|
|||
configs += [ "//third_party/libyuv:libyuv_config" ]
|
||||
|
||||
diff --git a/media/gpu/v4l2/v4l2_queue.cc b/media/gpu/v4l2/v4l2_queue.cc
|
||||
index fa7c7daaa1e46..6ed9ca4309798 100644
|
||||
index 945e7a7df9b93..9fc55cfd59459 100644
|
||||
--- a/media/gpu/v4l2/v4l2_queue.cc
|
||||
+++ b/media/gpu/v4l2/v4l2_queue.cc
|
||||
@@ -18,10 +18,11 @@
|
||||
@@ -20,10 +20,11 @@
|
||||
#include "media/gpu/chromeos/platform_video_frame_utils.h"
|
||||
#include "media/gpu/macros.h"
|
||||
|
||||
|
@ -39,7 +39,7 @@ index fa7c7daaa1e46..6ed9ca4309798 100644
|
|||
|
||||
namespace media {
|
||||
|
||||
@@ -153,6 +154,159 @@ std::vector<base::ScopedFD> GetDmabufsForV4L2Buffer(
|
||||
@@ -160,6 +161,159 @@ std::vector<base::ScopedFD> GetDmabufsForV4L2Buffer(
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -199,7 +199,7 @@ index fa7c7daaa1e46..6ed9ca4309798 100644
|
|||
V4L2ExtCtrl::V4L2ExtCtrl(uint32_t id) {
|
||||
memset(&ctrl, 0, sizeof(ctrl));
|
||||
ctrl.id = id;
|
||||
@@ -1168,6 +1322,31 @@ V4L2Queue::V4L2Queue(const IoctlAsCallback& ioctl_cb,
|
||||
@@ -1245,6 +1399,31 @@ V4L2Queue::V4L2Queue(const IoctlAsCallback& ioctl_cb,
|
||||
<< "This queue does " << (supports_requests_ ? "" : "not")
|
||||
<< " support requests.";
|
||||
|
|
@ -1,76 +0,0 @@
|
|||
From f73e5d05bc9d0693530c038e4a9b73e78f5c458a Mon Sep 17 00:00:00 2001
|
||||
From: Hou Qi <qi.hou@nxp.com>
|
||||
Date: Thu, 2 Nov 2023 14:34:11 +0900
|
||||
Subject: [PATCH 14/19] V4L2VDA: Set OUTPUT format with parsed resolution for
|
||||
amphion
|
||||
|
||||
For VP8, VC1l, rv, Amphion needs to set correct resolution for OUTPUT
|
||||
queue as it will be added to amphion customized header.
|
||||
|
||||
Upstream-Status: Inappropriate [NXP specific]
|
||||
---
|
||||
.../v4l2/legacy/v4l2_video_decode_accelerator.cc | 13 +++++++++++--
|
||||
.../gpu/v4l2/legacy/v4l2_video_decode_accelerator.h | 2 +-
|
||||
2 files changed, 12 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc b/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc
|
||||
index e6edbcd97a896..261d53ffe217e 100644
|
||||
--- a/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc
|
||||
+++ b/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc
|
||||
@@ -326,6 +326,9 @@ bool V4L2VideoDecodeAccelerator::CheckConfig(const Config& config) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+ int width, height;
|
||||
+ height = config.initial_expected_coded_size.height();
|
||||
+ width = config.initial_expected_coded_size.width();
|
||||
// Capabilities check.
|
||||
struct v4l2_capability caps;
|
||||
unsigned int device_caps;
|
||||
@@ -363,7 +366,7 @@ bool V4L2VideoDecodeAccelerator::CheckConfig(const Config& config) {
|
||||
if (!output_queue_)
|
||||
return false;
|
||||
|
||||
- if (!SetupFormats())
|
||||
+ if (!SetupFormats(width, height))
|
||||
return false;
|
||||
|
||||
// We have confirmed that |config| is supported, tell the good news to the
|
||||
@@ -2308,7 +2311,7 @@ bool V4L2VideoDecodeAccelerator::CreateInputBuffers() {
|
||||
return true;
|
||||
}
|
||||
|
||||
-bool V4L2VideoDecodeAccelerator::SetupFormats() {
|
||||
+bool V4L2VideoDecodeAccelerator::SetupFormats(int width, int height) {
|
||||
DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread());
|
||||
DCHECK_EQ(decoder_state_, kInitialized);
|
||||
DCHECK(!input_queue_->IsStreaming());
|
||||
@@ -2349,6 +2352,12 @@ bool V4L2VideoDecodeAccelerator::SetupFormats() {
|
||||
format.fmt.pix_mp.pixelformat = input_format_fourcc_;
|
||||
format.fmt.pix_mp.plane_fmt[0].sizeimage = input_size;
|
||||
format.fmt.pix_mp.num_planes = 1;
|
||||
+ // For VP8, VC1l, rv, Amphion needs to set correct resolution for
|
||||
+ // OUTPUT queue as it will be added to amphion customized header.
|
||||
+ if(V4L2_PIX_FMT_VP8 == input_format_fourcc_){
|
||||
+ format.fmt.pix_mp.width = width;
|
||||
+ format.fmt.pix_mp.height = height;
|
||||
+ }
|
||||
} else {
|
||||
format.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
|
||||
format.fmt.pix.pixelformat = input_format_fourcc_;
|
||||
diff --git a/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.h b/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.h
|
||||
index 89d830259add1..d2448871485f9 100644
|
||||
--- a/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.h
|
||||
+++ b/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.h
|
||||
@@ -407,7 +407,7 @@ class MEDIA_GPU_EXPORT V4L2VideoDecodeAccelerator
|
||||
bool DestroyOutputBuffers();
|
||||
|
||||
// Set input and output formats before starting decode.
|
||||
- bool SetupFormats();
|
||||
+ bool SetupFormats(int, int);
|
||||
// Reset image processor and drop all processing frames.
|
||||
bool ResetImageProcessor();
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
From c8b82b832fc6c34ff27f73739c60472c15ca7380 Mon Sep 17 00:00:00 2001
|
||||
From: Hou Qi <qi.hou@nxp.com>
|
||||
Date: Fri, 13 Sep 2024 23:15:59 +0900
|
||||
Subject: [PATCH 14/19] V4L2VideoDecoderBackend: Create queue according to
|
||||
queried caps capabilities
|
||||
|
||||
Upstream-Status: Inappropriate [NXP specific]
|
||||
---
|
||||
media/gpu/v4l2/v4l2_video_decoder_backend.cc | 26 ++++++++++++++++++--
|
||||
1 file changed, 24 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/media/gpu/v4l2/v4l2_video_decoder_backend.cc b/media/gpu/v4l2/v4l2_video_decoder_backend.cc
|
||||
index ff08c18100e0c..0e5747a5a83e7 100644
|
||||
--- a/media/gpu/v4l2/v4l2_video_decoder_backend.cc
|
||||
+++ b/media/gpu/v4l2/v4l2_video_decoder_backend.cc
|
||||
@@ -14,8 +14,30 @@ V4L2VideoDecoderBackend::V4L2VideoDecoderBackend(
|
||||
Client* const client,
|
||||
scoped_refptr<V4L2Device> device)
|
||||
: client_(client), device_(std::move(device)) {
|
||||
- input_queue_ = device_->GetQueue(V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
|
||||
- output_queue_ = device_->GetQueue(V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
|
||||
+ struct v4l2_capability caps;
|
||||
+ unsigned int device_caps;
|
||||
+ enum v4l2_buf_type input_type, output_type;
|
||||
+ if (device_->Ioctl(VIDIOC_QUERYCAP, &caps) != 0) {
|
||||
+ LOG(ERROR) << "QUERYCAP failed";
|
||||
+ }
|
||||
+
|
||||
+ if (caps.capabilities & V4L2_CAP_DEVICE_CAPS)
|
||||
+ device_caps = caps.device_caps;
|
||||
+ else
|
||||
+ device_caps = caps.capabilities;
|
||||
+
|
||||
+ if (device_caps & (V4L2_CAP_VIDEO_OUTPUT_MPLANE | V4L2_CAP_VIDEO_M2M_MPLANE))
|
||||
+ input_type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
|
||||
+ else
|
||||
+ input_type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
|
||||
+ if (device_caps & (V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_VIDEO_M2M_MPLANE))
|
||||
+ output_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
|
||||
+ else
|
||||
+ output_type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
+
|
||||
+ input_queue_ = device_->GetQueue(input_type);
|
||||
+ output_queue_ = device_->GetQueue(output_type);
|
||||
+
|
||||
if (!input_queue_ || !output_queue_) {
|
||||
VLOGF(1) << "Failed to get V4L2 queue. This should not happen since the "
|
||||
<< "queues are supposed to be initialized when we are called.";
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -1,109 +0,0 @@
|
|||
From 4fed5cc2e4e4f8188ba5a0dc6c6b784e1150ab5e Mon Sep 17 00:00:00 2001
|
||||
From: Hou Qi <qi.hou@nxp.com>
|
||||
Date: Thu, 2 Nov 2023 15:19:32 +0900
|
||||
Subject: [PATCH 15/19] V4L2VDA: Add V4L2_PIX_FMT_NV12M_8L128 format for
|
||||
amphion
|
||||
|
||||
Upstream-Status: Inappropriate [NXP specific]
|
||||
---
|
||||
media/gpu/chromeos/fourcc.cc | 2 ++
|
||||
media/gpu/chromeos/fourcc.h | 4 ++++
|
||||
media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc | 9 +++++++--
|
||||
media/gpu/v4l2/v4l2_device.cc | 1 +
|
||||
media/gpu/v4l2/v4l2_device.h | 6 ++++++
|
||||
5 files changed, 20 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/media/gpu/chromeos/fourcc.cc b/media/gpu/chromeos/fourcc.cc
|
||||
index 3fe7baed03dd1..675fe72d6b3cd 100644
|
||||
--- a/media/gpu/chromeos/fourcc.cc
|
||||
+++ b/media/gpu/chromeos/fourcc.cc
|
||||
@@ -24,6 +24,7 @@ absl::optional<Fourcc> Fourcc::FromUint32(uint32_t fourcc) {
|
||||
case YM12:
|
||||
case YM21:
|
||||
case YUYV:
|
||||
+ case NA12:
|
||||
case NV12:
|
||||
case NV21:
|
||||
case NM12:
|
||||
@@ -164,6 +165,7 @@ VideoPixelFormat Fourcc::ToVideoPixelFormat() const {
|
||||
return PIXEL_FORMAT_YUY2;
|
||||
case NV12:
|
||||
case NM12:
|
||||
+ case NA12:
|
||||
return PIXEL_FORMAT_NV12;
|
||||
case NV21:
|
||||
case NM21:
|
||||
diff --git a/media/gpu/chromeos/fourcc.h b/media/gpu/chromeos/fourcc.h
|
||||
index d43cd08594db7..7abad3ed299bd 100644
|
||||
--- a/media/gpu/chromeos/fourcc.h
|
||||
+++ b/media/gpu/chromeos/fourcc.h
|
||||
@@ -68,6 +68,10 @@ class MEDIA_GPU_EXPORT Fourcc {
|
||||
// Maps to PIXEL_FORMAT_NV21, V4L2_PIX_FMT_NV21M.
|
||||
NM21 = ComposeFourcc('N', 'M', '2', '1'),
|
||||
|
||||
+ // Tiled YUV formats, non contiguous planes.
|
||||
+ // Maps to V4L2_PIX_FMT_NV12M_8L128.
|
||||
+ NA12 = ComposeFourcc('N', 'A', '1', '2'),
|
||||
+
|
||||
// YUV422 single-planar format.
|
||||
// https://linuxtv.org/downloads/v4l-dvb-apis-new/userspace-api/v4l/pixfmt-yuv422p.html
|
||||
// Maps to PIXEL_FORMAT_I422, V4L2_PIX_FMT_YUV422P.
|
||||
diff --git a/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc b/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc
|
||||
index 261d53ffe217e..890f3dff9b726 100644
|
||||
--- a/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc
|
||||
+++ b/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc
|
||||
@@ -1385,8 +1385,9 @@ void V4L2VideoDecodeAccelerator::Enqueue() {
|
||||
// yet. Also, V4L2VDA calls STREAMOFF and STREAMON after resolution
|
||||
// change. They implicitly send a V4L2_DEC_CMD_STOP and V4L2_DEC_CMD_START
|
||||
// to the decoder.
|
||||
- if (input_queue_->QueuedBuffersCount() > 0)
|
||||
- break;
|
||||
+ if (input_queue_->QueuedBuffersCount() > 0) {
|
||||
+ // break;
|
||||
+ }
|
||||
|
||||
if (coded_size_.IsEmpty() || !input_queue_->IsStreaming()) {
|
||||
// In these situations, we should call NotifyFlushDone() immediately:
|
||||
@@ -1528,6 +1529,10 @@ bool V4L2VideoDecodeAccelerator::DequeueOutputBuffer() {
|
||||
// Dequeue a completed output (VIDEO_CAPTURE) buffer, and queue to the
|
||||
// completed queue.
|
||||
auto ret = output_queue_->DequeueBuffer();
|
||||
+ if (errno == EPIPE) {
|
||||
+ VLOG(1) << "Got eos";
|
||||
+ flush_awaiting_last_output_buffer_ = false;
|
||||
+ }
|
||||
if (ret.first == false) {
|
||||
LOG(ERROR) << "Error in Dequeue output buffer";
|
||||
NOTIFY_ERROR(PLATFORM_FAILURE);
|
||||
diff --git a/media/gpu/v4l2/v4l2_device.cc b/media/gpu/v4l2/v4l2_device.cc
|
||||
index c06a57a6f0df7..ac8796e81a35e 100644
|
||||
--- a/media/gpu/v4l2/v4l2_device.cc
|
||||
+++ b/media/gpu/v4l2/v4l2_device.cc
|
||||
@@ -43,6 +43,7 @@ uint32_t V4L2PixFmtToDrmFormat(uint32_t format) {
|
||||
switch (format) {
|
||||
case V4L2_PIX_FMT_NV12:
|
||||
case V4L2_PIX_FMT_NV12M:
|
||||
+ case V4L2_PIX_FMT_NV12M_8L128:
|
||||
return DRM_FORMAT_NV12;
|
||||
|
||||
case V4L2_PIX_FMT_YUV420:
|
||||
diff --git a/media/gpu/v4l2/v4l2_device.h b/media/gpu/v4l2/v4l2_device.h
|
||||
index 531aeabd70ce4..2c5ed4ea7e715 100644
|
||||
--- a/media/gpu/v4l2/v4l2_device.h
|
||||
+++ b/media/gpu/v4l2/v4l2_device.h
|
||||
@@ -62,6 +62,12 @@
|
||||
v4l2_fourcc('Q', '1', '0', 'C') /* Qualcomm 10-bit compressed */
|
||||
#endif
|
||||
|
||||
+/* Tiled YUV formats, non contiguous planes */
|
||||
+#ifndef V4L2_PIX_FMT_NV12M_8L128
|
||||
+#define V4L2_PIX_FMT_NV12M_8L128 \
|
||||
+ v4l2_fourcc('N', 'A', '1', '2') /* Y/CbCr 4:2:0 8x128 tiles */
|
||||
+#endif
|
||||
+
|
||||
#define V4L2_PIX_FMT_INVALID v4l2_fourcc('0', '0', '0', '0')
|
||||
|
||||
namespace media {
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
From f68295ed3d0a313948d8693e169933e3450156fb Mon Sep 17 00:00:00 2001
|
||||
From: Hou Qi <qi.hou@nxp.com>
|
||||
Date: Fri, 13 Sep 2024 23:19:48 +0900
|
||||
Subject: [PATCH 15/19] V4L2VideoDecoder: support gpu import NV12 format
|
||||
|
||||
Upstream-Status: Inappropriate [NXP specific]
|
||||
---
|
||||
media/mojo/services/gpu_mojo_media_client_linux.cc | 6 ++++++
|
||||
ui/gfx/linux/gbm_wrapper.cc | 3 ++-
|
||||
2 files changed, 8 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 6c8dcffca0505..f0be46c786975 100644
|
||||
--- a/media/mojo/services/gpu_mojo_media_client_linux.cc
|
||||
+++ b/media/mojo/services/gpu_mojo_media_client_linux.cc
|
||||
@@ -58,6 +58,12 @@ std::vector<Fourcc> GetPreferredRenderableFourccs(
|
||||
}
|
||||
#endif // BUILDFLAG(ENABLE_VULKAN)
|
||||
|
||||
+ // HACK: Support for zero-copy NV12 textures preferentially.
|
||||
+ if (gpu_preferences.gr_context_type == gpu::GrContextType::kGL) {
|
||||
+ renderable_fourccs.emplace_back(Fourcc::NV12);
|
||||
+ renderable_fourccs.emplace_back(Fourcc::NA12);
|
||||
+ }
|
||||
+
|
||||
// Support 1-copy argb textures.
|
||||
renderable_fourccs.emplace_back(Fourcc::AR24);
|
||||
|
||||
diff --git a/ui/gfx/linux/gbm_wrapper.cc b/ui/gfx/linux/gbm_wrapper.cc
|
||||
index 7a1ae26444f36..b5a1f5776b90a 100644
|
||||
--- a/ui/gfx/linux/gbm_wrapper.cc
|
||||
+++ b/ui/gfx/linux/gbm_wrapper.cc
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <dlfcn.h>
|
||||
#include <fcntl.h>
|
||||
#include <xf86drm.h>
|
||||
+#include <libdrm/drm_fourcc.h>
|
||||
|
||||
#include "base/strings/stringize_macros.h"
|
||||
#endif
|
||||
@@ -414,7 +415,7 @@ class Device final : public ui::GbmDevice {
|
||||
fd_data.height = size.height();
|
||||
fd_data.format = format;
|
||||
fd_data.num_fds = handle.planes.size();
|
||||
- fd_data.modifier = handle.modifier;
|
||||
+ fd_data.modifier = DRM_FORMAT_MOD_LINEAR;
|
||||
|
||||
// One specific situation where we expect 4 planes is for Intel media
|
||||
// compressed buffers: the number of planes for such buffers and format
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
From ce372a56ed44ddd6cda68080e9594e6d02d2279a Mon Sep 17 00:00:00 2001
|
||||
From: Hou Qi <qi.hou@nxp.com>
|
||||
Date: Fri, 13 Sep 2024 23:21:51 +0900
|
||||
Subject: [PATCH 16/19] VideoDecoderPipeline: Add resolution change support
|
||||
|
||||
Upstream-Status: Inappropriate [NXP specific]
|
||||
---
|
||||
media/gpu/chromeos/video_decoder_pipeline.cc | 31 ++++++++++----------
|
||||
1 file changed, 16 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/media/gpu/chromeos/video_decoder_pipeline.cc b/media/gpu/chromeos/video_decoder_pipeline.cc
|
||||
index a92b0a297e22d..7cf16cc9faa77 100644
|
||||
--- a/media/gpu/chromeos/video_decoder_pipeline.cc
|
||||
+++ b/media/gpu/chromeos/video_decoder_pipeline.cc
|
||||
@@ -647,21 +647,22 @@ void VideoDecoderPipeline::InitializeTask(const VideoDecoderConfig& config,
|
||||
&OOPVideoDecoder::GetOriginalFrame,
|
||||
base::Unretained(static_cast<OOPVideoDecoder*>(decoder_.get())));
|
||||
} else {
|
||||
- CHECK(main_frame_pool_);
|
||||
- PlatformVideoFramePool* platform_video_frame_pool =
|
||||
- main_frame_pool_->AsPlatformVideoFramePool();
|
||||
- // The only |frame_converter_| that needs the GetOriginalFrameCB callback
|
||||
- // is the MailboxVideoFrameConverter. When it is used, the
|
||||
- // |main_frame_pool_| should always be a PlatformVideoFramePool.
|
||||
- CHECK(platform_video_frame_pool);
|
||||
-
|
||||
- // Note: base::Unretained() is safe because either a) the
|
||||
- // |main_frame_pool_| outlives |frame_converter_| or b) we call
|
||||
- // |frame_converter_|->set_get_original_frame_cb() with a null
|
||||
- // GetOriginalFrameCB before destroying |main_frame_pool_|.
|
||||
- get_original_frame_cb =
|
||||
- base::BindRepeating(&PlatformVideoFramePool::GetOriginalFrame,
|
||||
- base::Unretained(platform_video_frame_pool));
|
||||
+ if (main_frame_pool_) {
|
||||
+ PlatformVideoFramePool* platform_video_frame_pool =
|
||||
+ main_frame_pool_->AsPlatformVideoFramePool();
|
||||
+ // The only |frame_converter_| that needs the GetOriginalFrameCB callback
|
||||
+ // is the MailboxVideoFrameConverter. When it is used, the
|
||||
+ // |main_frame_pool_| should always be a PlatformVideoFramePool.
|
||||
+ CHECK(platform_video_frame_pool);
|
||||
+
|
||||
+ // Note: base::Unretained() is safe because either a) the
|
||||
+ // |main_frame_pool_| outlives |frame_converter_| or b) we call
|
||||
+ // |frame_converter_|->set_get_original_frame_cb() with a null
|
||||
+ // GetOriginalFrameCB before destroying |main_frame_pool_|.
|
||||
+ get_original_frame_cb =
|
||||
+ base::BindRepeating(&PlatformVideoFramePool::GetOriginalFrame,
|
||||
+ base::Unretained(platform_video_frame_pool));
|
||||
+ }
|
||||
}
|
||||
|
||||
frame_converter_->set_get_original_frame_cb(
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
From 074a419931f1691e312cde9da3beeb454d31ee36 Mon Sep 17 00:00:00 2001
|
||||
From: Hou Qi <qi.hou@nxp.com>
|
||||
Date: Fri, 13 Sep 2024 23:22:56 +0900
|
||||
Subject: [PATCH 17/19] V4L2StatefulVideoDecoderBackend: Enlarge input buffer
|
||||
number to 16
|
||||
|
||||
Upstream-Status: Inappropriate [NXP specific]
|
||||
---
|
||||
media/gpu/v4l2/legacy/v4l2_video_decoder_backend_stateful.cc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/media/gpu/v4l2/legacy/v4l2_video_decoder_backend_stateful.cc b/media/gpu/v4l2/legacy/v4l2_video_decoder_backend_stateful.cc
|
||||
index 8929feb42d89c..7d35c58d4cae8 100644
|
||||
--- a/media/gpu/v4l2/legacy/v4l2_video_decoder_backend_stateful.cc
|
||||
+++ b/media/gpu/v4l2/legacy/v4l2_video_decoder_backend_stateful.cc
|
||||
@@ -778,7 +778,7 @@ bool V4L2StatefulVideoDecoderBackend::StopInputQueueOnResChange() const {
|
||||
size_t V4L2StatefulVideoDecoderBackend::GetNumOUTPUTQueueBuffers(
|
||||
bool secure_mode) const {
|
||||
CHECK(!secure_mode);
|
||||
- constexpr size_t kNumInputBuffers = 8;
|
||||
+ constexpr size_t kNumInputBuffers = 16;
|
||||
return kNumInputBuffers;
|
||||
}
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
From 2e1c40afd9f861fd9878534293134e12e8a59239 Mon Sep 17 00:00:00 2001
|
||||
From: Hou Qi <qi.hou@nxp.com>
|
||||
Date: Thu, 2 Nov 2023 16:21:06 +0900
|
||||
Subject: [PATCH 17/19] V4L2VDA: Enlarge input buffer count to 16
|
||||
|
||||
Some stream can decode one frame only after queuing over 8 buffers.
|
||||
So enlarge input buffer count to 16 to avoid such stream cannot play.
|
||||
|
||||
Upstream-Status: Inappropriate [NXP specific]
|
||||
---
|
||||
media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.h b/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.h
|
||||
index d2448871485f9..1b205abaafdda 100644
|
||||
--- a/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.h
|
||||
+++ b/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.h
|
||||
@@ -157,7 +157,7 @@ class MEDIA_GPU_EXPORT V4L2VideoDecodeAccelerator
|
||||
private:
|
||||
// These are rather subjectively tuned.
|
||||
enum {
|
||||
- kInputBufferCount = 8,
|
||||
+ kInputBufferCount = 16,
|
||||
// TODO(posciak): determine input buffer size based on level limits.
|
||||
// See http://crbug.com/255116.
|
||||
// Input bitstream buffer size for up to 1080p streams.
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
From 4ca9aa503552e9b052b85512e3d1fe24998de195 Mon Sep 17 00:00:00 2001
|
||||
From: Hou Qi <qi.hou@nxp.com>
|
||||
Date: Fri, 13 Sep 2024 23:23:56 +0900
|
||||
Subject: [PATCH 18/19] V4L2VideoDecoder: Fix amphion report size mismatch
|
||||
|
||||
Upstream-Status: Inappropriate [NXP specific]
|
||||
---
|
||||
media/gpu/v4l2/v4l2_video_decoder.cc | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/media/gpu/v4l2/v4l2_video_decoder.cc b/media/gpu/v4l2/v4l2_video_decoder.cc
|
||||
index 4a2591f092f42..4c33ed4fea41f 100644
|
||||
--- a/media/gpu/v4l2/v4l2_video_decoder.cc
|
||||
+++ b/media/gpu/v4l2/v4l2_video_decoder.cc
|
||||
@@ -736,7 +736,8 @@ CroStatus V4L2VideoDecoder::SetupOutputFormat(const gfx::Size& size,
|
||||
output_queue_->SetFormat(fourcc.ToV4L2PixFmt(), picked_size, 0);
|
||||
DCHECK(format);
|
||||
gfx::Size adjusted_size(format->fmt.pix_mp.width, format->fmt.pix_mp.height);
|
||||
- if (!gfx::Rect(adjusted_size).Contains(gfx::Rect(picked_size))) {
|
||||
+ if (fourcc != std::optional<Fourcc>(Fourcc(Fourcc::NA12)) &&
|
||||
+ !gfx::Rect(adjusted_size).Contains(gfx::Rect(picked_size))) {
|
||||
VLOGF(1) << "The adjusted coded size (" << adjusted_size.ToString()
|
||||
<< ") should contains the original coded size("
|
||||
<< picked_size.ToString() << ").";
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
From cd26159d92d138d6c34ca6acd72940e9a2f9af7f Mon Sep 17 00:00:00 2001
|
||||
From: Hou Qi <qi.hou@nxp.com>
|
||||
Date: Mon, 6 Nov 2023 17:31:56 +0900
|
||||
Subject: [PATCH 19/19] V4L2VDA: Add back legacy VideoDecoderType kVda
|
||||
|
||||
Upstream-Status: Inappropriate [NXP specific]
|
||||
---
|
||||
.../services/gpu_mojo_media_client_linux.cc | 18 ++++++++++++++++++
|
||||
1 file changed, 18 insertions(+)
|
||||
|
||||
diff --git a/media/mojo/services/gpu_mojo_media_client_linux.cc b/media/mojo/services/gpu_mojo_media_client_linux.cc
|
||||
index 1d63dce496709..f23b32fc1cc55 100644
|
||||
--- a/media/mojo/services/gpu_mojo_media_client_linux.cc
|
||||
+++ b/media/mojo/services/gpu_mojo_media_client_linux.cc
|
||||
@@ -28,6 +28,10 @@ VideoDecoderType GetPreferredLinuxDecoderImplementation() {
|
||||
return VideoDecoderType::kOutOfProcess;
|
||||
}
|
||||
|
||||
+ if (!base::FeatureList::IsEnabled(kUseChromeOSDirectVideoDecoder)) {
|
||||
+ return VideoDecoderType::kVda;
|
||||
+ }
|
||||
+
|
||||
return VideoDecoderType::kVaapi;
|
||||
}
|
||||
|
||||
@@ -56,6 +60,11 @@ VideoDecoderType GetActualPlatformDecoderImplementation(
|
||||
return VideoDecoderType::kUnknown;
|
||||
case VideoDecoderType::kOutOfProcess:
|
||||
return VideoDecoderType::kOutOfProcess;
|
||||
+ case VideoDecoderType::kVda: {
|
||||
+ return gpu_preferences.gr_context_type == gpu::GrContextType::kGL
|
||||
+ ? VideoDecoderType::kVda
|
||||
+ : VideoDecoderType::kUnknown;
|
||||
+ }
|
||||
case VideoDecoderType::kVaapi: {
|
||||
// Allow VaapiVideoDecoder on GL.
|
||||
if (gpu_preferences.gr_context_type == gpu::GrContextType::kGL) {
|
||||
@@ -148,6 +157,13 @@ std::unique_ptr<VideoDecoder> CreatePlatformVideoDecoder(
|
||||
GetPreferredRenderableFourccs(traits.gpu_preferences),
|
||||
traits.media_log->Clone(), /*oop_video_decoder=*/{});
|
||||
}
|
||||
+ case VideoDecoderType::kVda: {
|
||||
+ return VdaVideoDecoder::Create(
|
||||
+ traits.task_runner, traits.gpu_task_runner, traits.media_log->Clone(),
|
||||
+ *traits.target_color_space, traits.gpu_preferences,
|
||||
+ *traits.gpu_workarounds, traits.get_command_buffer_stub_cb,
|
||||
+ VideoDecodeAccelerator::Config::OutputMode::ALLOCATE);
|
||||
+ }
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
@@ -183,6 +199,8 @@ GetPlatformSupportedVideoDecoderConfigs(
|
||||
base::UmaHistogramEnumeration("Media.VaapiLinux.SupportedVideoDecoder",
|
||||
decoder_implementation);
|
||||
switch (decoder_implementation) {
|
||||
+ case VideoDecoderType::kVda:
|
||||
+ return std::move(get_vda_configs).Run();
|
||||
case VideoDecoderType::kOutOfProcess:
|
||||
case VideoDecoderType::kVaapi:
|
||||
case VideoDecoderType::kV4L2:
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
From 5bfdec4c48af188f30534914fbd9c3aa9d140503 Mon Sep 17 00:00:00 2001
|
||||
From: Hou Qi <qi.hou@nxp.com>
|
||||
Date: Thu, 19 Sep 2024 15:12:47 +0900
|
||||
Subject: [PATCH 19/19] VideoDecoderPipeline: Get V4L2VideoDecoder supported
|
||||
configs
|
||||
|
||||
Upstream-Status: Inappropriate [NXP specific]
|
||||
---
|
||||
media/gpu/chromeos/video_decoder_pipeline.cc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/media/gpu/chromeos/video_decoder_pipeline.cc b/media/gpu/chromeos/video_decoder_pipeline.cc
|
||||
index 7cf16cc9faa77..7bffad93cfd5e 100644
|
||||
--- a/media/gpu/chromeos/video_decoder_pipeline.cc
|
||||
+++ b/media/gpu/chromeos/video_decoder_pipeline.cc
|
||||
@@ -356,7 +356,7 @@ VideoDecoderPipeline::GetSupportedConfigs(
|
||||
break;
|
||||
#elif BUILDFLAG(USE_V4L2_CODEC)
|
||||
case VideoDecoderType::kV4L2:
|
||||
- configs = GetSupportedV4L2DecoderConfigs();
|
||||
+ configs = V4L2VideoDecoder::GetSupportedConfigs();
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
From 2ed69dec466c95c253d4c6397e9fa8d915a3c749 Mon Sep 17 00:00:00 2001
|
||||
From: Hou Qi <qi.hou@nxp.com>
|
||||
Date: Wed, 29 Nov 2023 11:00:59 +0900
|
||||
Subject: [PATCH] V4L2Buffer: Add support for imx95
|
||||
|
||||
Imx95 allocate capture buffers using NV12 format, while
|
||||
amphion allocate capture buffers using NV12M format.
|
||||
|
||||
Upstream-Status: Inappropriate [NXP specific]
|
||||
---
|
||||
media/gpu/v4l2/v4l2_queue.cc | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/media/gpu/v4l2/v4l2_queue.cc b/media/gpu/v4l2/v4l2_queue.cc
|
||||
index 6ed9ca4309798..2c53bbffe6fe5 100644
|
||||
--- a/media/gpu/v4l2/v4l2_queue.cc
|
||||
+++ b/media/gpu/v4l2/v4l2_queue.cc
|
||||
@@ -546,7 +546,8 @@ scoped_refptr<VideoFrame> V4L2Buffer::CreateVideoFrame() {
|
||||
}
|
||||
|
||||
std::vector<base::ScopedFD> g2dbufs_fds;
|
||||
- if (V4L2_TYPE_IS_MULTIPLANAR(v4l2_buffer_.type)) {
|
||||
+ if (V4L2_TYPE_IS_MULTIPLANAR(v4l2_buffer_.type) &&
|
||||
+ format_.fmt.pix_mp.pixelformat == V4L2_PIX_FMT_NV12M_8L128) {
|
||||
struct dma_buf_phys{
|
||||
unsigned long phys;
|
||||
};
|
||||
@@ -613,7 +614,8 @@ scoped_refptr<VideoFrame> V4L2Buffer::CreateVideoFrame() {
|
||||
dmabuf_fds.emplace_back(duped_fd);
|
||||
}
|
||||
|
||||
- if (V4L2_TYPE_IS_MULTIPLANAR(v4l2_buffer_.type)) {
|
||||
+ if (V4L2_TYPE_IS_MULTIPLANAR(v4l2_buffer_.type) &&
|
||||
+ format_.fmt.pix_mp.pixelformat == V4L2_PIX_FMT_NV12M_8L128) {
|
||||
gfx::Size size(format_.fmt.pix_mp.width, format_.fmt.pix_mp.height);
|
||||
return VideoFrame::WrapExternalDmabufs(
|
||||
*layout, gfx::Rect(size), size, std::move(g2dbufs_fds), base::TimeDelta());
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
From 2cf45a6abd796448126d1c1cc6f13e5e347d8c05 Mon Sep 17 00:00:00 2001
|
||||
From: Hou Qi <qi.hou@nxp.com>
|
||||
Date: Wed, 23 Oct 2024 19:08:46 +0900
|
||||
Subject: [PATCH] V4L2VideoDecoder: Fix amphion cannot streamoff after eos
|
||||
|
||||
Amphion vpu driver directly return EPIPE without dequeuing extra
|
||||
empty buffer when eos. Need to streamoff correctly for this case.
|
||||
|
||||
Upstream-Status: Inappropriate [NXP specific]
|
||||
---
|
||||
.../gpu/v4l2/legacy/v4l2_video_decoder_backend_stateful.cc | 6 ++++--
|
||||
media/gpu/v4l2/v4l2_video_decoder.cc | 2 +-
|
||||
2 files changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/media/gpu/v4l2/legacy/v4l2_video_decoder_backend_stateful.cc b/media/gpu/v4l2/legacy/v4l2_video_decoder_backend_stateful.cc
|
||||
index 7d35c58d4cae8..4bd6ac7fe1fcf 100644
|
||||
--- a/media/gpu/v4l2/legacy/v4l2_video_decoder_backend_stateful.cc
|
||||
+++ b/media/gpu/v4l2/legacy/v4l2_video_decoder_backend_stateful.cc
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "media/gpu/v4l2/legacy/v4l2_video_decoder_backend_stateful.h"
|
||||
|
||||
+#include <errno.h>
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
@@ -438,7 +439,7 @@ void V4L2StatefulVideoDecoderBackend::OnOutputBufferDequeued(
|
||||
DVLOGF(3);
|
||||
|
||||
// Zero-bytes buffers are returned as part of a flush and can be dismissed.
|
||||
- if (buffer->GetPlaneBytesUsed(0) > 0) {
|
||||
+ if (buffer && buffer->GetPlaneBytesUsed(0) > 0) {
|
||||
// TODO(mcasas): Consider using TimeValToTimeDelta().
|
||||
const struct timeval timeval = buffer->GetTimeStamp();
|
||||
const struct timespec timespec = {
|
||||
@@ -489,7 +490,8 @@ void V4L2StatefulVideoDecoderBackend::OnOutputBufferDequeued(
|
||||
// The order here is important! A flush event may come after a resolution
|
||||
// change event (but not the opposite), so we must make sure both events
|
||||
// are processed in the correct order.
|
||||
- if (buffer->IsLast()){
|
||||
+ if (errno == EPIPE || buffer->IsLast()){
|
||||
+ VLOGF(3) << "Got buffer with last flag or got EPIPE";
|
||||
// Check that we don't have a resolution change event pending. If we do
|
||||
// then this LAST buffer was related to it.
|
||||
ProcessEventQueue();
|
||||
diff --git a/media/gpu/v4l2/v4l2_video_decoder.cc b/media/gpu/v4l2/v4l2_video_decoder.cc
|
||||
index 4c33ed4fea41f..d0f35414c69c9 100644
|
||||
--- a/media/gpu/v4l2/v4l2_video_decoder.cc
|
||||
+++ b/media/gpu/v4l2/v4l2_video_decoder.cc
|
||||
@@ -1282,7 +1282,7 @@ void V4L2VideoDecoder::ServiceDeviceTask(bool event) {
|
||||
SetState(State::kError);
|
||||
return;
|
||||
}
|
||||
- if (!dequeued_buffer)
|
||||
+ if (!dequeued_buffer && errno != EPIPE)
|
||||
break;
|
||||
|
||||
if (backend_)
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -10,26 +10,26 @@ SRC_URI:append:imx-nxp-bsp = " \
|
|||
file://0007-Enable-native-GLES2-for-Ozone-wayland.patch \
|
||||
"
|
||||
VDA_PATCH_SET = " \
|
||||
file://0101-V4L2VDA-Switch-to-use-VDA-instead-of-direct-VideoDec.patch \
|
||||
file://0102-GenericV4L2Device-Correct-v4l2-decoder-device-path.patch \
|
||||
file://0103-V4L2VDA-Add-macro-use_linux_v4l2.patch \
|
||||
file://0104-V4L2VDA-Create-single-multi-plane-queues.patch \
|
||||
file://0105-V4L2Buffer-Allocate-correct-v4l2-buffers-for-queues.patch \
|
||||
file://0106-V4L2VDA-Create-videoframe-according-to-v4l2buffer.patch \
|
||||
file://0107-V4L2VDA-Add-function-IsMultiQueue-for-S_FMT-and-G_FM.patch \
|
||||
file://0108-V4L2VDA-Use-correct-size-to-allocate-CAPTURE-buffer.patch \
|
||||
file://0109-V4L2VDA-Use-correct-plane-size-and-bytesused.patch \
|
||||
file://0110-V4L2VDA-Add-hevc-format-support.patch \
|
||||
file://0111-V4L2VDA-fix-vp9-crash-caused-by-DequeueResolutionCha.patch \
|
||||
file://0112-V4L2VDA-Add-fps-in-SkiaOutputSurfaceImplOnGpu-by-VLO.patch \
|
||||
file://0113-V4L2VDA-Comment-some-unused-ioctl.patch \
|
||||
file://0114-V4L2VDA-Set-OUTPUT-format-with-parsed-resolution-for.patch \
|
||||
file://0115-V4L2VDA-Add-V4L2_PIX_FMT_NV12M_8L128-format-for-amph.patch \
|
||||
file://0116-V4L2VDA-Support-tile-to-linear-transform-for-amphion.patch \
|
||||
file://0117-V4L2VDA-Enlarge-input-buffer-count-to-16.patch \
|
||||
file://0118-V4L2VDA-Use-dlopen-to-dynamically-use-g2d-api.patch \
|
||||
file://0119-V4L2VDA-Add-back-legacy-VideoDecoderType-kVda.patch \
|
||||
file://0120-V4L2Buffer-Add-support-for-imx95.patch \
|
||||
file://0101-V4L2Device-Correct-v4l2-codec-device-path.patch \
|
||||
file://0102-V4L2VideoDecoder-Add-macro-use_linux_v4l2.patch \
|
||||
file://0103-V4L2VideoDecoder-Create-single-multi-plane-queues.patch \
|
||||
file://0104-V4L2Buffer-Allocate-correct-v4l2-buffers-for-queues.patch \
|
||||
file://0105-V4L2VideoDecoder-Create-videoframe-according-to-v4l2.patch \
|
||||
file://0106-V4L2VideoDecoder-Add-function-IsMultiQueue-for-S_FMT.patch \
|
||||
file://0107-V4L2VideoDecoder-Use-correct-plane-size-and-bytesuse.patch \
|
||||
file://0108-V4L2VideoDecoder-Add-hevc-format-support.patch \
|
||||
file://0109-display-Add-fps-in-SkiaOutputSurfaceImplOnGpu-by-VLO \
|
||||
file://0110-V4L2VideoDecoder-Comment-some-unused-ioctl.patch \
|
||||
file://0111-V4L2VideoDecoder-Add-V4L2_PIX_FMT_NV12M_8L128-format.patch \
|
||||
file://0112-V4L2VideoDecoder-Support-tile-to-linear-transform-fo.patch \
|
||||
file://0113-V4L2VideoDecoder-Use-dlopen-to-dynamically-use-g2d-a.patch \
|
||||
file://0114-V4L2VideoDecoderBackend-Create-queue-according-to-qu.patch \
|
||||
file://0115-V4L2VideoDecoder-support-gpu-import-NV12-format.patch \
|
||||
file://0116-VideoDecoderPipeline-Add-resolution-change-support.patch \
|
||||
file://0117-V4L2StatefulVideoDecoderBackend-Enlarge-input-buffer.patch \
|
||||
file://0118-V4L2VideoDecoder-Fix-amphion-report-size-mismatch.patch \
|
||||
file://0119-VideoDecoderPipeline-Get-V4L2VideoDecoder-supported-.patch \
|
||||
file://0120-V4L2VideoDecoder-Fix-amphion-cannot-streamoff-after-.patch \
|
||||
"
|
||||
SRC_URI_DISABLED_PATCHES:append:mx8-nxp-bsp = " ${VDA_PATCH_SET}"
|
||||
SRC_URI_DISABLED_PATCHES:append:mx95-nxp-bsp = " ${VDA_PATCH_SET}"
|
||||
|
|
Loading…
Reference in New Issue
Block a user