summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzmo@chromium.org <zmo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-07 22:08:44 +0000
committerzmo@chromium.org <zmo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-07 22:08:44 +0000
commit12e74bbd334775bd1961464e22085c551703ecb2 (patch)
tree9b003a163dd9f84f4c0b1396e5b793d31fc64114
parent36a7e0e42983e5b2ea4623a763be3a62f75b1cb6 (diff)
downloadchromium_src-12e74bbd334775bd1961464e22085c551703ecb2.zip
chromium_src-12e74bbd334775bd1961464e22085c551703ecb2.tar.gz
chromium_src-12e74bbd334775bd1961464e22085c551703ecb2.tar.bz2
Simply GPU info collection on GPU bots.
Before we collect basic info, now we only collect vendor_id/device_id. This hopefully will fix the mysterious random crashes on win gpu bots. BUG=165269 TEST=gpu bots Review URL: https://codereview.chromium.org/12224043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181371 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/gpu/gpu_info_collector.h3
-rw-r--r--content/gpu/gpu_info_collector_android.cc7
-rw-r--r--content/gpu/gpu_info_collector_linux.cc14
-rw-r--r--content/gpu/gpu_info_collector_mac.mm14
-rw-r--r--content/gpu/gpu_info_collector_win.cc30
-rw-r--r--content/test/gpu/gpu_test_config.cc3
6 files changed, 69 insertions, 2 deletions
diff --git a/content/gpu/gpu_info_collector.h b/content/gpu/gpu_info_collector.h
index 654ec48..b6b9bad 100644
--- a/content/gpu/gpu_info_collector.h
+++ b/content/gpu/gpu_info_collector.h
@@ -12,6 +12,9 @@
namespace gpu_info_collector {
+// Collect GPU vendor_id and device ID.
+CONTENT_EXPORT bool CollectGpuID(uint32* vendor_id, uint32* device_id);
+
// Collects basic GPU info without creating a GL/DirectX context (and without
// the danger of crashing), including vendor_id and device_id.
// This is called at browser process startup time.
diff --git a/content/gpu/gpu_info_collector_android.cc b/content/gpu/gpu_info_collector_android.cc
index 2ee10bc..3073fbd 100644
--- a/content/gpu/gpu_info_collector_android.cc
+++ b/content/gpu/gpu_info_collector_android.cc
@@ -53,6 +53,13 @@ bool CollectContextGraphicsInfo(content::GPUInfo* gpu_info) {
return CollectGraphicsInfoGL(gpu_info);
}
+bool CollectGpuID(uint32* vendor_id, uint32* device_id) {
+ DCHECK(vendor_id && device_id);
+ *vendor_id = 0;
+ *device_id = 0;
+ return false;
+}
+
bool CollectBasicGraphicsInfo(content::GPUInfo* gpu_info) {
gpu_info->can_lose_context = false;
// Create a short-lived context on the UI thread to collect the GL strings.
diff --git a/content/gpu/gpu_info_collector_linux.cc b/content/gpu/gpu_info_collector_linux.cc
index 76fb6c9..3652be9 100644
--- a/content/gpu/gpu_info_collector_linux.cc
+++ b/content/gpu/gpu_info_collector_linux.cc
@@ -217,6 +217,20 @@ bool CollectContextGraphicsInfo(content::GPUInfo* gpu_info) {
return rt;
}
+bool CollectGpuID(uint32* vendor_id, uint32* device_id) {
+ DCHECK(vendor_id && device_id);
+ *vendor_id = 0;
+ *device_id = 0;
+
+ content::GPUInfo gpu_info;
+ if (CollectPCIVideoCardInfo(&gpu_info)) {
+ *vendor_id = gpu_info.gpu.vendor_id;
+ *device_id = gpu_info.gpu.device_id;
+ return true;
+ }
+ return false;
+}
+
bool CollectBasicGraphicsInfo(content::GPUInfo* gpu_info) {
DCHECK(gpu_info);
diff --git a/content/gpu/gpu_info_collector_mac.mm b/content/gpu/gpu_info_collector_mac.mm
index 66c362d..f8aefe1 100644
--- a/content/gpu/gpu_info_collector_mac.mm
+++ b/content/gpu/gpu_info_collector_mac.mm
@@ -169,6 +169,20 @@ bool CollectContextGraphicsInfo(content::GPUInfo* gpu_info) {
return CollectGraphicsInfoGL(gpu_info);
}
+bool CollectGpuID(uint32* vendor_id, uint32* device_id) {
+ DCHECK(vendor_id && device_id);
+ *vendor_id = 0;
+ *device_id = 0;
+
+ content::GPUInfo gpu_info;
+ if (CollectPCIVideoCardInfo(&gpu_info)) {
+ *vendor_id = gpu_info.gpu.vendor_id;
+ *device_id = gpu_info.gpu.device_id;
+ return true;
+ }
+ return false;
+}
+
bool CollectBasicGraphicsInfo(content::GPUInfo* gpu_info) {
DCHECK(gpu_info);
diff --git a/content/gpu/gpu_info_collector_win.cc b/content/gpu/gpu_info_collector_win.cc
index 50806f6..11fec5f 100644
--- a/content/gpu/gpu_info_collector_win.cc
+++ b/content/gpu/gpu_info_collector_win.cc
@@ -426,6 +426,35 @@ bool CollectContextGraphicsInfo(content::GPUInfo* gpu_info) {
return true;
}
+bool CollectGpuID(uint32* vendor_id, uint32* device_id) {
+ DCHECK(vendor_id && device_id);
+ *vendor_id = 0;
+ *device_id = 0;
+
+ // Taken from http://developer.nvidia.com/object/device_ids.html
+ DISPLAY_DEVICE dd;
+ dd.cb = sizeof(DISPLAY_DEVICE);
+ std::wstring id;
+ for (int i = 0; EnumDisplayDevices(NULL, i, &dd, 0); ++i) {
+ if (dd.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) {
+ id = dd.DeviceID;
+ break;
+ }
+ }
+
+ if (id.length() > 20) {
+ int vendor = 0, device = 0;
+ std::wstring vendor_string = id.substr(8, 4);
+ std::wstring device_string = id.substr(17, 4);
+ base::HexStringToInt(WideToASCII(vendor_string), &vendor);
+ base::HexStringToInt(WideToASCII(device_string), &device);
+ *vendor_id = vendor;
+ *device_id = device;
+ return true;
+ }
+ return false;
+}
+
bool CollectBasicGraphicsInfo(content::GPUInfo* gpu_info) {
TRACE_EVENT0("gpu", "CollectPreliminaryGraphicsInfo");
@@ -440,7 +469,6 @@ bool CollectBasicGraphicsInfo(content::GPUInfo* gpu_info) {
// Taken from http://developer.nvidia.com/object/device_ids.html
DISPLAY_DEVICE dd;
dd.cb = sizeof(DISPLAY_DEVICE);
- int i = 0;
std::wstring id;
for (int i = 0; EnumDisplayDevices(NULL, i, &dd, 0); ++i) {
if (dd.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) {
diff --git a/content/test/gpu/gpu_test_config.cc b/content/test/gpu/gpu_test_config.cc
index 00837ad..d457ff5 100644
--- a/content/test/gpu/gpu_test_config.cc
+++ b/content/test/gpu/gpu_test_config.cc
@@ -212,7 +212,8 @@ bool GPUTestBotConfig::LoadCurrentConfig(const content::GPUInfo* gpu_info) {
bool rt;
if (gpu_info == NULL) {
content::GPUInfo my_gpu_info;
- gpu_info_collector::CollectBasicGraphicsInfo(&my_gpu_info);
+ gpu_info_collector::CollectGpuID(&my_gpu_info.gpu.vendor_id,
+ &my_gpu_info.gpu.device_id);
rt = SetGPUInfo(my_gpu_info);
} else {
rt = SetGPUInfo(*gpu_info);