diff options
author | henryhsu <henryhsu@chromium.org> | 2015-04-09 23:39:14 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-10 06:39:44 +0000 |
commit | d118544f749bae18a188141edba216fed9163eba (patch) | |
tree | b2ed838b95666d53668a3b12337cefa958156ef3 /gpu | |
parent | 36a4e7d48e672fc36cf235a7cd42b15da97dfa65 (diff) | |
download | chromium_src-d118544f749bae18a188141edba216fed9163eba.zip chromium_src-d118544f749bae18a188141edba216fed9163eba.tar.gz chromium_src-d118544f749bae18a188141edba216fed9163eba.tar.bz2 |
Add VDA supported profile to GPUInfo
Different CrOS devices have different supported decode profiles.
Add VDA supported profile to GPUInfo so this can be detected
in runtime. This is also the preparation of removing
--ignore-resolution-limits-for-accelerated-video-decode flag.
BUG=350197
TEST=Play a video on Exynos and Intel CrOS devices and make sure
Media.GpuVideoDecoderInitializeStatus is 0.
Review URL: https://codereview.chromium.org/795633005
Cr-Commit-Position: refs/heads/master@{#324596}
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/config/gpu_info.cc | 40 | ||||
-rw-r--r-- | gpu/config/gpu_info.h | 20 | ||||
-rw-r--r-- | gpu/config/gpu_info_collector.cc | 2 | ||||
-rw-r--r-- | gpu/config/gpu_info_unittest.cc | 1 |
4 files changed, 48 insertions, 15 deletions
diff --git a/gpu/config/gpu_info.cc b/gpu/config/gpu_info.cc index 3653a10..85d26fb 100644 --- a/gpu/config/gpu_info.cc +++ b/gpu/config/gpu_info.cc @@ -6,8 +6,8 @@ namespace { -void EnumerateGPUDevice(gpu::GPUInfo::Enumerator* enumerator, - const gpu::GPUInfo::GPUDevice& device) { +void EnumerateGPUDevice(const gpu::GPUInfo::GPUDevice& device, + gpu::GPUInfo::Enumerator* enumerator) { enumerator->BeginGPUDevice(); enumerator->AddInt("vendorId", device.vendor_id); enumerator->AddInt("deviceId", device.device_id); @@ -17,9 +17,21 @@ void EnumerateGPUDevice(gpu::GPUInfo::Enumerator* enumerator, enumerator->EndGPUDevice(); } +void EnumerateVideoDecodeAcceleratorSupportedProfile( + const gpu::VideoDecodeAcceleratorSupportedProfile& profile, + gpu::GPUInfo::Enumerator* enumerator) { + enumerator->BeginVideoDecodeAcceleratorSupportedProfile(); + enumerator->AddInt("profile", profile.profile); + enumerator->AddInt("maxResolutionWidth", profile.max_resolution.width()); + enumerator->AddInt("maxResolutionHeight", profile.max_resolution.height()); + enumerator->AddInt("minResolutionWidth", profile.min_resolution.width()); + enumerator->AddInt("minResolutionHeight", profile.min_resolution.height()); + enumerator->EndVideoDecodeAcceleratorSupportedProfile(); +} + void EnumerateVideoEncodeAcceleratorSupportedProfile( - gpu::GPUInfo::Enumerator* enumerator, - const gpu::VideoEncodeAcceleratorSupportedProfile profile) { + const gpu::VideoEncodeAcceleratorSupportedProfile& profile, + gpu::GPUInfo::Enumerator* enumerator) { enumerator->BeginVideoEncodeAcceleratorSupportedProfile(); enumerator->AddInt("profile", profile.profile); enumerator->AddInt("maxResolutionWidth", profile.max_resolution.width()); @@ -101,7 +113,9 @@ void GPUInfo::EnumerateFields(Enumerator* enumerator) const { CollectInfoResult dx_diagnostics_info_state; DxDiagNode dx_diagnostics; #endif - std::vector<VideoEncodeAcceleratorSupportedProfile> + VideoDecodeAcceleratorSupportedProfiles + video_decode_accelerator_supported_profiles; + VideoEncodeAcceleratorSupportedProfiles video_encode_accelerator_supported_profiles; }; @@ -115,10 +129,9 @@ void GPUInfo::EnumerateFields(Enumerator* enumerator) const { // Required fields (according to DevTools protocol) first. enumerator->AddString("machineModelName", machine_model_name); enumerator->AddString("machineModelVersion", machine_model_version); - EnumerateGPUDevice(enumerator, gpu); - for (size_t ii = 0; ii < secondary_gpus.size(); ++ii) { - EnumerateGPUDevice(enumerator, secondary_gpus[ii]); - } + EnumerateGPUDevice(gpu, enumerator); + for (const auto& secondary_gpu: secondary_gpus) + EnumerateGPUDevice(secondary_gpu, enumerator); enumerator->BeginAuxAttributes(); enumerator->AddTimeDeltaInSecondsF("initializationTime", @@ -159,11 +172,10 @@ void GPUInfo::EnumerateFields(Enumerator* enumerator) const { enumerator->AddInt("DxDiagnosticsInfoState", dx_diagnostics_info_state); #endif // TODO(kbr): add dx_diagnostics on Windows. - for (size_t ii = 0; ii < video_encode_accelerator_supported_profiles.size(); - ++ii) { - EnumerateVideoEncodeAcceleratorSupportedProfile( - enumerator, video_encode_accelerator_supported_profiles[ii]); - } + for (const auto& profile : video_decode_accelerator_supported_profiles) + EnumerateVideoDecodeAcceleratorSupportedProfile(profile, enumerator); + for (const auto& profile : video_encode_accelerator_supported_profiles) + EnumerateVideoEncodeAcceleratorSupportedProfile(profile, enumerator); enumerator->EndAuxAttributes(); } diff --git a/gpu/config/gpu_info.h b/gpu/config/gpu_info.h index cbd8361..f377698 100644 --- a/gpu/config/gpu_info.h +++ b/gpu/config/gpu_info.h @@ -54,6 +54,15 @@ enum VideoCodecProfile { VIDEO_CODEC_PROFILE_MAX = VP9PROFILE_ANY, }; +// Specification of a decoding profile supported by a hardware decoder. +struct GPU_EXPORT VideoDecodeAcceleratorSupportedProfile { + VideoCodecProfile profile; + gfx::Size max_resolution; + gfx::Size min_resolution; +}; +using VideoDecodeAcceleratorSupportedProfiles = + std::vector<VideoDecodeAcceleratorSupportedProfile>; + // Specification of an encoding profile supported by a hardware encoder. struct GPU_EXPORT VideoEncodeAcceleratorSupportedProfile { VideoCodecProfile profile; @@ -61,6 +70,8 @@ struct GPU_EXPORT VideoEncodeAcceleratorSupportedProfile { uint32 max_framerate_numerator; uint32 max_framerate_denominator; }; +using VideoEncodeAcceleratorSupportedProfiles = + std::vector<VideoEncodeAcceleratorSupportedProfile>; struct GPU_EXPORT GPUInfo { struct GPU_EXPORT GPUDevice { @@ -206,7 +217,9 @@ struct GPU_EXPORT GPUInfo { DxDiagNode dx_diagnostics; #endif - std::vector<VideoEncodeAcceleratorSupportedProfile> + VideoDecodeAcceleratorSupportedProfiles + video_decode_accelerator_supported_profiles; + VideoEncodeAcceleratorSupportedProfiles video_encode_accelerator_supported_profiles; // Note: when adding new members, please remember to update EnumerateFields // in gpu_info.cc. @@ -232,6 +245,11 @@ struct GPU_EXPORT GPUInfo { virtual void BeginGPUDevice() = 0; virtual void EndGPUDevice() = 0; + // Markers indicating that a VideoDecodeAcceleratorSupportedProfile is + // being described. + virtual void BeginVideoDecodeAcceleratorSupportedProfile() = 0; + virtual void EndVideoDecodeAcceleratorSupportedProfile() = 0; + // Markers indicating that a VideoEncodeAcceleratorSupportedProfile is // being described. virtual void BeginVideoEncodeAcceleratorSupportedProfile() = 0; diff --git a/gpu/config/gpu_info_collector.cc b/gpu/config/gpu_info_collector.cc index c673057..2403340 100644 --- a/gpu/config/gpu_info_collector.cc +++ b/gpu/config/gpu_info_collector.cc @@ -163,6 +163,8 @@ void MergeGPUInfoGL(GPUInfo* basic_gpu_info, basic_gpu_info->direct_rendering = context_gpu_info.direct_rendering; basic_gpu_info->context_info_state = context_gpu_info.context_info_state; basic_gpu_info->initialization_time = context_gpu_info.initialization_time; + basic_gpu_info->video_decode_accelerator_supported_profiles = + context_gpu_info.video_decode_accelerator_supported_profiles; basic_gpu_info->video_encode_accelerator_supported_profiles = context_gpu_info.video_encode_accelerator_supported_profiles; } diff --git a/gpu/config/gpu_info_unittest.cc b/gpu/config/gpu_info_unittest.cc index 1d5fa6e..21dd4ff 100644 --- a/gpu/config/gpu_info_unittest.cc +++ b/gpu/config/gpu_info_unittest.cc @@ -33,6 +33,7 @@ TEST(GPUInfoBasicTest, EmptyGPUInfo) { #if defined(OS_WIN) EXPECT_EQ(gpu_info.dx_diagnostics_info_state, kCollectInfoNone); #endif + EXPECT_EQ(gpu_info.video_decode_accelerator_supported_profiles.size(), 0u); EXPECT_EQ(gpu_info.video_encode_accelerator_supported_profiles.size(), 0u); } |