summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authornduca@chromium.org <nduca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-18 17:00:45 +0000
committernduca@chromium.org <nduca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-18 17:00:45 +0000
commit198b5007ee4e23b064e086fad89346eb03e7566e (patch)
treec48699857336486d16b43be9669d95d7ec911953 /content
parente85203d8a4434425b198bb251146c641640b4539 (diff)
downloadchromium_src-198b5007ee4e23b064e086fad89346eb03e7566e.zip
chromium_src-198b5007ee4e23b064e086fad89346eb03e7566e.tar.gz
chromium_src-198b5007ee4e23b064e086fad89346eb03e7566e.tar.bz2
Usability improvements to about:gpu status
The previous implementation of status was tied to the features that the blacklist understood. This limited our expressiveness about the status of user-facing features. For example.... Before: - Accelerated compositing: enabled/disabled/unavailable After: - 3D CSS: enabled, unavailable, disabled - Compositing: software, software rendering due to gpu unavailable, softawre rendering due to being disabled, enabled Key here is decoupling the features reported in the status from gpu blacklist features enum. On top of that, the states are expanded to show difference between off, off and falling back to software, and software rendering because it wasn't enabled. Review URL: http://codereview.chromium.org/6870004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81957 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/gpu_blacklist.cc175
-rw-r--r--content/browser/gpu_blacklist.h12
2 files changed, 104 insertions, 83 deletions
diff --git a/content/browser/gpu_blacklist.cc b/content/browser/gpu_blacklist.cc
index 4e57401..3a2ff6c 100644
--- a/content/browser/gpu_blacklist.cc
+++ b/content/browser/gpu_blacklist.cc
@@ -34,6 +34,14 @@ Version* GetDateFromString(const std::string& date_string) {
return Version::GetVersionFromString(date_as_version_string);
}
+Value* NewStatusValue(const char* name, const char* status)
+{
+ DictionaryValue* value = new DictionaryValue();
+ value->SetString("name", name);
+ value->SetString("status", status);
+ return value;
+}
+
} // namespace anonymous
GpuBlacklist::VersionInfo::VersionInfo(const std::string& version_op,
@@ -693,6 +701,16 @@ void GpuBlacklist::GetGpuFeatureFlagEntries(
}
}
+bool GpuBlacklist::IsFeatureBlacklisted(
+ GpuFeatureFlags::GpuFeatureType feature) const
+{
+ for (size_t i = 0; i < active_entries_.size(); ++i) {
+ if (active_entries_[i]->GetGpuFeatureFlags().flags() & feature)
+ return true;
+ }
+ return false;
+}
+
Value* GpuBlacklist::GetFeatureStatus(bool gpu_access_allowed,
bool disable_accelerated_compositing,
bool enable_accelerated_2D_canvas,
@@ -700,96 +718,89 @@ Value* GpuBlacklist::GetFeatureStatus(bool gpu_access_allowed,
bool disable_multisampling) const {
DictionaryValue* status = new DictionaryValue();
- // build the feature_status field
+ // Build the feature_status field.
{
ListValue* feature_status_list = new ListValue();
- // Iterate over all feature bits in kGpuFeatureAll and set feature status
- // for each one.
- for (size_t i = 0; i < sizeof(GpuFeatureFlags::GpuFeatureType) * 8; ++i) {
- GpuFeatureFlags::GpuFeatureType feature =
- static_cast<GpuFeatureFlags::GpuFeatureType>(1 << i);
- if (!(feature & GpuFeatureFlags::kGpuFeatureAll))
- continue;
-
- DictionaryValue* feature_status = new DictionaryValue();
-
- std::string feature_name(
- GpuFeatureFlags::GpuFeatureTypeToString(feature));
- feature_status->SetString("name", feature_name);
-
- // figure out if the feature is on or off
- bool blacklisted = false;
- for (size_t i = 0; i < active_entries_.size(); ++i) {
- if (active_entries_[i]->GetGpuFeatureFlags().flags() & feature)
- blacklisted |= true;
- }
- // status is actually a function of blacklisting + enable/disable flags +
- // global GPU state
- const char* status;
- if (!gpu_access_allowed) {
- status = "unavailable";
- } else {
- switch(feature) {
- case GpuFeatureFlags::kGpuFeatureAccelerated2dCanvas: {
- if (enable_accelerated_2D_canvas) {
- if (blacklisted)
- status = "unavailable";
- else
- status = "enabled";
- } else {
- status = "software";
- }
- break;
- }
- case GpuFeatureFlags::kGpuFeatureAcceleratedCompositing: {
- if (disable_accelerated_compositing) {
- status = "disabled";
- } else {
- if (blacklisted)
- status = "unavailable";
- else
- status = "enabled";
- }
- break;
- }
- case GpuFeatureFlags::kGpuFeatureWebgl: {
- if (disable_experimental_webgl) {
- status = "disabled";
- } else {
- if (blacklisted)
- status = "unavailable";
- else
- status = "enabled";
- }
- break;
- }
- case GpuFeatureFlags::kGpuFeatureMultisampling: {
- if(disable_multisampling) {
- status = "disabled";
- } else {
- if(blacklisted)
- status = "unavailable";
- else
- status = "enabled";
- }
- break;
- }
- default: {
- NOTREACHED();
- status = "unavailable";
- break;
- }
- }
- }
- feature_status->SetString("status", status);
+ // 2d_canvas.
+ if (!gpu_access_allowed) {
+ if(enable_accelerated_2D_canvas)
+ feature_status_list->Append(NewStatusValue("2d_canvas",
+ "unavailable_software"));
+ else
+ feature_status_list->Append(NewStatusValue("2d_canvas",
+ "software"));
+ } else if (enable_accelerated_2D_canvas) {
+ if (IsFeatureBlacklisted(
+ GpuFeatureFlags::kGpuFeatureAccelerated2dCanvas))
+ feature_status_list->Append(NewStatusValue("2d_canvas",
+ "unavailable_software"));
+ else
+ feature_status_list->Append(NewStatusValue("2d_canvas",
+ "enabled"));
+ } else {
+ feature_status_list->Append(NewStatusValue("2d_canvas",
+ "software"));
+ }
- feature_status_list->Append(feature_status);
+ // 3d css and compositing.
+ if (!gpu_access_allowed) {
+ feature_status_list->Append(NewStatusValue("3d_css",
+ "unavailable_off"));
+ feature_status_list->Append(NewStatusValue("compositing",
+ "unavailable_software"));
+ } else if (disable_accelerated_compositing) {
+ feature_status_list->Append(NewStatusValue("3d_css",
+ "unavailable_off"));
+ feature_status_list->Append(NewStatusValue("compositing",
+ "disabled_software"));
+ } else if (IsFeatureBlacklisted(
+ GpuFeatureFlags::kGpuFeatureAcceleratedCompositing)) {
+ feature_status_list->Append(NewStatusValue("3d_css",
+ "unavailable_off"));
+ feature_status_list->Append(NewStatusValue("compositing",
+ "disabled_software"));
+ } else {
+ feature_status_list->Append(NewStatusValue("3d_css",
+ "enabled"));
+ feature_status_list->Append(NewStatusValue("compositing",
+ "enabled"));
}
+
+ // webgl
+ if (!gpu_access_allowed)
+ feature_status_list->Append(NewStatusValue("webgl",
+ "unavailable_off"));
+ else if (disable_experimental_webgl)
+ feature_status_list->Append(NewStatusValue("webgl",
+ "disabled_off"));
+ else if (IsFeatureBlacklisted(
+ GpuFeatureFlags::kGpuFeatureWebgl))
+ feature_status_list->Append(NewStatusValue("webgl",
+ "unavailable_off"));
+ else
+ feature_status_list->Append(NewStatusValue("webgl",
+ "enabled"));
+
+ // multisampling
+ if (!gpu_access_allowed)
+ feature_status_list->Append(NewStatusValue("multisampling",
+ "unavailable_off"));
+ else if(disable_multisampling)
+ feature_status_list->Append(NewStatusValue("multisampling",
+ "disabled_off"));
+ else if (IsFeatureBlacklisted(
+ GpuFeatureFlags::kGpuFeatureMultisampling))
+ feature_status_list->Append(NewStatusValue("multisampling",
+ "disabled_off"));
+ else
+ feature_status_list->Append(NewStatusValue("multisampling",
+ "enabled"));
+
status->Set("featureStatus", feature_status_list);
}
- // build the problems list
+ // Build the problems list.
{
ListValue* problem_list = new ListValue();
if(!gpu_access_allowed) {
diff --git a/content/browser/gpu_blacklist.h b/content/browser/gpu_blacklist.h
index c2f8536..a7a5d73 100644
--- a/content/browser/gpu_blacklist.h
+++ b/content/browser/gpu_blacklist.h
@@ -70,9 +70,17 @@ class GpuBlacklist {
// Each entry in feature_status has:
// {
// name: "name of feature"
- // status: "enabled" | "unavailable" | "software" | "disabled";
+ // status: "enabled" | "unavailable_software" | "unavailable_off" |
+ // "software" | "disabled_off" | "disabled_softare";
// }
//
+ // The features reported are not 1:1 with GpuFeatureType. Rather, they are:
+ // '2d_canvas'
+ // '3d_css'
+ // 'composting',
+ // 'webgl',
+ // 'multisampling'
+ //
// Each problems has:
// {
// "description": "Your GPU is too old",
@@ -270,6 +278,8 @@ class GpuBlacklist {
void Clear();
+ bool IsFeatureBlacklisted(GpuFeatureFlags::GpuFeatureType feature) const;
+
// Check if the entry is supported by the current version of browser.
// By default, if there is no browser version information in the entry,
// return kSupported;