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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 #include "media/video/video_decode_accelerator.h" | 45 #include "media/video/video_decode_accelerator.h" |
46 #include "third_party/angle/include/EGL/egl.h" | 46 #include "third_party/angle/include/EGL/egl.h" |
47 #include "third_party/angle/include/EGL/eglext.h" | 47 #include "third_party/angle/include/EGL/eglext.h" |
48 #include "ui/gl/gl_bindings.h" | 48 #include "ui/gl/gl_bindings.h" |
49 #include "ui/gl/gl_context.h" | 49 #include "ui/gl/gl_context.h" |
50 #include "ui/gl/gl_fence.h" | 50 #include "ui/gl/gl_fence.h" |
51 #include "ui/gl/gl_surface_egl.h" | 51 #include "ui/gl/gl_surface_egl.h" |
52 | 52 |
53 namespace { | 53 namespace { |
54 | 54 |
| 55 // AMD |
| 56 // Path is appended on to the PROGRAM_FILES base path. |
| 57 const wchar_t kAMDVPXDecoderDLLPath[] = |
| 58 L"Common Files\\ATI Technologies\\Multimedia\\"; |
| 59 |
| 60 const wchar_t kAMDVP9DecoderDLLName[] = |
| 61 #if defined(ARCH_CPU_X86) |
| 62 L"amf-mft-decvp9-decoder32.dll"; |
| 63 #elif defined(ARCH_CPU_X86_64) |
| 64 L"amf-mft-decvp9-decoder64.dll"; |
| 65 #else |
| 66 #error Unsupported Windows CPU Architecture |
| 67 #endif |
| 68 |
| 69 const CLSID CLSID_AMDWebmMfVp9Dec = { |
| 70 0x2d2d728a, |
| 71 0x67d6, |
| 72 0x48ab, |
| 73 {0x89, 0xfb, 0xa6, 0xec, 0x65, 0x55, 0x49, 0x70}}; |
| 74 |
55 const wchar_t kMSVP9DecoderDLLName[] = L"MSVP9DEC.dll"; | 75 const wchar_t kMSVP9DecoderDLLName[] = L"MSVP9DEC.dll"; |
56 | 76 |
57 const CLSID MEDIASUBTYPE_VP80 = { | 77 const CLSID MEDIASUBTYPE_VP80 = { |
58 0x30385056, | 78 0x30385056, |
59 0x0000, | 79 0x0000, |
60 0x0010, | 80 0x0010, |
61 {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; | 81 {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; |
62 | 82 |
63 const CLSID MEDIASUBTYPE_VP90 = { | 83 const CLSID MEDIASUBTYPE_VP90 = { |
64 0x30395056, | 84 0x30395056, |
(...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1297 base::string16 file_version = version_info->file_version(); | 1317 base::string16 file_version = version_info->file_version(); |
1298 RETURN_ON_FAILURE(file_version.find(L"6.1.7140") == base::string16::npos, | 1318 RETURN_ON_FAILURE(file_version.find(L"6.1.7140") == base::string16::npos, |
1299 "blacklisted version of msmpeg2vdec.dll 6.1.7140", false); | 1319 "blacklisted version of msmpeg2vdec.dll 6.1.7140", false); |
1300 codec_ = kCodecH264; | 1320 codec_ = kCodecH264; |
1301 clsid = __uuidof(CMSH264DecoderMFT); | 1321 clsid = __uuidof(CMSH264DecoderMFT); |
1302 } else if (enable_accelerated_vpx_decode_ && | 1322 } else if (enable_accelerated_vpx_decode_ && |
1303 (profile == VP8PROFILE_ANY || profile == VP9PROFILE_PROFILE0 || | 1323 (profile == VP8PROFILE_ANY || profile == VP9PROFILE_PROFILE0 || |
1304 profile == VP9PROFILE_PROFILE1 || | 1324 profile == VP9PROFILE_PROFILE1 || |
1305 profile == VP9PROFILE_PROFILE2 || | 1325 profile == VP9PROFILE_PROFILE2 || |
1306 profile == VP9PROFILE_PROFILE3)) { | 1326 profile == VP9PROFILE_PROFILE3)) { |
1307 if (profile != VP8PROFILE_ANY) { | 1327 if (profile != VP8PROFILE_ANY && |
| 1328 (enable_accelerated_vpx_decode_ & |
| 1329 gpu::GpuPreferences::VPX_VENDOR_MICROSOFT)) { |
1308 codec_ = kCodecVP9; | 1330 codec_ = kCodecVP9; |
1309 clsid = CLSID_MSVPxDecoder; | 1331 clsid = CLSID_MSVPxDecoder; |
1310 decoder_dll = ::LoadLibrary(kMSVP9DecoderDLLName); | 1332 decoder_dll = ::LoadLibrary(kMSVP9DecoderDLLName); |
1311 if (decoder_dll) | 1333 if (decoder_dll) |
1312 using_ms_vp9_mft_ = true; | 1334 using_ms_vp9_mft_ = true; |
1313 } | 1335 } |
1314 RETURN_ON_FAILURE(decoder_dll, "vpx decoder dll is not loaded", false); | 1336 |
1315 } else { | 1337 int program_files_key = base::DIR_PROGRAM_FILES; |
| 1338 if (base::win::OSInfo::GetInstance()->wow64_status() == |
| 1339 base::win::OSInfo::WOW64_ENABLED) { |
| 1340 program_files_key = base::DIR_PROGRAM_FILES6432; |
| 1341 } |
| 1342 |
| 1343 // AMD |
| 1344 if (!decoder_dll && |
| 1345 enable_accelerated_vpx_decode_ & gpu::GpuPreferences::VPX_VENDOR_AMD && |
| 1346 profile == VP9PROFILE_PROFILE0) { |
| 1347 base::FilePath dll_path; |
| 1348 if (PathService::Get(program_files_key, &dll_path)) { |
| 1349 codec_ = media::kCodecVP9; |
| 1350 dll_path = dll_path.Append(kAMDVPXDecoderDLLPath); |
| 1351 dll_path = dll_path.Append(kAMDVP9DecoderDLLName); |
| 1352 clsid = CLSID_AMDWebmMfVp9Dec; |
| 1353 decoder_dll = ::LoadLibraryEx(dll_path.value().data(), NULL, |
| 1354 LOAD_WITH_ALTERED_SEARCH_PATH); |
| 1355 } |
| 1356 } |
| 1357 } |
| 1358 |
| 1359 if (!decoder_dll) { |
1316 RETURN_ON_FAILURE(false, "Unsupported codec.", false); | 1360 RETURN_ON_FAILURE(false, "Unsupported codec.", false); |
1317 } | 1361 } |
1318 | 1362 |
1319 HRESULT hr = CreateCOMObjectFromDll( | 1363 HRESULT hr = CreateCOMObjectFromDll( |
1320 decoder_dll, clsid, __uuidof(IMFTransform), decoder_.ReceiveVoid()); | 1364 decoder_dll, clsid, __uuidof(IMFTransform), decoder_.ReceiveVoid()); |
1321 RETURN_ON_HR_FAILURE(hr, "Failed to create decoder instance", false); | 1365 RETURN_ON_HR_FAILURE(hr, "Failed to create decoder instance", false); |
1322 | 1366 |
1323 RETURN_ON_FAILURE(CheckDecoderDxvaSupport(), | 1367 RETURN_ON_FAILURE(CheckDecoderDxvaSupport(), |
1324 "Failed to check decoder DXVA support", false); | 1368 "Failed to check decoder DXVA support", false); |
1325 | 1369 |
(...skipping 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2625 SetState(kConfigChange); | 2669 SetState(kConfigChange); |
2626 Invalidate(); | 2670 Invalidate(); |
2627 Initialize(config_, client_); | 2671 Initialize(config_, client_); |
2628 decoder_thread_task_runner_->PostTask( | 2672 decoder_thread_task_runner_->PostTask( |
2629 FROM_HERE, | 2673 FROM_HERE, |
2630 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, | 2674 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, |
2631 base::Unretained(this))); | 2675 base::Unretained(this))); |
2632 } | 2676 } |
2633 | 2677 |
2634 } // namespace media | 2678 } // namespace media |
OLD | NEW |