Commit a26cfed3 authored by Mohsen Izadi's avatar Mohsen Izadi Committed by Commit Bot

Fix chrome://gpu feature status when gpu access is blocked

When GPU access is blocked (i.e., hardware acceleration and SwiftShader
are both disabled), chrome://gpu reports incorrect values for Surface
Synchronization and Viz Service Display Compositor features.

BUG=829426
TEST=manual

Change-Id: I977a3902d71d53d77be2473ecd4b755b895f6a79
Reviewed-on: https://chromium-review.googlesource.com/1017227Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
Commit-Queue: Mohsen Izadi <mohsen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#551806}
parent 2b4854e6
...@@ -48,6 +48,7 @@ struct GpuFeatureData { ...@@ -48,6 +48,7 @@ struct GpuFeatureData {
bool disabled; bool disabled;
std::string disabled_description; std::string disabled_description;
bool fallback_to_software; bool fallback_to_software;
bool needs_gpu_access;
}; };
bool IsForceGpuRasterizationEnabled() { bool IsForceGpuRasterizationEnabled() {
...@@ -88,78 +89,79 @@ const GpuFeatureData GetGpuFeatureData(size_t index, bool* eof) { ...@@ -88,78 +89,79 @@ const GpuFeatureData GetGpuFeatureData(size_t index, bool* eof) {
SafeGetFeatureStatus(manager, SafeGetFeatureStatus(manager,
gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS), gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS),
command_line.HasSwitch(switches::kDisableAccelerated2dCanvas), command_line.HasSwitch(switches::kDisableAccelerated2dCanvas),
"Accelerated 2D canvas is unavailable: either disabled via blacklist or" "Accelerated 2D canvas is unavailable: either disabled via blacklist or "
" the command line.", "the command line.",
true}, true, true},
{"gpu_compositing", GetGpuCompositingStatus(), {"gpu_compositing", GetGpuCompositingStatus(),
command_line.HasSwitch(switches::kDisableGpuCompositing), command_line.HasSwitch(switches::kDisableGpuCompositing),
"Gpu compositing has been disabled, either via blacklist, about:flags" "Gpu compositing has been disabled, either via blacklist, about:flags "
" or the command line. The browser will fall back to software " "or the command line. The browser will fall back to software "
"compositing" "compositing and hardware acceleration will be unavailable.",
" and hardware acceleration will be unavailable.", true, true},
true},
{"webgl", {"webgl",
SafeGetFeatureStatus(manager, gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL), SafeGetFeatureStatus(manager, gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL),
command_line.HasSwitch(switches::kDisableWebGL), command_line.HasSwitch(switches::kDisableWebGL),
"WebGL has been disabled via blacklist or the command line.", false}, "WebGL has been disabled via blacklist or the command line.", false,
true},
{"flash_3d", SafeGetFeatureStatus(manager, gpu::GPU_FEATURE_TYPE_FLASH3D), {"flash_3d", SafeGetFeatureStatus(manager, gpu::GPU_FEATURE_TYPE_FLASH3D),
command_line.HasSwitch(switches::kDisableFlash3d), command_line.HasSwitch(switches::kDisableFlash3d),
"Using 3d in flash has been disabled, either via blacklist, about:flags " "Using 3d in flash has been disabled, either via blacklist, about:flags "
"or" "or the command line.",
" the command line.", true, true},
true},
{"flash_stage3d", {"flash_stage3d",
SafeGetFeatureStatus(manager, gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D), SafeGetFeatureStatus(manager, gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D),
command_line.HasSwitch(switches::kDisableFlashStage3d), command_line.HasSwitch(switches::kDisableFlashStage3d),
"Using Stage3d in Flash has been disabled, either via blacklist," "Using Stage3d in Flash has been disabled, either via blacklist, "
" about:flags or the command line.", "about:flags or the command line.",
true}, true, true},
{"flash_stage3d_baseline", {"flash_stage3d_baseline",
SafeGetFeatureStatus(manager, SafeGetFeatureStatus(manager,
gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D_BASELINE), gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D_BASELINE),
command_line.HasSwitch(switches::kDisableFlashStage3d), command_line.HasSwitch(switches::kDisableFlashStage3d),
"Using Stage3d Baseline profile in Flash has been disabled, either" "Using Stage3d Baseline profile in Flash has been disabled, either via "
" via blacklist, about:flags or the command line.", "blacklist, about:flags or the command line.",
true}, true, true},
{"video_decode", {"video_decode",
SafeGetFeatureStatus(manager, SafeGetFeatureStatus(manager,
gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE), gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE),
command_line.HasSwitch(switches::kDisableAcceleratedVideoDecode), command_line.HasSwitch(switches::kDisableAcceleratedVideoDecode),
"Accelerated video decode has been disabled, either via blacklist," "Accelerated video decode has been disabled, either via blacklist, "
" about:flags or the command line.", "about:flags or the command line.",
true}, true, true},
{"rasterization", {"rasterization",
SafeGetFeatureStatus(manager, gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION), SafeGetFeatureStatus(manager, gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION),
(command_line.HasSwitch(switches::kDisableGpuRasterization) && (command_line.HasSwitch(switches::kDisableGpuRasterization) &&
!IsForceGpuRasterizationEnabled()), !IsForceGpuRasterizationEnabled()),
"Accelerated rasterization has been disabled, either via blacklist," "Accelerated rasterization has been disabled, either via blacklist, "
" about:flags or the command line.", "about:flags or the command line.",
true}, true, true},
{"multiple_raster_threads", gpu::kGpuFeatureStatusEnabled, {"multiple_raster_threads", gpu::kGpuFeatureStatusEnabled,
NumberOfRendererRasterThreads() == 1, "Raster is using a single thread.", NumberOfRendererRasterThreads() == 1, "Raster is using a single thread.",
false}, false, true},
{"native_gpu_memory_buffers", gpu::kGpuFeatureStatusEnabled, {"native_gpu_memory_buffers", gpu::kGpuFeatureStatusEnabled,
!gpu::AreNativeGpuMemoryBuffersEnabled(), !gpu::AreNativeGpuMemoryBuffersEnabled(),
"Native GpuMemoryBuffers have been disabled, either via about:flags" "Native GpuMemoryBuffers have been disabled, either via about:flags or "
" or command line.", "command line.",
true}, true, true},
{"surface_synchronization", gpu::kGpuFeatureStatusEnabled, {"surface_synchronization", gpu::kGpuFeatureStatusEnabled,
!features::IsSurfaceSynchronizationEnabled(), !features::IsSurfaceSynchronizationEnabled(),
"Surface synchronization has been disabled by Finch trial or command " "Surface synchronization has been disabled by Finch trial or command "
"line.", "line.",
false}, false, false},
{"webgl2", {"webgl2",
SafeGetFeatureStatus(manager, gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL2), SafeGetFeatureStatus(manager, gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL2),
(command_line.HasSwitch(switches::kDisableWebGL) || (command_line.HasSwitch(switches::kDisableWebGL) ||
command_line.HasSwitch(switches::kDisableWebGL2)), command_line.HasSwitch(switches::kDisableWebGL2)),
"WebGL2 has been disabled via blacklist or the command line.", false}, "WebGL2 has been disabled via blacklist or the command line.", false,
true},
{"viz_display_compositor", gpu::kGpuFeatureStatusEnabled, {"viz_display_compositor", gpu::kGpuFeatureStatusEnabled,
!base::FeatureList::IsEnabled(features::kVizDisplayCompositor), !base::FeatureList::IsEnabled(features::kVizDisplayCompositor),
"Viz service display compositor is not enabled by default.", false}, "Viz service display compositor is not enabled by default.", false,
false},
{"checker_imaging", gpu::kGpuFeatureStatusEnabled, {"checker_imaging", gpu::kGpuFeatureStatusEnabled,
!IsCheckerImagingEnabled(), !IsCheckerImagingEnabled(),
"Checker-imaging has been disabled via finch trial or the command line.", "Checker-imaging has been disabled via finch trial or the command line.",
false}, false, true},
}; };
DCHECK(index < arraysize(kGpuFeatureData)); DCHECK(index < arraysize(kGpuFeatureData));
*eof = (index == arraysize(kGpuFeatureData) - 1); *eof = (index == arraysize(kGpuFeatureData) - 1);
...@@ -295,9 +297,7 @@ bool IsCheckerImagingEnabled() { ...@@ -295,9 +297,7 @@ bool IsCheckerImagingEnabled() {
std::unique_ptr<base::DictionaryValue> GetFeatureStatus() { std::unique_ptr<base::DictionaryValue> GetFeatureStatus() {
GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance();
std::string gpu_access_blocked_reason; bool gpu_access_blocked = !manager->GpuAccessAllowed(nullptr);
bool gpu_access_blocked =
!manager->GpuAccessAllowed(&gpu_access_blocked_reason);
auto feature_status_dict = std::make_unique<base::DictionaryValue>(); auto feature_status_dict = std::make_unique<base::DictionaryValue>();
...@@ -305,7 +305,8 @@ std::unique_ptr<base::DictionaryValue> GetFeatureStatus() { ...@@ -305,7 +305,8 @@ std::unique_ptr<base::DictionaryValue> GetFeatureStatus() {
for (size_t i = 0; !eof; ++i) { for (size_t i = 0; !eof; ++i) {
const GpuFeatureData gpu_feature_data = GetGpuFeatureData(i, &eof); const GpuFeatureData gpu_feature_data = GetGpuFeatureData(i, &eof);
std::string status; std::string status;
if (gpu_feature_data.disabled || gpu_access_blocked || if (gpu_feature_data.disabled ||
(gpu_feature_data.needs_gpu_access && gpu_access_blocked) ||
gpu_feature_data.status == gpu::kGpuFeatureStatusDisabled) { gpu_feature_data.status == gpu::kGpuFeatureStatusDisabled) {
status = "disabled"; status = "disabled";
if (gpu_feature_data.fallback_to_software) if (gpu_feature_data.fallback_to_software)
...@@ -366,8 +367,8 @@ std::unique_ptr<base::ListValue> GetProblems() { ...@@ -366,8 +367,8 @@ std::unique_ptr<base::ListValue> GetProblems() {
if (gpu_access_blocked) { if (gpu_access_blocked) {
auto problem = std::make_unique<base::DictionaryValue>(); auto problem = std::make_unique<base::DictionaryValue>();
problem->SetString("description", problem->SetString("description", "GPU was unable to initialize: " +
"GPU process was unable to boot: " + gpu_access_blocked_reason); gpu_access_blocked_reason);
problem->Set("crBugs", std::make_unique<base::ListValue>()); problem->Set("crBugs", std::make_unique<base::ListValue>());
auto disabled_features = std::make_unique<base::ListValue>(); auto disabled_features = std::make_unique<base::ListValue>();
disabled_features->AppendString("all"); disabled_features->AppendString("all");
......
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