summaryrefslogtreecommitdiffstats
path: root/content/browser/gpu/gpu_internals_ui.cc
diff options
context:
space:
mode:
authordtu@chromium.org <dtu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-16 05:48:02 +0000
committerdtu@chromium.org <dtu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-16 05:48:02 +0000
commitf454eed0f7ead2959c249da24f6b0e6e69bbe832 (patch)
tree0c7992080726f1e338475d88f4863da064c365bd /content/browser/gpu/gpu_internals_ui.cc
parentebc6f0ab551100dca9d3a5fc142e8ce8a4dac9c7 (diff)
downloadchromium_src-f454eed0f7ead2959c249da24f6b0e6e69bbe832.zip
chromium_src-f454eed0f7ead2959c249da24f6b0e6e69bbe832.tar.gz
chromium_src-f454eed0f7ead2959c249da24f6b0e6e69bbe832.tar.bz2
[telemetry] Print graphics feature status.
Moved GetFeatureStatus() from the gpu_internals_ui to compositor_util, so we can add it to the existing SystemInfo.getInfo API. This exposes the top three sections of the chrome://gpu page through DevTools to Telemetry. BUG=296773 TEST=TBD Review URL: https://codereview.chromium.org/24828002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@228870 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/gpu/gpu_internals_ui.cc')
-rw-r--r--content/browser/gpu/gpu_internals_ui.cc297
1 files changed, 4 insertions, 293 deletions
diff --git a/content/browser/gpu/gpu_internals_ui.cc b/content/browser/gpu/gpu_internals_ui.cc
index 0340077..c97cb38 100644
--- a/content/browser/gpu/gpu_internals_ui.cc
+++ b/content/browser/gpu/gpu_internals_ui.cc
@@ -14,7 +14,6 @@
#include "base/strings/stringprintf.h"
#include "base/sys_info.h"
#include "base/values.h"
-#include "cc/base/switches.h"
#include "content/browser/gpu/compositor_util.h"
#include "content/browser/gpu/gpu_data_manager_impl.h"
#include "content/public/browser/browser_thread.h"
@@ -34,14 +33,6 @@
namespace content {
namespace {
-struct GpuFeatureInfo {
- std::string name;
- uint32 blocked;
- bool disabled;
- std::string disabled_description;
- bool fallback_to_software;
-};
-
WebUIDataSource* CreateGpuHTMLSource() {
WebUIDataSource* source = WebUIDataSource::Create(kChromeUIGpuHost);
@@ -67,13 +58,6 @@ base::DictionaryValue* NewDescriptionValuePair(const std::string& desc,
return dict;
}
-base::Value* NewStatusValue(const char* name, const char* status) {
- base::DictionaryValue* value = new base::DictionaryValue();
- value->SetString("name", name);
- value->SetString("status", status);
- return value;
-}
-
#if defined(OS_WIN)
// Output DxDiagNode tree as nested array of {description,value} pairs
base::ListValue* DxDiagNodeToList(const gpu::DxDiagNode& node) {
@@ -192,282 +176,6 @@ base::DictionaryValue* GpuInfoAsDictionaryValue() {
return info;
}
-// Determine if accelerated-2d-canvas is supported, which depends on whether
-// lose_context could happen.
-bool SupportsAccelerated2dCanvas() {
- if (GpuDataManagerImpl::GetInstance()->GetGPUInfo().can_lose_context)
- return false;
- return true;
-}
-
-base::Value* GetFeatureStatus() {
- const CommandLine& command_line = *CommandLine::ForCurrentProcess();
- GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance();
- std::string gpu_access_blocked_reason;
- bool gpu_access_blocked =
- !manager->GpuAccessAllowed(&gpu_access_blocked_reason);
-
- base::DictionaryValue* status = new base::DictionaryValue();
-
- const GpuFeatureInfo kGpuFeatureInfo[] = {
- {
- "2d_canvas",
- manager->IsFeatureBlacklisted(
- gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS),
- command_line.HasSwitch(switches::kDisableAccelerated2dCanvas) ||
- !SupportsAccelerated2dCanvas(),
- "Accelerated 2D canvas is unavailable: either disabled at the command"
- " line or not supported by the current system.",
- true
- },
- {
- "compositing",
- manager->IsFeatureBlacklisted(
- gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING),
- command_line.HasSwitch(switches::kDisableAcceleratedCompositing),
- "Accelerated compositing has been disabled, either via about:flags or"
- " command line. This adversely affects performance of all hardware"
- " accelerated features.",
- true
- },
- {
- "3d_css",
- manager->IsFeatureBlacklisted(
- gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING) ||
- manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_3D_CSS),
- command_line.HasSwitch(switches::kDisableAcceleratedLayers),
- "Accelerated layers have been disabled at the command line.",
- false
- },
- {
- "css_animation",
- manager->IsFeatureBlacklisted(
- gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING) ||
- manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_3D_CSS),
- command_line.HasSwitch(cc::switches::kDisableThreadedAnimation) ||
- command_line.HasSwitch(switches::kDisableAcceleratedCompositing) ||
- command_line.HasSwitch(switches::kDisableAcceleratedLayers),
- "Accelerated CSS animation has been disabled at the command line.",
- true
- },
- {
- "webgl",
- manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL),
- command_line.HasSwitch(switches::kDisableExperimentalWebGL),
- "WebGL has been disabled, either via about:flags or command line.",
- false
- },
- {
- "multisampling",
- manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_MULTISAMPLING),
- command_line.HasSwitch(switches::kDisableGLMultisampling),
- "Multisampling has been disabled, either via about:flags or command"
- " line.",
- false
- },
- {
- "flash_3d",
- manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH3D),
- command_line.HasSwitch(switches::kDisableFlash3d),
- "Using 3d in flash has been disabled, either via about:flags or"
- " command line.",
- false
- },
- {
- "flash_stage3d",
- manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D),
- command_line.HasSwitch(switches::kDisableFlashStage3d),
- "Using Stage3d in Flash has been disabled, either via about:flags or"
- " command line.",
- false
- },
- {
- "flash_stage3d_baseline",
- manager->IsFeatureBlacklisted(
- gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D_BASELINE) ||
- manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D),
- command_line.HasSwitch(switches::kDisableFlashStage3d),
- "Using Stage3d Baseline profile in Flash has been disabled, either"
- " via about:flags or command line.",
- false
- },
- {
- "texture_sharing",
- manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_TEXTURE_SHARING),
- command_line.HasSwitch(switches::kDisableImageTransportSurface),
- "Sharing textures between processes has been disabled, either via"
- " about:flags or command line.",
- false
- },
- {
- "video_decode",
- manager->IsFeatureBlacklisted(
- gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE),
- command_line.HasSwitch(switches::kDisableAcceleratedVideoDecode),
- "Accelerated video decode has been disabled, either via about:flags"
- " or command line.",
- true
- },
- {
- "video",
- manager->IsFeatureBlacklisted(
- gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO),
- command_line.HasSwitch(switches::kDisableAcceleratedVideo) ||
- command_line.HasSwitch(switches::kDisableAcceleratedCompositing),
- "Accelerated video presentation has been disabled, either via"
- " about:flags or command line.",
- true
- },
-#if defined(OS_CHROMEOS)
- {
- "panel_fitting",
- manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_PANEL_FITTING),
- command_line.HasSwitch(switches::kDisablePanelFitting),
- "Panel fitting has been disabled, either via about:flags or command"
- " line.",
- false
- },
-#endif
- {
- "force_compositing_mode",
- manager->IsFeatureBlacklisted(
- gpu::GPU_FEATURE_TYPE_FORCE_COMPOSITING_MODE) &&
- !IsForceCompositingModeEnabled(),
- !IsForceCompositingModeEnabled() &&
- !manager->IsFeatureBlacklisted(
- gpu::GPU_FEATURE_TYPE_FORCE_COMPOSITING_MODE),
- "Force compositing mode is off, either disabled at the command"
- " line or not supported by the current system.",
- false
- },
- };
- const size_t kNumFeatures = sizeof(kGpuFeatureInfo) / sizeof(GpuFeatureInfo);
-
- // Build the feature_status field.
- {
- base::ListValue* feature_status_list = new base::ListValue();
-
- for (size_t i = 0; i < kNumFeatures; ++i) {
- // force_compositing_mode status is part of the compositing status.
- if (kGpuFeatureInfo[i].name == "force_compositing_mode")
- continue;
-
- std::string status;
- if (kGpuFeatureInfo[i].disabled) {
- status = "disabled";
- if (kGpuFeatureInfo[i].name == "css_animation") {
- status += "_software_animated";
- } else if (kGpuFeatureInfo[i].name == "raster") {
- if (cc::switches::IsImplSidePaintingEnabled())
- status += "_software_multithreaded";
- else
- status += "_software";
- } else {
- if (kGpuFeatureInfo[i].fallback_to_software)
- status += "_software";
- else
- status += "_off";
- }
- } else if (GpuDataManagerImpl::GetInstance()->ShouldUseSwiftShader()) {
- status = "unavailable_software";
- } else if (kGpuFeatureInfo[i].blocked ||
- gpu_access_blocked) {
- status = "unavailable";
- if (kGpuFeatureInfo[i].fallback_to_software)
- status += "_software";
- else
- status += "_off";
- } else {
- status = "enabled";
- if (kGpuFeatureInfo[i].name == "webgl" &&
- (command_line.HasSwitch(switches::kDisableAcceleratedCompositing) ||
- manager->IsFeatureBlacklisted(
- gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING)))
- status += "_readback";
- bool has_thread = IsThreadedCompositingEnabled();
- if (kGpuFeatureInfo[i].name == "compositing") {
- bool force_compositing = IsForceCompositingModeEnabled();
- if (force_compositing)
- status += "_force";
- if (has_thread)
- status += "_threaded";
- }
- if (kGpuFeatureInfo[i].name == "css_animation") {
- if (has_thread)
- status = "accelerated_threaded";
- else
- status = "accelerated";
- }
- }
- // TODO(reveman): Remove this when crbug.com/223286 has been fixed.
- if (kGpuFeatureInfo[i].name == "raster" &&
- cc::switches::IsImplSidePaintingEnabled()) {
- status = "disabled_software_multithreaded";
- }
- feature_status_list->Append(
- NewStatusValue(kGpuFeatureInfo[i].name.c_str(), status.c_str()));
- }
- gpu::GpuSwitchingOption gpu_switching_option =
- GpuDataManagerImpl::GetInstance()->GetGpuSwitchingOption();
- if (gpu_switching_option != gpu::GPU_SWITCHING_OPTION_UNKNOWN) {
- std::string gpu_switching;
- switch (gpu_switching_option) {
- case gpu::GPU_SWITCHING_OPTION_AUTOMATIC:
- gpu_switching = "gpu_switching_automatic";
- break;
- case gpu::GPU_SWITCHING_OPTION_FORCE_DISCRETE:
- gpu_switching = "gpu_switching_force_discrete";
- break;
- case gpu::GPU_SWITCHING_OPTION_FORCE_INTEGRATED:
- gpu_switching = "gpu_switching_force_integrated";
- break;
- default:
- break;
- }
- feature_status_list->Append(
- NewStatusValue("gpu_switching", gpu_switching.c_str()));
- }
- status->Set("featureStatus", feature_status_list);
- }
-
- // Build the problems list.
- {
- base::ListValue* problem_list = new base::ListValue();
- GpuDataManagerImpl::GetInstance()->GetBlacklistReasons(problem_list);
-
- if (gpu_access_blocked) {
- base::DictionaryValue* problem = new base::DictionaryValue();
- problem->SetString("description",
- "GPU process was unable to boot: " + gpu_access_blocked_reason);
- problem->Set("crBugs", new base::ListValue());
- problem->Set("webkitBugs", new base::ListValue());
- problem_list->Insert(0, problem);
- }
-
- for (size_t i = 0; i < kNumFeatures; ++i) {
- if (kGpuFeatureInfo[i].disabled) {
- base::DictionaryValue* problem = new base::DictionaryValue();
- problem->SetString(
- "description", kGpuFeatureInfo[i].disabled_description);
- problem->Set("crBugs", new base::ListValue());
- problem->Set("webkitBugs", new base::ListValue());
- problem_list->Append(problem);
- }
- }
-
- status->Set("problems", problem_list);
- }
-
- // Build driver bug workaround list.
- {
- base::ListValue* workaround_list = new base::ListValue();
- GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(workaround_list);
- status->Set("workarounds", workaround_list);
- }
-
- return status;
-}
-
// This class receives javascript messages from the renderer.
// Note that the WebUI infrastructure runs on the UI thread, therefore all of
// this class's methods are expected to run on the UI thread.
@@ -626,7 +334,10 @@ void GpuMessageHandler::OnGpuInfoUpdate() {
scoped_ptr<base::DictionaryValue> gpu_info_val(GpuInfoAsDictionaryValue());
// Add in blacklisting features
- base::Value* feature_status = GetFeatureStatus();
+ base::DictionaryValue* feature_status = new DictionaryValue;
+ feature_status->Set("featureStatus", GetFeatureStatus());
+ feature_status->Set("problems", GetProblems());
+ feature_status->Set("workarounds", GetDriverBugWorkarounds());
if (feature_status)
gpu_info_val->Set("featureStatus", feature_status);