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

Unified Diff: android_webview/browser/deferred_gpu_command_service.cc

Issue 1778693002: Revert of Get rid of gpu related switches by passing gpu::GpuPreferences via IPC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | content/browser/android/synchronous_compositor_base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/browser/deferred_gpu_command_service.cc
diff --git a/android_webview/browser/deferred_gpu_command_service.cc b/android_webview/browser/deferred_gpu_command_service.cc
index 9021deb94f7ebb00d2d4fa74bc2e0901dfe4077b..d2a19f681b0d4625113ccbd138a4926f034a27ee 100644
--- a/android_webview/browser/deferred_gpu_command_service.cc
+++ b/android_webview/browser/deferred_gpu_command_service.cc
@@ -12,7 +12,6 @@
#include "base/synchronization/lock.h"
#include "base/trace_event/trace_event.h"
#include "content/public/browser/android/synchronous_compositor.h"
-#include "content/public/browser/gpu_utils.h"
#include "content/public/common/content_switches.h"
#include "gpu/command_buffer/service/framebuffer_completeness_cache.h"
#include "gpu/command_buffer/service/gpu_preferences.h"
@@ -28,6 +27,75 @@
base::LazyInstance<scoped_refptr<DeferredGpuCommandService> >
g_service = LAZY_INSTANCE_INITIALIZER;
+bool GetSizeTFromSwitch(const base::CommandLine* command_line,
+ const base::StringPiece& switch_string,
+ size_t* value) {
+ if (!command_line->HasSwitch(switch_string))
+ return false;
+ std::string switch_value(command_line->GetSwitchValueASCII(switch_string));
+ return base::StringToSizeT(switch_value, value);
+}
+
+gpu::GpuPreferences GetGpuPreferencesFromCommandLine() {
+ // TODO(penghuang): share below code with content/gpu/gpu_child_thread.cc
+ // http://crbug.com/590825
+ DCHECK(base::CommandLine::InitializedForCurrentProcess());
+ const base::CommandLine* command_line =
+ base::CommandLine::ForCurrentProcess();
+ gpu::GpuPreferences gpu_preferences;
+ gpu_preferences.single_process =
+ command_line->HasSwitch(switches::kSingleProcess);
+ gpu_preferences.in_process_gpu =
+ command_line->HasSwitch(switches::kInProcessGPU);
+ gpu_preferences.ui_prioritize_in_gpu_process =
+ command_line->HasSwitch(switches::kUIPrioritizeInGpuProcess);
+ gpu_preferences.compile_shader_always_succeeds =
+ command_line->HasSwitch(switches::kCompileShaderAlwaysSucceeds);
+ gpu_preferences.disable_gl_error_limit =
+ command_line->HasSwitch(switches::kDisableGLErrorLimit);
+ gpu_preferences.disable_glsl_translator =
+ command_line->HasSwitch(switches::kDisableGLSLTranslator);
+ gpu_preferences.disable_gpu_driver_bug_workarounds =
+ command_line->HasSwitch(switches::kDisableGpuDriverBugWorkarounds);
+ gpu_preferences.disable_shader_name_hashing =
+ command_line->HasSwitch(switches::kDisableShaderNameHashing);
+ gpu_preferences.enable_gpu_command_logging =
+ command_line->HasSwitch(switches::kEnableGPUCommandLogging);
+ gpu_preferences.enable_gpu_debugging =
+ command_line->HasSwitch(switches::kEnableGPUDebugging);
+ gpu_preferences.enable_gpu_service_logging_gpu =
+ command_line->HasSwitch(switches::kEnableGPUServiceLoggingGPU);
+ gpu_preferences.disable_gpu_program_cache =
+ command_line->HasSwitch(switches::kDisableGpuProgramCache);
+ gpu_preferences.enforce_gl_minimums =
+ command_line->HasSwitch(switches::kEnforceGLMinimums);
+ if (GetSizeTFromSwitch(command_line, switches::kForceGpuMemAvailableMb,
+ &gpu_preferences.force_gpu_mem_available)) {
+ gpu_preferences.force_gpu_mem_available *= 1024 * 1024;
+ }
+ if (GetSizeTFromSwitch(command_line, switches::kGpuProgramCacheSizeKb,
+ &gpu_preferences.gpu_program_cache_size)) {
+ gpu_preferences.gpu_program_cache_size *= 1024;
+ }
+ gpu_preferences.enable_share_group_async_texture_upload =
+ command_line->HasSwitch(switches::kEnableShareGroupAsyncTextureUpload);
+ gpu_preferences.enable_subscribe_uniform_extension =
+ command_line->HasSwitch(switches::kEnableSubscribeUniformExtension);
+ gpu_preferences.enable_threaded_texture_mailboxes =
+ command_line->HasSwitch(switches::kEnableThreadedTextureMailboxes);
+ gpu_preferences.gl_shader_interm_output =
+ command_line->HasSwitch(switches::kGLShaderIntermOutput);
+ gpu_preferences.emulate_shader_precision =
+ command_line->HasSwitch(switches::kEmulateShaderPrecision);
+ gpu_preferences.enable_gpu_service_logging =
+ command_line->HasSwitch(switches::kEnableGPUServiceLogging);
+ gpu_preferences.enable_gpu_service_tracing =
+ command_line->HasSwitch(switches::kEnableGPUServiceTracing);
+ gpu_preferences.enable_unsafe_es3_apis =
+ command_line->HasSwitch(switches::kEnableUnsafeES3APIs);
+ return gpu_preferences;
+}
+
} // namespace
base::LazyInstance<base::ThreadLocalBoolean> ScopedAllowGL::allow_gl;
@@ -72,8 +140,7 @@
}
DeferredGpuCommandService::DeferredGpuCommandService()
- : gpu::InProcessCommandBuffer::Service(
- content::GetGpuPreferencesFromCommandLine()),
+ : gpu::InProcessCommandBuffer::Service(GetGpuPreferencesFromCommandLine()),
sync_point_manager_(new gpu::SyncPointManager(true)) {
}
« no previous file with comments | « no previous file | content/browser/android/synchronous_compositor_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698