summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2018-11-01 12:45:29 +0100
committerJani Heikkinen <jani.heikkinen@qt.io>2018-11-02 05:12:41 +0000
commit9ad3c7aa8c8cd2917191b0b90d048d7d8fcebab5 (patch)
tree3d44afc1de6b277d23707cf5ad59930407e51848
parent55175a9f4c2ffd4df3da8a8a23485beb236c77b1 (diff)
Add missing fallback for glxGetProcAddress
This fallback was added in 5.11, however fell out somehow during ozone change. Fixes: QTBUG-70696 Change-Id: I68d12842e2283a25db64035e57d5a19323b4e6c0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r--src/core/ozone/gl_ozone_glx_qt.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/core/ozone/gl_ozone_glx_qt.cpp b/src/core/ozone/gl_ozone_glx_qt.cpp
index 9a0fea7c..2e7a28a0 100644
--- a/src/core/ozone/gl_ozone_glx_qt.cpp
+++ b/src/core/ozone/gl_ozone_glx_qt.cpp
@@ -41,7 +41,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
+#include <QGuiApplication>
#include "gl_ozone_glx_qt.h"
#include "gl_surface_glx_qt.h"
#include "ui/gl/gl_context_glx.h"
@@ -49,6 +49,13 @@
#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
+
namespace ui {
bool GLOzoneGLXQt::InitializeGLOneOffPlatform() {
@@ -72,6 +79,16 @@ bool GLOzoneGLXQt::InitializeStaticGLBindings(
reinterpret_cast<gl::GLGetProcAddressProc>(
base::GetFunctionPointerFromNativeLibrary(library,
"glXGetProcAddress"));
+
+#ifndef QT_NO_OPENGL
+ if (!get_proc_address) {
+ // 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);