diff options
author | skaslev@chromium.org <skaslev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-23 19:39:00 +0000 |
---|---|---|
committer | skaslev@chromium.org <skaslev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-23 19:39:00 +0000 |
commit | 7dcb858349ca4aa8ac26357adda7de0441b01528 (patch) | |
tree | cc51527a6f2a6276b7d45c96fb981e1076e68ea2 /content/browser/gpu | |
parent | 3c30585426cfcf1b7118a62e8939199435cee616 (diff) | |
download | chromium_src-7dcb858349ca4aa8ac26357adda7de0441b01528.zip chromium_src-7dcb858349ca4aa8ac26357adda7de0441b01528.tar.gz chromium_src-7dcb858349ca4aa8ac26357adda7de0441b01528.tar.bz2 |
Renamed 'software_rendering' to 'swiftshader' to differentiate from
the new Skia software compositing mode.
BUG=230120
Review URL: https://chromiumcodereview.appspot.com/14146011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195881 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/gpu')
-rw-r--r-- | content/browser/gpu/compositor_util.cc | 4 | ||||
-rw-r--r-- | content/browser/gpu/gpu_data_manager_impl.cc | 39 | ||||
-rw-r--r-- | content/browser/gpu/gpu_data_manager_impl.h | 14 | ||||
-rw-r--r-- | content/browser/gpu/gpu_data_manager_impl_unittest.cc | 22 | ||||
-rw-r--r-- | content/browser/gpu/gpu_internals_ui.cc | 3 | ||||
-rw-r--r-- | content/browser/gpu/gpu_process_host.cc | 32 | ||||
-rw-r--r-- | content/browser/gpu/gpu_process_host.h | 5 |
7 files changed, 56 insertions, 63 deletions
diff --git a/content/browser/gpu/compositor_util.cc b/content/browser/gpu/compositor_util.cc index e586726..114987e 100644 --- a/content/browser/gpu/compositor_util.cc +++ b/content/browser/gpu/compositor_util.cc @@ -24,8 +24,8 @@ bool CanDoAcceleratedCompositing() { manager->IsFeatureBlacklisted(GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING)) return false; - // Check for the software rasterizer (SwiftShader). - if (manager->ShouldUseSoftwareRendering()) + // Check for SwiftShader. + if (manager->ShouldUseSwiftShader()) return false; const CommandLine& command_line = *CommandLine::ForCurrentProcess(); diff --git a/content/browser/gpu/gpu_data_manager_impl.cc b/content/browser/gpu/gpu_data_manager_impl.cc index 589ff0b..e6fc470 100644 --- a/content/browser/gpu/gpu_data_manager_impl.cc +++ b/content/browser/gpu/gpu_data_manager_impl.cc @@ -121,7 +121,7 @@ void GpuDataManagerImpl::InitializeForTesting( } bool GpuDataManagerImpl::IsFeatureBlacklisted(int feature) const { - if (software_rendering_) { + if (use_swiftshader_) { // Skia's software rendering is probably more efficient than going through // software emulation of the GPU, so use that. if (feature == GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS) @@ -133,7 +133,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 +168,7 @@ void GpuDataManagerImpl::GetGpuProcessHandles( } bool GpuDataManagerImpl::GpuAccessAllowed() const { - if (software_rendering_) + if (use_swiftshader_) return true; if (!gpu_info_.gpu_accessible) @@ -225,13 +225,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 +348,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; @@ -419,7 +419,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 +438,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 +538,7 @@ void GpuDataManagerImpl::AppendPluginCommandLine( void GpuDataManagerImpl::UpdateRendererWebPrefs( webkit_glue::WebPreferences* prefs) const { DCHECK(prefs); + if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING)) prefs->accelerated_compositing_enabled = false; if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_WEBGL)) @@ -561,9 +562,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 +584,7 @@ void GpuDataManagerImpl::DisableHardwareAcceleration() { for (int i = 0; i < NUMBER_OF_GPU_FEATURE_TYPES; ++i) blacklisted_features_.insert(i); - EnableSoftwareRenderingIfNecessary(); + EnableSwiftShaderIfNecessary(); NotifyGpuInfoUpdate(); } @@ -646,7 +647,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 +686,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 +770,7 @@ void GpuDataManagerImpl::UpdateBlacklistedFeatures( blacklisted_features_.insert(GPU_FEATURE_TYPE_WEBGL); } - EnableSoftwareRenderingIfNecessary(); + EnableSwiftShaderIfNecessary(); } void GpuDataManagerImpl::UpdatePreliminaryBlacklistedFeatures() { @@ -799,13 +800,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; } } diff --git a/content/browser/gpu/gpu_data_manager_impl.h b/content/browser/gpu/gpu_data_manager_impl.h index 020501e..0bca69b 100644 --- a/content/browser/gpu/gpu_data_manager_impl.h +++ b/content/browser/gpu/gpu_data_manager_impl.h @@ -76,7 +76,7 @@ class CONTENT_EXPORT GpuDataManagerImpl virtual void RequestCompleteGpuInfoIfNeeded() OVERRIDE; virtual bool IsCompleteGpuInfoAvailable() const OVERRIDE; virtual void RequestVideoMemoryUsageStatsUpdate() const OVERRIDE; - virtual bool ShouldUseSoftwareRendering() const OVERRIDE; + virtual bool ShouldUseSwiftShader() const OVERRIDE; virtual void RegisterSwiftShaderPath(const base::FilePath& path) OVERRIDE; virtual void AddObserver(GpuDataManagerObserver* observer) OVERRIDE; virtual void RemoveObserver(GpuDataManagerObserver* observer) OVERRIDE; @@ -192,11 +192,11 @@ class CONTENT_EXPORT GpuDataManagerImpl FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, GpuSideExceptions); FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, DisableHardwareAcceleration); - FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, SoftwareRendering); - FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, SoftwareRendering2); + FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, SwiftShaderRendering); + FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, SwiftShaderRendering2); FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, GpuInfoUpdate); FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, - NoGpuInfoUpdateWithSoftwareRendering); + NoGpuInfoUpdateWithSwiftShader); FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, GPUVideoMemoryUsageStatsUpdate); FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, @@ -233,8 +233,8 @@ class CONTENT_EXPORT GpuDataManagerImpl // Notify all observers whenever there is a GPU info update. void NotifyGpuInfoUpdate(); - // Try to switch to software rendering, if possible and necessary. - void EnableSoftwareRenderingIfNecessary(); + // Try to switch to SwiftShader rendering, if possible and necessary. + void EnableSwiftShaderIfNecessary(); // Helper to extract the domain from a given URL. std::string GetDomainFromURL(const GURL& url) const; @@ -273,7 +273,7 @@ class CONTENT_EXPORT GpuDataManagerImpl ListValue log_messages_; mutable base::Lock log_messages_lock_; - bool software_rendering_; + bool use_swiftshader_; base::FilePath swiftshader_path_; diff --git a/content/browser/gpu/gpu_data_manager_impl_unittest.cc b/content/browser/gpu/gpu_data_manager_impl_unittest.cc index 64795c5..95d7ea0 100644 --- a/content/browser/gpu/gpu_data_manager_impl_unittest.cc +++ b/content/browser/gpu/gpu_data_manager_impl_unittest.cc @@ -214,46 +214,46 @@ TEST_F(GpuDataManagerImplTest, DisableHardwareAcceleration) { manager->GetBlacklistedFeatureCount()); } -TEST_F(GpuDataManagerImplTest, SoftwareRendering) { +TEST_F(GpuDataManagerImplTest, SwiftShaderRendering) { // Blacklist, then register SwiftShader. ScopedGpuDataManagerImpl manager; ASSERT_TRUE(manager.get()); EXPECT_EQ(0u, manager->GetBlacklistedFeatureCount()); EXPECT_TRUE(manager->GpuAccessAllowed()); - EXPECT_FALSE(manager->ShouldUseSoftwareRendering()); + EXPECT_FALSE(manager->ShouldUseSwiftShader()); manager->DisableHardwareAcceleration(); EXPECT_FALSE(manager->GpuAccessAllowed()); - EXPECT_FALSE(manager->ShouldUseSoftwareRendering()); + EXPECT_FALSE(manager->ShouldUseSwiftShader()); - // If software rendering is enabled, even if we blacklist GPU, + // If SwiftShader is enabled, even if we blacklist GPU, // GPU process is still allowed. const base::FilePath test_path(FILE_PATH_LITERAL("AnyPath")); manager->RegisterSwiftShaderPath(test_path); - EXPECT_TRUE(manager->ShouldUseSoftwareRendering()); + EXPECT_TRUE(manager->ShouldUseSwiftShader()); EXPECT_TRUE(manager->GpuAccessAllowed()); EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount()); EXPECT_TRUE( manager->IsFeatureBlacklisted(GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)); } -TEST_F(GpuDataManagerImplTest, SoftwareRendering2) { +TEST_F(GpuDataManagerImplTest, SwiftShaderRendering2) { // Register SwiftShader, then blacklist. ScopedGpuDataManagerImpl manager; ASSERT_TRUE(manager.get()); EXPECT_EQ(0u, manager->GetBlacklistedFeatureCount()); EXPECT_TRUE(manager->GpuAccessAllowed()); - EXPECT_FALSE(manager->ShouldUseSoftwareRendering()); + EXPECT_FALSE(manager->ShouldUseSwiftShader()); const base::FilePath test_path(FILE_PATH_LITERAL("AnyPath")); manager->RegisterSwiftShaderPath(test_path); EXPECT_EQ(0u, manager->GetBlacklistedFeatureCount()); EXPECT_TRUE(manager->GpuAccessAllowed()); - EXPECT_FALSE(manager->ShouldUseSoftwareRendering()); + EXPECT_FALSE(manager->ShouldUseSwiftShader()); manager->DisableHardwareAcceleration(); EXPECT_TRUE(manager->GpuAccessAllowed()); - EXPECT_TRUE(manager->ShouldUseSoftwareRendering()); + EXPECT_TRUE(manager->ShouldUseSwiftShader()); EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount()); EXPECT_TRUE( manager->IsFeatureBlacklisted(GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)); @@ -281,14 +281,14 @@ TEST_F(GpuDataManagerImplTest, GpuInfoUpdate) { EXPECT_TRUE(observer.gpu_info_updated()); } -TEST_F(GpuDataManagerImplTest, NoGpuInfoUpdateWithSoftwareRendering) { +TEST_F(GpuDataManagerImplTest, NoGpuInfoUpdateWithSwiftShader) { ScopedGpuDataManagerImpl manager; ASSERT_TRUE(manager.get()); manager->DisableHardwareAcceleration(); const base::FilePath test_path(FILE_PATH_LITERAL("AnyPath")); manager->RegisterSwiftShaderPath(test_path); - EXPECT_TRUE(manager->ShouldUseSoftwareRendering()); + EXPECT_TRUE(manager->ShouldUseSwiftShader()); EXPECT_TRUE(manager->GpuAccessAllowed()); { diff --git a/content/browser/gpu/gpu_internals_ui.cc b/content/browser/gpu/gpu_internals_ui.cc index 6f589c8..d8ac963 100644 --- a/content/browser/gpu/gpu_internals_ui.cc +++ b/content/browser/gpu/gpu_internals_ui.cc @@ -368,8 +368,7 @@ base::Value* GetFeatureStatus() { else status += "_off"; } - } else if (GpuDataManagerImpl::GetInstance()-> - ShouldUseSoftwareRendering()) { + } else if (GpuDataManagerImpl::GetInstance()->ShouldUseSwiftShader()) { status = "unavailable_software"; } else if (kGpuFeatureInfo[i].blocked || gpu_access_blocked) { diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc index 2d2a5e2..d39d870 100644 --- a/content/browser/gpu/gpu_process_host.cc +++ b/content/browser/gpu/gpu_process_host.cc @@ -325,13 +325,13 @@ bool GpuProcessHost::ValidateHost(GpuProcessHost* host) { if (!host) return false; - // The Gpu process is invalid if it's not using software, the card is + // The Gpu process is invalid if it's not using SwiftShader, the card is // blacklisted, and we can kill it and start over. if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess) || CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessGPU) || (host->valid_ && - (host->software_rendering() || - !GpuDataManagerImpl::GetInstance()->ShouldUseSoftwareRendering()))) { + (host->swiftshader_rendering_ || + !GpuDataManagerImpl::GetInstance()->ShouldUseSwiftShader()))) { return true; } @@ -423,7 +423,7 @@ GpuProcessHost::GpuProcessHost(int host_id, GpuProcessKind kind) : host_id_(host_id), valid_(true), in_process_(false), - software_rendering_(false), + swiftshader_rendering_(false), kind_(kind), process_launched_(false), initialized_(false), @@ -467,20 +467,19 @@ GpuProcessHost::~GpuProcessHost() { static int gpu_recent_crash_count = 0; static base::Time last_gpu_crash_time; static bool crashed_before = false; - static int gpu_software_crash_count = 0; + static int swiftshader_crash_count = 0; // Ending only acts as a failure if the GPU process was actually started and // was intended for actual rendering (and not just checking caps or other // options). if (process_launched_ && kind_ == GPU_PROCESS_KIND_SANDBOXED) { - if (software_rendering_) { - UMA_HISTOGRAM_ENUMERATION("GPU.SoftwareRendererLifetimeEvents", - DIED_FIRST_TIME + gpu_software_crash_count, + if (swiftshader_rendering_) { + UMA_HISTOGRAM_ENUMERATION("GPU.SwiftShaderLifetimeEvents", + DIED_FIRST_TIME + swiftshader_crash_count, GPU_PROCESS_LIFETIME_EVENT_MAX); - if (++gpu_software_crash_count >= kGpuMaxCrashCount) { - // The software renderer is too unstable to use. Disable it for current - // session. + if (++swiftshader_crash_count >= kGpuMaxCrashCount) { + // SwiftShader is too unstable to use. Disable it for current session. gpu_enabled_ = false; } } else { @@ -1055,10 +1054,6 @@ void GpuProcessHost::OnProcessCrashed(int exit_code) { process_->GetTerminationStatus(NULL)); } -bool GpuProcessHost::software_rendering() { - return software_rendering_; -} - GpuProcessHost::GpuProcessKind GpuProcessHost::kind() { return kind_; } @@ -1084,7 +1079,7 @@ void GpuProcessHost::EndFrameSubscription(int surface_id) { bool GpuProcessHost::LaunchGpuProcess(const std::string& channel_id) { if (!(gpu_enabled_ && - GpuDataManagerImpl::GetInstance()->ShouldUseSoftwareRendering()) && + GpuDataManagerImpl::GetInstance()->ShouldUseSwiftShader()) && !hardware_gpu_enabled_) { SendOutstandingReplies(); return false; @@ -1156,11 +1151,12 @@ bool GpuProcessHost::LaunchGpuProcess(const std::string& channel_id) { GpuDataManagerImpl::GetInstance()->AppendGpuCommandLine(cmd_line); if (cmd_line->HasSwitch(switches::kUseGL)) { - software_rendering_ = + swiftshader_rendering_ = (cmd_line->GetSwitchValueASCII(switches::kUseGL) == "swiftshader"); } - UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessSoftwareRendering", software_rendering_); + UMA_HISTOGRAM_BOOLEAN("GPU.GPU.GPUProcessSoftwareRendering", + swiftshader_rendering_); // If specified, prepend a launcher program to the command line. if (!gpu_launcher.empty()) diff --git a/content/browser/gpu/gpu_process_host.h b/content/browser/gpu/gpu_process_host.h index 4d99c9e..35195b6 100644 --- a/content/browser/gpu/gpu_process_host.h +++ b/content/browser/gpu/gpu_process_host.h @@ -118,9 +118,6 @@ class GpuProcessHost : public BrowserChildProcessHostDelegate, // Tells the GPU process to delete image. void DeleteImage(int client_id, int image_id, int sync_point); - // Whether this GPU process is set up to use software rendering. - bool software_rendering(); - // What kind of GPU process, e.g. sandboxed or unsandboxed. GpuProcessKind kind(); @@ -213,7 +210,7 @@ class GpuProcessHost : public BrowserChildProcessHostDelegate, // of a separate GPU process. bool in_process_; - bool software_rendering_; + bool swiftshader_rendering_; GpuProcessKind kind_; scoped_ptr<GpuMainThread> in_process_gpu_thread_; |