diff options
Diffstat (limited to 'dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland/0104-V4L2VDA-Create-single-multi-plane-queues.patch')
| -rw-r--r-- | dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland/0104-V4L2VDA-Create-single-multi-plane-queues.patch | 152 |
1 files changed, 0 insertions, 152 deletions
diff --git a/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland/0104-V4L2VDA-Create-single-multi-plane-queues.patch b/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland/0104-V4L2VDA-Create-single-multi-plane-queues.patch deleted file mode 100644 index 817868acf..000000000 --- a/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland/0104-V4L2VDA-Create-single-multi-plane-queues.patch +++ /dev/null | |||
| @@ -1,152 +0,0 @@ | |||
| 1 | From 9caf73fb012217db1581a5079dfbc9872196571f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Hou Qi <qi.hou@nxp.com> | ||
| 3 | Date: Fri, 2 Sep 2022 15:35:52 +0800 | ||
| 4 | Subject: [PATCH 04/17] V4L2VDA: Create single/multi plane queues | ||
| 5 | |||
| 6 | Decide to create single-plane queue or multi-plane queue according to | ||
| 7 | the capabilities returned by VIDIOC_QUERYCAP. | ||
| 8 | |||
| 9 | Upstream-Status: Inappropriate [NXP specific] | ||
| 10 | --- | ||
| 11 | media/gpu/v4l2/generic_v4l2_device.cc | 15 ++++++---- | ||
| 12 | media/gpu/v4l2/v4l2_device.cc | 11 ++++++-- | ||
| 13 | .../gpu/v4l2/v4l2_video_decode_accelerator.cc | 28 ++++++++++++++----- | ||
| 14 | 3 files changed, 39 insertions(+), 15 deletions(-) | ||
| 15 | |||
| 16 | diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc | ||
| 17 | index 319357922c901..a578768f8d3b1 100644 | ||
| 18 | --- a/media/gpu/v4l2/generic_v4l2_device.cc | ||
| 19 | +++ b/media/gpu/v4l2/generic_v4l2_device.cc | ||
| 20 | @@ -489,27 +489,28 @@ void GenericV4L2Device::EnumerateDevicesForType(Type type) { | ||
| 21 | static const std::string kJpegEncoderDevicePattern = "/dev/jpeg-enc"; | ||
| 22 | |||
| 23 | std::string device_pattern; | ||
| 24 | - v4l2_buf_type buf_type; | ||
| 25 | + std::vector<v4l2_buf_type> candidate_buf_types; | ||
| 26 | switch (type) { | ||
| 27 | case Type::kDecoder: | ||
| 28 | device_pattern = kDecoderDevicePattern; | ||
| 29 | - buf_type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; | ||
| 30 | + candidate_buf_types.push_back(V4L2_BUF_TYPE_VIDEO_OUTPUT); | ||
| 31 | + candidate_buf_types.push_back(V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); | ||
| 32 | break; | ||
| 33 | case Type::kEncoder: | ||
| 34 | device_pattern = kEncoderDevicePattern; | ||
| 35 | - buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; | ||
| 36 | + candidate_buf_types.push_back(V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); | ||
| 37 | break; | ||
| 38 | case Type::kImageProcessor: | ||
| 39 | device_pattern = kImageProcessorDevicePattern; | ||
| 40 | - buf_type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; | ||
| 41 | + candidate_buf_types.push_back(V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); | ||
| 42 | break; | ||
| 43 | case Type::kJpegDecoder: | ||
| 44 | device_pattern = kJpegDecoderDevicePattern; | ||
| 45 | - buf_type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; | ||
| 46 | + candidate_buf_types.push_back(V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); | ||
| 47 | break; | ||
| 48 | case Type::kJpegEncoder: | ||
| 49 | device_pattern = kJpegEncoderDevicePattern; | ||
| 50 | - buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; | ||
| 51 | + candidate_buf_types.push_back(V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); | ||
| 52 | break; | ||
| 53 | } | ||
| 54 | |||
| 55 | @@ -529,6 +530,7 @@ void GenericV4L2Device::EnumerateDevicesForType(Type type) { | ||
| 56 | |||
| 57 | Devices devices; | ||
| 58 | for (const auto& path : candidate_paths) { | ||
| 59 | + for (const auto& buf_type : candidate_buf_types){ | ||
| 60 | if (!OpenDevicePath(path, type)) | ||
| 61 | continue; | ||
| 62 | |||
| 63 | @@ -541,6 +543,7 @@ void GenericV4L2Device::EnumerateDevicesForType(Type type) { | ||
| 64 | |||
| 65 | CloseDevice(); | ||
| 66 | } | ||
| 67 | + } | ||
| 68 | |||
| 69 | DCHECK_EQ(devices_by_type_.count(type), 0u); | ||
| 70 | devices_by_type_[type] = devices; | ||
| 71 | diff --git a/media/gpu/v4l2/v4l2_device.cc b/media/gpu/v4l2/v4l2_device.cc | ||
| 72 | index 722ddbd68cb2b..8194d8646637c 100644 | ||
| 73 | --- a/media/gpu/v4l2/v4l2_device.cc | ||
| 74 | +++ b/media/gpu/v4l2/v4l2_device.cc | ||
| 75 | @@ -1479,6 +1479,8 @@ scoped_refptr<V4L2Queue> V4L2Device::GetQueue(enum v4l2_buf_type type) { | ||
| 76 | // Supported queue types. | ||
| 77 | case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: | ||
| 78 | case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: | ||
| 79 | + case V4L2_BUF_TYPE_VIDEO_OUTPUT: | ||
| 80 | + case V4L2_BUF_TYPE_VIDEO_CAPTURE: | ||
| 81 | break; | ||
| 82 | default: | ||
| 83 | VLOGF(1) << "Unsupported V4L2 queue type: " << type; | ||
| 84 | @@ -2049,8 +2051,13 @@ V4L2Device::EnumerateSupportedDecodeProfiles(const size_t num_formats, | ||
| 85 | const uint32_t pixelformats[]) { | ||
| 86 | VideoDecodeAccelerator::SupportedProfiles profiles; | ||
| 87 | |||
| 88 | - const auto& supported_pixelformats = | ||
| 89 | - EnumerateSupportedPixelformats(V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); | ||
| 90 | + std::vector<uint32_t> enumerated_pixelformats; | ||
| 91 | + enumerated_pixelformats = EnumerateSupportedPixelformats(V4L2_BUF_TYPE_VIDEO_OUTPUT); | ||
| 92 | + if (enumerated_pixelformats.empty()) { | ||
| 93 | + VLOG(1) << "empty.... Try Multi-plane"; | ||
| 94 | + enumerated_pixelformats = EnumerateSupportedPixelformats(V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); | ||
| 95 | + } | ||
| 96 | + const auto& supported_pixelformats = enumerated_pixelformats; | ||
| 97 | |||
| 98 | for (uint32_t pixelformat : supported_pixelformats) { | ||
| 99 | if (std::find(pixelformats, pixelformats + num_formats, pixelformat) == | ||
| 100 | diff --git a/media/gpu/v4l2/v4l2_video_decode_accelerator.cc b/media/gpu/v4l2/v4l2_video_decode_accelerator.cc | ||
| 101 | index c920940572fb2..631e68e0f9314 100644 | ||
| 102 | --- a/media/gpu/v4l2/v4l2_video_decode_accelerator.cc | ||
| 103 | +++ b/media/gpu/v4l2/v4l2_video_decode_accelerator.cc | ||
| 104 | @@ -322,24 +322,38 @@ bool V4L2VideoDecodeAccelerator::CheckConfig(const Config& config) { | ||
| 105 | |||
| 106 | // Capabilities check. | ||
| 107 | struct v4l2_capability caps; | ||
| 108 | - const __u32 kCapsRequired = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING; | ||
| 109 | - IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_QUERYCAP, &caps); | ||
| 110 | - if ((caps.capabilities & kCapsRequired) != kCapsRequired) { | ||
| 111 | - VLOGF(1) << "ioctl() failed: VIDIOC_QUERYCAP" | ||
| 112 | - << ", caps check failed: 0x" << std::hex << caps.capabilities; | ||
| 113 | + unsigned int device_caps; | ||
| 114 | + enum v4l2_buf_type input_type, output_type; | ||
| 115 | + if (device_->Ioctl(VIDIOC_QUERYCAP, &caps) != 0) { | ||
| 116 | + VPLOGF(1) << "ioctl() failed: VIDIOC_QUERYCAP" | ||
| 117 | + << ", caps check failed: 0x" << std::hex << caps.capabilities; | ||
| 118 | return false; | ||
| 119 | } | ||
| 120 | |||
| 121 | + if (caps.capabilities & V4L2_CAP_DEVICE_CAPS) | ||
| 122 | + device_caps = caps.device_caps; | ||
| 123 | + else | ||
| 124 | + device_caps = caps.capabilities; | ||
| 125 | + | ||
| 126 | + if (device_caps & (V4L2_CAP_VIDEO_OUTPUT_MPLANE | V4L2_CAP_VIDEO_M2M_MPLANE)) | ||
| 127 | + input_type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; | ||
| 128 | + else | ||
| 129 | + input_type = V4L2_BUF_TYPE_VIDEO_OUTPUT; | ||
| 130 | + if (device_caps & (V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_VIDEO_M2M_MPLANE)) | ||
| 131 | + output_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; | ||
| 132 | + else | ||
| 133 | + output_type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
| 134 | + | ||
| 135 | workarounds_ = | ||
| 136 | CreateV4L2StatefulWorkarounds(V4L2Device::Type::kDecoder, config.profile); | ||
| 137 | |||
| 138 | output_mode_ = config.output_mode; | ||
| 139 | |||
| 140 | - input_queue_ = device_->GetQueue(V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); | ||
| 141 | + input_queue_ = device_->GetQueue(input_type); | ||
| 142 | if (!input_queue_) | ||
| 143 | return false; | ||
| 144 | |||
| 145 | - output_queue_ = device_->GetQueue(V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); | ||
| 146 | + output_queue_ = device_->GetQueue(output_type); | ||
| 147 | if (!output_queue_) | ||
| 148 | return false; | ||
| 149 | |||
| 150 | -- | ||
| 151 | 2.17.1 | ||
| 152 | |||
