diff options
author | zmo@chromium.org <zmo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-30 19:04:21 +0000 |
---|---|---|
committer | zmo@chromium.org <zmo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-30 19:04:21 +0000 |
commit | 43fb70012595f295078e3957a083590a1ee25c6d (patch) | |
tree | 94e5023b3f6cec4024422ad5fb86876399af18c0 /gpu | |
parent | 71a7571049a620cb7aa5ef60c4a517ad30b4e844 (diff) | |
download | chromium_src-43fb70012595f295078e3957a083590a1ee25c6d.zip chromium_src-43fb70012595f295078e3957a083590a1ee25c6d.tar.gz chromium_src-43fb70012595f295078e3957a083590a1ee25c6d.tar.bz2 |
Fix wrong behaviors in gpu blacklist entry exceptions.
So here is what's going on: sometimes an exception is specified with device_id but without vendor_id. The assumption is it's the same vendor_id from the parent entry.
However, our code does not handle this vendor_id inheritence. Therefore, without the vendor_id information, any GPUInfo becomes a match (because it assumes no GPU requirement is specified lacking of vendor_id).
BUG=164555
TEST=gpu_unittests, intel mesa older than 9.1 should not have GPU features on linux.
R=piman@chromium.org
Review URL: https://codereview.chromium.org/15899014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203192 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/config/gpu_control_list.cc | 4 | ||||
-rw-r--r-- | gpu/config/gpu_control_list_unittest.cc | 53 |
2 files changed, 57 insertions, 0 deletions
diff --git a/gpu/config/gpu_control_list.cc b/gpu/config/gpu_control_list.cc index 670ccff..f5139db 100644 --- a/gpu/config/gpu_control_list.cc +++ b/gpu/config/gpu_control_list.cc @@ -762,6 +762,10 @@ GpuControlList::GpuControlListEntry::GetEntryFromValue( LOG(WARNING) << "Malformed exceptions entry " << entry->id(); return NULL; } + // Exception should inherit vendor_id from parent, otherwise if only + // device_ids are specified in Exception, the info will be incomplete. + if (exception->vendor_id_ == 0 && entry->vendor_id_ != 0) + exception->vendor_id_ = entry->vendor_id_; if (exception->contains_unknown_fields_) { LOG(WARNING) << "Exception with unknown fields " << entry->id(); entry->contains_unknown_fields_ = true; diff --git a/gpu/config/gpu_control_list_unittest.cc b/gpu/config/gpu_control_list_unittest.cc index 447b684..f20e9bb 100644 --- a/gpu/config/gpu_control_list_unittest.cc +++ b/gpu/config/gpu_control_list_unittest.cc @@ -440,5 +440,58 @@ TEST_F(GpuControlListTest, IgnorableEntries) { EXPECT_FALSE(control_list->needs_more_info()); } +TEST_F(GpuControlListTest, ExceptionWithoutVendorId) { + const std::string json = LONG_STRING_CONST( + { + "name": "gpu control list", + "version": "0.1", + "entries": [ + { + "id": 1, + "os": { + "type": "linux" + }, + "vendor_id": "0x8086", + "exceptions": [ + { + "device_id": ["0x2a06"], + "driver_version": { + "op": ">=", + "number": "8.1" + } + }, + { + "device_id": ["0x2a02"], + "driver_version": { + "op": ">=", + "number": "9.1" + } + } + ], + "features": [ + "test_feature_0" + ] + } + ] + } + ); + GPUInfo gpu_info; + gpu_info.gpu.vendor_id = kIntelVendorId; + gpu_info.gpu.device_id = 0x2a02; + gpu_info.driver_version = "9.1"; + + scoped_ptr<GpuControlList> control_list(Create()); + EXPECT_TRUE(control_list->LoadList(json, GpuControlList::kAllOs)); + + std::set<int> features = control_list->MakeDecision( + GpuControlList::kOsLinux, kOsVersion, gpu_info); + EXPECT_EMPTY_SET(features); + + gpu_info.driver_version = "9.0"; + features = control_list->MakeDecision( + GpuControlList::kOsLinux, kOsVersion, gpu_info); + EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); +} + } // namespace gpu |