summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-07 01:03:49 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-07 01:03:49 +0000
commitb41d6b5a9976f7586e4c83b5b2af3979339cc002 (patch)
tree99ee065dd4a54be8cf114d27c5333e0e5b120b87
parentcdcfcd5dc89aca09361ac524f7d378475d171ada (diff)
downloadchromium_src-b41d6b5a9976f7586e4c83b5b2af3979339cc002.zip
chromium_src-b41d6b5a9976f7586e4c83b5b2af3979339cc002.tar.gz
chromium_src-b41d6b5a9976f7586e4c83b5b2af3979339cc002.tar.bz2
Windows: Only collect D3D11 UMA stats if the GPU process launches and initializes successfully.
DisplayLink seems to make D3D initialization crash. It turns out we have the same issue with D3D9 as well. However, in the case of D3D9, the GPU process tends to crash first, causing the browser process to not use D3D for anything. By waiting to see whether the GPU process crashes, the browser process should not crash (often) if a problematic version of DisplayLink is installed. BUG=175525 Review URL: https://chromiumcodereview.appspot.com/12340089 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186559 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/gpu/gpu_process_host.cc13
-rw-r--r--content/gpu/gpu_info_collector.h22
-rw-r--r--content/gpu/gpu_info_collector_win.cc41
3 files changed, 41 insertions, 35 deletions
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc
index 6b22dc0..376dc8b 100644
--- a/content/browser/gpu/gpu_process_host.cc
+++ b/content/browser/gpu/gpu_process_host.cc
@@ -13,6 +13,7 @@
#include "base/metrics/histogram.h"
#include "base/process_util.h"
#include "base/threading/thread.h"
+#include "base/threading/worker_pool.h"
#include "content/browser/browser_child_process_host_impl.h"
#include "content/browser/gpu/gpu_data_manager_impl.h"
#include "content/browser/gpu/gpu_process_host_ui_shim.h"
@@ -23,6 +24,7 @@
#include "content/common/gpu/gpu_messages.h"
#include "content/common/view_messages.h"
#include "content/gpu/gpu_child_thread.h"
+#include "content/gpu/gpu_info_collector.h"
#include "content/gpu/gpu_process.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h"
@@ -654,6 +656,17 @@ void GpuProcessHost::DeleteImage(int client_id,
void GpuProcessHost::OnInitialized(bool result) {
UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessInitialized", result);
+
+#if defined(OS_WIN)
+ // Only collect D3D11 statistics if D3D was successfully initialized in
+ // the GPU process.
+ if (result) {
+ base::WorkerPool::PostTask(
+ FROM_HERE,
+ base::Bind(&gpu_info_collector::CollectD3D11Support),
+ false);
+ }
+#endif
}
void GpuProcessHost::OnChannelEstablished(
diff --git a/content/gpu/gpu_info_collector.h b/content/gpu/gpu_info_collector.h
index b6b9bad..e70b832 100644
--- a/content/gpu/gpu_info_collector.h
+++ b/content/gpu/gpu_info_collector.h
@@ -12,6 +12,15 @@
namespace gpu_info_collector {
+// Advanced Micro Devices has interesting configurations on laptops were
+// there are two videocards that can alternatively a given process output.
+enum AMDVideoCardType {
+ UNKNOWN,
+ STANDALONE,
+ INTEGRATED,
+ SWITCHABLE
+};
+
// Collect GPU vendor_id and device ID.
CONTENT_EXPORT bool CollectGpuID(uint32* vendor_id, uint32* device_id);
@@ -48,14 +57,11 @@ void MergeGPUInfo(content::GPUInfo* basic_gpu_info,
void MergeGPUInfoGL(content::GPUInfo* basic_gpu_info,
const content::GPUInfo& context_gpu_info);
-// Advanced Micro Devices has interesting configurations on laptops were
-// there are two videocards that can alternatively a given process output.
-enum AMDVideoCardType {
- UNKNOWN,
- STANDALONE,
- INTEGRATED,
- SWITCHABLE
-};
+#if defined(OS_WIN)
+// 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();
+#endif
} // namespace gpu_info_collector
diff --git a/content/gpu/gpu_info_collector_win.cc b/content/gpu/gpu_info_collector_win.cc
index 3123eb39..c365a7f 100644
--- a/content/gpu/gpu_info_collector_win.cc
+++ b/content/gpu/gpu_info_collector_win.cc
@@ -199,14 +199,7 @@ AMDVideoCardType GetAMDVideocardType() {
AMDVideoCardType GetAMDVideocardType();
#endif
-// 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");
-
+void CollectD3D11Support() {
typedef HRESULT (WINAPI *D3D11CreateDeviceFunc)(
IDXGIAdapter* adapter,
D3D_DRIVER_TYPE driver_type,
@@ -235,15 +228,27 @@ void CollectD3D11Support(HMODULE d3d11_module) {
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>(
- GetProcAddress(d3d11_module, "D3D11CreateDevice"));
+ base::GetFunctionPointerFromNativeLibrary(d3d11_module,
+ "D3D11CreateDevice"));
if (!create_func) {
feature_level = FEATURE_LEVEL_NO_CREATE_DEVICE_ENTRY_POINT;
} else {
@@ -320,24 +325,6 @@ void CollectD3D11Support(HMODULE d3d11_module) {
(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");