diff options
-rw-r--r-- | chrome/browser/gpu/chrome_gpu_util.cc | 6 | ||||
-rw-r--r-- | chrome/test/base/test_launcher_utils.cc | 4 | ||||
-rw-r--r-- | chrome/test/gpu/gpu_feature_browsertest.cc | 20 | ||||
-rw-r--r-- | content/browser/gpu/gpu_data_manager_impl_private.cc | 41 | ||||
-rw-r--r-- | content/browser/gpu/gpu_data_manager_impl_private.h | 3 | ||||
-rw-r--r-- | content/public/common/content_switches.cc | 6 | ||||
-rw-r--r-- | content/public/common/content_switches.h | 1 | ||||
-rw-r--r-- | content/public/test/browser_test_base.cc | 4 | ||||
-rw-r--r-- | gpu/config/gpu_control_list.cc | 14 | ||||
-rw-r--r-- | gpu/config/gpu_control_list.h | 15 | ||||
-rw-r--r-- | gpu/config/software_rendering_list_json.cc | 42 |
11 files changed, 133 insertions, 23 deletions
diff --git a/chrome/browser/gpu/chrome_gpu_util.cc b/chrome/browser/gpu/chrome_gpu_util.cc index 61da773..f59e46d 100644 --- a/chrome/browser/gpu/chrome_gpu_util.cc +++ b/chrome/browser/gpu/chrome_gpu_util.cc @@ -46,12 +46,6 @@ bool ShouldRunCompositingFieldTrial() { return false; #endif -#if defined(OS_WIN) - // Don't run the trial on Windows XP. - if (base::win::GetVersion() < base::win::VERSION_VISTA) - return false; -#endif - #if defined(OS_MACOSX) // Browser and content shell tests hang on 10.7 when the Apple software // renderer is used. These tests ignore the blacklist (which disables diff --git a/chrome/test/base/test_launcher_utils.cc b/chrome/test/base/test_launcher_utils.cc index 1f81ef9..afbfc58 100644 --- a/chrome/test/base/test_launcher_utils.cc +++ b/chrome/test/base/test_launcher_utils.cc @@ -47,9 +47,11 @@ void PrepareBrowserCommandLineForTests(CommandLine* command_line) { // Don't install default apps. command_line->AppendSwitch(switches::kDisableDefaultApps); +#if !defined(OS_WIN) // Don't collect GPU info, load GPU blacklist, or schedule a GPU blacklist - // auto-update. + // auto-update on non-Win bots for now (http://crbug.com/304833). command_line->AppendSwitch(switches::kSkipGpuDataLoading); +#endif #if defined(USE_AURA) // Disable window animations under Ash as the animations effect the diff --git a/chrome/test/gpu/gpu_feature_browsertest.cc b/chrome/test/gpu/gpu_feature_browsertest.cc index 6263e2d..0cbe428 100644 --- a/chrome/test/gpu/gpu_feature_browsertest.cc +++ b/chrome/test/gpu/gpu_feature_browsertest.cc @@ -216,7 +216,7 @@ class AcceleratedCompositingBlockedTest : public GpuFeatureTest { #endif IN_PROC_BROWSER_TEST_F(AcceleratedCompositingBlockedTest, - MAYBE_AcceleratedCompositingBlocked) { + MAYBE_AcceleratedCompositingBlocked) { EXPECT_TRUE(GpuDataManager::GetInstance()->IsFeatureBlacklisted( gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING)); @@ -367,11 +367,23 @@ IN_PROC_BROWSER_TEST_F(GpuFeatureTest, Canvas2DAllowed) { if (gpu::GPUTestBotConfig::CurrentConfigMatches("XP")) return; - EXPECT_FALSE(GpuDataManager::GetInstance()->IsFeatureBlacklisted( - gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)); + bool is_blacklisted = false; +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) + // Blacklist rule #24 disables accelerated_2d_canvas on Linux. + // TODO(gab): Enable GPU control lists on Linux. + // is_blacklisted = true; +#elif defined(OS_WIN) + // Blacklist rule #67 disables accelerated_2d_canvas on XP. + if (base::win::GetVersion() < base::win::VERSION_VISTA) + is_blacklisted = true; +#endif + + EXPECT_EQ(is_blacklisted, + GpuDataManager::GetInstance()->IsFeatureBlacklisted( + gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)); const base::FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html")); - RunEventTest(url, kAcceleratedCanvasCreationEvent, true); + RunEventTest(url, kAcceleratedCanvasCreationEvent, !is_blacklisted); } IN_PROC_BROWSER_TEST_F(GpuFeatureTest, Canvas2DBlocked) { diff --git a/content/browser/gpu/gpu_data_manager_impl_private.cc b/content/browser/gpu/gpu_data_manager_impl_private.cc index d48c2fc..513a1d5 100644 --- a/content/browser/gpu/gpu_data_manager_impl_private.cc +++ b/content/browser/gpu/gpu_data_manager_impl_private.cc @@ -320,6 +320,9 @@ void GpuDataManagerImplPrivate::InitializeForTesting( // This function is for testing only, so disable histograms. update_histograms_ = false; + // Prevent all further initialization. + finalized_ = true; + InitializeImpl(gpu_blacklist_json, std::string(), std::string(), gpu_info); } @@ -533,13 +536,30 @@ void GpuDataManagerImplPrivate::GetGLStrings(std::string* gl_vendor, void GpuDataManagerImplPrivate::Initialize() { TRACE_EVENT0("startup", "GpuDataManagerImpl::Initialize"); - CommandLine* command_line = CommandLine::ForCurrentProcess(); - if (command_line->HasSwitch(switches::kSkipGpuDataLoading) && - !command_line->HasSwitch(switches::kUseGpuInTests)) + if (finalized_) { + DLOG(INFO) << "GpuDataManagerImpl marked as finalized; skipping Initialize"; + return; + } + + const CommandLine* command_line = CommandLine::ForCurrentProcess(); + if (command_line->HasSwitch(switches::kSkipGpuDataLoading)) return; gpu::GPUInfo gpu_info; - { + if (command_line->GetSwitchValueASCII( + switches::kUseGL) == gfx::kGLImplementationOSMesaName) { + // If using the OSMesa GL implementation, use fake vendor and device ids to + // make sure it never gets blacklisted. This is better than simply + // cancelling GPUInfo gathering as it allows us to proceed with loading the + // blacklist below which may have non-device specific entries we want to + // apply anyways (e.g., OS version blacklisting). + gpu_info.gpu.vendor_id = 0xffff; + gpu_info.gpu.device_id = 0xffff; + + // Also declare the driver_vendor to be osmesa to be able to specify + // exceptions based on driver_vendor==osmesa for some blacklist rules. + gpu_info.driver_vendor = gfx::kGLImplementationOSMesaName; + } else { TRACE_EVENT0("startup", "GpuDataManagerImpl::Initialize:CollectBasicGraphicsInfo"); gpu::CollectBasicGraphicsInfo(&gpu_info); @@ -973,7 +993,8 @@ GpuDataManagerImplPrivate::GpuDataManagerImplPrivate( owner_(owner), display_count_(0), gpu_process_accessible_(true), - use_software_compositor_(false) { + use_software_compositor_(false), + finalized_(false) { DCHECK(owner_); CommandLine* command_line = CommandLine::ForCurrentProcess(); if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) { @@ -1018,8 +1039,14 @@ void GpuDataManagerImplPrivate::InitializeImpl( GetContentClient()->GetProduct()); CHECK(!browser_version_string.empty()); + const bool log_gpu_control_list_decisions = + CommandLine::ForCurrentProcess()->HasSwitch( + switches::kLogGpuControlListDecisions); + if (!gpu_blacklist_json.empty()) { gpu_blacklist_.reset(gpu::GpuBlacklist::Create()); + if (log_gpu_control_list_decisions) + gpu_blacklist_->enable_control_list_logging("gpu_blacklist"); bool success = gpu_blacklist_->LoadList( browser_version_string, gpu_blacklist_json, gpu::GpuControlList::kCurrentOsOnly); @@ -1027,6 +1054,8 @@ void GpuDataManagerImplPrivate::InitializeImpl( } if (!gpu_switching_list_json.empty()) { gpu_switching_list_.reset(gpu::GpuSwitchingList::Create()); + if (log_gpu_control_list_decisions) + gpu_switching_list_->enable_control_list_logging("gpu_switching_list"); bool success = gpu_switching_list_->LoadList( browser_version_string, gpu_switching_list_json, gpu::GpuControlList::kCurrentOsOnly); @@ -1034,6 +1063,8 @@ void GpuDataManagerImplPrivate::InitializeImpl( } if (!gpu_driver_bug_list_json.empty()) { gpu_driver_bug_list_.reset(gpu::GpuDriverBugList::Create()); + if (log_gpu_control_list_decisions) + gpu_driver_bug_list_->enable_control_list_logging("gpu_driver_bug_list"); bool success = gpu_driver_bug_list_->LoadList( browser_version_string, gpu_driver_bug_list_json, gpu::GpuControlList::kCurrentOsOnly); diff --git a/content/browser/gpu/gpu_data_manager_impl_private.h b/content/browser/gpu/gpu_data_manager_impl_private.h index 8d15296..ed1b39c 100644 --- a/content/browser/gpu/gpu_data_manager_impl_private.h +++ b/content/browser/gpu/gpu_data_manager_impl_private.h @@ -247,6 +247,9 @@ class CONTENT_EXPORT GpuDataManagerImplPrivate { bool use_software_compositor_; + // True if all future Initialize calls should be ignored. + bool finalized_; + DISALLOW_COPY_AND_ASSIGN(GpuDataManagerImplPrivate); }; diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc index b6a1704..b529058 100644 --- a/content/public/common/content_switches.cc +++ b/content/public/common/content_switches.cc @@ -633,6 +633,9 @@ const char kJavaScriptFlags[] = "js-flags"; // Load an NPAPI plugin from the specified path. const char kLoadPlugin[] = "load-plugin"; +// Logs GPU control list decisions when enforcing blacklist rules. +const char kLogGpuControlListDecisions[] = "log-gpu-control-list-decisions"; + // Sets the minimum log level. Valid values are from 0 to 3: // INFO = 0, WARNING = 1, LOG_ERROR = 2, LOG_FATAL = 3. const char kLoggingLevel[] = "log-level"; @@ -782,7 +785,8 @@ const char kSitePerProcess[] = "site-per-process"; // Skip gpu info collection, blacklist loading, and blacklist auto-update // scheduling at browser startup time. // Therefore, all GPU features are available, and about:gpu page shows empty -// content. The switch is intended only for tests. +// content. The switch is intended only for layout tests. +// TODO(gab): Get rid of this switch entirely. const char kSkipGpuDataLoading[] = "skip-gpu-data-loading"; // Specifies the request key for the continuous speech recognition webservice. diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h index 61268c1..9198905 100644 --- a/content/public/common/content_switches.h +++ b/content/public/common/content_switches.h @@ -189,6 +189,7 @@ extern const char kInProcessGPU[]; extern const char kInProcessPlugins[]; CONTENT_EXPORT extern const char kJavaScriptFlags[]; extern const char kLoadPlugin[]; +CONTENT_EXPORT extern const char kLogGpuControlListDecisions[]; CONTENT_EXPORT extern const char kLoggingLevel[]; CONTENT_EXPORT extern const char kLogNetLog[]; extern const char kLogPluginMessages[]; diff --git a/content/public/test/browser_test_base.cc b/content/public/test/browser_test_base.cc index cb5e3b8..5fed0cc 100644 --- a/content/public/test/browser_test_base.cc +++ b/content/public/test/browser_test_base.cc @@ -153,7 +153,9 @@ void BrowserTestBase::SetUp() { command_line->AppendSwitch(switches::kDomAutomationController); - command_line->AppendSwitch(switches::kSkipGpuDataLoading); + // It is sometimes useful when looking at browser test failures to know which + // GPU blacklisting decisions were made. + command_line->AppendSwitch(switches::kLogGpuControlListDecisions); #if defined(USE_AURA) // Use test contexts for browser tests unless they override and force us to diff --git a/gpu/config/gpu_control_list.cc b/gpu/config/gpu_control_list.cc index 1d45d72..0c645b5 100644 --- a/gpu/config/gpu_control_list.cc +++ b/gpu/config/gpu_control_list.cc @@ -10,6 +10,7 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" +#include "base/strings/stringprintf.h" #include "base/sys_info.h" #include "gpu/config/gpu_info.h" #include "gpu/config/gpu_util.h" @@ -1030,6 +1031,14 @@ GpuControlList::GpuControlListEntry::StringToMultiGpuCategory( return kMultiGpuCategoryNone; } +void GpuControlList::GpuControlListEntry::LogControlListMatch( + const std::string& control_list_logging_name) const { + static const char kControlListMatchMessage[] = + "Control list match for rule #%u in %s."; + LOG(INFO) << base::StringPrintf(kControlListMatchMessage, id_, + control_list_logging_name.c_str()); +} + bool GpuControlList::GpuControlListEntry::Contains( OsType os_type, const std::string& os_version, const GPUInfo& gpu_info) const { @@ -1185,7 +1194,8 @@ bool GpuControlList::GpuControlListEntry::StringToFeature( GpuControlList::GpuControlList() : max_entry_id_(0), needs_more_info_(false), - supports_feature_type_all_(false) { + supports_feature_type_all_(false), + control_list_logging_enabled_(false) { } GpuControlList::~GpuControlList() { @@ -1292,6 +1302,8 @@ std::set<int> GpuControlList::MakeDecision( for (size_t i = 0; i < entries_.size(); ++i) { if (entries_[i]->Contains(os, os_version, gpu_info)) { if (!entries_[i]->disabled()) { + if (control_list_logging_enabled_) + entries_[i]->LogControlListMatch(control_list_logging_name_); MergeFeatureSets(&possible_features, entries_[i]->features()); if (!entries_[i]->NeedsMoreInfo(gpu_info)) MergeFeatureSets(&features, entries_[i]->features()); diff --git a/gpu/config/gpu_control_list.h b/gpu/config/gpu_control_list.h index ced3b52..29a5f77 100644 --- a/gpu/config/gpu_control_list.h +++ b/gpu/config/gpu_control_list.h @@ -93,6 +93,13 @@ class GPU_EXPORT GpuControlList { // Register whether "all" is recognized as all features. void set_supports_feature_type_all(bool supported); + // Enables logging of control list decisions. + void enable_control_list_logging( + const std::string& control_list_logging_name) { + control_list_logging_enabled_ = true; + control_list_logging_name_ = control_list_logging_name; + } + private: friend class GpuControlListEntryTest; friend class MachineModelInfoTest; @@ -289,6 +296,11 @@ class GPU_EXPORT GpuControlList { const FeatureMap& feature_map, bool supports_feature_type_all); + // Logs a control list match for this rule in the list identified by + // |control_list_logging_name|. + void LogControlListMatch( + const std::string& control_list_logging_name) const; + // Determines if a given os/gc/machine_model/driver is included in the // Entry set. bool Contains(OsType os_type, const std::string& os_version, @@ -479,6 +491,9 @@ class GPU_EXPORT GpuControlList { // The features a GpuControlList recognizes and handles. FeatureMap feature_map_; bool supports_feature_type_all_; + + bool control_list_logging_enabled_; + std::string control_list_logging_name_; }; } // namespace gpu diff --git a/gpu/config/software_rendering_list_json.cc b/gpu/config/software_rendering_list_json.cc index ae2b4a0..a454ded 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": "6.11", + "version": "6.12", "entries": [ { "id": 1, @@ -138,6 +138,12 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( "op": ">=", "value": "7.15.10.1624" } + }, + { + "driver_vendor": { + "op": "=", + "value": "osmesa" + } } ], "features": [ @@ -329,6 +335,14 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( "op": "<", "value": "7.11" }, + "exceptions": [ + { + "driver_vendor": { + "op": "=", + "value": "osmesa" + } + } + ], "features": [ "all" ] @@ -766,6 +780,12 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( "op": ">=", "value": "7.15.10.1624" } + }, + { + "driver_vendor": { + "op": "=", + "value": "osmesa" + } } ], "features": [ @@ -1069,6 +1089,8 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( "all" ] }, +) // String split to avoid MSVC char limit. +LONG_STRING_CONST( { "id": 75, "description": "Texture sharing not supported on AMD Switchable GPUs due to driver issues", @@ -1081,8 +1103,6 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( "texture_sharing" ] }, -) // String split to avoid MSVC char limit. -LONG_STRING_CONST( { "id": 76, "description": "WebGL is disabled on Android unless GPU reset notification is supported", @@ -1134,6 +1154,21 @@ LONG_STRING_CONST( "features": [ "accelerated_video_decode" ] + }, + { + "id": 79, + "description": "Disable force compositing mode on all Windows versions prior to Vista.", + "cr_bugs": [273920], + "os": { + "type": "win", + "version": { + "op": "<", + "value": "6.0" + } + }, + "features": [ + "force_compositing_mode" + ] } ] } @@ -1141,4 +1176,3 @@ LONG_STRING_CONST( ); // LONG_STRING_CONST macro } // namespace gpu - |