Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(551)

Unified Diff: content/browser/gpu/gpu_data_manager_impl.cc

Issue 13983014: [CLOSED] Cleaning up the plethora of switches for GPU vs software vs SwiftShader. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/gpu/gpu_data_manager_impl.h ('k') | content/browser/gpu/gpu_data_manager_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/gpu/gpu_data_manager_impl.cc
diff --git a/content/browser/gpu/gpu_data_manager_impl.cc b/content/browser/gpu/gpu_data_manager_impl.cc
index 589ff0bbe4ba12fbf6cfaeb5c666b299a53c1813..f1efb6605b00f5877d1f696b1a7f61e1a95b1b3b 100644
--- a/content/browser/gpu/gpu_data_manager_impl.cc
+++ b/content/browser/gpu/gpu_data_manager_impl.cc
@@ -20,6 +20,7 @@
#include "base/sys_info.h"
#include "base/values.h"
#include "base/version.h"
+#include "cc/base/switches.h"
#include "content/browser/gpu/gpu_process_host.h"
#include "content/browser/gpu/gpu_util.h"
#include "content/common/gpu/gpu_messages.h"
@@ -46,6 +47,8 @@
namespace content {
namespace {
+const bool DISABLE_GPU = true;
+
// Strip out the non-digital info; if after that, we get an empty string,
// return "0".
std::string ProcessVersionString(const std::string& raw_string) {
@@ -121,9 +124,9 @@ void GpuDataManagerImpl::InitializeForTesting(
}
bool GpuDataManagerImpl::IsFeatureBlacklisted(int feature) const {
- if (software_rendering_) {
- // Skia's software rendering is probably more efficient than going through
- // software emulation of the GPU, so use that.
+ if (use_swiftshader_) {
+ // Skia's rendering is more efficient than going through
+ // SwiftShader emulation, so use that.
if (feature == GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)
return true;
return false;
@@ -133,7 +136,7 @@ bool GpuDataManagerImpl::IsFeatureBlacklisted(int feature) const {
}
size_t GpuDataManagerImpl::GetBlacklistedFeatureCount() const {
- if (software_rendering_)
+ if (use_swiftshader_)
return 1;
return blacklisted_features_.size();
}
@@ -168,7 +171,7 @@ void GpuDataManagerImpl::GetGpuProcessHandles(
}
bool GpuDataManagerImpl::GpuAccessAllowed() const {
- if (software_rendering_)
+ if (use_swiftshader_)
return true;
if (!gpu_info_.gpu_accessible)
@@ -225,13 +228,13 @@ void GpuDataManagerImpl::RequestVideoMemoryUsageStatsUpdate() const {
new GpuMsg_GetVideoMemoryUsageStats());
}
-bool GpuDataManagerImpl::ShouldUseSoftwareRendering() const {
- return software_rendering_;
+bool GpuDataManagerImpl::ShouldUseSwiftShader() const {
+ return use_swiftshader_;
}
void GpuDataManagerImpl::RegisterSwiftShaderPath(const base::FilePath& path) {
swiftshader_path_ = path;
- EnableSoftwareRenderingIfNecessary();
+ EnableSwiftShaderIfNecessary();
}
void GpuDataManagerImpl::AddObserver(GpuDataManagerObserver* observer) {
@@ -348,8 +351,8 @@ void GpuDataManagerImpl::Initialize() {
}
void GpuDataManagerImpl::UpdateGpuInfo(const GPUInfo& gpu_info) {
- // No further update of gpu_info if falling back to software renderer.
- if (software_rendering_)
+ // No further update of gpu_info if falling back to SwiftShader.
+ if (use_swiftshader_)
return;
GPUInfo my_gpu_info;
@@ -399,6 +402,30 @@ void GpuDataManagerImpl::AppendRendererCommandLine(
CommandLine* command_line) const {
DCHECK(command_line);
+ if (DISABLE_GPU) {
+ if (!command_line->HasSwitch(switches::kAllowWebUICompositing))
+ command_line->AppendSwitch(switches::kAllowWebUICompositing);
+ if (!command_line->HasSwitch(switches::kDisableGpu))
+ command_line->AppendSwitch(switches::kDisableGpu);
+#ifndef OS_ANDROID
+ if (!command_line->HasSwitch(switches::kDisableExperimentalWebGL))
+ command_line->AppendSwitch(switches::kDisableExperimentalWebGL);
+#endif
+ if (!command_line->HasSwitch(switches::kDisablePepper3d))
+ command_line->AppendSwitch(switches::kDisablePepper3d);
+ if (!command_line->HasSwitch(switches::kDisableAcceleratedPlugins))
+ command_line->AppendSwitch(switches::kDisableAcceleratedPlugins);
+ if (!command_line->HasSwitch(switches::kDisableAccelerated2dCanvas))
+ command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas);
+ if (!command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode))
+ command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode);
+ if (!command_line->HasSwitch(switches::kDisableFlashFullscreen3d))
+ command_line->AppendSwitch(switches::kDisableFlashFullscreen3d);
+ if (!command_line->HasSwitch(cc::switches::kEnableCompositorFrameMessage))
+ command_line->AppendSwitch(cc::switches::kEnableCompositorFrameMessage);
+ return;
+ }
+
if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_WEBGL)) {
#if !defined(OS_ANDROID)
if (!command_line->HasSwitch(switches::kDisableExperimentalWebGL))
@@ -419,7 +446,7 @@ void GpuDataManagerImpl::AppendRendererCommandLine(
if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) &&
!command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode))
command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode);
- if (ShouldUseSoftwareRendering())
+ if (ShouldUseSwiftShader())
command_line->AppendSwitch(switches::kDisableFlashFullscreen3d);
}
@@ -438,7 +465,7 @@ void GpuDataManagerImpl::AppendGpuCommandLine(
if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_TEXTURE_SHARING))
command_line->AppendSwitch(switches::kDisableImageTransportSurface);
- if (software_rendering_) {
+ if (use_swiftshader_) {
command_line->AppendSwitchASCII(switches::kUseGL, "swiftshader");
if (swiftshader_path.empty())
swiftshader_path = swiftshader_path_;
@@ -538,6 +565,23 @@ void GpuDataManagerImpl::AppendPluginCommandLine(
void GpuDataManagerImpl::UpdateRendererWebPrefs(
webkit_glue::WebPreferences* prefs) const {
DCHECK(prefs);
+
+ if (DISABLE_GPU) {
+ prefs->force_compositing_mode = true;
+ prefs->accelerated_compositing_enabled = true;
+ prefs->accelerated_compositing_for_3d_transforms_enabled = true;
+ prefs->accelerated_compositing_for_animation_enabled = true;
+ prefs->experimental_webgl_enabled = false;
+ prefs->flash_3d_enabled = false;
+ prefs->flash_stage3d_enabled = false;
+ prefs->flash_stage3d_baseline_enabled = false;
+ prefs->accelerated_2d_canvas_enabled = false;
+ prefs->gl_multisampling_enabled = false;
+ prefs->accelerated_compositing_for_video_enabled = false;
+ prefs->accelerated_compositing_for_plugins_enabled = false;
+ return;
+ }
+
if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING))
prefs->accelerated_compositing_enabled = false;
if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_WEBGL))
@@ -561,9 +605,9 @@ void GpuDataManagerImpl::UpdateRendererWebPrefs(
if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_ACCELERATED_VIDEO))
prefs->accelerated_compositing_for_video_enabled = false;
- // Accelerated video and animation are slower than regular when using a
- // software 3d rasterizer. 3D CSS may also be too slow to be worthwhile.
- if (ShouldUseSoftwareRendering()) {
+ // Accelerated video and animation are slower than regular when using
+ // SwiftShader. 3D CSS may also be too slow to be worthwhile.
+ if (ShouldUseSwiftShader()) {
prefs->accelerated_compositing_for_video_enabled = false;
prefs->accelerated_compositing_for_animation_enabled = false;
prefs->accelerated_compositing_for_3d_transforms_enabled = false;
@@ -583,7 +627,7 @@ void GpuDataManagerImpl::DisableHardwareAcceleration() {
for (int i = 0; i < NUMBER_OF_GPU_FEATURE_TYPES; ++i)
blacklisted_features_.insert(i);
- EnableSoftwareRenderingIfNecessary();
+ EnableSwiftShaderIfNecessary();
NotifyGpuInfoUpdate();
}
@@ -646,7 +690,7 @@ bool GpuDataManagerImpl::IsUsingAcceleratedSurface() const {
if (gpu_info_.amd_switchable)
return false;
- if (software_rendering_)
+ if (use_swiftshader_)
return false;
CommandLine* command_line = CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kDisableImageTransportSurface))
@@ -685,7 +729,7 @@ GpuDataManagerImpl::GpuDataManagerImpl()
: complete_gpu_info_already_requested_(false),
gpu_switching_(GPU_SWITCHING_OPTION_AUTOMATIC),
observer_list_(new GpuDataManagerObserverList),
- software_rendering_(false),
+ use_swiftshader_(false),
card_blacklisted_(false),
update_histograms_(true),
window_count_(0),
@@ -769,7 +813,7 @@ void GpuDataManagerImpl::UpdateBlacklistedFeatures(
blacklisted_features_.insert(GPU_FEATURE_TYPE_WEBGL);
}
- EnableSoftwareRenderingIfNecessary();
+ EnableSwiftShaderIfNecessary();
}
void GpuDataManagerImpl::UpdatePreliminaryBlacklistedFeatures() {
@@ -799,13 +843,13 @@ void GpuDataManagerImpl::NotifyGpuInfoUpdate() {
observer_list_->Notify(&GpuDataManagerObserver::OnGpuInfoUpdate);
}
-void GpuDataManagerImpl::EnableSoftwareRenderingIfNecessary() {
+void GpuDataManagerImpl::EnableSwiftShaderIfNecessary() {
if (!GpuAccessAllowed() ||
blacklisted_features_.count(GPU_FEATURE_TYPE_WEBGL)) {
if (!swiftshader_path_.empty() &&
!CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableSoftwareRasterizer))
- software_rendering_ = true;
+ use_swiftshader_ = true;
}
}
« no previous file with comments | « content/browser/gpu/gpu_data_manager_impl.h ('k') | content/browser/gpu/gpu_data_manager_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698