summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-25 17:16:10 +0000
committerzmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-25 17:16:10 +0000
commit61ce18f36d0d081e8b28557c48b69ddacc803b1e (patch)
tree3bfc0a8788703237de2cb8d9e95bba412d66a1b7
parent0b96bc3333e332f7dd81f3a07332ba84e72ca694 (diff)
downloadchromium_src-61ce18f36d0d081e8b28557c48b69ddacc803b1e.zip
chromium_src-61ce18f36d0d081e8b28557c48b69ddacc803b1e.tar.gz
chromium_src-61ce18f36d0d081e8b28557c48b69ddacc803b1e.tar.bz2
Improve blacklist logic: use more fields (driver_vendor, gl_renderer, ect) for blacklist logic; add blacklist logic and blacklist entry id; also improves the histogram to record occurance of each entry blocking gpu.
BUG=none TEST=unittest Review URL: http://codereview.chromium.org/6352011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72502 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/gpu_blacklist.cc168
-rw-r--r--chrome/browser/gpu_blacklist.h101
-rw-r--r--chrome/browser/gpu_blacklist_unittest.cc21
-rw-r--r--chrome/browser/gpu_process_host.cc40
-rw-r--r--chrome/browser/gpu_process_host.h5
-rw-r--r--chrome/browser/resources/gpu_blacklist.json64
6 files changed, 331 insertions, 68 deletions
diff --git a/chrome/browser/gpu_blacklist.cc b/chrome/browser/gpu_blacklist.cc
index 8603b40..0fc87df 100644
--- a/chrome/browser/gpu_blacklist.cc
+++ b/chrome/browser/gpu_blacklist.cc
@@ -135,6 +135,45 @@ GpuBlacklist::OsType GpuBlacklist::OsInfo::StringToOsType(
return kOsUnknown;
}
+GpuBlacklist::StringInfo::StringInfo(const std::string& string_op,
+ const std::string& string_value) {
+ op_ = StringToOp(string_op);
+ value_ = StringToLowerASCII(string_value);
+}
+
+bool GpuBlacklist::StringInfo::Contains(const std::string& value) const {
+ std::string my_value = StringToLowerASCII(value);
+ switch (op_) {
+ case kContains:
+ return strstr(my_value.c_str(), value_.c_str()) != NULL;
+ case kBeginWith:
+ return StartsWithASCII(my_value, value_, false);
+ case kEndWith:
+ return EndsWith(my_value, value_, false);
+ case kEQ:
+ return value_ == my_value;
+ default:
+ return false;
+ }
+}
+
+bool GpuBlacklist::StringInfo::IsValid() const {
+ return op_ != kUnknown;
+}
+
+GpuBlacklist::StringInfo::Op GpuBlacklist::StringInfo::StringToOp(
+ const std::string& string_op) {
+ if (string_op == "=")
+ return kEQ;
+ else if (string_op == "contains")
+ return kContains;
+ else if (string_op == "beginwith")
+ return kBeginWith;
+ else if (string_op == "endwith")
+ return kEndWith;
+ return kUnknown;
+}
+
GpuBlacklist::GpuBlacklistEntry*
GpuBlacklist::GpuBlacklistEntry::GetGpuBlacklistEntryFromValue(
DictionaryValue* value) {
@@ -143,6 +182,12 @@ GpuBlacklist::GpuBlacklistEntry::GetGpuBlacklistEntryFromValue(
GpuBlacklistEntry* entry = new GpuBlacklistEntry();
+ std::string id;
+ if (!value->GetString("id", &id) || !entry->SetId(id)) {
+ delete entry;
+ return NULL;
+ }
+
DictionaryValue* os_value = NULL;
if (value->GetDictionary("os", &os_value)) {
std::string os_type;
@@ -179,6 +224,18 @@ GpuBlacklist::GpuBlacklistEntry::GetGpuBlacklistEntryFromValue(
}
}
+ DictionaryValue* driver_vendor_value = NULL;
+ if (value->GetDictionary("driver_vendor", &driver_vendor_value)) {
+ std::string vendor_op;
+ std::string vendor_value;
+ driver_vendor_value->GetString("op", &vendor_op);
+ driver_vendor_value->GetString("value", &vendor_value);
+ if (!entry->SetDriverVendorInfo(vendor_op, vendor_value)) {
+ delete entry;
+ return NULL;
+ }
+ }
+
DictionaryValue* driver_version_value = NULL;
if (value->GetDictionary("driver_version", &driver_version_value)) {
std::string driver_version_op = "any";
@@ -194,6 +251,18 @@ GpuBlacklist::GpuBlacklistEntry::GetGpuBlacklistEntryFromValue(
}
}
+ DictionaryValue* gl_renderer_value = NULL;
+ if (value->GetDictionary("gl_renderer", &gl_renderer_value)) {
+ std::string renderer_op;
+ std::string renderer_value;
+ gl_renderer_value->GetString("op", &renderer_op);
+ gl_renderer_value->GetString("value", &renderer_value);
+ if (!entry->SetGLRendererInfo(renderer_op, renderer_value)) {
+ delete entry;
+ return NULL;
+ }
+ }
+
ListValue* blacklist_value = NULL;
if (!value->GetList("blacklist", &blacklist_value)) {
delete entry;
@@ -224,6 +293,17 @@ GpuBlacklist::GpuBlacklistEntry::GpuBlacklistEntry()
device_id_(0) {
}
+bool GpuBlacklist::GpuBlacklistEntry::SetId(
+ const std::string& id_string) {
+ id_ = 0;
+ int my_id;
+ if (base::HexStringToInt(id_string, &my_id) && my_id != 0) {
+ id_ = static_cast<uint32>(my_id);
+ return true;
+ }
+ return false;
+}
+
bool GpuBlacklist::GpuBlacklistEntry::SetOsInfo(
const std::string& os,
const std::string& version_op,
@@ -247,6 +327,14 @@ bool GpuBlacklist::GpuBlacklistEntry::SetDeviceId(
reinterpret_cast<int*>(&device_id_));
}
+bool GpuBlacklist::GpuBlacklistEntry::SetDriverVendorInfo(
+ const std::string& vendor_op,
+ const std::string& vendor_value) {
+ driver_vendor_info_.reset(
+ new StringInfo(vendor_op, vendor_value));
+ return driver_vendor_info_->IsValid();
+}
+
bool GpuBlacklist::GpuBlacklistEntry::SetDriverVersionInfo(
const std::string& version_op,
const std::string& version_string,
@@ -256,6 +344,14 @@ bool GpuBlacklist::GpuBlacklistEntry::SetDriverVersionInfo(
return driver_version_info_->IsValid();
}
+bool GpuBlacklist::GpuBlacklistEntry::SetGLRendererInfo(
+ const std::string& renderer_op,
+ const std::string& renderer_value) {
+ gl_renderer_info_.reset(
+ new StringInfo(renderer_op, renderer_value));
+ return gl_renderer_info_->IsValid();
+}
+
bool GpuBlacklist::GpuBlacklistEntry::SetBlacklistedFeatures(
const std::vector<std::string>& blacklisted_features) {
size_t size = blacklisted_features.size();
@@ -284,7 +380,9 @@ bool GpuBlacklist::GpuBlacklistEntry::SetBlacklistedFeatures(
bool GpuBlacklist::GpuBlacklistEntry::Contains(
OsType os_type, const Version& os_version,
uint32 vendor_id, uint32 device_id,
- const Version& driver_version) const {
+ const std::string& driver_vendor,
+ const Version& driver_version,
+ const std::string& gl_renderer) const {
DCHECK(os_type != kOsAny);
if (os_info_.get() != NULL && !os_info_->Contains(os_type, os_version))
return false;
@@ -292,9 +390,16 @@ bool GpuBlacklist::GpuBlacklistEntry::Contains(
return false;
if (device_id_ != 0 && device_id_ != device_id)
return false;
- if (driver_version_info_.get() == NULL)
- return true;
- return driver_version_info_->Contains(driver_version);
+ if (driver_vendor_info_.get() != NULL &&
+ !driver_vendor_info_->Contains(driver_vendor))
+ return false;
+ if (driver_version_info_.get() != NULL &&
+ !driver_version_info_->Contains(driver_version))
+ return false;
+ if (gl_renderer_info_.get() != NULL &&
+ !gl_renderer_info_->Contains(gl_renderer))
+ return false;
+ return true;
}
GpuBlacklist::OsType GpuBlacklist::GpuBlacklistEntry::GetOsType() const {
@@ -303,6 +408,10 @@ GpuBlacklist::OsType GpuBlacklist::GpuBlacklistEntry::GetOsType() const {
return os_info_->type();
}
+uint32 GpuBlacklist::GpuBlacklistEntry::id() const {
+ return id_;
+}
+
GpuFeatureFlags GpuBlacklist::GpuBlacklistEntry::GetGpuFeatureFlags() const {
return *feature_flags_;
}
@@ -322,11 +431,20 @@ bool GpuBlacklist::LoadGpuBlacklist(const std::string& json_context,
if (root.get() == NULL || !root->IsType(Value::TYPE_DICTIONARY))
return false;
+ DictionaryValue* root_dictionary = static_cast<DictionaryValue*>(root.get());
+ DCHECK(root_dictionary);
+ std::string version_string;
+ root_dictionary->GetString("version", &version_string);
+ version_.reset(Version::GetVersionFromString(version_string));
+ if (version_.get() == NULL)
+ return false;
+
ListValue* list = NULL;
- static_cast<DictionaryValue*>(root.get())->GetList("entries", &list);
+ root_dictionary->GetList("entries", &list);
if (list == NULL)
return false;
+ uint32 max_entry_id = 0;
for (size_t i = 0; i < list->GetSize(); ++i) {
DictionaryValue* list_item = NULL;
bool valid = list->GetDictionary(i, &list_item);
@@ -336,6 +454,8 @@ bool GpuBlacklist::LoadGpuBlacklist(const std::string& json_context,
GpuBlacklistEntry::GetGpuBlacklistEntryFromValue(list_item);
if (entry == NULL)
break;
+ if (entry->id() > max_entry_id)
+ max_entry_id = entry->id();
entries.push_back(entry);
}
@@ -358,13 +478,15 @@ bool GpuBlacklist::LoadGpuBlacklist(const std::string& json_context,
delete entries[i];
}
}
+ max_entry_id_ = max_entry_id;
return true;
}
GpuFeatureFlags GpuBlacklist::DetermineGpuFeatureFlags(
GpuBlacklist::OsType os,
Version* os_version,
- const GPUInfo& gpu_info) const {
+ const GPUInfo& gpu_info) {
+ active_entries_.clear();
GpuFeatureFlags flags;
// No need to go through blacklist entries if GPUInfo isn't available.
if (gpu_info.progress() == GPUInfo::kUninitialized)
@@ -403,13 +525,44 @@ GpuFeatureFlags GpuBlacklist::DetermineGpuFeatureFlags(
for (size_t i = 0; i < blacklist_.size(); ++i) {
if (blacklist_[i]->Contains(os, *os_version,
gpu_info.vendor_id(), gpu_info.device_id(),
- *driver_version)) {
+ gpu_info.driver_vendor(),
+ *driver_version,
+ gpu_info.gl_renderer())) {
flags.Combine(blacklist_[i]->GetGpuFeatureFlags());
+ active_entries_.push_back(blacklist_[i]);
}
}
return flags;
}
+void GpuBlacklist::GetGpuFeatureFlagEntries(
+ GpuFeatureFlags::GpuFeatureType feature,
+ std::vector<uint32>& entry_ids) const {
+ entry_ids.clear();
+ for (size_t i = 0; i < active_entries_.size(); ++i) {
+ if ((feature & active_entries_[i]->GetGpuFeatureFlags().flags()) != 0)
+ entry_ids.push_back(active_entries_[i]->id());
+ }
+}
+
+uint32 GpuBlacklist::max_entry_id() const {
+ return max_entry_id_;
+}
+
+bool GpuBlacklist::GetVersion(uint16* major, uint16* minor) const {
+ DCHECK(major && minor);
+ *major = 0;
+ *minor = 0;
+ if (version_.get() == NULL)
+ return false;
+ const std::vector<uint16>& components_reference = version_->components();
+ if (components_reference.size() != 2)
+ return false;
+ *major = components_reference[0];
+ *minor = components_reference[1];
+ return true;
+}
+
GpuBlacklist::OsType GpuBlacklist::GetOsType() {
#if defined(OS_WIN)
return kOsWin;
@@ -426,5 +579,6 @@ void GpuBlacklist::Clear() {
for (size_t i = 0; i < blacklist_.size(); ++i)
delete blacklist_[i];
blacklist_.clear();
+ active_entries_.clear();
}
diff --git a/chrome/browser/gpu_blacklist.h b/chrome/browser/gpu_blacklist.h
index 85c4145..e5e04b1 100644
--- a/chrome/browser/gpu_blacklist.h
+++ b/chrome/browser/gpu_blacklist.h
@@ -6,36 +6,6 @@
#define CHROME_BROWSER_GPU_BLACKLIST_H_
#pragma once
-// Determines whether certain gpu-related features are blacklisted or not.
-// A valid gpu_blacklist.json file are in the format of
-// {
-// "entries": [
-// { // entry 1
-// },
-// ...
-// { // entry n
-// }
-// ]
-// }
-// Each entry contains the following fields:
-// "os", "vendor_id", "device_id", "driver_version", and "blacklist".
-// Only "blacklist" is mandatory.
-// 1. "os" contains "type" and an optional "version". "type" could be "macosx",
-// "linux", "win", or "any". "any" is the same as not specifying "os".
-// "version" is a VERSION structure (defined later).
-// 2. "vendor_id" has the value of a string.
-// 3. "device_id" has the value of a string.
-// 4. "driver_version" is a VERSION structure (defined later).
-// 5. "blacklist" is a list of gpu feature strings, valid values include
-// "accelerated_2d_canvas", "accelerated_compositing", "webgl", and "all".
-// Currently whatever feature is selected, the effect is the same as "all",
-// i.e., it's not supported to turn off one GPU feature and not the others.
-// VERSION includes "op" "number", and "number2". "op" can be any of the
-// following value: "=", "<", "<=", ">", ">=", "any", "between". "number2" is
-// only used if "op" is "between". "number" is used for all "op" values except
-// "any". "number" and "number2" are in the format of x, x.x, x.x.x, ect.
-// Check out "gpu_blacklist_unittest.cc" for examples.
-
#include <string>
#include <vector>
@@ -74,7 +44,24 @@ class GpuBlacklist {
// current OS version.
GpuFeatureFlags DetermineGpuFeatureFlags(OsType os,
Version* os_version,
- const GPUInfo& gpu_info) const;
+ const GPUInfo& gpu_info);
+
+ // Collects the entries that set the "feature" flag from the last
+ // DetermineGpuFeatureFlags() call. This tells which entries are responsible
+ // for raising a certain flag, i.e, for blacklisting a certain feature.
+ // Examples of "feature":
+ // kGpuFeatureAll - any of the supported features;
+ // kGpuFeatureWebgl - a single feature;
+ // kGpuFeatureWebgl | kGpuFeatureAcceleratedCompositing - two features.
+ void GetGpuFeatureFlagEntries(GpuFeatureFlags::GpuFeatureType feature,
+ std::vector<uint32>& entry_ids) const;
+
+ // Return the largest entry id. This is used for histogramming.
+ uint32 max_entry_id() const;
+
+ // Collects the version of the current blacklist. Returns false and sets
+ // major and minor to 0 on failure.
+ bool GetVersion(uint16* major, uint16* monir) const;
private:
class VersionInfo {
@@ -134,6 +121,32 @@ class GpuBlacklist {
scoped_ptr<VersionInfo> version_info_;
};
+ class StringInfo {
+ public:
+ StringInfo(const std::string& string_op, const std::string& string_value);
+
+ // Determines if a given string is included in the StringInfo.
+ bool Contains(const std::string& value) const;
+
+ // Determines if the StringInfo contains valid information.
+ bool IsValid() const;
+
+ private:
+ enum Op {
+ kContains,
+ kBeginWith,
+ kEndWith,
+ kEQ, // =
+ kUnknown // Indicates StringInfo data is invalid.
+ };
+
+ // Maps string to Op; returns kUnknown if it's not a valid Op.
+ static Op StringToOp(const std::string& string_op);
+
+ Op op_;
+ std::string value_;
+ };
+
class GpuBlacklistEntry {
public:
// Constructs GpuBlacklistEntry from DictionaryValue loaded from json.
@@ -143,11 +156,16 @@ class GpuBlacklist {
// Determines if a given os/gc/driver is included in the Entry set.
bool Contains(OsType os_type, const Version& os_version,
uint32 vendor_id, uint32 device_id,
- const Version& driver_version) const;
+ const std::string& driver_vendor,
+ const Version& driver_version,
+ const std::string& gl_renderer) const;
// Returns the OsType.
OsType GetOsType() const;
+ // Returns the entry's unique id. 0 is reserved.
+ uint32 id() const;
+
// Returns the GpuFeatureFlags.
GpuFeatureFlags GetGpuFeatureFlags() const;
@@ -156,6 +174,8 @@ class GpuBlacklist {
private:
GpuBlacklistEntry();
+ bool SetId(const std::string& id_string);
+
bool SetOsInfo(const std::string& os,
const std::string& version_op,
const std::string& version_string,
@@ -165,17 +185,26 @@ class GpuBlacklist {
bool SetDeviceId(const std::string& device_id_string);
+ bool SetDriverVendorInfo(const std::string& vendor_op,
+ const std::string& vendor_value);
+
bool SetDriverVersionInfo(const std::string& version_op,
const std::string& version_string,
const std::string& version_string2);
+ bool SetGLRendererInfo(const std::string& renderer_op,
+ const std::string& renderer_value);
+
bool SetBlacklistedFeatures(
const std::vector<std::string>& blacklisted_features);
+ uint32 id_;
scoped_ptr<OsInfo> os_info_;
uint32 vendor_id_;
uint32 device_id_;
+ scoped_ptr<StringInfo> driver_vendor_info_;
scoped_ptr<VersionInfo> driver_version_info_;
+ scoped_ptr<StringInfo> gl_renderer_info_;
scoped_ptr<GpuFeatureFlags> feature_flags_;
};
@@ -184,8 +213,16 @@ class GpuBlacklist {
void Clear();
+ scoped_ptr<Version> version_;
std::vector<GpuBlacklistEntry*> blacklist_;
+ // This records all the blacklist entries that are appliable to the current
+ // user machine. It is updated everytime DetermineGpuFeatureFlags() is
+ // called and is used later by GetGpuFeatureFlagEntries().
+ std::vector<GpuBlacklistEntry*> active_entries_;
+
+ uint32 max_entry_id_;
+
DISALLOW_COPY_AND_ASSIGN(GpuBlacklist);
};
diff --git a/chrome/browser/gpu_blacklist_unittest.cc b/chrome/browser/gpu_blacklist_unittest.cc
index 32d9eb85..a4533b4 100644
--- a/chrome/browser/gpu_blacklist_unittest.cc
+++ b/chrome/browser/gpu_blacklist_unittest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <vector>
+
#include "base/version.h"
#include "chrome/browser/gpu_blacklist.h"
#include "chrome/common/gpu_info.h"
@@ -27,11 +29,15 @@ TEST(GpuBlacklistTest, BlacklistLogic) {
const std::string empty_list_json =
"{\n"
" \"name\": \"gpu blacklist\",\n"
- " \"version\": \"0.0\",\n"
+ " \"version\": \"2.5\",\n"
" \"entries\": [\n"
" ]\n"
"}";
EXPECT_TRUE(blacklist.LoadGpuBlacklist(empty_list_json, false));
+ uint16 major, minor;
+ EXPECT_TRUE(blacklist.GetVersion(&major, &minor));
+ EXPECT_EQ(major, 2u);
+ EXPECT_EQ(minor, 5u);
flags = blacklist.DetermineGpuFeatureFlags(
GpuBlacklist::kOsMacosx, os_version.get(), gpu_info);
EXPECT_EQ(flags.flags(), 0u);
@@ -43,6 +49,7 @@ TEST(GpuBlacklistTest, BlacklistLogic) {
" \"version\": \"0.1\",\n"
" \"entries\": [\n"
" {\n"
+ " \"id\": \"5\",\n"
" \"os\": {\n"
" \"type\": \"macosx\",\n"
" \"version\": {\n"
@@ -77,6 +84,16 @@ TEST(GpuBlacklistTest, BlacklistLogic) {
EXPECT_EQ(
flags.flags(),
static_cast<uint32>(GpuFeatureFlags::kGpuFeatureAcceleratedCompositing));
+ std::vector<uint32> entries;
+ blacklist.GetGpuFeatureFlagEntries(
+ GpuFeatureFlags::kGpuFeatureAcceleratedCompositing, entries);
+ EXPECT_EQ(entries.size(), 1u);
+ EXPECT_EQ(entries[0], 5u);
+ blacklist.GetGpuFeatureFlagEntries(
+ GpuFeatureFlags::kGpuFeatureAll, entries);
+ EXPECT_EQ(entries.size(), 1u);
+ EXPECT_EQ(entries[0], 5u);
+ EXPECT_EQ(blacklist.max_entry_id(), 5u);
// Blacklist a vendor on all OS.
const std::string vendor_json =
@@ -85,6 +102,7 @@ TEST(GpuBlacklistTest, BlacklistLogic) {
" \"version\": \"0.1\",\n"
" \"entries\": [\n"
" {\n"
+ " \"id\": \"1\",\n"
" \"vendor_id\": \"0x10de\",\n"
" \"blacklist\": [\n"
" \"webgl\"\n"
@@ -113,6 +131,7 @@ TEST(GpuBlacklistTest, BlacklistLogic) {
" \"version\": \"0.1\",\n"
" \"entries\": [\n"
" {\n"
+ " \"id\": \"1\",\n"
" \"os\": {\n"
" \"type\": \"linux\"\n"
" },\n"
diff --git a/chrome/browser/gpu_process_host.cc b/chrome/browser/gpu_process_host.cc
index d3b8342f..ef931aa 100644
--- a/chrome/browser/gpu_process_host.cc
+++ b/chrome/browser/gpu_process_host.cc
@@ -28,12 +28,6 @@
namespace {
-enum GPUBlacklistTestResult {
- BLOCKED,
- ALLOWED,
- BLACKLIST_TEST_RESULT_MAX
-};
-
enum GPUProcessLifetimeEvent {
LAUNCED,
CRASHED,
@@ -106,7 +100,7 @@ GpuProcessHost::GpuProcessHost()
: BrowserChildProcessHost(GPU_PROCESS, NULL),
initialized_(false),
initialized_successfully_(false),
- blacklist_result_recorded_(false) {
+ gpu_feature_flags_set_(false) {
DCHECK_EQ(sole_instance_, static_cast<GpuProcessHost*>(NULL));
}
@@ -226,27 +220,35 @@ bool GpuProcessHost::OnControlMessageReceived(const IPC::Message& message) {
void GpuProcessHost::OnChannelEstablished(
const IPC::ChannelHandle& channel_handle,
const GPUInfo& gpu_info) {
- GpuFeatureFlags gpu_feature_flags;
- if (channel_handle.name.size() != 0) {
- gpu_feature_flags = gpu_blacklist_->DetermineGpuFeatureFlags(
+ if (channel_handle.name.size() != 0 && !gpu_feature_flags_set_) {
+ gpu_feature_flags_ = gpu_blacklist_->DetermineGpuFeatureFlags(
GpuBlacklist::kOsAny, NULL, gpu_info);
+ gpu_feature_flags_set_ = true;
+ uint32 max_entry_id = gpu_blacklist_->max_entry_id();
+ if (gpu_feature_flags_.flags() != 0) {
+ std::vector<uint32> flag_entries;
+ gpu_blacklist_->GetGpuFeatureFlagEntries(GpuFeatureFlags::kGpuFeatureAll,
+ flag_entries);
+ DCHECK_GT(flag_entries.size(), 0u);
+ for (size_t i = 0; i < flag_entries.size(); ++i) {
+ UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResultsPerEntry",
+ flag_entries[i], max_entry_id + 1);
+ }
+ } else {
+ // id 0 is never used by any entry, so we use it here to indicate that
+ // gpu is allowed.
+ UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResultsPerEntry",
+ 0, max_entry_id + 1);
+ }
}
const ChannelRequest& request = sent_requests_.front();
// Currently if any of the GPU features are blacklised, we don't establish a
// GPU channel.
- GPUBlacklistTestResult test_result;
- if (gpu_feature_flags.flags() != 0) {
+ if (gpu_feature_flags_.flags() != 0) {
Send(new GpuMsg_CloseChannel(channel_handle));
SendEstablishChannelReply(IPC::ChannelHandle(), gpu_info, request.filter);
- test_result = BLOCKED;
} else {
SendEstablishChannelReply(channel_handle, gpu_info, request.filter);
- test_result = ALLOWED;
- }
- if (!blacklist_result_recorded_) {
- UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResults",
- test_result, BLACKLIST_TEST_RESULT_MAX);
- blacklist_result_recorded_ = true;
}
sent_requests_.pop();
}
diff --git a/chrome/browser/gpu_process_host.h b/chrome/browser/gpu_process_host.h
index 8339f10..a1dfdc4 100644
--- a/chrome/browser/gpu_process_host.h
+++ b/chrome/browser/gpu_process_host.h
@@ -12,6 +12,7 @@
#include "base/ref_counted.h"
#include "base/threading/non_thread_safe.h"
#include "chrome/browser/browser_child_process_host.h"
+#include "chrome/common/gpu_feature_flags.h"
#include "gfx/native_widget_types.h"
class GpuBlacklist;
@@ -104,9 +105,9 @@ class GpuProcessHost : public BrowserChildProcessHost,
bool initialized_;
bool initialized_successfully_;
- bool blacklist_result_recorded_;
-
+ bool gpu_feature_flags_set_;
scoped_ptr<GpuBlacklist> gpu_blacklist_;
+ GpuFeatureFlags gpu_feature_flags_;
// These are the channel requests that we have already sent to
// the GPU process, but haven't heard back about yet.
diff --git a/chrome/browser/resources/gpu_blacklist.json b/chrome/browser/resources/gpu_blacklist.json
index f211db2..af64da7 100644
--- a/chrome/browser/resources/gpu_blacklist.json
+++ b/chrome/browser/resources/gpu_blacklist.json
@@ -1,8 +1,47 @@
+// Determines whether certain gpu-related features are blacklisted or not.
+// A valid gpu_blacklist.json file are in the format of
+// {
+// "version": "x.y",
+// "entries": [
+// { // entry 1
+// },
+// ...
+// { // entry n
+// }
+// ]
+// }
+//
+// Each entry contains the following fields:
+// "os", "vendor_id", "device_id", "driver_version", and "blacklist".
+// Only "blacklist" is mandatory.
+// 1. "os" contains "type" and an optional "version". "type" could be "macosx",
+// "linux", "win", or "any". "any" is the same as not specifying "os".
+// "version" is a VERSION structure (defined below).
+// 2. "vendor_id" has the value of a string.
+// 3. "device_id" has the value of a string.
+// 4. "driver_vendor" is a STRING structure (defined below).
+// 5. "driver_version" is a VERSION structure (defined below).
+// 6. "gl_renderer" is a STRING structure (defined below).
+// 7. "blacklist" is a list of gpu feature strings, valid values include
+// "accelerated_2d_canvas", "accelerated_compositing", "webgl", and "all".
+// Currently whatever feature is selected, the effect is the same as "all",
+// i.e., it's not supported to turn off one GPU feature and not the others.
+//
+// VERSION includes "op" "number", and "number2". "op" can be any of the
+// following values: "=", "<", "<=", ">", ">=", "any", "between". "number2" is
+// only used if "op" is "between". "number" is used for all "op" values except
+// "any". "number" and "number2" are in the format of x, x.x, x.x.x, ect.
+//
+// STRING includes "op" and "value". "op" can be any of the following values:
+// "contains", "beginwith", "endwith", "=". "value" is a string.
+
{
"name": "gpu blacklist",
- "version": "0.2",
+ // Please update the version number whenever you change this file.
+ "version": "0.3",
"entries": [
{ // ATI Radeon X1900 on Mac, BUGWEBKIT=47028
+ "id": "1",
"os": {
"type": "macosx"
},
@@ -12,24 +51,35 @@
"webgl"
]
},
- { // Intel Corporation Mobile 4 Series Chipset Integrated Graphics Controller, BUG=67345,67939
+ { // Intel cards with Mesa driver earlier than 7.9, BUG=66718,67345,67939
+ "id": "2",
"os": {
"type": "linux"
},
"vendor_id": "0x8086",
- "device_id": "0x2a42",
+ "driver_vendor": {
+ "op": "=",
+ "value": "mesa"
+ },
+ "driver_version": {
+ "op": "<",
+ "number": "7.9"
+ },
"blacklist": [
"webgl"
]
},
- { // Intel Corporation Core Processor Integrated Graphics Controller, BUG=66718
+ { // In linux, don't allow GPU compositing if it's software rendering, BUG=59302
+ "id": "3",
"os": {
"type": "linux"
},
- "vendor_id": "0x8086",
- "device_id": "0x0046",
+ "gl_renderer": {
+ "op": "contains",
+ "value": "software"
+ },
"blacklist": [
- "webgl"
+ "accelerated_compositing"
]
}
]