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

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

Issue 2715563002: Moving SwiftShader from component to bundled library (Closed)
Patch Set: Specify x11 only support on Linux Created 3 years, 10 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
Index: content/browser/gpu/gpu_data_manager_impl_private.cc
diff --git a/content/browser/gpu/gpu_data_manager_impl_private.cc b/content/browser/gpu/gpu_data_manager_impl_private.cc
index 8d21371fd09cb5f40b3f03622d96e787eb5c1ab4..826d2469f2c0eaad827f8c4a0e2d2146be28404c 100644
--- a/content/browser/gpu/gpu_data_manager_impl_private.cc
+++ b/content/browser/gpu/gpu_data_manager_impl_private.cc
@@ -43,6 +43,7 @@
#include "gpu/ipc/service/switches.h"
#include "media/media_features.h"
#include "ui/base/ui_base_switches.h"
+#include "ui/gl/gl_features.h"
#include "ui/gl/gl_implementation.h"
#include "ui/gl/gl_switches.h"
#include "ui/gl/gpu_switching_manager.h"
@@ -295,7 +296,8 @@ bool GpuDataManagerImplPrivate::IsFeatureBlacklisted(int feature) const {
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::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)
+ if (feature == gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS ||
+ feature == gpu::GPU_FEATURE_TYPE_WEBGL2)
grt (UTC plus 2) 2017/02/27 09:31:55 nit: add braces since the condition now spans two
sugoi 2017/02/28 16:45:10 Done.
return true;
return false;
}
@@ -316,7 +318,8 @@ bool GpuDataManagerImplPrivate::IsDriverBugWorkaroundActive(int feature) const {
size_t GpuDataManagerImplPrivate::GetBlacklistedFeatureCount() const {
if (use_swiftshader_)
- return 1;
+ return 2; // GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS and
+ // GPU_FEATURE_TYPE_WEBGL2
return blacklisted_features_.size();
}
@@ -440,12 +443,6 @@ bool GpuDataManagerImplPrivate::ShouldUseSwiftShader() const {
return use_swiftshader_;
}
-void GpuDataManagerImplPrivate::RegisterSwiftShaderPath(
- const base::FilePath& path) {
- swiftshader_path_ = path;
- EnableSwiftShaderIfNecessary();
-}
-
void GpuDataManagerImplPrivate::AddObserver(GpuDataManagerObserver* observer) {
GpuDataManagerImpl::UnlockedSession session(owner_);
observer_list_->AddObserver(observer);
@@ -670,10 +667,6 @@ void GpuDataManagerImplPrivate::UpdateGpuInfoHelper() {
}
void GpuDataManagerImplPrivate::UpdateGpuInfo(const gpu::GPUInfo& gpu_info) {
- // No further update of gpu_info if falling back to SwiftShader.
- if (use_swiftshader_)
jbauman 2017/02/25 00:30:15 I think we still need this so we don't try to upda
sugoi 2017/02/28 16:45:10 Done.
- return;
-
bool was_info_available = IsCompleteGpuInfoAvailable();
gpu::MergeGPUInfo(&gpu_info_, gpu_info);
if (IsCompleteGpuInfoAvailable()) {
@@ -754,11 +747,6 @@ void GpuDataManagerImplPrivate::AppendGpuCommandLine(
else
command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "false");
- if (!swiftshader_path_.empty()) {
- command_line->AppendSwitchPath(switches::kSwiftShaderPath,
- swiftshader_path_);
- }
-
if (!gpu_driver_bugs_.empty()) {
command_line->AppendSwitchASCII(switches::kGpuDriverBugWorkarounds,
IntSetToString(gpu_driver_bugs_));
@@ -1139,8 +1127,6 @@ GpuDataManagerImplPrivate::GpuDataManagerImplPrivate(GpuDataManagerImpl* owner)
DCHECK(owner_);
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
- swiftshader_path_ = command_line->GetSwitchValuePath(
- switches::kSwiftShaderPath);
if (ShouldDisableHardwareAcceleration())
DisableHardwareAcceleration();
@@ -1243,13 +1229,13 @@ void GpuDataManagerImplPrivate::NotifyGpuInfoUpdate() {
}
void GpuDataManagerImplPrivate::EnableSwiftShaderIfNecessary() {
- if (!GpuAccessAllowed(NULL) ||
- blacklisted_features_.count(gpu::GPU_FEATURE_TYPE_WEBGL)) {
- if (!swiftshader_path_.empty() &&
- !base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kDisableSoftwareRasterizer))
- use_swiftshader_ = true;
- }
+#if BUILDFLAG(ENABLE_SWIFTSHADER)
+ use_swiftshader_ =
+ (!GpuAccessAllowed(NULL) ||
grt (UTC plus 2) 2017/02/27 09:31:55 nit: NULL -> nullptr
sugoi 2017/02/28 16:45:09 Done.
+ blacklisted_features_.count(gpu::GPU_FEATURE_TYPE_WEBGL)) &&
+ !base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableSoftwareRasterizer);
+#endif
}
std::string GpuDataManagerImplPrivate::GetDomainFromURL(

Powered by Google App Engine
This is Rietveld 408576698