diff options
author | zmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-28 21:26:56 +0000 |
---|---|---|
committer | zmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-28 21:26:56 +0000 |
commit | a605729023f03852a0cbeefbab5d59cc29b84aeb (patch) | |
tree | c95e133af58cb458d5476bab3b61a90831a5869c | |
parent | 6f9382246177f915fe14d5700d7c1f733b9bd80b (diff) | |
download | chromium_src-a605729023f03852a0cbeefbab5d59cc29b84aeb.zip chromium_src-a605729023f03852a0cbeefbab5d59cc29b84aeb.tar.gz chromium_src-a605729023f03852a0cbeefbab5d59cc29b84aeb.tar.bz2 |
Add --gpu-no-context-lost commandline switch.
At the moment chrome users with GLES backend do not have accelerated 2d canvas if a graphics context could be lost. Unfortunately we don't have a way to know if a GLES backend does or does not lose context in situations like entering power saving mode, screen saving mode, etc. This switch basically tells chrome the backend does not lose context, thus, enable accelerated 2d canvas.
BUG=90464
TEST=bots green, passing this switch with GLES backend enables accelerated 2d canvas
Review URL: http://codereview.chromium.org/7530008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94548 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | content/browser/gpu/gpu_process_host.cc | 5 | ||||
-rw-r--r-- | content/gpu/gpu_info_collector_linux.cc | 16 | ||||
-rw-r--r-- | ui/gfx/gl/gl_switches.cc | 11 | ||||
-rw-r--r-- | ui/gfx/gl/gl_switches.h | 3 |
4 files changed, 25 insertions, 10 deletions
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc index e689b07..34e83ac 100644 --- a/content/browser/gpu/gpu_process_host.cc +++ b/content/browser/gpu/gpu_process_host.cc @@ -521,7 +521,7 @@ bool GpuProcessHost::LaunchGpuProcess() { // Propagate relevant command line switches. static const char* const kSwitchNames[] = { - switches::kUseGL, + switches::kDisableGLMultisampling, switches::kDisableGpuSandbox, switches::kDisableGpuVsync, switches::kDisableGpuWatchdog, @@ -531,10 +531,11 @@ bool GpuProcessHost::LaunchGpuProcess() { #if defined(OS_MACOSX) switches::kEnableSandboxLogging, #endif + switches::kGpuNoContextLost, switches::kGpuStartupDialog, switches::kLoggingLevel, switches::kNoSandbox, - switches::kDisableGLMultisampling, + switches::kUseGL, }; cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames, arraysize(kSwitchNames)); diff --git a/content/gpu/gpu_info_collector_linux.cc b/content/gpu/gpu_info_collector_linux.cc index c8115bf3..79b1cce 100644 --- a/content/gpu/gpu_info_collector_linux.cc +++ b/content/gpu/gpu_info_collector_linux.cc @@ -7,6 +7,7 @@ #include <dlfcn.h> #include <vector> +#include "base/command_line.h" #include "base/file_util.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" @@ -17,6 +18,7 @@ #include "ui/gfx/gl/gl_bindings.h" #include "ui/gfx/gl/gl_context.h" #include "ui/gfx/gl/gl_implementation.h" +#include "ui/gfx/gl/gl_switches.h" namespace { @@ -192,10 +194,16 @@ namespace gpu_info_collector { bool CollectGraphicsInfo(GPUInfo* gpu_info) { DCHECK(gpu_info); - // TODO(zmo): need to consider the case where we are running on top of - // desktop GL and GL_ARB_robustness extension is available. - gpu_info->can_lose_context = - (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2); + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kGpuNoContextLost)) { + gpu_info->can_lose_context = false; + } else { + // TODO(zmo): need to consider the case where we are running on top + // of desktop GL and GL_ARB_robustness extension is available. + gpu_info->can_lose_context = + (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2); + } + gpu_info->finalized = true; return CollectGraphicsInfoGL(gpu_info); } diff --git a/ui/gfx/gl/gl_switches.cc b/ui/gfx/gl/gl_switches.cc index b7aa18c..3644323 100644 --- a/ui/gfx/gl/gl_switches.cc +++ b/ui/gfx/gl/gl_switches.cc @@ -18,6 +18,10 @@ namespace switches { // Stop the GPU from synchronizing on the vsync before presenting. const char kDisableGpuVsync[] = "disable-gpu-vsync"; +// Turns on GPU logging (debug build only). +const char kEnableGPUServiceLogging[] = "enable-gpu-service-logging"; +const char kEnableGPUClientLogging[] = "enable-gpu-client-logging"; + // Select which implementation of GL the GPU process should use. Options are: // desktop: whatever desktop OpenGL the user has installed (Linux and Mac // default). @@ -26,8 +30,9 @@ const char kDisableGpuVsync[] = "disable-gpu-vsync"; // osmesa: The OSMesa software renderer. const char kUseGL[] = "use-gl"; -// Turns on GPU logging (debug build only). -const char kEnableGPUServiceLogging[] = "enable-gpu-service-logging"; -const char kEnableGPUClientLogging[] = "enable-gpu-client-logging"; +// Inform Chrome that a GPU context will not be lost in power saving mode, +// screen saving mode, etc. Note that this flag does not ensure that a GPU +// context will never be lost in any situations, say, a GPU reset. +const char kGpuNoContextLost[] = "gpu-no-context-lost"; } // namespace switches diff --git a/ui/gfx/gl/gl_switches.h b/ui/gfx/gl/gl_switches.h index 62f826e..74646c1 100644 --- a/ui/gfx/gl/gl_switches.h +++ b/ui/gfx/gl/gl_switches.h @@ -21,9 +21,10 @@ extern const char kGLImplementationMockName[]; namespace switches { extern const char kDisableGpuVsync[]; -extern const char kUseGL[]; extern const char kEnableGPUServiceLogging[]; extern const char kEnableGPUClientLogging[]; +extern const char kGpuNoContextLost[]; +extern const char kUseGL[]; } // namespace switches |