diff options
-rw-r--r-- | chrome/browser/gpu/chrome_gpu_util.cc | 26 | ||||
-rw-r--r-- | chrome/test/base/test_launcher_utils.cc | 4 | ||||
-rw-r--r-- | chrome/test/gpu/gpu_feature_browsertest.cc | 41 | ||||
-rw-r--r-- | content/browser/gpu/compositor_util.cc | 25 | ||||
-rw-r--r-- | content/browser/gpu/compositor_util_browsertest.cc | 33 | ||||
-rw-r--r-- | content/browser/gpu/gpu_data_manager_impl_private.cc | 29 | ||||
-rw-r--r-- | content/content_tests.gypi | 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 | 12 | ||||
-rw-r--r-- | gpu/config/gpu_control_list.h | 8 | ||||
-rw-r--r-- | gpu/config/software_rendering_list_json.cc | 20 |
13 files changed, 132 insertions, 80 deletions
diff --git a/chrome/browser/gpu/chrome_gpu_util.cc b/chrome/browser/gpu/chrome_gpu_util.cc index 61da773..c2f646d 100644 --- a/chrome/browser/gpu/chrome_gpu_util.cc +++ b/chrome/browser/gpu/chrome_gpu_util.cc @@ -40,32 +40,6 @@ bool ShouldRunCompositingFieldTrial() { return false; #endif -// Necessary for linux_chromeos build since it defines both OS_LINUX -// and OS_CHROMEOS. -#if defined(OS_CHROMEOS) - 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 - // compositing both on 10.7 and when the Apple software renderer is used) - // by specifying the kSkipGpuDataLoading switch, so disable forced - // compositing here based on the switch and OS version. - // http://crbug.com/230931 - if (base::mac::IsOSLion() && - CommandLine::ForCurrentProcess()->HasSwitch( - switches::kSkipGpuDataLoading)) { - return false; - } -#endif - // Don't activate the field trial if force-compositing-mode has been // explicitly disabled from the command line. if (CommandLine::ForCurrentProcess()->HasSwitch( diff --git a/chrome/test/base/test_launcher_utils.cc b/chrome/test/base/test_launcher_utils.cc index 1f81ef9..f5bf93c 100644 --- a/chrome/test/base/test_launcher_utils.cc +++ b/chrome/test/base/test_launcher_utils.cc @@ -47,10 +47,6 @@ void PrepareBrowserCommandLineForTests(CommandLine* command_line) { // Don't install default apps. command_line->AppendSwitch(switches::kDisableDefaultApps); - // Don't collect GPU info, load GPU blacklist, or schedule a GPU blacklist - // auto-update. - command_line->AppendSwitch(switches::kSkipGpuDataLoading); - #if defined(USE_AURA) // Disable window animations under Ash as the animations effect the // coordinates returned and result in flake. diff --git a/chrome/test/gpu/gpu_feature_browsertest.cc b/chrome/test/gpu/gpu_feature_browsertest.cc index a1baa93..5e36c09 100644 --- a/chrome/test/gpu/gpu_feature_browsertest.cc +++ b/chrome/test/gpu/gpu_feature_browsertest.cc @@ -187,11 +187,15 @@ IN_PROC_BROWSER_TEST_F(GpuFeatureTest, MAYBE_AcceleratedCompositingAllowed) { RunEventTest(url, kSwapBuffersEvent, true); } -class AcceleratedCompositingBlockedTest : public GpuFeatureTest { - public: - virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { - GpuFeatureTest::SetUpInProcessBrowserTestFixture(); - const std::string json_blacklist = +#if defined(USE_AURA) +// Compositing is always on for Aura. +#define MAYBE_AcceleratedCompositingBlocked DISABLED_AcceleratedCompositingBlocked +#else +#define MAYBE_AcceleratedCompositingBlocked AcceleratedCompositingBlocked +#endif + +IN_PROC_BROWSER_TEST_F(GpuFeatureTest, MAYBE_AcceleratedCompositingBlocked) { + const std::string json_blacklist = "{\n" " \"name\": \"gpu blacklist\",\n" " \"version\": \"1.0\",\n" @@ -204,19 +208,7 @@ class AcceleratedCompositingBlockedTest : public GpuFeatureTest { " }\n" " ]\n" "}"; - SetupBlacklist(json_blacklist); - } -}; - -#if defined(USE_AURA) -// Compositing is always on for Aura. -#define MAYBE_AcceleratedCompositingBlocked DISABLED_AcceleratedCompositingBlocked -#else -#define MAYBE_AcceleratedCompositingBlocked AcceleratedCompositingBlocked -#endif - -IN_PROC_BROWSER_TEST_F(AcceleratedCompositingBlockedTest, - MAYBE_AcceleratedCompositingBlocked) { + SetupBlacklist(json_blacklist); EXPECT_TRUE(GpuDataManager::GetInstance()->IsFeatureBlacklisted( gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING)); @@ -366,11 +358,18 @@ 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. + 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/compositor_util.cc b/content/browser/gpu/compositor_util.cc index 8afd0e9..150005a 100644 --- a/content/browser/gpu/compositor_util.cc +++ b/content/browser/gpu/compositor_util.cc @@ -6,6 +6,7 @@ #include "base/command_line.h" #include "base/metrics/field_trial.h" +#include "build/build_config.h" #include "content/public/browser/gpu_data_manager.h" #include "content/public/common/content_constants.h" #include "content/public/common/content_switches.h" @@ -36,11 +37,6 @@ bool CanDoAcceleratedCompositing() { return true; } -bool IsForceCompositingModeBlacklisted() { - return GpuDataManager::GetInstance()->IsFeatureBlacklisted( - gpu::GPU_FEATURE_TYPE_FORCE_COMPOSITING_MODE); -} - } // namespace bool IsThreadedCompositingEnabled() { @@ -49,20 +45,17 @@ bool IsThreadedCompositingEnabled() { return true; #endif - if (!CanDoAcceleratedCompositing()) - return false; - const CommandLine& command_line = *CommandLine::ForCurrentProcess(); // Command line switches take precedence over blacklist and field trials. if (command_line.HasSwitch(switches::kDisableForceCompositingMode) || - command_line.HasSwitch(switches::kDisableThreadedCompositing)) + command_line.HasSwitch(switches::kDisableThreadedCompositing)) { return false; - - if (command_line.HasSwitch(switches::kEnableThreadedCompositing)) + } else if (command_line.HasSwitch(switches::kEnableThreadedCompositing)) { return true; + } - if (IsForceCompositingModeBlacklisted()) + if (!CanDoAcceleratedCompositing()) return false; base::FieldTrial* trial = @@ -77,19 +70,15 @@ bool IsForceCompositingModeEnabled() { return true; #endif - if (!CanDoAcceleratedCompositing()) - return false; - const CommandLine& command_line = *CommandLine::ForCurrentProcess(); // Command line switches take precedence over blacklisting and field trials. if (command_line.HasSwitch(switches::kDisableForceCompositingMode)) return false; - - if (command_line.HasSwitch(switches::kForceCompositingMode)) + else if (command_line.HasSwitch(switches::kForceCompositingMode)) return true; - if (IsForceCompositingModeBlacklisted()) + if (!CanDoAcceleratedCompositing()) return false; base::FieldTrial* trial = diff --git a/content/browser/gpu/compositor_util_browsertest.cc b/content/browser/gpu/compositor_util_browsertest.cc new file mode 100644 index 0000000..d58db54 --- /dev/null +++ b/content/browser/gpu/compositor_util_browsertest.cc @@ -0,0 +1,33 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/browser/gpu/compositor_util.h" +#include "content/test/content_browser_test.h" + +#if defined(OS_WIN) +#include "base/win/windows_version.h" +#endif + +namespace content { + +typedef ContentBrowserTest CompositorUtilTest; + +// Test that threaded compositing and FCM are in the expected mode on the bots +// for all platforms. +IN_PROC_BROWSER_TEST_F(CompositorUtilTest, CompositingModeAsExpected) { + enum CompositingMode { + DISABLED, + ENABLED, + THREADED, + } expected_mode = DISABLED; +#if defined(OS_ANDROID) || defined(USE_AURA) + expected_mode = THREADED; +#endif + + EXPECT_EQ(expected_mode == ENABLED || expected_mode == THREADED, + IsForceCompositingModeEnabled()); + EXPECT_EQ(expected_mode == THREADED, IsThreadedCompositingEnabled()); +} + +} diff --git a/content/browser/gpu/gpu_data_manager_impl_private.cc b/content/browser/gpu/gpu_data_manager_impl_private.cc index ee5463d..08472e5 100644 --- a/content/browser/gpu/gpu_data_manager_impl_private.cc +++ b/content/browser/gpu/gpu_data_manager_impl_private.cc @@ -571,13 +571,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)) + 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; + + // Hardcode some values otherwise some blacklisting rules in + // kSoftwareRenderingListJson result in a positive match as GpuControlList + // assumes a match (by design) when a property is required for the + // verification yet not present in the GpuInfo. + gpu_info.driver_vendor = + gfx::kGLImplementationOSMesaName; // Bypass rule #74. + gpu_info.driver_date = "2013.8"; // Bypass rules #12 and #55. + gpu_info.driver_version = "9.0.3"; // Bypass rule #23. + } else { TRACE_EVENT0("startup", "GpuDataManagerImpl::Initialize:CollectBasicGraphicsInfo"); gpu::CollectBasicGraphicsInfo(&gpu_info); @@ -1058,6 +1075,10 @@ void GpuDataManagerImplPrivate::InitializeImpl( if (!gpu_blacklist_json.empty()) { gpu_blacklist_.reset(gpu::GpuBlacklist::Create()); + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kLogGpuControlListDecisions)) { + gpu_blacklist_->enable_control_list_logging(); + } gpu_blacklist_->LoadList( browser_version_string, gpu_blacklist_json, gpu::GpuControlList::kCurrentOsOnly); diff --git a/content/content_tests.gypi b/content/content_tests.gypi index 6b2aef6..3061d30 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi @@ -812,10 +812,11 @@ 'browser/download/mhtml_generation_browsertest.cc', 'browser/download/save_package_browsertest.cc', 'browser/fileapi/file_system_browsertest.cc', + 'browser/gpu/compositor_util_browsertest.cc', 'browser/gpu/gpu_crash_browsertest.cc', + 'browser/gpu/gpu_functional_browsertest.cc', 'browser/gpu/gpu_info_browsertest.cc', 'browser/gpu/gpu_ipc_browsertests.cc', - 'browser/gpu/gpu_functional_browsertest.cc', 'browser/gpu/gpu_memory_test.cc', 'browser/gpu/gpu_pixel_browsertest.cc', 'browser/gpu/webgl_conformance_test.cc', diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc index 2521315..3e97bd6 100644 --- a/content/public/common/content_switches.cc +++ b/content/public/common/content_switches.cc @@ -611,6 +611,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"; @@ -761,7 +764,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 b83a288..5c46dc8 100644 --- a/content/public/common/content_switches.h +++ b/content/public/common/content_switches.h @@ -181,6 +181,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 069ba5d..bb8f3487 100644 --- a/content/public/test/browser_test_base.cc +++ b/content/public/test/browser_test_base.cc @@ -109,7 +109,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 5eb09c4..e106995 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" @@ -1036,6 +1037,12 @@ GpuControlList::GpuControlListEntry::StringToMultiGpuCategory( return kMultiGpuCategoryNone; } +void GpuControlList::GpuControlListEntry::LogControlListMatch() const { + static const char kControlListMatchMessage[] = + "Control list match for rule #%u."; + LOG(INFO) << base::StringPrintf(kControlListMatchMessage, id_); +} + bool GpuControlList::GpuControlListEntry::Contains( OsType os_type, const std::string& os_version, const GPUInfo& gpu_info) const { @@ -1192,7 +1199,8 @@ GpuControlList::GpuControlList() : max_entry_id_(0), contains_unknown_fields_(false), needs_more_info_(false), - supports_feature_type_all_(false) { + supports_feature_type_all_(false), + control_list_logging_enabled_(false) { } GpuControlList::~GpuControlList() { @@ -1309,6 +1317,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(); 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 62b66ec..b6d8d5c 100644 --- a/gpu/config/gpu_control_list.h +++ b/gpu/config/gpu_control_list.h @@ -96,6 +96,9 @@ 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() { control_list_logging_enabled_ = true; } + private: friend class GpuControlListEntryTest; friend class MachineModelInfoTest; @@ -292,6 +295,9 @@ class GPU_EXPORT GpuControlList { const FeatureMap& feature_map, bool supports_feature_type_all); + // Logs a control list match for this rule. + void LogControlListMatch() 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, @@ -495,6 +501,8 @@ class GPU_EXPORT GpuControlList { // The features a GpuControlList recognizes and handles. FeatureMap feature_map_; bool supports_feature_type_all_; + + bool control_list_logging_enabled_; }; } // namespace gpu diff --git a/gpu/config/software_rendering_list_json.cc b/gpu/config/software_rendering_list_json.cc index 4a2f0bf..ef1c47c 100644 --- a/gpu/config/software_rendering_list_json.cc +++ b/gpu/config/software_rendering_list_json.cc @@ -67,7 +67,7 @@ // "number" is used for all "op" values except "any". "number" and "number2" // are in the format of x, x.x, x.x.x, etc. // Only "driver_version" supports lexical style if the format is major.minor; -// in that case, major is still numerical, but minor is lexical. +// in that case, major is still numerical, but minor is lexical. // // STRING includes "op" and "value". "op" can be any of the following values: // "contains", "beginwith", "endwith", "=". "value" is a string. @@ -89,7 +89,7 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( { "name": "software rendering list", // Please update the version number whenever you change this file. - "version": "6.6", + "version": "6.7", "entries": [ { "id": 1, @@ -1177,6 +1177,21 @@ LONG_STRING_CONST( "features": [ "multisampling" ] + }, + { + "id": 78, + "description": "Disable force compositing mode on all Windows versions prior to Vista.", + "cr_bugs": [273920], + "os": { + "type": "win", + "version": { + "op": "<", + "number": "6.0" + } + }, + "features": [ + "force_compositing_mode" + ] } ] } @@ -1184,4 +1199,3 @@ LONG_STRING_CONST( ); // LONG_STRING_CONST macro } // namespace gpu - |