Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: media/gpu/dxva_video_decode_accelerator_win.cc

Issue 2105693003: Vp9 decoder mft support for AMD apu/gpu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change enum to follow chromium style enum naming, remove unecessary media:: scope Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "media/video/video_decode_accelerator.h" 43 #include "media/video/video_decode_accelerator.h"
44 #include "third_party/angle/include/EGL/egl.h" 44 #include "third_party/angle/include/EGL/egl.h"
45 #include "third_party/angle/include/EGL/eglext.h" 45 #include "third_party/angle/include/EGL/eglext.h"
46 #include "ui/gl/gl_bindings.h" 46 #include "ui/gl/gl_bindings.h"
47 #include "ui/gl/gl_context.h" 47 #include "ui/gl/gl_context.h"
48 #include "ui/gl/gl_fence.h" 48 #include "ui/gl/gl_fence.h"
49 #include "ui/gl/gl_surface_egl.h" 49 #include "ui/gl/gl_surface_egl.h"
50 50
51 namespace { 51 namespace {
52 52
53 // AMD
54 // Path is appended on to the PROGRAM_FILES base path.
55 const wchar_t kAMDVPXDecoderDLLPath[] =
56 L"Common Files\\ATI Technologies\\Multimedia\\";
57
58 const wchar_t kAMDVP9DecoderDLLName[] =
59 #if defined(ARCH_CPU_X86)
60 L"amf-mft-decvp9-decoder32.dll";
61 #elif defined(ARCH_CPU_X86_64)
62 L"amf-mft-decvp9-decoder64.dll";
63 #else
64 #error Unsupported Windows CPU Architecture
65 #endif
66
67 const CLSID CLSID_AMDWebmMfVp9Dec = {
68 0x2d2d728a,
69 0x67d6,
70 0x48ab,
71 {0x89, 0xfb, 0xa6, 0xec, 0x65, 0x55, 0x49, 0x70}};
72
73 // Intel
53 // Path is appended on to the PROGRAM_FILES base path. 74 // Path is appended on to the PROGRAM_FILES base path.
54 const wchar_t kVPXDecoderDLLPath[] = L"Intel\\Media SDK\\"; 75 const wchar_t kVPXDecoderDLLPath[] = L"Intel\\Media SDK\\";
55 76
56 const wchar_t kVP8DecoderDLLName[] = 77 const wchar_t kVP8DecoderDLLName[] =
57 #if defined(ARCH_CPU_X86) 78 #if defined(ARCH_CPU_X86)
58 L"mfx_mft_vp8vd_32.dll"; 79 L"mfx_mft_vp8vd_32.dll";
59 #elif defined(ARCH_CPU_X86_64) 80 #elif defined(ARCH_CPU_X86_64)
60 L"mfx_mft_vp8vd_64.dll"; 81 L"mfx_mft_vp8vd_64.dll";
61 #else 82 #else
62 #error Unsupported Windows CPU Architecture 83 #error Unsupported Windows CPU Architecture
(...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1381 // fall back to software decoding. See crbug/403440. 1402 // fall back to software decoding. See crbug/403440.
1382 std::unique_ptr<FileVersionInfo> version_info( 1403 std::unique_ptr<FileVersionInfo> version_info(
1383 FileVersionInfo::CreateFileVersionInfoForModule(decoder_dll)); 1404 FileVersionInfo::CreateFileVersionInfoForModule(decoder_dll));
1384 RETURN_ON_FAILURE(version_info, "unable to get version of msmpeg2vdec.dll", 1405 RETURN_ON_FAILURE(version_info, "unable to get version of msmpeg2vdec.dll",
1385 false); 1406 false);
1386 base::string16 file_version = version_info->file_version(); 1407 base::string16 file_version = version_info->file_version();
1387 RETURN_ON_FAILURE(file_version.find(L"6.1.7140") == base::string16::npos, 1408 RETURN_ON_FAILURE(file_version.find(L"6.1.7140") == base::string16::npos,
1388 "blacklisted version of msmpeg2vdec.dll 6.1.7140", false); 1409 "blacklisted version of msmpeg2vdec.dll 6.1.7140", false);
1389 codec_ = kCodecH264; 1410 codec_ = kCodecH264;
1390 clsid = __uuidof(CMSH264DecoderMFT); 1411 clsid = __uuidof(CMSH264DecoderMFT);
1391 } else if (enable_accelerated_vpx_decode_ && 1412 } else if (enable_accelerated_vpx_decode_ != 0 &&
DaleCurtis 2016/07/07 20:30:16 != unnecessary?
1392 (profile == VP8PROFILE_ANY || profile == VP9PROFILE_PROFILE0 || 1413 (profile == VP8PROFILE_ANY || profile == VP9PROFILE_PROFILE0 ||
1393 profile == VP9PROFILE_PROFILE1 || 1414 profile == VP9PROFILE_PROFILE1 ||
1394 profile == VP9PROFILE_PROFILE2 || 1415 profile == VP9PROFILE_PROFILE2 ||
1395 profile == VP9PROFILE_PROFILE3)) { 1416 profile == VP9PROFILE_PROFILE3)) {
1396 int program_files_key = base::DIR_PROGRAM_FILES; 1417 int program_files_key = base::DIR_PROGRAM_FILES;
1397 if (base::win::OSInfo::GetInstance()->wow64_status() == 1418 if (base::win::OSInfo::GetInstance()->wow64_status() ==
1398 base::win::OSInfo::WOW64_ENABLED) { 1419 base::win::OSInfo::WOW64_ENABLED) {
1399 program_files_key = base::DIR_PROGRAM_FILES6432; 1420 program_files_key = base::DIR_PROGRAM_FILES6432;
1400 } 1421 }
1401 1422
1402 base::FilePath dll_path; 1423 // Intel
1403 RETURN_ON_FAILURE(PathService::Get(program_files_key, &dll_path), 1424 if (enable_accelerated_vpx_decode_ &
1404 "failed to get path for Program Files", false); 1425 gpu::GpuPreferences::VPX_VENDOR_INTEL) {
1426 base::FilePath dll_path;
1427 if (PathService::Get(program_files_key, &dll_path)) {
1428 dll_path = dll_path.Append(kVPXDecoderDLLPath);
1429 if (profile == VP8PROFILE_ANY) {
1430 codec_ = media::kCodecVP8;
1431 dll_path = dll_path.Append(kVP8DecoderDLLName);
1432 clsid = CLSID_WebmMfVp8Dec;
1433 } else {
1434 codec_ = media::kCodecVP9;
1435 dll_path = dll_path.Append(kVP9DecoderDLLName);
1436 clsid = CLSID_WebmMfVp9Dec;
1437 }
1438 decoder_dll = ::LoadLibraryEx(dll_path.value().data(), NULL,
1439 LOAD_WITH_ALTERED_SEARCH_PATH);
1440 }
1441 }
1442 // AMD
1443 if (decoder_dll == NULL &&
DaleCurtis 2016/07/07 20:30:16 !decoder_dll
1444 enable_accelerated_vpx_decode_ & gpu::GpuPreferences::VPX_VENDOR_AMD &&
1445 profile == VP9PROFILE_PROFILE0) {
1446 base::FilePath dll_path;
1447 if (PathService::Get(program_files_key, &dll_path)) {
1448 codec_ = media::kCodecVP9;
1449 dll_path = dll_path.Append(kAMDVPXDecoderDLLPath);
1450 dll_path = dll_path.Append(kAMDVP9DecoderDLLName);
1451 clsid = CLSID_AMDWebmMfVp9Dec;
1452 decoder_dll = ::LoadLibraryEx(dll_path.value().data(), NULL,
1453 LOAD_WITH_ALTERED_SEARCH_PATH);
1454 }
1455 }
1456 }
1405 1457
1406 dll_path = dll_path.Append(kVPXDecoderDLLPath); 1458 // if nothing selected at this point, or dlls failed to load,
1407 if (profile == VP8PROFILE_ANY) { 1459 // there is no support for this codec.
1408 codec_ = kCodecVP8; 1460 if (decoder_dll == NULL) {
DaleCurtis 2016/07/07 20:30:16 !decoder_dll
1409 dll_path = dll_path.Append(kVP8DecoderDLLName);
1410 clsid = CLSID_WebmMfVp8Dec;
1411 } else {
1412 codec_ = kCodecVP9;
1413 dll_path = dll_path.Append(kVP9DecoderDLLName);
1414 clsid = CLSID_WebmMfVp9Dec;
1415 }
1416 decoder_dll = ::LoadLibraryEx(dll_path.value().data(), NULL,
1417 LOAD_WITH_ALTERED_SEARCH_PATH);
1418 RETURN_ON_FAILURE(decoder_dll, "vpx decoder dll is not loaded", false);
1419 } else {
1420 RETURN_ON_FAILURE(false, "Unsupported codec.", false); 1461 RETURN_ON_FAILURE(false, "Unsupported codec.", false);
1421 } 1462 }
1422 1463
1423 HRESULT hr = CreateCOMObjectFromDll( 1464 HRESULT hr = CreateCOMObjectFromDll(
1424 decoder_dll, clsid, __uuidof(IMFTransform), decoder_.ReceiveVoid()); 1465 decoder_dll, clsid, __uuidof(IMFTransform), decoder_.ReceiveVoid());
1425 RETURN_ON_HR_FAILURE(hr, "Failed to create decoder instance", false); 1466 RETURN_ON_HR_FAILURE(hr, "Failed to create decoder instance", false);
1426 1467
1427 RETURN_ON_FAILURE(CheckDecoderDxvaSupport(), 1468 RETURN_ON_FAILURE(CheckDecoderDxvaSupport(),
1428 "Failed to check decoder DXVA support", false); 1469 "Failed to check decoder DXVA support", false);
1429 1470
(...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after
2683 SetState(kConfigChange); 2724 SetState(kConfigChange);
2684 Invalidate(); 2725 Invalidate();
2685 Initialize(config_, client_); 2726 Initialize(config_, client_);
2686 decoder_thread_task_runner_->PostTask( 2727 decoder_thread_task_runner_->PostTask(
2687 FROM_HERE, 2728 FROM_HERE,
2688 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, 2729 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers,
2689 base::Unretained(this))); 2730 base::Unretained(this)));
2690 } 2731 }
2691 2732
2692 } // namespace media 2733 } // namespace media
OLDNEW
« content/public/browser/gpu_utils.cc ('K') | « media/gpu/dxva_video_decode_accelerator_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698