Commit 7d87facf authored by vangelis@chromium.org's avatar vangelis@chromium.org

Cleanup logic that generates about:gpu feature status.

Code cleanup for the logic that generates the labels used by the about:gpu page
to report on the feature status. Also separates (and fixes) reporting for impl-side-painting
and gpu rasterization.

BUG=386420

Review URL: https://codereview.chromium.org/344653004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278541 0039d316-1c4b-4281-b951-d872f2087c98
parent b06772ce
......@@ -37,10 +37,11 @@ static bool IsGpuRasterizationBlacklisted() {
const char* kGpuCompositingFeatureName = "gpu_compositing";
const char* kWebGLFeatureName = "webgl";
const char* kRasterizationFeatureName = "rasterization";
const char* kThreadedRasterizationFeatureName = "threaded_rasterization";
struct GpuFeatureInfo {
std::string name;
uint32 blocked;
bool blocked;
bool disabled;
std::string disabled_description;
bool fallback_to_software;
......@@ -84,7 +85,7 @@ const GpuFeatureInfo GetGpuFeatureInfo(size_t index, bool* eof) {
command_line.HasSwitch(switches::kDisableFlash3d),
"Using 3d in flash has been disabled, either via about:flags or"
" command line.",
false
true
},
{
"flash_stage3d",
......@@ -92,7 +93,7 @@ const GpuFeatureInfo GetGpuFeatureInfo(size_t index, bool* eof) {
command_line.HasSwitch(switches::kDisableFlashStage3d),
"Using Stage3d in Flash has been disabled, either via about:flags or"
" command line.",
false
true
},
{
"flash_stage3d_baseline",
......@@ -102,7 +103,7 @@ const GpuFeatureInfo GetGpuFeatureInfo(size_t index, bool* eof) {
command_line.HasSwitch(switches::kDisableFlashStage3d),
"Using Stage3d Baseline profile in Flash has been disabled, either"
" via about:flags or command line.",
false
true
},
{
"video_decode",
......@@ -140,10 +141,19 @@ const GpuFeatureInfo GetGpuFeatureInfo(size_t index, bool* eof) {
!IsGpuRasterizationEnabled() && !IsForceGpuRasterizationEnabled(),
!IsGpuRasterizationEnabled() && !IsForceGpuRasterizationEnabled() &&
!IsGpuRasterizationBlacklisted(),
"Accelerated rasterization has not been enabled or"
" is not supported by the current system.",
"Accelerated rasterization has been disabled, either via about:flags"
" or command line.",
true
},
{
kThreadedRasterizationFeatureName,
false,
!IsImplSidePaintingEnabled(),
"Threaded rasterization has not been enabled or"
" is not supported by the current system.",
false
}
};
DCHECK(index < arraysize(kGpuFeatureInfo));
*eof = (index == arraysize(kGpuFeatureInfo) - 1);
......@@ -268,25 +278,18 @@ base::Value* GetFeatureStatus() {
std::string status;
if (gpu_feature_info.disabled) {
status = "disabled";
if (gpu_feature_info.name == kRasterizationFeatureName) {
if (IsImplSidePaintingEnabled())
status += "_software_multithreaded";
else
status += "_software";
} else {
if (gpu_feature_info.fallback_to_software)
status += "_software";
else
status += "_off";
}
} else if (manager->ShouldUseSwiftShader()) {
status = "unavailable_software";
if (gpu_feature_info.fallback_to_software)
status += "_software";
else
status += "_off";
if (gpu_feature_info.name == kThreadedRasterizationFeatureName)
status += "_ok";
} else if (gpu_feature_info.blocked ||
gpu_access_blocked) {
status = "unavailable";
if (gpu_feature_info.fallback_to_software)
if (gpu_feature_info.fallback_to_software) {
status += "_software";
else
} else
status += "_off";
} else {
status = "enabled";
......@@ -297,11 +300,19 @@ base::Value* GetFeatureStatus() {
if (IsForceGpuRasterizationEnabled())
status += "_force";
}
if (gpu_feature_info.name == kThreadedRasterizationFeatureName)
status += "_on";
}
if (gpu_feature_info.name == kGpuCompositingFeatureName) {
if (IsThreadedCompositingEnabled())
status += "_threaded";
}
if (gpu_feature_info.name == kWebGLFeatureName &&
(gpu_feature_info.blocked || gpu_access_blocked) &&
manager->ShouldUseSwiftShader()) {
status = "unavailable_software";
}
feature_status_dict->SetString(
gpu_feature_info.name.c_str(), status.c_str());
}
......
......@@ -85,59 +85,70 @@ cr.define('gpu', function() {
'gpu_compositing': 'Compositing',
'webgl': 'WebGL',
'multisampling': 'WebGL multisampling',
'flash_3d': 'Flash 3D',
'flash_3d': 'Flash',
'flash_stage3d': 'Flash Stage3D',
'flash_stage3d_baseline': 'Flash Stage3D Baseline profile',
'texture_sharing': 'Texture Sharing',
'video_decode': 'Video Decode',
'video_encode': 'Video Encode',
// GPU Switching
'gpu_switching': 'GPU Switching',
'panel_fitting': 'Panel Fitting',
'rasterization': 'Rasterization',
};
var statusLabelMap = {
'disabled_software': 'Software only. Hardware acceleration disabled.',
'disabled_software_animated': 'Software animated.',
'disabled_software_multithreaded': 'Software only, multi-threaded',
'disabled_off': 'Unavailable. Hardware acceleration disabled.',
'software': 'Software rendered. Hardware acceleration not enabled.',
'unavailable_off': 'Unavailable. Hardware acceleration unavailable',
'unavailable_software':
'Software only, hardware acceleration unavailable',
'unavailable_software_threaded':
'Software only and threaded. Hardware acceleration unavailable.',
'enabled_readback': 'Hardware accelerated, but at reduced performance',
'enabled_force': 'Hardware accelerated',
'enabled_threaded': 'Hardware accelerated and threaded.',
'enabled': 'Hardware accelerated',
'accelerated': 'Accelerated',
'accelerated_threaded': 'Accelerated and threaded',
// GPU Switching
'gpu_switching_automatic': 'Automatic switching',
'gpu_switching_force_discrete': 'Always on discrete GPU',
'gpu_switching_force_integrated': 'Always on integrated GPU',
'threaded_rasterization': 'Threaded Rasterization',
};
var statusClassMap = {
'disabled_software': 'feature-yellow',
'disabled_software_animated': 'feature-yellow',
'disabled_software_multithreaded': 'feature-yellow',
'disabled_off': 'feature-red',
'software': 'feature-yellow',
'unavailable_off': 'feature-red',
'unavailable_software': 'feature-yellow',
'unavailable_software_threaded': 'feature-yellow',
'enabled_force': 'feature-green',
'enabled_readback': 'feature-yellow',
'enabled_threaded': 'feature-green',
'enabled': 'feature-green',
'accelerated': 'feature-green',
'accelerated_threaded': 'feature-green',
// GPU Switching
'gpu_switching_automatic': 'feature-green',
'gpu_switching_force_discrete': 'feature-red',
'gpu_switching_force_integrated': 'feature-red',
var statusMap = {
'disabled_software': {
'label': 'Software only. Hardware acceleration disabled',
'class': 'feature-yellow'
},
'disabled_software_threaded': {
'label': 'Software only, threaded. Hardware acceleration disabled',
'class': 'feature-yellow'
},
'disabled_off': {
'label': 'Disabled',
'class': 'feature-red'
},
'disabled_off_ok': {
'label': 'Disabled',
'class': 'feature-yellow'
},
'unavailable_software': {
'label': 'Software only, hardware acceleration unavailable',
'class': 'feature-yellow'
},
'unavailable_software_threaded': {
'label': 'Software only, threaded. Hardware acceleration unavailable',
'class': 'feature-yellow'
},
'unavailable_off': {
'label': 'Unavailable',
'class': 'feature-red'
},
'unavailable_off_ok': {
'label': 'Unavailable',
'class': 'feature-yellow'
},
'enabled_readback': {
'label': 'Hardware accelerated but at reduced performance',
'class': 'feature-yellow'
},
'enabled_force': {
'label': 'Hardware accelerated on all pages',
'class': 'feature-green'
},
'enabled_threaded': {
'label': 'Hardware accelerated and threaded',
'class': 'feature-green'
},
'enabled': {
'label': 'Hardware accelerated',
'class': 'feature-green'
},
'enabled_on': {
'label': 'Enabled',
'class': 'feature-green'
}
};
// GPU info, basic
......@@ -169,12 +180,15 @@ cr.define('gpu', function() {
featureEl.appendChild(nameEl);
var statusEl = document.createElement('span');
if (!statusLabelMap[featureStatus])
console.log('Missing statusLabel for', featureStatus);
if (!statusClassMap[featureStatus])
console.log('Missing statusClass for', featureStatus);
statusEl.textContent = statusLabelMap[featureStatus];
statusEl.className = statusClassMap[featureStatus];
var statusInfo = statusMap[featureStatus];
if (!statusInfo) {
console.log('Missing status for ', featureStatus);
statusEl.textContent = 'Unknown';
statusEl.className = 'feature-red';
} else {
statusEl.textContent = statusInfo['label'];
statusEl.className = statusInfo['class'];
}
featureEl.appendChild(statusEl);
featureStatusList.appendChild(featureEl);
......
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