Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1362)

Unified Diff: media/gpu/v4l2_video_decode_accelerator.cc

Issue 2260123002: V4L2VDA: use YV12 as output format if processor supports it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address Pawel's offline comment. Prefer YVU420>NV12>others Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/gpu/v4l2_device.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/gpu/v4l2_video_decode_accelerator.cc
diff --git a/media/gpu/v4l2_video_decode_accelerator.cc b/media/gpu/v4l2_video_decode_accelerator.cc
index 01e650a2f3cf35fdb5581f672b957672d9a2ae06..b4a27d1455fd734ecaf22f7956e8a4235e846d09 100644
--- a/media/gpu/v4l2_video_decode_accelerator.cc
+++ b/media/gpu/v4l2_video_decode_accelerator.cc
@@ -2038,9 +2038,30 @@ uint32_t V4L2VideoDecodeAccelerator::FindImageProcessorInputFormat() {
}
uint32_t V4L2VideoDecodeAccelerator::FindImageProcessorOutputFormat() {
+ // Prefer YVU420 and NV12 because ArcGpuVideoDecodeAccelerator and drm_gralloc
+ // only support single physical plane. Prefer YVU420 over NV12 because chrome
+ // rendering supports YV12 only. When we use NV12, chrome thinks it is RGBA
+ // and mali handles that transparently knowing it is really NV12.
+ static const uint32_t kPreferredFormats[] = {V4L2_PIX_FMT_YVU420,
+ V4L2_PIX_FMT_NV12};
+ struct {
kcwu 2016/08/22 08:07:00 I feel it's unnecessary to use struct. A normal fu
wuchengli 2016/08/22 09:08:04 Yeah. Lambda is simpler. Done.
+ bool operator()(uint32_t a, uint32_t b) {
+ auto iter_a = std::find(std::begin(kPreferredFormats),
+ std::end(kPreferredFormats), a);
+ auto iter_b = std::find(std::begin(kPreferredFormats),
+ std::end(kPreferredFormats), b);
+ return iter_a < iter_b;
+ }
+ } preferred_formats_first;
+
V4L2ImageProcessor image_processor(image_processor_device_);
std::vector<uint32_t> processor_output_formats =
image_processor.GetSupportedOutputFormats();
+
+ // Move the preferred format to the front.
+ std::sort(processor_output_formats.begin(), processor_output_formats.end(),
kcwu 2016/08/22 08:07:00 Just curious, does the ordering of GetSupportedOut
wuchengli 2016/08/22 09:08:03 The order of GetSupportedOutputFormats does not me
+ preferred_formats_first);
+
for (uint32_t processor_output_format : processor_output_formats) {
if (device_->CanCreateEGLImageFrom(processor_output_format)) {
DVLOGF(1) << "Image processor output format=" << processor_output_format;
« no previous file with comments | « media/gpu/v4l2_device.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698