summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2018-04-24 07:25:38 +0200
committerJani Heikkinen <jani.heikkinen@qt.io>2018-05-01 12:14:30 +0000
commit2370f8f6afb6d477123de85be3a988993d4b351e (patch)
tree114b40881e9750023dea2d9a5d790e500666250b
parent3fe37b2be241d6f3c3a7f682f5ecd4b1393168a9 (diff)
Add fallback to qpa when query for glXGetProcAddress
Seems that with pyqt we have to fallback to qpa. Task-number: QTBUG-67898 Change-Id: I70889b4f5858f675e4692858de3dcb111c64c147 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--src/core/gl_surface_qt.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/core/gl_surface_qt.cpp b/src/core/gl_surface_qt.cpp
index 8bfbd865c..0d143ee18 100644
--- a/src/core/gl_surface_qt.cpp
+++ b/src/core/gl_surface_qt.cpp
@@ -72,6 +72,14 @@
#include "ozone/gl_surface_glx_qt.h"
#include "ui/gl/gl_glx_api_implementation.h"
#include <dlfcn.h>
+
+#ifndef QT_NO_OPENGL
+#include <QOpenGLContext>
+QT_BEGIN_NAMESPACE
+Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context();
+QT_END_NAMESPACE
+#endif
+
#endif
#include "ozone/gl_surface_egl_qt.h"
@@ -195,10 +203,20 @@ bool InitializeStaticGLBindings(GLImplementation implementation) {
reinterpret_cast<GLGetProcAddressProc>(
base::GetFunctionPointerFromNativeLibrary(library,
"glXGetProcAddress"));
+
+#ifndef QT_NO_OPENGL
if (!get_proc_address) {
- LOG(ERROR) << "glxGetProcAddress not found.";
- base::UnloadNativeLibrary(library);
- return false;
+ // glx handle not loaded , fallback to qpa
+ if (QOpenGLContext *context = qt_gl_global_share_context()) {
+ get_proc_address = reinterpret_cast<gl::GLGetProcAddressProc>(
+ context->getProcAddress("glXGetProcAddress"));
+ }
+ }
+#endif
+ if (!get_proc_address) {
+ LOG(ERROR) << "glxGetProcAddress not found.";
+ base::UnloadNativeLibrary(library);
+ return false;
}
SetGLGetProcAddressProc(get_proc_address);