From 14030054ebf9fb1b066edab8b4b10bc595aa261f Mon Sep 17 00:00:00 2001 From: "zmo@google.com" Date: Tue, 27 Sep 2011 18:12:55 +0000 Subject: Implement --use-gl=any The behavior is this: if --use-gl=any passes in, and the default GL binding causes GPU features to be blacklisted, fallback to osmesa. Also, in GPU process, if the default binding fails, fallback to osmesa. This option will be used in testing to make sure accelerated path is always tested, if not on GPU, then on top of osmesa. This CL also moves certain functions out of GpuBlacklist to GpuDataManager so we could manage the special cases when --use-gl=osmesa or --use-gl=any is passed. BUG=97675 TEST=bots green Review URL: http://codereview.chromium.org/7967020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102973 0039d316-1c4b-4281-b951-d872f2087c98 --- ui/gfx/gl/gl_implementation.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'ui/gfx/gl') diff --git a/ui/gfx/gl/gl_implementation.cc b/ui/gfx/gl/gl_implementation.cc index ae4b2d6..19cc91c 100644 --- a/ui/gfx/gl/gl_implementation.cc +++ b/ui/gfx/gl/gl_implementation.cc @@ -65,11 +65,18 @@ bool InitializeRequestedGLBindings( const GLImplementation* allowed_implementations_begin, const GLImplementation* allowed_implementations_end, GLImplementation default_implementation) { + bool fallback_to_osmesa = false; if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL)) { std::string requested_implementation_name = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kUseGL); - GLImplementation requested_implementation = + GLImplementation requested_implementation; + if (requested_implementation_name == "any") { + requested_implementation = default_implementation; + fallback_to_osmesa = true; + } else { + requested_implementation = GetNamedGLImplementation(requested_implementation_name); + } if (std::find(allowed_implementations_begin, allowed_implementations_end, requested_implementation) == allowed_implementations_end) { @@ -82,6 +89,9 @@ bool InitializeRequestedGLBindings( InitializeGLBindings(default_implementation); } + if (GetGLImplementation() == kGLImplementationNone && fallback_to_osmesa) + InitializeGLBindings(kGLImplementationOSMesaGL); + if (CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableGPUServiceLogging)) { InitializeDebugGLBindings(); -- cgit v1.1