Commit 9045c60a authored by gab@chromium.org's avatar gab@chromium.org

Enable GPU blacklist in tests.

Partial re-land of https://codereview.chromium.org/22198004/) -- Always enable FCM on Windows -- Part 1/3.

On top of fixing some of the issues there; only lands the part that enables the GPU blacklist in tests as the former CL is too hard to land all at once.

Also keeping --skip-gpu-data-loading around for now to be able to deal with failures caused in layout_tests by this on their own later (this needs to land ASAP and layout_tests don't need this ASAP).

Another CL will follow to always enable FCM on non-blacklisted Windows machines.

This part re-enables loading the blacklist in tests (and adds a content_browsertest to make sure that the configuration we expect to be testing is indeed the one we are testing -- this uncertainty is basically the only reason the blacklist was explicitly disabled before).

This CL also cleans up compositor_util.cc which was enforcing the blacklist twice.

The original plan was to do this only for Windows as Mac/Linux was causing trouble, but it turns out to be harder to do it only on Windows; so taking care of http://crbug.com/277242 in this CL too after all... 

BUG=233830, 267038, 190942, 277242
TBR=jcivelli, piman 

Originally Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=219132 
Then Reverted: https://src.chromium.org/viewvc/chrome?view=rev&revision=219159

Then re-committed (part 1/3): https://src.chromium.org/viewvc/chrome?view=rev&revision=221114
Reverted in: https://src.chromium.org/viewvc/chrome?view=rev&revision=221145

Review URL: https://chromiumcodereview.appspot.com/23534006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@222105 0039d316-1c4b-4281-b951-d872f2087c98
parent 01c44101
...@@ -40,32 +40,6 @@ bool ShouldRunCompositingFieldTrial() { ...@@ -40,32 +40,6 @@ bool ShouldRunCompositingFieldTrial() {
return false; return false;
#endif #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 // Don't activate the field trial if force-compositing-mode has been
// explicitly disabled from the command line. // explicitly disabled from the command line.
if (CommandLine::ForCurrentProcess()->HasSwitch( if (CommandLine::ForCurrentProcess()->HasSwitch(
......
...@@ -47,10 +47,6 @@ void PrepareBrowserCommandLineForTests(CommandLine* command_line) { ...@@ -47,10 +47,6 @@ void PrepareBrowserCommandLineForTests(CommandLine* command_line) {
// Don't install default apps. // Don't install default apps.
command_line->AppendSwitch(switches::kDisableDefaultApps); 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) #if defined(USE_AURA)
// Disable window animations under Ash as the animations effect the // Disable window animations under Ash as the animations effect the
// coordinates returned and result in flake. // coordinates returned and result in flake.
......
...@@ -189,8 +189,8 @@ IN_PROC_BROWSER_TEST_F(GpuFeatureTest, MAYBE_AcceleratedCompositingAllowed) { ...@@ -189,8 +189,8 @@ IN_PROC_BROWSER_TEST_F(GpuFeatureTest, MAYBE_AcceleratedCompositingAllowed) {
class AcceleratedCompositingBlockedTest : public GpuFeatureTest { class AcceleratedCompositingBlockedTest : public GpuFeatureTest {
public: public:
virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { virtual void SetUpOnMainThread() OVERRIDE {
GpuFeatureTest::SetUpInProcessBrowserTestFixture(); GpuFeatureTest::SetUpOnMainThread();
const std::string json_blacklist = const std::string json_blacklist =
"{\n" "{\n"
" \"name\": \"gpu blacklist\",\n" " \"name\": \"gpu blacklist\",\n"
...@@ -216,7 +216,7 @@ class AcceleratedCompositingBlockedTest : public GpuFeatureTest { ...@@ -216,7 +216,7 @@ class AcceleratedCompositingBlockedTest : public GpuFeatureTest {
#endif #endif
IN_PROC_BROWSER_TEST_F(AcceleratedCompositingBlockedTest, IN_PROC_BROWSER_TEST_F(AcceleratedCompositingBlockedTest,
MAYBE_AcceleratedCompositingBlocked) { MAYBE_AcceleratedCompositingBlocked) {
EXPECT_TRUE(GpuDataManager::GetInstance()->IsFeatureBlacklisted( EXPECT_TRUE(GpuDataManager::GetInstance()->IsFeatureBlacklisted(
gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING)); gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING));
...@@ -366,11 +366,18 @@ IN_PROC_BROWSER_TEST_F(GpuFeatureTest, Canvas2DAllowed) { ...@@ -366,11 +366,18 @@ IN_PROC_BROWSER_TEST_F(GpuFeatureTest, Canvas2DAllowed) {
if (gpu::GPUTestBotConfig::CurrentConfigMatches("XP")) if (gpu::GPUTestBotConfig::CurrentConfigMatches("XP"))
return; return;
EXPECT_FALSE(GpuDataManager::GetInstance()->IsFeatureBlacklisted( bool is_blacklisted = false;
gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)); #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")); 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) { IN_PROC_BROWSER_TEST_F(GpuFeatureTest, Canvas2DBlocked) {
......
...@@ -332,6 +332,9 @@ void GpuDataManagerImplPrivate::InitializeForTesting( ...@@ -332,6 +332,9 @@ void GpuDataManagerImplPrivate::InitializeForTesting(
// This function is for testing only, so disable histograms. // This function is for testing only, so disable histograms.
update_histograms_ = false; update_histograms_ = false;
// Prevent all further initialization.
finalized_ = true;
InitializeImpl(gpu_blacklist_json, std::string(), std::string(), gpu_info); InitializeImpl(gpu_blacklist_json, std::string(), std::string(), gpu_info);
} }
...@@ -545,13 +548,35 @@ void GpuDataManagerImplPrivate::GetGLStrings(std::string* gl_vendor, ...@@ -545,13 +548,35 @@ void GpuDataManagerImplPrivate::GetGLStrings(std::string* gl_vendor,
void GpuDataManagerImplPrivate::Initialize() { void GpuDataManagerImplPrivate::Initialize() {
TRACE_EVENT0("startup", "GpuDataManagerImpl::Initialize"); TRACE_EVENT0("startup", "GpuDataManagerImpl::Initialize");
CommandLine* command_line = CommandLine::ForCurrentProcess(); if (finalized_) {
if (command_line->HasSwitch(switches::kSkipGpuDataLoading) && DLOG(INFO) << "GpuDataManagerImpl marked as finalized; skipping Initialize";
!command_line->HasSwitch(switches::kUseGpuInTests)) return;
}
const CommandLine* command_line = CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kSkipGpuDataLoading))
return; return;
gpu::GPUInfo gpu_info; 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", TRACE_EVENT0("startup",
"GpuDataManagerImpl::Initialize:CollectBasicGraphicsInfo"); "GpuDataManagerImpl::Initialize:CollectBasicGraphicsInfo");
gpu::CollectBasicGraphicsInfo(&gpu_info); gpu::CollectBasicGraphicsInfo(&gpu_info);
...@@ -985,7 +1010,8 @@ GpuDataManagerImplPrivate::GpuDataManagerImplPrivate( ...@@ -985,7 +1010,8 @@ GpuDataManagerImplPrivate::GpuDataManagerImplPrivate(
owner_(owner), owner_(owner),
display_count_(0), display_count_(0),
gpu_process_accessible_(true), gpu_process_accessible_(true),
use_software_compositor_(false) { use_software_compositor_(false),
finalized_(false) {
DCHECK(owner_); DCHECK(owner_);
CommandLine* command_line = CommandLine::ForCurrentProcess(); CommandLine* command_line = CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) { if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) {
...@@ -1032,6 +1058,10 @@ void GpuDataManagerImplPrivate::InitializeImpl( ...@@ -1032,6 +1058,10 @@ void GpuDataManagerImplPrivate::InitializeImpl(
if (!gpu_blacklist_json.empty()) { if (!gpu_blacklist_json.empty()) {
gpu_blacklist_.reset(gpu::GpuBlacklist::Create()); gpu_blacklist_.reset(gpu::GpuBlacklist::Create());
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kLogGpuControlListDecisions)) {
gpu_blacklist_->enable_control_list_logging();
}
gpu_blacklist_->LoadList( gpu_blacklist_->LoadList(
browser_version_string, gpu_blacklist_json, browser_version_string, gpu_blacklist_json,
gpu::GpuControlList::kCurrentOsOnly); gpu::GpuControlList::kCurrentOsOnly);
......
...@@ -247,6 +247,9 @@ class CONTENT_EXPORT GpuDataManagerImplPrivate { ...@@ -247,6 +247,9 @@ class CONTENT_EXPORT GpuDataManagerImplPrivate {
bool use_software_compositor_; bool use_software_compositor_;
// True if all future Initialize calls should be ignored.
bool finalized_;
DISALLOW_COPY_AND_ASSIGN(GpuDataManagerImplPrivate); DISALLOW_COPY_AND_ASSIGN(GpuDataManagerImplPrivate);
}; };
......
...@@ -612,6 +612,9 @@ const char kJavaScriptFlags[] = "js-flags"; ...@@ -612,6 +612,9 @@ const char kJavaScriptFlags[] = "js-flags";
// Load an NPAPI plugin from the specified path. // Load an NPAPI plugin from the specified path.
const char kLoadPlugin[] = "load-plugin"; 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: // Sets the minimum log level. Valid values are from 0 to 3:
// INFO = 0, WARNING = 1, LOG_ERROR = 2, LOG_FATAL = 3. // INFO = 0, WARNING = 1, LOG_ERROR = 2, LOG_FATAL = 3.
const char kLoggingLevel[] = "log-level"; const char kLoggingLevel[] = "log-level";
...@@ -762,7 +765,8 @@ const char kSitePerProcess[] = "site-per-process"; ...@@ -762,7 +765,8 @@ const char kSitePerProcess[] = "site-per-process";
// Skip gpu info collection, blacklist loading, and blacklist auto-update // Skip gpu info collection, blacklist loading, and blacklist auto-update
// scheduling at browser startup time. // scheduling at browser startup time.
// Therefore, all GPU features are available, and about:gpu page shows empty // 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"; const char kSkipGpuDataLoading[] = "skip-gpu-data-loading";
// Specifies the request key for the continuous speech recognition webservice. // Specifies the request key for the continuous speech recognition webservice.
......
...@@ -181,6 +181,7 @@ extern const char kInProcessGPU[]; ...@@ -181,6 +181,7 @@ extern const char kInProcessGPU[];
extern const char kInProcessPlugins[]; extern const char kInProcessPlugins[];
CONTENT_EXPORT extern const char kJavaScriptFlags[]; CONTENT_EXPORT extern const char kJavaScriptFlags[];
extern const char kLoadPlugin[]; extern const char kLoadPlugin[];
CONTENT_EXPORT extern const char kLogGpuControlListDecisions[];
CONTENT_EXPORT extern const char kLoggingLevel[]; CONTENT_EXPORT extern const char kLoggingLevel[];
CONTENT_EXPORT extern const char kLogNetLog[]; CONTENT_EXPORT extern const char kLogNetLog[];
extern const char kLogPluginMessages[]; extern const char kLogPluginMessages[];
......
...@@ -109,7 +109,9 @@ void BrowserTestBase::SetUp() { ...@@ -109,7 +109,9 @@ void BrowserTestBase::SetUp() {
command_line->AppendSwitch(switches::kDomAutomationController); 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) #if defined(USE_AURA)
// Use test contexts for browser tests unless they override and force us to // Use test contexts for browser tests unless they override and force us to
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h" #include "base/strings/string_split.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/sys_info.h" #include "base/sys_info.h"
#include "gpu/config/gpu_info.h" #include "gpu/config/gpu_info.h"
#include "gpu/config/gpu_util.h" #include "gpu/config/gpu_util.h"
...@@ -1036,6 +1037,12 @@ GpuControlList::GpuControlListEntry::StringToMultiGpuCategory( ...@@ -1036,6 +1037,12 @@ GpuControlList::GpuControlListEntry::StringToMultiGpuCategory(
return kMultiGpuCategoryNone; 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( bool GpuControlList::GpuControlListEntry::Contains(
OsType os_type, const std::string& os_version, OsType os_type, const std::string& os_version,
const GPUInfo& gpu_info) const { const GPUInfo& gpu_info) const {
...@@ -1192,7 +1199,8 @@ GpuControlList::GpuControlList() ...@@ -1192,7 +1199,8 @@ GpuControlList::GpuControlList()
: max_entry_id_(0), : max_entry_id_(0),
contains_unknown_fields_(false), contains_unknown_fields_(false),
needs_more_info_(false), needs_more_info_(false),
supports_feature_type_all_(false) { supports_feature_type_all_(false),
control_list_logging_enabled_(false) {
} }
GpuControlList::~GpuControlList() { GpuControlList::~GpuControlList() {
...@@ -1309,6 +1317,8 @@ std::set<int> GpuControlList::MakeDecision( ...@@ -1309,6 +1317,8 @@ std::set<int> GpuControlList::MakeDecision(
for (size_t i = 0; i < entries_.size(); ++i) { for (size_t i = 0; i < entries_.size(); ++i) {
if (entries_[i]->Contains(os, os_version, gpu_info)) { if (entries_[i]->Contains(os, os_version, gpu_info)) {
if (!entries_[i]->disabled()) { if (!entries_[i]->disabled()) {
if (control_list_logging_enabled_)
entries_[i]->LogControlListMatch();
MergeFeatureSets(&possible_features, entries_[i]->features()); MergeFeatureSets(&possible_features, entries_[i]->features());
if (!entries_[i]->NeedsMoreInfo(gpu_info)) if (!entries_[i]->NeedsMoreInfo(gpu_info))
MergeFeatureSets(&features, entries_[i]->features()); MergeFeatureSets(&features, entries_[i]->features());
......
...@@ -96,6 +96,9 @@ class GPU_EXPORT GpuControlList { ...@@ -96,6 +96,9 @@ class GPU_EXPORT GpuControlList {
// Register whether "all" is recognized as all features. // Register whether "all" is recognized as all features.
void set_supports_feature_type_all(bool supported); 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: private:
friend class GpuControlListEntryTest; friend class GpuControlListEntryTest;
friend class MachineModelInfoTest; friend class MachineModelInfoTest;
...@@ -292,6 +295,9 @@ class GPU_EXPORT GpuControlList { ...@@ -292,6 +295,9 @@ class GPU_EXPORT GpuControlList {
const FeatureMap& feature_map, const FeatureMap& feature_map,
bool supports_feature_type_all); 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 // Determines if a given os/gc/machine_model/driver is included in the
// Entry set. // Entry set.
bool Contains(OsType os_type, const std::string& os_version, bool Contains(OsType os_type, const std::string& os_version,
...@@ -495,6 +501,8 @@ class GPU_EXPORT GpuControlList { ...@@ -495,6 +501,8 @@ class GPU_EXPORT GpuControlList {
// The features a GpuControlList recognizes and handles. // The features a GpuControlList recognizes and handles.
FeatureMap feature_map_; FeatureMap feature_map_;
bool supports_feature_type_all_; bool supports_feature_type_all_;
bool control_list_logging_enabled_;
}; };
} // namespace gpu } // namespace gpu
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
// "number" is used for all "op" values except "any". "number" and "number2" // "number" is used for all "op" values except "any". "number" and "number2"
// are in the format of x, x.x, x.x.x, etc. // are in the format of x, x.x, x.x.x, etc.
// Only "driver_version" supports lexical style if the format is major.minor; // 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: // STRING includes "op" and "value". "op" can be any of the following values:
// "contains", "beginwith", "endwith", "=". "value" is a string. // "contains", "beginwith", "endwith", "=". "value" is a string.
...@@ -89,7 +89,7 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( ...@@ -89,7 +89,7 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST(
{ {
"name": "software rendering list", "name": "software rendering list",
// Please update the version number whenever you change this file. // Please update the version number whenever you change this file.
"version": "6.9", "version": "6.10",
"entries": [ "entries": [
{ {
"id": 1, "id": 1,
...@@ -1177,6 +1177,21 @@ LONG_STRING_CONST( ...@@ -1177,6 +1177,21 @@ LONG_STRING_CONST(
"features": [ "features": [
"multisampling" "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( ...@@ -1184,4 +1199,3 @@ LONG_STRING_CONST(
); // LONG_STRING_CONST macro ); // LONG_STRING_CONST macro
} // namespace gpu } // namespace gpu
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment