From 991c5681b88c15d59498f193850a226d46c126eb Mon Sep 17 00:00:00 2001 From: "backer@chromium.org" Date: Mon, 30 Jan 2012 13:32:34 +0000 Subject: Reland 119457: --test-gl-lib for GpuPixelBrowserTests This CL causes the GpuPixelBrowserTests to load libllvmpipe.so (if it is available) and fallback to standard libGL.so otherwise. This is so that we can do a smoke test of the GPU accelerated display path on the Aura dbg bot on the Chromium waterfall. BUG=none TEST=none Review URL: https://chromiumcodereview.appspot.com/9298022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119667 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/test/gpu/gpu_pixel_browsertest.cc | 3 +++ ui/gfx/gl/gl_implementation_linux.cc | 17 ++++++++++++++--- ui/gfx/gl/gl_switches.cc | 6 +++++- ui/gfx/gl/gl_switches.h | 3 ++- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/chrome/test/gpu/gpu_pixel_browsertest.cc b/chrome/test/gpu/gpu_pixel_browsertest.cc index b4b98c3..649eddd 100644 --- a/chrome/test/gpu/gpu_pixel_browsertest.cc +++ b/chrome/test/gpu/gpu_pixel_browsertest.cc @@ -26,6 +26,7 @@ #include "third_party/skia/include/core/SkColor.h" #include "ui/gfx/codec/png_codec.h" #include "ui/gfx/compositor/compositor_setup.h" +#include "ui/gfx/gl/gl_switches.h" #include "ui/gfx/size.h" namespace { @@ -71,6 +72,8 @@ class GpuPixelBrowserTest : public InProcessBrowserTest { virtual void SetUpCommandLine(CommandLine* command_line) { InProcessBrowserTest::SetUpCommandLine(command_line); + command_line->AppendSwitchASCII(switches::kTestGLLib, + "libllvmpipe.so"); // This enables DOM automation for tab contents. EnableDOMAutomation(); diff --git a/ui/gfx/gl/gl_implementation_linux.cc b/ui/gfx/gl/gl_implementation_linux.cc index 9819b2b..5f96ed1 100644 --- a/ui/gfx/gl/gl_implementation_linux.cc +++ b/ui/gfx/gl/gl_implementation_linux.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -13,6 +13,7 @@ #include "base/threading/thread_restrictions.h" #include "ui/gfx/gl/gl_bindings.h" #include "ui/gfx/gl/gl_implementation.h" +#include "ui/gfx/gl/gl_switches.h" namespace gfx { namespace { @@ -102,11 +103,21 @@ bool InitializeGLBindings(GLImplementation implementation) { break; } case kGLImplementationDesktopGL: { + base::NativeLibrary library = NULL; + const CommandLine* command_line = CommandLine::ForCurrentProcess(); + + if (command_line->HasSwitch(switches::kTestGLLib)) + library = LoadLibrary(command_line->GetSwitchValueASCII( + switches::kTestGLLib).c_str()); + + if (!library) { #if defined(OS_OPENBSD) - base::NativeLibrary library = LoadLibrary("libGL.so"); + library = LoadLibrary("libGL.so"); #else - base::NativeLibrary library = LoadLibrary("libGL.so.1"); + library = LoadLibrary("libGL.so.1"); #endif + } + if (!library) return false; diff --git a/ui/gfx/gl/gl_switches.cc b/ui/gfx/gl/gl_switches.cc index 2fed5ee..38828f3 100644 --- a/ui/gfx/gl/gl_switches.cc +++ b/ui/gfx/gl/gl_switches.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -39,4 +39,8 @@ const char kSwiftShaderPath[] = "swiftshader-path"; // context will never be lost in any situations, say, a GPU reset. const char kGpuNoContextLost[] = "gpu-no-context-lost"; +// Flag used for Linux tests: for desktop GL bindings, try to load this GL +// library first, but fall back to regular library if loading fails. +const char kTestGLLib[] = "test-gl-lib"; + } // namespace switches diff --git a/ui/gfx/gl/gl_switches.h b/ui/gfx/gl/gl_switches.h index ed6df57..6f4460e 100644 --- a/ui/gfx/gl/gl_switches.h +++ b/ui/gfx/gl/gl_switches.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -30,6 +30,7 @@ GL_EXPORT extern const char kEnableGPUClientLogging[]; GL_EXPORT extern const char kGpuNoContextLost[]; GL_EXPORT extern const char kUseGL[]; GL_EXPORT extern const char kSwiftShaderPath[]; +GL_EXPORT extern const char kTestGLLib[]; } // namespace switches -- cgit v1.1