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

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

Issue 1796633002: Revert of content gpu refactor: get rid of gpu related content switches. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 "content/common/gpu/media/dxva_video_decode_accelerator_win.h" 5 #include "content/common/gpu/media/dxva_video_decode_accelerator_win.h"
6 6
7 #if !defined(OS_WIN) 7 #if !defined(OS_WIN)
8 #error This file should only be built on Windows. 8 #error This file should only be built on Windows.
9 #endif // !defined(OS_WIN) 9 #endif // !defined(OS_WIN)
10 10
11 #include <codecapi.h> 11 #include <codecapi.h>
12 #include <dxgi1_2.h> 12 #include <dxgi1_2.h>
13 #include <ks.h> 13 #include <ks.h>
14 #include <mfapi.h> 14 #include <mfapi.h>
15 #include <mferror.h> 15 #include <mferror.h>
16 #include <ntverp.h> 16 #include <ntverp.h>
17 #include <stddef.h> 17 #include <stddef.h>
18 #include <string.h> 18 #include <string.h>
19 #include <wmcodecdsp.h> 19 #include <wmcodecdsp.h>
20 20
21 #include "base/base_paths_win.h" 21 #include "base/base_paths_win.h"
22 #include "base/bind.h" 22 #include "base/bind.h"
23 #include "base/callback.h" 23 #include "base/callback.h"
24 #include "base/command_line.h"
24 #include "base/debug/alias.h" 25 #include "base/debug/alias.h"
25 #include "base/file_version_info.h" 26 #include "base/file_version_info.h"
26 #include "base/files/file_path.h" 27 #include "base/files/file_path.h"
27 #include "base/logging.h" 28 #include "base/logging.h"
28 #include "base/macros.h" 29 #include "base/macros.h"
29 #include "base/memory/scoped_ptr.h" 30 #include "base/memory/scoped_ptr.h"
30 #include "base/memory/shared_memory.h" 31 #include "base/memory/shared_memory.h"
31 #include "base/message_loop/message_loop.h" 32 #include "base/message_loop/message_loop.h"
32 #include "base/path_service.h" 33 #include "base/path_service.h"
33 #include "base/trace_event/trace_event.h" 34 #include "base/trace_event/trace_event.h"
34 #include "base/win/windows_version.h" 35 #include "base/win/windows_version.h"
35 #include "build/build_config.h" 36 #include "build/build_config.h"
37 #include "content/public/common/content_switches.h"
36 #include "media/base/win/mf_initializer.h" 38 #include "media/base/win/mf_initializer.h"
37 #include "media/video/video_decode_accelerator.h" 39 #include "media/video/video_decode_accelerator.h"
38 #include "third_party/angle/include/EGL/egl.h" 40 #include "third_party/angle/include/EGL/egl.h"
39 #include "third_party/angle/include/EGL/eglext.h" 41 #include "third_party/angle/include/EGL/eglext.h"
40 #include "ui/gl/gl_bindings.h" 42 #include "ui/gl/gl_bindings.h"
41 #include "ui/gl/gl_context.h" 43 #include "ui/gl/gl_context.h"
42 #include "ui/gl/gl_fence.h" 44 #include "ui/gl/gl_fence.h"
43 #include "ui/gl/gl_surface_egl.h" 45 #include "ui/gl/gl_surface_egl.h"
46 #include "ui/gl/gl_switches.h"
44 47
45 namespace { 48 namespace {
46 49
47 // Path is appended on to the PROGRAM_FILES base path. 50 // Path is appended on to the PROGRAM_FILES base path.
48 const wchar_t kVPXDecoderDLLPath[] = L"Intel\\Media SDK\\"; 51 const wchar_t kVPXDecoderDLLPath[] = L"Intel\\Media SDK\\";
49 52
50 const wchar_t kVP8DecoderDLLName[] = 53 const wchar_t kVP8DecoderDLLName[] =
51 #if defined(ARCH_CPU_X86) 54 #if defined(ARCH_CPU_X86)
52 L"mfx_mft_vp8vd_32.dll"; 55 L"mfx_mft_vp8vd_32.dll";
53 #elif defined(ARCH_CPU_X86_64) 56 #elif defined(ARCH_CPU_X86_64)
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 int32_t buffer_id, 669 int32_t buffer_id,
667 IMFSample* sample) 670 IMFSample* sample)
668 : input_buffer_id(buffer_id), picture_buffer_id(-1) { 671 : input_buffer_id(buffer_id), picture_buffer_id(-1) {
669 output_sample.Attach(sample); 672 output_sample.Attach(sample);
670 } 673 }
671 674
672 DXVAVideoDecodeAccelerator::PendingSampleInfo::~PendingSampleInfo() {} 675 DXVAVideoDecodeAccelerator::PendingSampleInfo::~PendingSampleInfo() {}
673 676
674 DXVAVideoDecodeAccelerator::DXVAVideoDecodeAccelerator( 677 DXVAVideoDecodeAccelerator::DXVAVideoDecodeAccelerator(
675 const base::Callback<bool(void)>& make_context_current, 678 const base::Callback<bool(void)>& make_context_current,
676 gfx::GLContext* gl_context, 679 gfx::GLContext* gl_context)
677 bool enable_accelerated_vpx_decode)
678 : client_(NULL), 680 : client_(NULL),
679 dev_manager_reset_token_(0), 681 dev_manager_reset_token_(0),
680 dx11_dev_manager_reset_token_(0), 682 dx11_dev_manager_reset_token_(0),
681 egl_config_(NULL), 683 egl_config_(NULL),
682 state_(kUninitialized), 684 state_(kUninitialized),
683 pictures_requested_(false), 685 pictures_requested_(false),
684 inputs_before_decode_(0), 686 inputs_before_decode_(0),
685 sent_drain_message_(false), 687 sent_drain_message_(false),
686 make_context_current_(make_context_current), 688 make_context_current_(make_context_current),
687 codec_(media::kUnknownVideoCodec), 689 codec_(media::kUnknownVideoCodec),
688 decoder_thread_("DXVAVideoDecoderThread"), 690 decoder_thread_("DXVAVideoDecoderThread"),
689 pending_flush_(false), 691 pending_flush_(false),
690 use_dx11_(false), 692 use_dx11_(false),
691 use_keyed_mutex_(false), 693 use_keyed_mutex_(false),
692 dx11_video_format_converter_media_type_needs_init_(true), 694 dx11_video_format_converter_media_type_needs_init_(true),
693 gl_context_(gl_context), 695 gl_context_(gl_context),
694 using_angle_device_(false), 696 using_angle_device_(false),
695 enable_accelerated_vpx_decode_(enable_accelerated_vpx_decode),
696 weak_this_factory_(this) { 697 weak_this_factory_(this) {
697 weak_ptr_ = weak_this_factory_.GetWeakPtr(); 698 weak_ptr_ = weak_this_factory_.GetWeakPtr();
698 memset(&input_stream_info_, 0, sizeof(input_stream_info_)); 699 memset(&input_stream_info_, 0, sizeof(input_stream_info_));
699 memset(&output_stream_info_, 0, sizeof(output_stream_info_)); 700 memset(&output_stream_info_, 0, sizeof(output_stream_info_));
700 } 701 }
701 702
702 DXVAVideoDecodeAccelerator::~DXVAVideoDecodeAccelerator() { 703 DXVAVideoDecodeAccelerator::~DXVAVideoDecodeAccelerator() {
703 client_ = NULL; 704 client_ = NULL;
704 } 705 }
705 706
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
1247 FileVersionInfo::CreateFileVersionInfoForModule(decoder_dll)); 1248 FileVersionInfo::CreateFileVersionInfoForModule(decoder_dll));
1248 RETURN_ON_FAILURE(version_info, 1249 RETURN_ON_FAILURE(version_info,
1249 "unable to get version of msmpeg2vdec.dll", 1250 "unable to get version of msmpeg2vdec.dll",
1250 false); 1251 false);
1251 base::string16 file_version = version_info->file_version(); 1252 base::string16 file_version = version_info->file_version();
1252 RETURN_ON_FAILURE(file_version.find(L"6.1.7140") == base::string16::npos, 1253 RETURN_ON_FAILURE(file_version.find(L"6.1.7140") == base::string16::npos,
1253 "blacklisted version of msmpeg2vdec.dll 6.1.7140", 1254 "blacklisted version of msmpeg2vdec.dll 6.1.7140",
1254 false); 1255 false);
1255 codec_ = media::kCodecH264; 1256 codec_ = media::kCodecH264;
1256 clsid = __uuidof(CMSH264DecoderMFT); 1257 clsid = __uuidof(CMSH264DecoderMFT);
1257 } else if (enable_accelerated_vpx_decode_ && 1258 } else if ((profile == media::VP8PROFILE_ANY ||
1258 (profile == media::VP8PROFILE_ANY || 1259 profile == media::VP9PROFILE_ANY) &&
1259 profile == media::VP9PROFILE_ANY)) { 1260 base::CommandLine::ForCurrentProcess()->HasSwitch(
1261 switches::kEnableAcceleratedVpxDecode)) {
1260 int program_files_key = base::DIR_PROGRAM_FILES; 1262 int program_files_key = base::DIR_PROGRAM_FILES;
1261 if (base::win::OSInfo::GetInstance()->wow64_status() == 1263 if (base::win::OSInfo::GetInstance()->wow64_status() ==
1262 base::win::OSInfo::WOW64_ENABLED) { 1264 base::win::OSInfo::WOW64_ENABLED) {
1263 program_files_key = base::DIR_PROGRAM_FILES6432; 1265 program_files_key = base::DIR_PROGRAM_FILES6432;
1264 } 1266 }
1265 1267
1266 base::FilePath dll_path; 1268 base::FilePath dll_path;
1267 RETURN_ON_FAILURE(PathService::Get(program_files_key, &dll_path), 1269 RETURN_ON_FAILURE(PathService::Get(program_files_key, &dll_path),
1268 "failed to get path for Program Files", false); 1270 "failed to get path for Program Files", false);
1269 1271
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after
2448 hr = transform->SetOutputType(0, media_type.get(), 0); // No flags 2450 hr = transform->SetOutputType(0, media_type.get(), 0); // No flags
2449 RETURN_ON_HR_FAILURE(hr, "Failed to set output type", false); 2451 RETURN_ON_HR_FAILURE(hr, "Failed to set output type", false);
2450 return true; 2452 return true;
2451 } 2453 }
2452 media_type.Release(); 2454 media_type.Release();
2453 } 2455 }
2454 return false; 2456 return false;
2455 } 2457 }
2456 2458
2457 } // namespace content 2459 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/media/dxva_video_decode_accelerator_win.h ('k') | content/common/gpu/media/gpu_video_decode_accelerator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698