From a40850f0c165045fd037ff945b00b643031700a9 Mon Sep 17 00:00:00 2001
From: Michal Klocek <michal.klocek@qt.io>
Date: Tue, 10 Apr 2018 10:57:18 +0200
Subject: [PATCH] Move check for g_egl_surfaceless_context_supported

The check g_egl_surfaceless_context_supported can not take place in
InitializeExtensionSettingsOneOff since correct surface/less
initialization is required for gpu info collection which
is initialized with InitializeGLNoExtensionsOneOff. Otherwise
egl with pbuffers is only supported, which will fail on wayland.
Move the check to InitializeOneOff.

Task-number: QTBUG-65682
Change-Id: I0f5107134366f141e1941e824e3238473383962a
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
---
 src/core/ozone/gl_surface_egl_qt.cpp | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/src/core/ozone/gl_surface_egl_qt.cpp b/src/core/ozone/gl_surface_egl_qt.cpp
index 0f21b8dfe..e4dc738aa 100644
--- a/src/core/ozone/gl_surface_egl_qt.cpp
+++ b/src/core/ozone/gl_surface_egl_qt.cpp
@@ -89,15 +89,6 @@ bool GLSurfaceEGLQt::InitializeOneOff()
         return false;
     }
 
-    s_initialized = true;
-    return true;
-}
-
-bool GLSurfaceEGLQt::InitializeExtensionSettingsOneOff()
-{
-    if (!s_initialized)
-        return false;
-
     g_extensions = eglQueryString(g_display, EGL_EXTENSIONS);
     g_egl_surfaceless_context_supported = ExtensionsContain(g_extensions, "EGL_KHR_surfaceless_context");
     if (g_egl_surfaceless_context_supported) {
@@ -116,10 +107,15 @@ bool GLSurfaceEGLQt::InitializeExtensionSettingsOneOff()
             context->ReleaseCurrent(surface.get());
         }
     }
-
+    s_initialized = true;
     return true;
 }
 
+bool GLSurfaceEGLQt::InitializeExtensionSettingsOneOff()
+{
+    return s_initialized;
+}
+
 bool GLSurfaceEGL::InitializeExtensionSettingsOneOff()
 {
     return GLSurfaceEGLQt::InitializeExtensionSettingsOneOff();
-- 
GitLab