Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Unified Diff: gpu/config/gpu_control_list_unittest.cc

Issue 338183005: Add semantics to apply gpu blakclist to AMD swichable when a discrete/integrated GPU is in use (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/config/gpu_control_list_format.txt ('k') | gpu/config/software_rendering_list_json.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/config/gpu_control_list_unittest.cc
diff --git a/gpu/config/gpu_control_list_unittest.cc b/gpu/config/gpu_control_list_unittest.cc
index 33c69734a296d82bef79f363331ea0db7de6206a..03a7d0e2491463637af2d3a67a66bce74779e132 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
« no previous file with comments | « gpu/config/gpu_control_list_format.txt ('k') | gpu/config/software_rendering_list_json.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698