diff options
author | apatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-20 02:01:28 +0000 |
---|---|---|
committer | apatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-20 02:01:28 +0000 |
commit | a9494b6cdd4be18f6ecabdb316e5a1c442f2a2d5 (patch) | |
tree | 2f7c2f2c4aef8140fbc169b262ccd8ca64588ee3 /content/gpu | |
parent | c044616ec1a51a544e454077ff08cb471f9bd2b9 (diff) | |
download | chromium_src-a9494b6cdd4be18f6ecabdb316e5a1c442f2a2d5.zip chromium_src-a9494b6cdd4be18f6ecabdb316e5a1c442f2a2d5.tar.gz chromium_src-a9494b6cdd4be18f6ecabdb316e5a1c442f2a2d5.tar.bz2 |
Revert 183320
> Windows: Collect D3D11 capability statistics after a 10 seconds delay.
>
> This is to see if dlumd32.dll is hooking D3D11.dll while we are using it and if delaying our use of it prevents the crash in the referenced bug.
>
> BUG=175525
>
> Review URL: https://chromiumcodereview.appspot.com/12259035
TBR=apatrick@chromium.org
Review URL: https://codereview.chromium.org/12308016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@183368 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/gpu')
-rw-r--r-- | content/gpu/gpu_info_collector_win.cc | 44 |
1 files changed, 17 insertions, 27 deletions
diff --git a/content/gpu/gpu_info_collector_win.cc b/content/gpu/gpu_info_collector_win.cc index aa066e6..ca081a0 100644 --- a/content/gpu/gpu_info_collector_win.cc +++ b/content/gpu/gpu_info_collector_win.cc @@ -24,7 +24,7 @@ #include "base/stringprintf.h" #include "base/string_number_conversions.h" #include "base/string_util.h" -#include "base/threading/thread.h" +#include "base/threading/worker_pool.h" #include "base/win/scoped_com_initializer.h" #include "base/win/scoped_comptr.h" #include "base/win/windows_version.h" @@ -169,7 +169,7 @@ AMDVideoCardType GetAMDVideocardType(); // Collects information about the level of D3D11 support and records it in // the UMA stats. Records no stats when D3D11 in not supported at all. -void CollectD3D11Support(HMODULE d3d11_module) { +void CollectD3D11Support() { TRACE_EVENT0("gpu", "CollectD3D11Support"); typedef HRESULT (WINAPI *D3D11CreateDeviceFunc)( @@ -200,18 +200,25 @@ void CollectD3D11Support(HMODULE d3d11_module) { NUM_FEATURE_LEVELS }; - // Make sure this thread quits when it has run all its tasks. - MessageLoop::current()->Quit(); + // Windows XP is expected to not support D3D11. + if (base::win::GetVersion() <= base::win::VERSION_XP) + return; + + // Creating a D3D11 device when DisplayLink is installed causes D3D11 to + // crash. + if (GetModuleHandle(L"dlumd32.dll")) + return; FeatureLevel feature_level = FEATURE_LEVEL_UNKNOWN; UINT bgra_support = 0; - if (!d3d11_module) { + base::ScopedNativeLibrary module(base::FilePath(L"d3d11.dll")); + if (!module.is_valid()) { feature_level = FEATURE_LEVEL_NO_D3D11_DLL; } else { D3D11CreateDeviceFunc create_func = reinterpret_cast<D3D11CreateDeviceFunc>( - GetProcAddress(d3d11_module, "D3D11CreateDevice")); + module.GetFunctionPointer("D3D11CreateDevice")); if (!create_func) { feature_level = FEATURE_LEVEL_NO_CREATE_DEVICE_ENTRY_POINT; } else { @@ -288,31 +295,14 @@ void CollectD3D11Support(HMODULE d3d11_module) { (bgra_support & D3D11_FORMAT_SUPPORT_RENDER_TARGET) != 0); } -void CollectD3D11SupportDelayed() { - // Windows XP is expected to not support D3D11. - if (base::win::GetVersion() <= base::win::VERSION_XP) - return; - - HMODULE d3d11_module = LoadLibrary(L"d3d11.dll"); - - // Collect the D3D11 stats after a delay to allow racy third party DLLs - // to hook D3D11 before we try to use it. - MessageLoop::current()->PostDelayedTask( - FROM_HERE, - base::Bind(CollectD3D11Support, d3d11_module), - base::TimeDelta::FromSeconds(10)); -} - bool CollectDriverInfoD3D(const std::wstring& device_id, content::GPUInfo* gpu_info) { TRACE_EVENT0("gpu", "CollectDriverInfoD3D"); - scoped_ptr<base::Thread> d3d11_thread(new base::Thread("D3D11 Support")); - if (d3d11_thread->Start()) { - d3d11_thread.release()->message_loop()->PostTask( - FROM_HERE, - base::Bind(CollectD3D11SupportDelayed)); - } + base::WorkerPool::PostTask( + FROM_HERE, + base::Bind(CollectD3D11Support), + false); // create device info for the display device HDEVINFO device_info = SetupDiGetClassDevsW( |