summaryrefslogtreecommitdiffstats
path: root/app/gfx
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-14 19:52:33 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-14 19:52:33 +0000
commit07c11a7688f9677967eae04b237c38c6166420c1 (patch)
treee526d77c746334f87d2f87ae2dfab774760b865f /app/gfx
parenta3bb1a6c553b17964e4e8ee9041b7dff7191364e (diff)
downloadchromium_src-07c11a7688f9677967eae04b237c38c6166420c1.zip
chromium_src-07c11a7688f9677967eae04b237c38c6166420c1.tar.gz
chromium_src-07c11a7688f9677967eae04b237c38c6166420c1.tar.bz2
Revert 71472 - Use GL rather than EGL by default on linux.
Debug Chromium builds display an error if they don't find EGL, even if GLX is available. This prompts people to install the EGL packages, even though that probably isn't their issue. Also, it looks like EGL, even if available, has some issues. If GLX isn't available, it still falls back to EGL. --use-gl=desktop should not be required to force use of GLX on boxes that also have EGL installed. Changed LOG(ERROR) to VLOG(1) if a shared library fails to load since this is not necessarily an error. Report an error only if no GL implementation can be initialized. Log which GL implementation was selected. TEST=launch chrome with various combinations of --use-gl switch and check the log output is correct. BUG=none Review URL: http://codereview.chromium.org/6342001 TBR=apatrick@chromium.org Review URL: http://codereview.chromium.org/6314005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71474 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/gfx')
-rw-r--r--app/gfx/gl/gl_context_linux.cc2
-rw-r--r--app/gfx/gl/gl_implementation.cc53
-rw-r--r--app/gfx/gl/gl_implementation.h3
-rw-r--r--app/gfx/gl/gl_implementation_linux.cc10
-rw-r--r--app/gfx/gl/gl_implementation_mac.cc2
-rw-r--r--app/gfx/gl/gl_implementation_win.cc6
6 files changed, 29 insertions, 47 deletions
diff --git a/app/gfx/gl/gl_context_linux.cc b/app/gfx/gl/gl_context_linux.cc
index 5fa77ce..0f28a1d 100644
--- a/app/gfx/gl/gl_context_linux.cc
+++ b/app/gfx/gl/gl_context_linux.cc
@@ -188,8 +188,8 @@ bool GLContext::InitializeOneOff() {
return true;
static const GLImplementation kAllowedGLImplementations[] = {
- kGLImplementationDesktopGL,
kGLImplementationEGLGLES2,
+ kGLImplementationDesktopGL,
kGLImplementationOSMesaGL
};
diff --git a/app/gfx/gl/gl_implementation.cc b/app/gfx/gl/gl_implementation.cc
index 30ff0e3..fccfb09 100644
--- a/app/gfx/gl/gl_implementation.cc
+++ b/app/gfx/gl/gl_implementation.cc
@@ -21,16 +21,6 @@ const char kGLImplementationMockName[] = "mock";
namespace {
-const struct {
- const char* name;
- GLImplementation implementation;
-} kGLImplementationNamePairs[] = {
- { kGLImplementationDesktopName, kGLImplementationDesktopGL },
- { kGLImplementationOSMesaName, kGLImplementationOSMesaGL },
- { kGLImplementationEGLName, kGLImplementationEGLGLES2 },
- { kGLImplementationMockName, kGLImplementationMockGL }
-};
-
typedef std::vector<base::NativeLibrary> LibraryArray;
GLImplementation g_gl_implementation = kGLImplementationNone;
@@ -50,23 +40,24 @@ void CleanupNativeLibraries(void* unused) {
}
GLImplementation GetNamedGLImplementation(const std::string& name) {
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kGLImplementationNamePairs); ++i) {
- if (name == kGLImplementationNamePairs[i].name)
- return kGLImplementationNamePairs[i].implementation;
+ static const struct {
+ const char* name;
+ GLImplementation implemention;
+ } name_pairs[] = {
+ { kGLImplementationDesktopName, kGLImplementationDesktopGL },
+ { kGLImplementationOSMesaName, kGLImplementationOSMesaGL },
+ { kGLImplementationEGLName, kGLImplementationEGLGLES2 },
+ { kGLImplementationMockName, kGLImplementationMockGL }
+ };
+
+ for (size_t i = 0; i < ARRAYSIZE_UNSAFE(name_pairs); ++i) {
+ if (name == name_pairs[i].name)
+ return name_pairs[i].implemention;
}
return kGLImplementationNone;
}
-const char* GetGLImplementationName(GLImplementation implementation) {
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kGLImplementationNamePairs); ++i) {
- if (implementation == kGLImplementationNamePairs[i].implementation)
- return kGLImplementationNamePairs[i].name;
- }
-
- return "unknown";
-}
-
bool InitializeBestGLBindings(
const GLImplementation* allowed_implementations_begin,
const GLImplementation* allowed_implementations_end) {
@@ -78,29 +69,23 @@ bool InitializeBestGLBindings(
if (std::find(allowed_implementations_begin,
allowed_implementations_end,
requested_implementation) == allowed_implementations_end) {
- LOG(ERROR) << "Requested GL implementation is not available.";
+ LOG(ERROR) << "Requested GL implementation is not allowed.";
return false;
}
- InitializeGLBindings(requested_implementation);
+ if (InitializeGLBindings(requested_implementation))
+ return true;
} else {
for (const GLImplementation* p = allowed_implementations_begin;
p < allowed_implementations_end;
++p) {
if (InitializeGLBindings(*p))
- break;
+ return true;
}
}
- if (GetGLImplementation() == kGLImplementationNone) {
- LOG(ERROR) << "Could not initialize GL.";
- return false;
- } else {
- LOG(INFO) << "Using "
- << GetGLImplementationName(GetGLImplementation())
- << " GL implementation.";
- return true;
- }
+ LOG(ERROR) << "Could not initialize GL.";
+ return false;
}
void SetGLImplementation(GLImplementation implementation) {
diff --git a/app/gfx/gl/gl_implementation.h b/app/gfx/gl/gl_implementation.h
index b8f43f1..2131c19 100644
--- a/app/gfx/gl/gl_implementation.h
+++ b/app/gfx/gl/gl_implementation.h
@@ -49,9 +49,6 @@ GLImplementation GetGLImplementation();
// Get the GL implementation with a given name.
GLImplementation GetNamedGLImplementation(const std::wstring& name);
-// Get the name of a GL implementation.
-const char* GetGLImplementationName(GLImplementation implementation);
-
// Initialize the preferred GL binding from the given list. The preferred GL
// bindings depend on command line switches passed by the user and which GL
// implementations are available and working on the system
diff --git a/app/gfx/gl/gl_implementation_linux.cc b/app/gfx/gl/gl_implementation_linux.cc
index 258650c..8ac29a3 100644
--- a/app/gfx/gl/gl_implementation_linux.cc
+++ b/app/gfx/gl/gl_implementation_linux.cc
@@ -47,7 +47,7 @@ bool InitializeGLBindings(GLImplementation implementation) {
base::NativeLibrary library = base::LoadNativeLibrary(
module_path.Append("libosmesa.so"));
if (!library) {
- VLOG(1) << "libosmesa.so not found";
+ DVLOG(1) << "libosmesa.so not found";
return false;
}
@@ -56,7 +56,7 @@ bool InitializeGLBindings(GLImplementation implementation) {
base::GetFunctionPointerFromNativeLibrary(
library, "OSMesaGetProcAddress"));
if (!get_proc_address) {
- LOG(ERROR) << "OSMesaGetProcAddress not found.";
+ DLOG(ERROR) << "OSMesaGetProcAddress not found.";
base::UnloadNativeLibrary(library);
return false;
}
@@ -73,7 +73,7 @@ bool InitializeGLBindings(GLImplementation implementation) {
base::NativeLibrary library = base::LoadNativeLibrary(
FilePath("libGL.so.1"));
if (!library) {
- VLOG(1) << "libGL.so.1 not found.";
+ LOG(ERROR) << "libGL.so.1 not found.";
return false;
}
@@ -99,14 +99,14 @@ bool InitializeGLBindings(GLImplementation implementation) {
base::NativeLibrary gles_library = base::LoadNativeLibrary(
FilePath("libGLESv2.so"));
if (!gles_library) {
- VLOG(1)(ERROR) << "libGLESv2.so not found";
+ DLOG(ERROR) << "libGLESv2.so not found";
return false;
}
base::NativeLibrary egl_library = base::LoadNativeLibrary(
FilePath("libEGL.so"));
if (!egl_library) {
- VLOG(1) << "libEGL.so not found";
+ DLOG(ERROR) << "libEGL.so not found";
base::UnloadNativeLibrary(gles_library);
return false;
}
diff --git a/app/gfx/gl/gl_implementation_mac.cc b/app/gfx/gl/gl_implementation_mac.cc
index 33f9ea8..0a1d5a5 100644
--- a/app/gfx/gl/gl_implementation_mac.cc
+++ b/app/gfx/gl/gl_implementation_mac.cc
@@ -35,7 +35,7 @@ bool InitializeGLBindings(GLImplementation implementation) {
base::NativeLibrary library = base::LoadNativeLibrary(
module_path.Append("osmesa.so"));
if (!library) {
- VLOG(1) << "osmesa.so not found";
+ DVLOG(1) << "osmesa.so not found";
return false;
}
diff --git a/app/gfx/gl/gl_implementation_win.cc b/app/gfx/gl/gl_implementation_win.cc
index 4ee01c5..c3869b1 100644
--- a/app/gfx/gl/gl_implementation_win.cc
+++ b/app/gfx/gl/gl_implementation_win.cc
@@ -45,7 +45,7 @@ bool InitializeGLBindings(GLImplementation implementation) {
base::NativeLibrary library = base::LoadNativeLibrary(
module_path.Append(L"osmesa.dll"));
if (!library) {
- VLOG(1) << "osmesa.dll not found";
+ DVLOG(1) << "osmesa.dll not found";
return false;
}
@@ -78,7 +78,7 @@ bool InitializeGLBindings(GLImplementation implementation) {
base::NativeLibrary gles_library = base::LoadNativeLibrary(
module_path.Append(L"libglesv2.dll"));
if (!gles_library) {
- VLOG(1) << "libglesv2.dll not found";
+ LOG(ERROR) << "libglesv2.dll not found";
return false;
}
@@ -87,7 +87,7 @@ bool InitializeGLBindings(GLImplementation implementation) {
base::NativeLibrary egl_library = base::LoadNativeLibrary(
module_path.Append(L"libegl.dll"));
if (!egl_library) {
- VLOG(1) << "libegl.dll not found.";
+ LOG(ERROR) << "libegl.dll not found.";
base::UnloadNativeLibrary(gles_library);
return false;
}