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

Unified Diff: content/common/gpu/media/v4l2_device.cc

Issue 795633005: Add VDA supported profile to GPUInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address patch set 13 review comments Created 5 years, 9 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
Index: content/common/gpu/media/v4l2_device.cc
diff --git a/content/common/gpu/media/v4l2_device.cc b/content/common/gpu/media/v4l2_device.cc
index 4337f4078aff13a5468fd1a16cede48fe6929b3d..58c8da6fa967fdab821ec05a7bba26f3e85b27ba 100644
--- a/content/common/gpu/media/v4l2_device.cc
+++ b/content/common/gpu/media/v4l2_device.cc
@@ -5,11 +5,13 @@
#include <libdrm/drm_fourcc.h>
#include <linux/videodev2.h>
+#include "base/command_line.h"
#include "base/numerics/safe_conversions.h"
#include "content/common/gpu/media/generic_v4l2_device.h"
#if defined(ARCH_CPU_ARMEL)
#include "content/common/gpu/media/tegra_v4l2_device.h"
#endif
+#include "media/base/media_switches.h"
// TODO(posciak): remove this once V4L2 headers are updated.
#define V4L2_PIX_FMT_VP9 v4l2_fourcc('V', 'P', '9', '0')
@@ -202,4 +204,81 @@ gfx::Size V4L2Device::CodedSizeFromV4L2Format(struct v4l2_format format) {
return coded_size;
}
+// static
+std::vector<media::VideoDecodeAccelerator::SupportedProfile>
+V4L2Device::GetSupportedDecodeProfiles() {
+ std::vector<media::VideoDecodeAccelerator::SupportedProfile> profiles;
+ scoped_refptr<V4L2Device> device = Create(kDecoder);
+ if (!device)
+ return profiles;
+
+ media::VideoDecodeAccelerator::SupportedProfile profile;
+ profile.min_resolution.SetSize(16, 16);
+ // NOTE: additional autodetection logic may require updating input buffer size
+ // selection.
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kIgnoreResolutionLimitsForAcceleratedVideoDecode))
+ profile.max_resolution.SetSize(4096, 2160);
+ else
+ profile.max_resolution.SetSize(1920, 1088);
+
+ v4l2_fmtdesc fmtdesc;
+ memset(&fmtdesc, 0, sizeof(fmtdesc));
+ fmtdesc.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+ for (; device->Ioctl(VIDIOC_ENUM_FMT, &fmtdesc) == 0; ++fmtdesc.index) {
+ switch (fmtdesc.pixelformat) {
+ case V4L2_PIX_FMT_H264:
wuchengli 2015/03/18 08:02:37 As discussed, SliceVDA supports V4L2_PIX_FMT_VP8_F
henryhsu 2015/03/18 11:06:09 Done.
+ profile.profile = media::H264PROFILE_MAIN;
+ profiles.push_back(profile);
+ break;
+ case V4L2_PIX_FMT_VP8:
+ profile.profile = media::VP8PROFILE_ANY;
+ profiles.push_back(profile);
+ break;
+ case V4L2_PIX_FMT_VP9:
+ profile.profile = media::VP9PROFILE_ANY;
+ profiles.push_back(profile);
+ break;
+ }
+ }
+
+ return profiles;
+}
+
+// static
+std::vector<media::VideoEncodeAccelerator::SupportedProfile>
+V4L2Device::GetSupportedEncodeProfiles() {
+ std::vector<media::VideoEncodeAccelerator::SupportedProfile> profiles;
+ scoped_refptr<V4L2Device> device = Create(kEncoder);
+ if (!device)
+ return profiles;
+
+ media::VideoEncodeAccelerator::SupportedProfile profile;
+ profile.max_resolution.SetSize(1920, 1088);
+ profile.max_framerate_numerator = 30;
+ profile.max_framerate_denominator = 1;
+
+ v4l2_fmtdesc fmtdesc;
+ memset(&fmtdesc, 0, sizeof(fmtdesc));
+ fmtdesc.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+ for (; device->Ioctl(VIDIOC_ENUM_FMT, &fmtdesc) == 0; ++fmtdesc.index) {
+ switch (fmtdesc.pixelformat) {
+ case V4L2_PIX_FMT_H264:
+ profile.profile = media::H264PROFILE_MAIN;
+ profiles.push_back(profile);
+ break;
+ case V4L2_PIX_FMT_VP8:
+ profile.profile = media::VP8PROFILE_ANY;
+ profiles.push_back(profile);
+ break;
+ case V4L2_PIX_FMT_VP9:
+ profile.profile = media::VP9PROFILE_ANY;
+ profiles.push_back(profile);
+ break;
+ }
+ }
+
+ return profiles;
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698