diff options
-rw-r--r-- | content/browser/gpu/gpu_data_manager_impl_private_unittest.cc | 4 | ||||
-rw-r--r-- | gpu/config/gpu_control_list.cc | 61 | ||||
-rw-r--r-- | gpu/config/gpu_control_list.h | 2 | ||||
-rw-r--r-- | gpu/config/gpu_control_list_entry_unittest.cc | 11 | ||||
-rw-r--r-- | gpu/config/gpu_control_list_unittest.cc | 3 | ||||
-rw-r--r-- | gpu/config/software_rendering_list_json.cc | 8 |
6 files changed, 61 insertions, 28 deletions
diff --git a/content/browser/gpu/gpu_data_manager_impl_private_unittest.cc b/content/browser/gpu/gpu_data_manager_impl_private_unittest.cc index 41223ac..1179a9a 100644 --- a/content/browser/gpu/gpu_data_manager_impl_private_unittest.cc +++ b/content/browser/gpu/gpu_data_manager_impl_private_unittest.cc @@ -218,7 +218,7 @@ TEST_F(GpuDataManagerImplPrivateTest, GpuSideExceptions) { manager->InitializeForTesting(blacklist_json, gpu_info); EXPECT_TRUE(manager->GpuAccessAllowed(NULL)); - EXPECT_EQ(0u, manager->GetBlacklistedFeatureCount()); + EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount()); // Now assume gpu process launches and full GPU info is collected. gpu_info.gl_renderer = "NVIDIA GeForce GT 120"; @@ -536,7 +536,7 @@ TEST_F(GpuDataManagerImplPrivateTest, SetGLStrings) { // Not enough GPUInfo. EXPECT_TRUE(manager->GpuAccessAllowed(NULL)); - EXPECT_EQ(0u, manager->GetBlacklistedFeatureCount()); + EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount()); // Now assume browser gets GL strings from local state. // The entry applies, blacklist more features than from the preliminary step. diff --git a/gpu/config/gpu_control_list.cc b/gpu/config/gpu_control_list.cc index 2f4b6aa..e187b5f 100644 --- a/gpu/config/gpu_control_list.cc +++ b/gpu/config/gpu_control_list.cc @@ -1250,14 +1250,15 @@ bool GpuControlList::GpuControlListEntry::Contains( for (size_t i = 0; i < exceptions_.size(); ++i) { if (exceptions_[i]->Contains(os_type, os_version, gpu_info) && - !exceptions_[i]->NeedsMoreInfo(gpu_info)) + !exceptions_[i]->NeedsMoreInfo(gpu_info, true)) return false; } return true; } bool GpuControlList::GpuControlListEntry::NeedsMoreInfo( - const GPUInfo& gpu_info) const { + const GPUInfo& gpu_info, + bool consider_exceptions) const { // We only check for missing info that might be collected with a gl context. // If certain info is missing due to some error, say, we fail to collect // vendor_id/device_id, then even if we launch GPU process and create a gl @@ -1270,10 +1271,14 @@ bool GpuControlList::GpuControlListEntry::NeedsMoreInfo( return true; if (!gl_renderer_info_.empty() && gpu_info.gl_renderer.empty()) return true; - for (size_t i = 0; i < exceptions_.size(); ++i) { - if (exceptions_[i]->NeedsMoreInfo(gpu_info)) - return true; + + if (consider_exceptions) { + for (size_t i = 0; i < exceptions_.size(); ++i) { + if (exceptions_[i]->NeedsMoreInfo(gpu_info, consider_exceptions)) + return true; + } } + return false; } @@ -1395,7 +1400,12 @@ std::set<int> GpuControlList::MakeDecision( std::set<int> features; needs_more_info_ = false; - std::set<int> possible_features; + // Has all features permanently in the list without any possibility of + // removal in the future (subset of "features" set). + std::set<int> permanent_features; + // Has all features absent from "features" set that could potentially be + // included later with more information. + std::set<int> potential_features; if (os == kOsAny) os = GetOsType(); @@ -1403,23 +1413,38 @@ std::set<int> GpuControlList::MakeDecision( os_version = base::SysInfo::OperatingSystemVersion(); for (size_t i = 0; i < entries_.size(); ++i) { - if (entries_[i]->Contains(os, os_version, gpu_info)) { - bool needs_more_info = entries_[i]->NeedsMoreInfo(gpu_info); - if (!entries_[i]->disabled()) { + ScopedGpuControlListEntry entry = entries_[i]; + if (entry->Contains(os, os_version, gpu_info)) { + bool needs_more_info_main = entry->NeedsMoreInfo(gpu_info, false); + bool needs_more_info_exception = entry->NeedsMoreInfo(gpu_info, true); + + if (!entry->disabled()) { if (control_list_logging_enabled_) - entries_[i]->LogControlListMatch(control_list_logging_name_); - MergeFeatureSets(&possible_features, entries_[i]->features()); - if (!needs_more_info) - MergeFeatureSets(&features, entries_[i]->features()); + entry->LogControlListMatch(control_list_logging_name_); + // Only look at main entry info when deciding what to add to "features" + // set. If we don't have enough info for an exception, it's safer if we + // just ignore the exception and assume the exception doesn't apply. + for (std::set<int>::const_iterator iter = entry->features().begin(); + iter != entry->features().end(); ++iter) { + if (needs_more_info_main) { + if (!features.count(*iter)) + potential_features.insert(*iter); + } else { + features.insert(*iter); + potential_features.erase(*iter); + if (!needs_more_info_exception) + permanent_features.insert(*iter); + } + } } - if (!needs_more_info) - active_entries_.push_back(entries_[i]); + + if (!needs_more_info_main) + active_entries_.push_back(entry); } } - if (possible_features.size() > features.size()) - needs_more_info_ = true; - + needs_more_info_ = permanent_features.size() < features.size() || + !potential_features.empty(); return features; } diff --git a/gpu/config/gpu_control_list.h b/gpu/config/gpu_control_list.h index 3cd7625..3249415 100644 --- a/gpu/config/gpu_control_list.h +++ b/gpu/config/gpu_control_list.h @@ -269,7 +269,7 @@ class GPU_EXPORT GpuControlList { // Determines whether we needs more gpu info to make the blacklisting // decision. It should only be checked if Contains() returns true. - bool NeedsMoreInfo(const GPUInfo& gpu_info) const; + bool NeedsMoreInfo(const GPUInfo& gpu_info, bool consider_exceptions) const; // Returns the OsType. OsType GetOsType() const; diff --git a/gpu/config/gpu_control_list_entry_unittest.cc b/gpu/config/gpu_control_list_entry_unittest.cc index d52ad6c..dbe7031 100644 --- a/gpu/config/gpu_control_list_entry_unittest.cc +++ b/gpu/config/gpu_control_list_entry_unittest.cc @@ -107,7 +107,7 @@ TEST_F(GpuControlListEntryTest, DetailedEntry) { EXPECT_EQ(1950, entry->webkit_bugs()[0]); EXPECT_EQ(1u, entry->features().size()); EXPECT_EQ(1u, entry->features().count(TEST_FEATURE_0)); - EXPECT_FALSE(entry->NeedsMoreInfo(gpu_info())); + EXPECT_FALSE(entry->NeedsMoreInfo(gpu_info(), true)); EXPECT_TRUE(entry->Contains( GpuControlList::kOsMacosx, "10.6.4", gpu_info())); EXPECT_STREQ("test_extension1", entry->disabled_extensions()[0].c_str()); @@ -762,10 +762,10 @@ TEST_F(GpuControlListEntryTest, NeedsMoreInfoEntry) { GPUInfo gpu_info; gpu_info.gpu.vendor_id = 0x8086; - EXPECT_TRUE(entry->NeedsMoreInfo(gpu_info)); + EXPECT_TRUE(entry->NeedsMoreInfo(gpu_info, true)); gpu_info.driver_version = "10.6"; - EXPECT_FALSE(entry->NeedsMoreInfo(gpu_info)); + EXPECT_FALSE(entry->NeedsMoreInfo(gpu_info, true)); } TEST_F(GpuControlListEntryTest, NeedsMoreInfoForExceptionsEntry) { @@ -788,10 +788,11 @@ TEST_F(GpuControlListEntryTest, NeedsMoreInfoForExceptionsEntry) { GPUInfo gpu_info; gpu_info.gpu.vendor_id = 0x8086; - EXPECT_TRUE(entry->NeedsMoreInfo(gpu_info)); + EXPECT_TRUE(entry->NeedsMoreInfo(gpu_info, true)); + EXPECT_FALSE(entry->NeedsMoreInfo(gpu_info, false)); gpu_info.gl_renderer = "mesa"; - EXPECT_FALSE(entry->NeedsMoreInfo(gpu_info)); + EXPECT_FALSE(entry->NeedsMoreInfo(gpu_info, true)); } TEST_F(GpuControlListEntryTest, FeatureTypeAllEntry) { diff --git a/gpu/config/gpu_control_list_unittest.cc b/gpu/config/gpu_control_list_unittest.cc index 91b9d81..88452fc 100644 --- a/gpu/config/gpu_control_list_unittest.cc +++ b/gpu/config/gpu_control_list_unittest.cc @@ -370,7 +370,8 @@ TEST_F(GpuControlListTest, NeedsMoreInfoForExceptions) { // The case this entry might apply, but need more info. features = control_list->MakeDecision( GpuControlList::kOsLinux, kOsVersion, gpu_info); - EXPECT_EMPTY_SET(features); + // Ignore exceptions if main entry info matches + EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); EXPECT_TRUE(control_list->needs_more_info()); // The case we have full info, and the exception applies (so the entry diff --git a/gpu/config/software_rendering_list_json.cc b/gpu/config/software_rendering_list_json.cc index 7a4d694..a4cf2b0 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": "10.8", + "version": "10.9", "entries": [ { "id": 1, @@ -245,6 +245,12 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( "os": { "type": "linux" }, + "exceptions": [ + { + "gl_vendor": "Vivante Corporation", + "gl_renderer": "Vivante GC1000" + } + ], "features": [ "accelerated_2d_canvas" ] |