| 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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 pending_flush_(false), | 497 pending_flush_(false), |
| 498 enable_low_latency_(gpu_preferences.enable_low_latency_dxva), | 498 enable_low_latency_(gpu_preferences.enable_low_latency_dxva), |
| 499 share_nv12_textures_(gpu_preferences.enable_zero_copy_dxgi_video && | 499 share_nv12_textures_(gpu_preferences.enable_zero_copy_dxgi_video && |
| 500 !workarounds.disable_dxgi_zero_copy_video), | 500 !workarounds.disable_dxgi_zero_copy_video), |
| 501 copy_nv12_textures_(gpu_preferences.enable_nv12_dxgi_video && | 501 copy_nv12_textures_(gpu_preferences.enable_nv12_dxgi_video && |
| 502 !workarounds.disable_nv12_dxgi_video), | 502 !workarounds.disable_nv12_dxgi_video), |
| 503 use_dx11_(false), | 503 use_dx11_(false), |
| 504 use_keyed_mutex_(false), | 504 use_keyed_mutex_(false), |
| 505 using_angle_device_(false), | 505 using_angle_device_(false), |
| 506 enable_accelerated_vpx_decode_( | 506 enable_accelerated_vpx_decode_( |
| 507 gpu_preferences.enable_accelerated_vpx_decode), | 507 workarounds.disable_accelerated_vpx_decode |
| 508 ? gpu::GpuPreferences::VpxDecodeVendors::VPX_VENDOR_NONE |
| 509 : gpu_preferences.enable_accelerated_vpx_decode), |
| 508 processing_config_changed_(false), | 510 processing_config_changed_(false), |
| 509 weak_this_factory_(this) { | 511 weak_this_factory_(this) { |
| 510 weak_ptr_ = weak_this_factory_.GetWeakPtr(); | 512 weak_ptr_ = weak_this_factory_.GetWeakPtr(); |
| 511 memset(&input_stream_info_, 0, sizeof(input_stream_info_)); | 513 memset(&input_stream_info_, 0, sizeof(input_stream_info_)); |
| 512 memset(&output_stream_info_, 0, sizeof(output_stream_info_)); | 514 memset(&output_stream_info_, 0, sizeof(output_stream_info_)); |
| 513 use_color_info_ = base::FeatureList::IsEnabled(kVideoBlitColorAccuracy); | 515 use_color_info_ = base::FeatureList::IsEnabled(kVideoBlitColorAccuracy); |
| 514 } | 516 } |
| 515 | 517 |
| 516 DXVAVideoDecodeAccelerator::~DXVAVideoDecodeAccelerator() { | 518 DXVAVideoDecodeAccelerator::~DXVAVideoDecodeAccelerator() { |
| 517 client_ = NULL; | 519 client_ = NULL; |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1186 return false; | 1188 return false; |
| 1187 } | 1189 } |
| 1188 | 1190 |
| 1189 GLenum DXVAVideoDecodeAccelerator::GetSurfaceInternalFormat() const { | 1191 GLenum DXVAVideoDecodeAccelerator::GetSurfaceInternalFormat() const { |
| 1190 return GL_BGRA_EXT; | 1192 return GL_BGRA_EXT; |
| 1191 } | 1193 } |
| 1192 | 1194 |
| 1193 // static | 1195 // static |
| 1194 VideoDecodeAccelerator::SupportedProfiles | 1196 VideoDecodeAccelerator::SupportedProfiles |
| 1195 DXVAVideoDecodeAccelerator::GetSupportedProfiles( | 1197 DXVAVideoDecodeAccelerator::GetSupportedProfiles( |
| 1196 const gpu::GpuPreferences& preferences) { | 1198 const gpu::GpuPreferences& preferences, |
| 1199 const gpu::GpuDriverBugWorkarounds& workarounds) { |
| 1197 TRACE_EVENT0("gpu,startup", | 1200 TRACE_EVENT0("gpu,startup", |
| 1198 "DXVAVideoDecodeAccelerator::GetSupportedProfiles"); | 1201 "DXVAVideoDecodeAccelerator::GetSupportedProfiles"); |
| 1199 | 1202 |
| 1200 // TODO(henryhsu): Need to ensure the profiles are actually supported. | 1203 // TODO(henryhsu): Need to ensure the profiles are actually supported. |
| 1201 SupportedProfiles profiles; | 1204 SupportedProfiles profiles; |
| 1202 | 1205 |
| 1203 for (const wchar_t* mfdll : kMediaFoundationVideoDecoderDLLs) { | 1206 for (const wchar_t* mfdll : kMediaFoundationVideoDecoderDLLs) { |
| 1204 if (!::GetModuleHandle(mfdll)) { | 1207 if (!::GetModuleHandle(mfdll)) { |
| 1205 // Windows N is missing the media foundation DLLs unless the media | 1208 // Windows N is missing the media foundation DLLs unless the media |
| 1206 // feature pack is installed. | 1209 // feature pack is installed. |
| 1207 DVLOG(ERROR) << mfdll << " is required for hardware video decoding"; | 1210 DVLOG(ERROR) << mfdll << " is required for hardware video decoding"; |
| 1208 return profiles; | 1211 return profiles; |
| 1209 } | 1212 } |
| 1210 } | 1213 } |
| 1211 for (const auto& supported_profile : kSupportedProfiles) { | 1214 for (const auto& supported_profile : kSupportedProfiles) { |
| 1212 if (!preferences.enable_accelerated_vpx_decode && | 1215 if ((!preferences.enable_accelerated_vpx_decode || |
| 1216 workarounds.disable_accelerated_vpx_decode) && |
| 1213 (supported_profile >= VP8PROFILE_MIN) && | 1217 (supported_profile >= VP8PROFILE_MIN) && |
| 1214 (supported_profile <= VP9PROFILE_MAX)) { | 1218 (supported_profile <= VP9PROFILE_MAX)) { |
| 1215 continue; | 1219 continue; |
| 1216 } | 1220 } |
| 1217 std::pair<int, int> min_resolution = GetMinResolution(supported_profile); | 1221 std::pair<int, int> min_resolution = GetMinResolution(supported_profile); |
| 1218 std::pair<int, int> max_resolution = GetMaxResolution(supported_profile); | 1222 std::pair<int, int> max_resolution = GetMaxResolution(supported_profile); |
| 1219 | 1223 |
| 1220 SupportedProfile profile; | 1224 SupportedProfile profile; |
| 1221 profile.profile = supported_profile; | 1225 profile.profile = supported_profile; |
| 1222 profile.min_resolution.SetSize(min_resolution.first, min_resolution.second); | 1226 profile.min_resolution.SetSize(min_resolution.first, min_resolution.second); |
| (...skipping 1763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2986 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, | 2990 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, |
| 2987 base::Unretained(this))); | 2991 base::Unretained(this))); |
| 2988 } | 2992 } |
| 2989 | 2993 |
| 2990 uint32_t DXVAVideoDecodeAccelerator::GetTextureTarget() const { | 2994 uint32_t DXVAVideoDecodeAccelerator::GetTextureTarget() const { |
| 2991 bool provide_nv12_textures = share_nv12_textures_ || copy_nv12_textures_; | 2995 bool provide_nv12_textures = share_nv12_textures_ || copy_nv12_textures_; |
| 2992 return provide_nv12_textures ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D; | 2996 return provide_nv12_textures ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D; |
| 2993 } | 2997 } |
| 2994 | 2998 |
| 2995 } // namespace media | 2999 } // namespace media |
| OLD | NEW |