Skip to content

Commit

Permalink
content: Restore rasterization status in about:gpu.
Browse files Browse the repository at this point in the history
Without any flags it shows:
Rasterization: Software only. Hardware acceleration disabled.

Add --enable-impl-side-painting and it shows:
Rasterization: Software only, multi-threaded

Add --enable-gpu-rasterization and it shows:
Rasterization: Hardware accelerated

add --force-gpu-rasterization and it shows:
Rasterization: Hardware accelerated on all pages

BUG=354449

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260623 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
reveman@chromium.org committed Mar 31, 2014
1 parent d581102 commit b8d82c2
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 20 deletions.
41 changes: 36 additions & 5 deletions content/browser/gpu/compositor_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,14 @@ const GpuFeatureInfo GetGpuFeatureInfo(size_t index, bool* eof) {
" line or not supported by the current system.",
false
},
{
"raster",
false,
!IsGpuRasterizationEnabled() && !IsForceGpuRasterizationEnabled(),
"Accelerated rasterization has not been enabled or"
" is not supported by the current system.",
true
}
};
DCHECK(index < arraysize(kGpuFeatureInfo));
*eof = (index == arraysize(kGpuFeatureInfo) - 1);
Expand Down Expand Up @@ -273,6 +281,30 @@ bool IsImplSidePaintingEnabled() {
#endif
}

bool IsGpuRasterizationEnabled() {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();

if (!IsImplSidePaintingEnabled())
return false;

if (command_line.HasSwitch(switches::kDisableGpuRasterization))
return false;
else if (command_line.HasSwitch(switches::kEnableGpuRasterization))
return true;

return command_line.HasSwitch(
switches::kEnableBleedingEdgeRenderingFastPaths);
}

bool IsForceGpuRasterizationEnabled() {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();

if (!IsImplSidePaintingEnabled())
return false;

return command_line.HasSwitch(switches::kForceGpuRasterization);
}

base::Value* GetFeatureStatus() {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance();
Expand Down Expand Up @@ -328,17 +360,16 @@ base::Value* GetFeatureStatus() {
status += "_force";
if (has_thread)
status += "_threaded";
}
if (gpu_feature_info.name == "css_animation") {
} else if (gpu_feature_info.name == "css_animation") {
if (has_thread)
status = "accelerated_threaded";
else
status = "accelerated";
} else if (gpu_feature_info.name == "raster") {
if (IsForceGpuRasterizationEnabled())
status += "_force";
}
}
// TODO(reveman): Remove this when crbug.com/223286 has been fixed.
if (gpu_feature_info.name == "raster" && IsImplSidePaintingEnabled())
status = "disabled_software_multithreaded";
feature_status_dict->SetString(
gpu_feature_info.name.c_str(), status.c_str());
}
Expand Down
6 changes: 6 additions & 0 deletions content/browser/gpu/compositor_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ CONTENT_EXPORT bool IsDelegatedRendererEnabled();
// for the renderer.
CONTENT_EXPORT bool IsImplSidePaintingEnabled();

// Returns true if gpu rasterization is on (via flags) for the renderer.
CONTENT_EXPORT bool IsGpuRasterizationEnabled();

// Returns true if force-gpu-rasterization is on (via flags) for the renderer.
CONTENT_EXPORT bool IsForceGpuRasterizationEnabled();

CONTENT_EXPORT base::Value* GetFeatureStatus();
CONTENT_EXPORT base::Value* GetProblems();
CONTENT_EXPORT base::Value* GetDriverBugWorkarounds();
Expand Down
9 changes: 6 additions & 3 deletions content/browser/renderer_host/render_process_host_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,12 @@ static void AppendGpuCommandLineFlags(CommandLine* command_line) {
if (IsImplSidePaintingEnabled())
command_line->AppendSwitch(switches::kEnableImplSidePainting);

if (content::IsGpuRasterizationEnabled())
command_line->AppendSwitch(switches::kEnableGpuRasterization);

if (content::IsForceGpuRasterizationEnabled())
command_line->AppendSwitch(switches::kForceGpuRasterization);

// Appending disable-gpu-feature switches due to software rendering list.
GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance();
DCHECK(gpu_data_manager);
Expand Down Expand Up @@ -1038,7 +1044,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
switches::kDisableFiltersOverIPC,
switches::kDisableGpu,
switches::kDisableGpuCompositing,
switches::kDisableGpuRasterization,
switches::kDisableGpuVsync,
switches::kDisableLowResTiling,
switches::kDisableHistogramCustomizer,
Expand Down Expand Up @@ -1079,7 +1084,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
switches::kEnableFastTextAutosizing,
switches::kEnableGPUClientLogging,
switches::kEnableGpuClientTracing,
switches::kEnableGpuRasterization,
switches::kEnableGPUServiceLogging,
switches::kEnableHighDpiCompositingForFixedPosition,
switches::kEnableHTMLImports,
Expand Down Expand Up @@ -1114,7 +1118,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
switches::kEnableWebGLDraftExtensions,
switches::kEnableWebMIDI,
switches::kForceDeviceScaleFactor,
switches::kForceGpuRasterization,
switches::kFullMemoryCrashReport,
switches::kJavaScriptFlags,
switches::kLoggingLevel,
Expand Down
16 changes: 4 additions & 12 deletions content/renderer/render_thread_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -431,18 +431,10 @@ void RenderThreadImpl::Init() {
#endif
}

is_gpu_rasterization_enabled_ = false;
is_gpu_rasterization_forced_ = false;
if (is_impl_side_painting_enabled_ &&
!command_line.HasSwitch(switches::kDisableGpuRasterization)) {
if (command_line.HasSwitch(switches::kForceGpuRasterization)) {
is_gpu_rasterization_forced_ = true;
} else if (command_line.HasSwitch(switches::kEnableGpuRasterization) ||
command_line.HasSwitch(
switches::kEnableBleedingEdgeRenderingFastPaths)) {
is_gpu_rasterization_enabled_ = true;
}
}
is_gpu_rasterization_enabled_ =
command_line.HasSwitch(switches::kEnableGpuRasterization);
is_gpu_rasterization_forced_ =
command_line.HasSwitch(switches::kForceGpuRasterization);

is_low_res_tiling_enabled_ = true;
if (command_line.HasSwitch(switches::kDisableLowResTiling) &&
Expand Down

0 comments on commit b8d82c2

Please sign in to comment.