OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/gpu/dxva_video_decode_accelerator_win.h" | 5 #include "media/gpu/dxva_video_decode_accelerator_win.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #if !defined(OS_WIN) | 9 #if !defined(OS_WIN) |
10 #error This file should only be built on Windows. | 10 #error This file should only be built on Windows. |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 enable_low_latency_(gpu_preferences.enable_low_latency_dxva), | 496 enable_low_latency_(gpu_preferences.enable_low_latency_dxva), |
497 share_nv12_textures_(gpu_preferences.enable_zero_copy_dxgi_video && | 497 share_nv12_textures_(gpu_preferences.enable_zero_copy_dxgi_video && |
498 !workarounds.disable_dxgi_zero_copy_video), | 498 !workarounds.disable_dxgi_zero_copy_video), |
499 copy_nv12_textures_(gpu_preferences.enable_nv12_dxgi_video && | 499 copy_nv12_textures_(gpu_preferences.enable_nv12_dxgi_video && |
500 !workarounds.disable_nv12_dxgi_video), | 500 !workarounds.disable_nv12_dxgi_video), |
501 use_dx11_(false), | 501 use_dx11_(false), |
502 use_keyed_mutex_(false), | 502 use_keyed_mutex_(false), |
503 dx11_video_format_converter_media_type_needs_init_(true), | 503 dx11_video_format_converter_media_type_needs_init_(true), |
504 using_angle_device_(false), | 504 using_angle_device_(false), |
505 enable_accelerated_vpx_decode_( | 505 enable_accelerated_vpx_decode_( |
506 gpu_preferences.enable_accelerated_vpx_decode), | 506 workarounds.disable_accelerated_vpx_decode |
| 507 ? gpu::GpuPreferences::VpxDecodeVendors::VPX_VENDOR_NONE |
| 508 : gpu_preferences.enable_accelerated_vpx_decode), |
507 processing_config_changed_(false), | 509 processing_config_changed_(false), |
508 weak_this_factory_(this) { | 510 weak_this_factory_(this) { |
509 weak_ptr_ = weak_this_factory_.GetWeakPtr(); | 511 weak_ptr_ = weak_this_factory_.GetWeakPtr(); |
510 memset(&input_stream_info_, 0, sizeof(input_stream_info_)); | 512 memset(&input_stream_info_, 0, sizeof(input_stream_info_)); |
511 memset(&output_stream_info_, 0, sizeof(output_stream_info_)); | 513 memset(&output_stream_info_, 0, sizeof(output_stream_info_)); |
512 use_color_info_ = base::FeatureList::IsEnabled(kVideoBlitColorAccuracy); | 514 use_color_info_ = base::FeatureList::IsEnabled(kVideoBlitColorAccuracy); |
513 } | 515 } |
514 | 516 |
515 DXVAVideoDecodeAccelerator::~DXVAVideoDecodeAccelerator() { | 517 DXVAVideoDecodeAccelerator::~DXVAVideoDecodeAccelerator() { |
516 client_ = NULL; | 518 client_ = NULL; |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 return false; | 1179 return false; |
1178 } | 1180 } |
1179 | 1181 |
1180 GLenum DXVAVideoDecodeAccelerator::GetSurfaceInternalFormat() const { | 1182 GLenum DXVAVideoDecodeAccelerator::GetSurfaceInternalFormat() const { |
1181 return GL_BGRA_EXT; | 1183 return GL_BGRA_EXT; |
1182 } | 1184 } |
1183 | 1185 |
1184 // static | 1186 // static |
1185 VideoDecodeAccelerator::SupportedProfiles | 1187 VideoDecodeAccelerator::SupportedProfiles |
1186 DXVAVideoDecodeAccelerator::GetSupportedProfiles( | 1188 DXVAVideoDecodeAccelerator::GetSupportedProfiles( |
1187 const gpu::GpuPreferences& preferences) { | 1189 const gpu::GpuPreferences& preferences, |
| 1190 const gpu::GpuDriverBugWorkarounds& workarounds) { |
1188 TRACE_EVENT0("gpu,startup", | 1191 TRACE_EVENT0("gpu,startup", |
1189 "DXVAVideoDecodeAccelerator::GetSupportedProfiles"); | 1192 "DXVAVideoDecodeAccelerator::GetSupportedProfiles"); |
1190 | 1193 |
1191 // TODO(henryhsu): Need to ensure the profiles are actually supported. | 1194 // TODO(henryhsu): Need to ensure the profiles are actually supported. |
1192 SupportedProfiles profiles; | 1195 SupportedProfiles profiles; |
1193 | 1196 |
1194 for (const wchar_t* mfdll : kMediaFoundationVideoDecoderDLLs) { | 1197 for (const wchar_t* mfdll : kMediaFoundationVideoDecoderDLLs) { |
1195 if (!::GetModuleHandle(mfdll)) { | 1198 if (!::GetModuleHandle(mfdll)) { |
1196 // Windows N is missing the media foundation DLLs unless the media | 1199 // Windows N is missing the media foundation DLLs unless the media |
1197 // feature pack is installed. | 1200 // feature pack is installed. |
1198 DVLOG(ERROR) << mfdll << " is required for hardware video decoding"; | 1201 DVLOG(ERROR) << mfdll << " is required for hardware video decoding"; |
1199 return profiles; | 1202 return profiles; |
1200 } | 1203 } |
1201 } | 1204 } |
1202 for (const auto& supported_profile : kSupportedProfiles) { | 1205 for (const auto& supported_profile : kSupportedProfiles) { |
1203 if (!preferences.enable_accelerated_vpx_decode && | 1206 if ((!preferences.enable_accelerated_vpx_decode || |
| 1207 workarounds.disable_accelerated_vpx_decode) && |
1204 (supported_profile >= VP8PROFILE_MIN) && | 1208 (supported_profile >= VP8PROFILE_MIN) && |
1205 (supported_profile <= VP9PROFILE_MAX)) { | 1209 (supported_profile <= VP9PROFILE_MAX)) { |
1206 continue; | 1210 continue; |
1207 } | 1211 } |
1208 std::pair<int, int> min_resolution = GetMinResolution(supported_profile); | 1212 std::pair<int, int> min_resolution = GetMinResolution(supported_profile); |
1209 std::pair<int, int> max_resolution = GetMaxResolution(supported_profile); | 1213 std::pair<int, int> max_resolution = GetMaxResolution(supported_profile); |
1210 | 1214 |
1211 SupportedProfile profile; | 1215 SupportedProfile profile; |
1212 profile.profile = supported_profile; | 1216 profile.profile = supported_profile; |
1213 profile.min_resolution.SetSize(min_resolution.first, min_resolution.second); | 1217 profile.min_resolution.SetSize(min_resolution.first, min_resolution.second); |
(...skipping 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2924 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, | 2928 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, |
2925 base::Unretained(this))); | 2929 base::Unretained(this))); |
2926 } | 2930 } |
2927 | 2931 |
2928 uint32_t DXVAVideoDecodeAccelerator::GetTextureTarget() const { | 2932 uint32_t DXVAVideoDecodeAccelerator::GetTextureTarget() const { |
2929 bool provide_nv12_textures = share_nv12_textures_ || copy_nv12_textures_; | 2933 bool provide_nv12_textures = share_nv12_textures_ || copy_nv12_textures_; |
2930 return provide_nv12_textures ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D; | 2934 return provide_nv12_textures ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D; |
2931 } | 2935 } |
2932 | 2936 |
2933 } // namespace media | 2937 } // namespace media |
OLD | NEW |