summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/core/surface_factory_qt.cpp40
1 files changed, 32 insertions, 8 deletions
diff --git a/src/core/surface_factory_qt.cpp b/src/core/surface_factory_qt.cpp
index e8be8480..36c05ec5 100644
--- a/src/core/surface_factory_qt.cpp
+++ b/src/core/surface_factory_qt.cpp
@@ -51,27 +51,51 @@
#if defined(USE_OZONE)
#include <EGL/egl.h>
-#include <dlfcn.h>
+
+#ifndef QT_LIBDIR_EGL
+#define QT_LIBDIR_EGL "/usr/lib"
+#endif
+#ifndef QT_LIBDIR_GLES2
+#define QT_LIBDIR_GLES2 QT_LIBDIR_EGL
+#endif
namespace QtWebEngineCore {
+base::NativeLibrary LoadLibrary(const base::FilePath& filename) {
+ base::NativeLibraryLoadError error;
+ base::NativeLibrary library = base::LoadNativeLibrary(filename, &error);
+ if (!library) {
+ LOG(ERROR) << "Failed to load " << filename.MaybeAsASCII() << ": " << error.ToString();
+ return NULL;
+ }
+ return library;
+}
+
bool SurfaceFactoryQt::LoadEGLGLES2Bindings()
{
- base::NativeLibrary eglgles2Library = dlopen(NULL, RTLD_LAZY);
- if (!eglgles2Library) {
- LOG(ERROR) << "Failed to open EGL/GLES2 context " << dlerror();
+ base::FilePath libEGLPath = QtWebEngineCore::toFilePath(QT_LIBDIR_EGL);
+ libEGLPath = libEGLPath.Append("libEGL.so.1");
+ base::NativeLibrary eglLibrary = LoadLibrary(libEGLPath);
+ if (!eglLibrary)
+ return false;
+
+ base::FilePath libGLES2Path = QtWebEngineCore::toFilePath(QT_LIBDIR_GLES2);
+ libGLES2Path = libGLES2Path.Append("libGLESv2.so.2");
+ base::NativeLibrary gles2Library = LoadLibrary(libGLES2Path);
+ if (!gles2Library)
return false;
- }
- gl::GLGetProcAddressProc get_proc_address = reinterpret_cast<gl::GLGetProcAddressProc>(base::GetFunctionPointerFromNativeLibrary(eglgles2Library, "eglGetProcAddress"));
+ gl::GLGetProcAddressProc get_proc_address = reinterpret_cast<gl::GLGetProcAddressProc>(base::GetFunctionPointerFromNativeLibrary(eglLibrary, "eglGetProcAddress"));
if (!get_proc_address) {
LOG(ERROR) << "eglGetProcAddress not found.";
- base::UnloadNativeLibrary(eglgles2Library);
+ base::UnloadNativeLibrary(eglLibrary);
+ base::UnloadNativeLibrary(gles2Library);
return false;
}
gl::SetGLGetProcAddressProc(get_proc_address);
- gl::AddGLNativeLibrary(eglgles2Library);
+ gl::AddGLNativeLibrary(eglLibrary);
+ gl::AddGLNativeLibrary(gles2Library);
return true;
}