summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorzmo@chromium.org <zmo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-20 13:56:48 +0000
committerzmo@chromium.org <zmo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-20 13:56:48 +0000
commit4a6ed96840c17651ac21d5a101c5bcbf2d1217c3 (patch)
tree87bcb6d942fc50ad6b89270d2ad20d45b305defe /gpu
parent1020fead22fb3dd13f0fb95f2372d3b5f25db1f4 (diff)
downloadchromium_src-4a6ed96840c17651ac21d5a101c5bcbf2d1217c3.zip
chromium_src-4a6ed96840c17651ac21d5a101c5bcbf2d1217c3.tar.gz
chromium_src-4a6ed96840c17651ac21d5a101c5bcbf2d1217c3.tar.bz2
Add semantics to apply gpu blakclist to AMD swichable when a discrete/integrated GPU is in use
BUG=376562 TEST=gpu_unittests R=kbr@chromium.org Review URL: https://codereview.chromium.org/338183005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278703 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/config/gpu_control_list.cc24
-rw-r--r--gpu/config/gpu_control_list.h2
-rw-r--r--gpu/config/gpu_control_list_format.txt8
-rw-r--r--gpu/config/gpu_control_list_unittest.cc94
-rw-r--r--gpu/config/software_rendering_list_json.cc4
5 files changed, 128 insertions, 4 deletions
diff --git a/gpu/config/gpu_control_list.cc b/gpu/config/gpu_control_list.cc
index f921b00..e881606 100644
--- a/gpu/config/gpu_control_list.cc
+++ b/gpu/config/gpu_control_list.cc
@@ -87,6 +87,10 @@ int CompareLexicalNumberStrings(
}
const char kMultiGpuStyleStringAMDSwitchable[] = "amd_switchable";
+const char kMultiGpuStyleStringAMDSwitchableDiscrete[] =
+ "amd_switchable_discrete";
+const char kMultiGpuStyleStringAMDSwitchableIntegrated[] =
+ "amd_switchable_integrated";
const char kMultiGpuStyleStringOptimus[] = "optimus";
const char kMultiGpuCategoryStringPrimary[] = "primary";
@@ -1078,6 +1082,10 @@ GpuControlList::GpuControlListEntry::StringToMultiGpuStyle(
return kMultiGpuStyleOptimus;
if (style == kMultiGpuStyleStringAMDSwitchable)
return kMultiGpuStyleAMDSwitchable;
+ if (style == kMultiGpuStyleStringAMDSwitchableIntegrated)
+ return kMultiGpuStyleAMDSwitchableIntegrated;
+ if (style == kMultiGpuStyleStringAMDSwitchableDiscrete)
+ return kMultiGpuStyleAMDSwitchableDiscrete;
return kMultiGpuStyleNone;
}
@@ -1199,6 +1207,22 @@ bool GpuControlList::GpuControlListEntry::Contains(
if (!gpu_info.amd_switchable)
return false;
break;
+ case kMultiGpuStyleAMDSwitchableDiscrete:
+ if (!gpu_info.amd_switchable)
+ return false;
+ // The discrete GPU is always the primary GPU.
+ // This is guaranteed by GpuInfoCollector.
+ if (!gpu_info.gpu.active)
+ return false;
+ break;
+ case kMultiGpuStyleAMDSwitchableIntegrated:
+ if (!gpu_info.amd_switchable)
+ return false;
+ // Assume the integrated GPU is the first in the secondary GPU list.
+ if (gpu_info.secondary_gpus.size() == 0 ||
+ !gpu_info.secondary_gpus[0].active)
+ return false;
+ break;
case kMultiGpuStyleNone:
break;
}
diff --git a/gpu/config/gpu_control_list.h b/gpu/config/gpu_control_list.h
index 2616940..b2daa47 100644
--- a/gpu/config/gpu_control_list.h
+++ b/gpu/config/gpu_control_list.h
@@ -324,6 +324,8 @@ class GPU_EXPORT GpuControlList {
enum MultiGpuStyle {
kMultiGpuStyleOptimus,
kMultiGpuStyleAMDSwitchable,
+ kMultiGpuStyleAMDSwitchableIntegrated,
+ kMultiGpuStyleAMDSwitchableDiscrete,
kMultiGpuStyleNone
};
diff --git a/gpu/config/gpu_control_list_format.txt b/gpu/config/gpu_control_list_format.txt
index 879b91e..71c569c 100644
--- a/gpu/config/gpu_control_list_format.txt
+++ b/gpu/config/gpu_control_list_format.txt
@@ -23,8 +23,12 @@
// "version" is a VERSION structure (defined below).
// 3. "vendor_id" is a string. 0 is reserved.
// 4. "device_id" is an array of strings. 0 is reserved.
-// 5. "multi_gpu_style" is a string, valid values include "optimus", and
-// "amd_switchable".
+// 5. "multi_gpu_style" is a string, valid values include:
+// a) "optimus": NVIDIA dual GPU
+// b) "amd_switchable": AMD dual GPU
+// c) "amd_switchable_integrated": AMD dual GPU, integrated GPU is active
+// d) "amd_switchable_discrete": AMD dual GPU, discrete GPU is active
+// c) and d) are only valid on Win, as on Mac we can switch GPU on the fly.
// 6. "multi_gpu_category" is a string, valid values include "any", "primary",
// "secondary", and "active". If unspecified, the default value is "primary".
// See gpu_control_list.h for more details on the meanings of the strings.
diff --git a/gpu/config/gpu_control_list_unittest.cc b/gpu/config/gpu_control_list_unittest.cc
index 33c6973..03a7d0e 100644
--- a/gpu/config/gpu_control_list_unittest.cc
+++ b/gpu/config/gpu_control_list_unittest.cc
@@ -12,6 +12,7 @@
const char kOsVersion[] = "10.6.4";
const uint32 kIntelVendorId = 0x8086;
const uint32 kNvidiaVendorId = 0x10de;
+const uint32 kAmdVendorId = 0x10de;
#define LONG_STRING_CONST(...) #__VA_ARGS__
@@ -448,5 +449,98 @@ TEST_F(GpuControlListTest, ExceptionWithoutVendorId) {
EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0);
}
+TEST_F(GpuControlListTest, AMDSwitchable) {
+ GPUInfo gpu_info;
+ gpu_info.amd_switchable = true;
+ gpu_info.gpu.vendor_id = kAmdVendorId;
+ gpu_info.gpu.device_id = 0x6760;
+ GPUInfo::GPUDevice integrated_gpu;
+ integrated_gpu.vendor_id = kIntelVendorId;
+ integrated_gpu.device_id = 0x0116;
+ gpu_info.secondary_gpus.push_back(integrated_gpu);
+
+ { // amd_switchable_discrete entry
+ const std::string json= LONG_STRING_CONST(
+ {
+ "name": "gpu control list",
+ "version": "0.1",
+ "entries": [
+ {
+ "id": 1,
+ "os": {
+ "type": "win"
+ },
+ "multi_gpu_style": "amd_switchable_discrete",
+ "features": [
+ "test_feature_0"
+ ]
+ }
+ ]
+ }
+ );
+
+ scoped_ptr<GpuControlList> control_list(Create());
+ EXPECT_TRUE(control_list->LoadList(json, GpuControlList::kAllOs));
+
+ // Integrated GPU is active
+ gpu_info.gpu.active = false;
+ gpu_info.secondary_gpus[0].active = true;
+ std::set<int> features = control_list->MakeDecision(
+ GpuControlList::kOsWin, kOsVersion, gpu_info);
+ EXPECT_EMPTY_SET(features);
+
+ // Discrete GPU is active
+ gpu_info.gpu.active = true;
+ gpu_info.secondary_gpus[0].active = false;
+ features = control_list->MakeDecision(
+ GpuControlList::kOsWin, kOsVersion, gpu_info);
+ EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0);
+ }
+
+ { // amd_switchable_integrated entry
+ const std::string json= LONG_STRING_CONST(
+ {
+ "name": "gpu control list",
+ "version": "0.1",
+ "entries": [
+ {
+ "id": 1,
+ "os": {
+ "type": "win"
+ },
+ "multi_gpu_style": "amd_switchable_integrated",
+ "features": [
+ "test_feature_0"
+ ]
+ }
+ ]
+ }
+ );
+
+ scoped_ptr<GpuControlList> control_list(Create());
+ EXPECT_TRUE(control_list->LoadList(json, GpuControlList::kAllOs));
+
+ // Discrete GPU is active
+ gpu_info.gpu.active = true;
+ gpu_info.secondary_gpus[0].active = false;
+ std::set<int> features = control_list->MakeDecision(
+ GpuControlList::kOsWin, kOsVersion, gpu_info);
+ EXPECT_EMPTY_SET(features);
+
+ // Integrated GPU is active
+ gpu_info.gpu.active = false;
+ gpu_info.secondary_gpus[0].active = true;
+ features = control_list->MakeDecision(
+ GpuControlList::kOsWin, kOsVersion, gpu_info);
+ EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0);
+
+ // For non AMD switchable
+ gpu_info.amd_switchable = false;
+ features = control_list->MakeDecision(
+ GpuControlList::kOsWin, kOsVersion, gpu_info);
+ EXPECT_EMPTY_SET(features);
+ }
+}
+
} // namespace gpu
diff --git a/gpu/config/software_rendering_list_json.cc b/gpu/config/software_rendering_list_json.cc
index 36348b5..6e9f79d 100644
--- a/gpu/config/software_rendering_list_json.cc
+++ b/gpu/config/software_rendering_list_json.cc
@@ -18,7 +18,7 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST(
{
"name": "software rendering list",
// Please update the version number whenever you change this file.
- "version": "8.5",
+ "version": "8.6",
"entries": [
{
"id": 1,
@@ -1092,7 +1092,7 @@ LONG_STRING_CONST(
"os": {
"type": "win"
},
- "multi_gpu_style": "amd_switchable",
+ "multi_gpu_style": "amd_switchable_discrete",
"features": [
"accelerated_video_decode"
]