Commit 0a72febb authored by posciak@chromium.org's avatar posciak@chromium.org

Add 4k HW decode override flag and support larger bitstream buffers in V4L2VDA.

Add a flag to override 4k hardware video decode capability detection in GVD
if needed. This is for platforms that currently do not give us a proper way
to detect it.

Also bump input bistream size in V4L2VDA to accommodate potentially
larger streams in higher resolutions. We cannot estimate input buffer size
based on the stream, as we do not currently pass video config info down to
the VDAs, and the bitstream buffers are needed in order to parse the
stream to get that information.

BUG=373717
TEST=4k video playback

Review URL: https://codereview.chromium.org/285343003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271653 0039d316-1c4b-4281-b951-d872f2087c98
parent 85791b0b
......@@ -129,6 +129,7 @@ std::string DeriveCommandLine(const GURL& start_url,
::switches::kGpuSandboxAllowSysVShm,
::switches::kGpuSandboxFailuresFatal,
::switches::kGpuSandboxStartAfterInitialization,
::switches::kIgnoreResolutionLimitsForAcceleratedVideoDecode,
::switches::kNoSandbox,
::switches::kNumRasterThreads,
::switches::kPpapiFlashArgs,
......
......@@ -38,6 +38,7 @@
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_switches.h"
#include "ipc/message_filter.h"
#include "media/base/media_switches.h"
#include "ui/events/latency_info.h"
#include "ui/gl/gl_switches.h"
......@@ -937,6 +938,7 @@ bool GpuProcessHost::LaunchGpuProcess(const std::string& channel_id) {
switches::kGpuSandboxAllowSysVShm,
switches::kGpuSandboxFailuresFatal,
switches::kGpuSandboxStartAfterInitialization,
switches::kIgnoreResolutionLimitsForAcceleratedVideoDecode,
switches::kLoggingLevel,
switches::kNoSandbox,
switches::kTestGLLib,
......
......@@ -1111,6 +1111,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
switches::kForceCompositingMode,
switches::kForceDeviceScaleFactor,
switches::kFullMemoryCrashReport,
switches::kIgnoreResolutionLimitsForAcceleratedVideoDecode,
switches::kJavaScriptFlags,
switches::kLoggingLevel,
switches::kMaxUntiledLayerWidth,
......
......@@ -12,12 +12,14 @@
#include <sys/mman.h>
#include "base/bind.h"
#include "base/command_line.h"
#include "base/debug/trace_event.h"
#include "base/memory/shared_memory.h"
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/numerics/safe_conversions.h"
#include "content/common/gpu/media/v4l2_video_decode_accelerator.h"
#include "media/base/media_switches.h"
#include "media/filters/h264_parser.h"
#include "ui/gl/scoped_binders.h"
......@@ -1669,7 +1671,11 @@ bool V4L2VideoDecodeAccelerator::CreateInputBuffers() {
memset(&format, 0, sizeof(format));
format.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
format.fmt.pix_mp.pixelformat = pixelformat;
format.fmt.pix_mp.plane_fmt[0].sizeimage = kInputBufferMaxSize;
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kIgnoreResolutionLimitsForAcceleratedVideoDecode))
format.fmt.pix_mp.plane_fmt[0].sizeimage = kInputBufferMaxSizeFor4k;
else
format.fmt.pix_mp.plane_fmt[0].sizeimage = kInputBufferMaxSizeFor1080p;
format.fmt.pix_mp.num_planes = 1;
IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_S_FMT, &format);
......
......@@ -105,7 +105,10 @@ class CONTENT_EXPORT V4L2VideoDecodeAccelerator
kInputBufferCount = 8,
// TODO(posciak): determine input buffer size based on level limits.
// See http://crbug.com/255116.
kInputBufferMaxSize = 1024 * 1024,
// Input bitstream buffer size for up to 1080p streams.
kInputBufferMaxSizeFor1080p = 1024 * 1024,
// Input bitstream buffer size for up to 4k streams.
kInputBufferMaxSizeFor4k = 4 * kInputBufferMaxSizeFor1080p,
// Number of output buffers to use for each VDA stage above what's required
// by the decoder (e.g. DPB size, in H264). We need
// media::limits::kMaxVideoFrames to fill up the GpuVideoDecode pipeline,
......
......@@ -15,6 +15,11 @@ const char kVideoThreads[] = "video-threads";
// Enables ADTS stream parser for Media Source Extensions.
const char kEnableADTSStreamParser[] = "enable-adts-stream-parser";
// Bypass autodetection of the upper limit on resolution of streams that can
// be hardware decoded.
const char kIgnoreResolutionLimitsForAcceleratedVideoDecode[] =
"ignore-resolution-limits-for-accelerated-video-decode";
#if defined(OS_ANDROID)
// Disables the infobar popup for accessing protected media identifier.
const char kDisableInfobarForProtectedMediaIdentifier[] =
......
......@@ -18,6 +18,9 @@ MEDIA_EXPORT extern const char kVideoThreads[];
MEDIA_EXPORT extern const char kEnableADTSStreamParser[];
MEDIA_EXPORT extern const char
kIgnoreResolutionLimitsForAcceleratedVideoDecode[];
#if defined(OS_ANDROID)
MEDIA_EXPORT extern const char kDisableInfobarForProtectedMediaIdentifier[];
MEDIA_EXPORT extern const char kMediaDrmEnableNonCompositing[];
......
......@@ -8,6 +8,7 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/command_line.h"
#include "base/cpu.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram.h"
......@@ -18,6 +19,7 @@
#include "media/base/bind_to_current_loop.h"
#include "media/base/decoder_buffer.h"
#include "media/base/media_log.h"
#include "media/base/media_switches.h"
#include "media/base/pipeline.h"
#include "media/base/pipeline_status.h"
#include "media/base/video_decoder_config.h"
......@@ -120,9 +122,14 @@ static bool IsCodedSizeSupported(const gfx::Size& coded_size) {
if (coded_size.width() <= 1920 && coded_size.height() <= 1088)
return true;
// NOTE: additional autodetection logic may require updating input buffer size
// selection in platform-specific implementations, such as
// V4L2VideoDecodeAccelerator.
base::CPU cpu;
bool hw_large_video_support =
(cpu.vendor_name() == "GenuineIntel") && cpu.model() >= 55;
CommandLine::ForCurrentProcess()->HasSwitch(
switches::kIgnoreResolutionLimitsForAcceleratedVideoDecode) ||
((cpu.vendor_name() == "GenuineIntel") && cpu.model() >= 55);
bool os_large_video_support = true;
#if defined(OS_WIN)
os_large_video_support = false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment