summaryrefslogtreecommitdiffstats
path: root/content/gpu/gpu_info_collector_win.cc
diff options
context:
space:
mode:
Diffstat (limited to 'content/gpu/gpu_info_collector_win.cc')
-rw-r--r--content/gpu/gpu_info_collector_win.cc41
1 files changed, 27 insertions, 14 deletions
diff --git a/content/gpu/gpu_info_collector_win.cc b/content/gpu/gpu_info_collector_win.cc
index c365a7f..3123eb39 100644
--- a/content/gpu/gpu_info_collector_win.cc
+++ b/content/gpu/gpu_info_collector_win.cc
@@ -199,7 +199,14 @@ AMDVideoCardType GetAMDVideocardType() {
AMDVideoCardType GetAMDVideocardType();
#endif
-void CollectD3D11Support() {
+// 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.
+//
+// http://crbug.com/175525. Using D3D11 seems to crash when dlumd32.dll is
+// loaded. This function is not currently called.
+void CollectD3D11Support(HMODULE d3d11_module) {
+ TRACE_EVENT0("gpu", "CollectD3D11Support");
+
typedef HRESULT (WINAPI *D3D11CreateDeviceFunc)(
IDXGIAdapter* adapter,
D3D_DRIVER_TYPE driver_type,
@@ -228,27 +235,15 @@ void CollectD3D11Support() {
NUM_FEATURE_LEVELS
};
- TRACE_EVENT0("gpu", "CollectD3D11Support");
-
- // Windows XP is expected to not support D3D11.
- if (base::win::GetVersion() <= base::win::VERSION_XP)
- return;
-
FeatureLevel feature_level = FEATURE_LEVEL_UNKNOWN;
UINT bgra_support = 0;
- // This is leaked in case it is hooked by a third party DLL.
- base::NativeLibrary d3d11_module = base::LoadNativeLibrary(
- base::FilePath(L"d3d11.dll"),
- NULL);
-
if (!d3d11_module) {
feature_level = FEATURE_LEVEL_NO_D3D11_DLL;
} else {
D3D11CreateDeviceFunc create_func =
reinterpret_cast<D3D11CreateDeviceFunc>(
- base::GetFunctionPointerFromNativeLibrary(d3d11_module,
- "D3D11CreateDevice"));
+ GetProcAddress(d3d11_module, "D3D11CreateDevice"));
if (!create_func) {
feature_level = FEATURE_LEVEL_NO_CREATE_DEVICE_ENTRY_POINT;
} else {
@@ -325,6 +320,24 @@ void CollectD3D11Support() {
(bgra_support & D3D11_FORMAT_SUPPORT_RENDER_TARGET) != 0);
}
+void CollectD3D11SupportDelayed(
+ const scoped_refptr<base::MessageLoopProxy> main_loop) {
+ // Windows XP is expected to not support D3D11.
+ if (base::win::GetVersion() <= base::win::VERSION_XP)
+ return;
+
+ // This is leaked in case it is hooked by a third party DLL.
+ HMODULE d3d11_module = LoadLibrary(L"d3d11.dll");
+
+ // Collect the D3D11 stats after a delay to allow third party DLLs
+ // to hook D3D11 before we try to use it. Also do it on the main thread
+ // in case the third party DLL does this on the main thread.
+ main_loop->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");