From be375614971d89365138fa4b899239da729940cb Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 12 Apr 2023 13:16:00 +0200 Subject: [PATCH] Default NVidia EGL to GLES2 Found some documentation saying NVidia provided desktop GL for development purposes only, and recommmended against using it. Not sure if that applied to all NVidia drivers, or only that one embedded platform, but since we have multiple bugs about EGL not working on NVidia, default to using GLES2 like it suggested. Change-Id: If8ac8dd61c4ceb88162360f1eaa2a096acefa9c6 Pick-to: 6.5 6.2 Fixes: QTBUG-105921 Reviewed-by: Laszlo Agocs --- src/gui/opengl/platform/egl/qeglconvenience.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/opengl/platform/egl/qeglconvenience.cpp b/src/gui/opengl/platform/egl/qeglconvenience.cpp index 3d5b99c38c..5124e2e5dc 100644 --- a/src/gui/opengl/platform/egl/qeglconvenience.cpp +++ b/src/gui/opengl/platform/egl/qeglconvenience.cpp @@ -216,14 +216,17 @@ EGLConfig QEglConfigChooser::chooseConfig() configureAttributes.append(EGL_OPENVG_BIT); break; #ifdef EGL_VERSION_1_4 - case QSurfaceFormat::DefaultRenderableType: + case QSurfaceFormat::DefaultRenderableType: { #ifndef QT_NO_OPENGL - if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) + // NVIDIA EGL only provides desktop GL for development purposes, and recommends against using it. + const char *vendor = eglQueryString(display(), EGL_VENDOR); + if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL && (!vendor || !strstr(vendor, "NVIDIA"))) configureAttributes.append(EGL_OPENGL_BIT); else #endif // QT_NO_OPENGL needsES2Plus = true; break; + } case QSurfaceFormat::OpenGL: configureAttributes.append(EGL_OPENGL_BIT); break; @@ -353,6 +356,7 @@ QSurfaceFormat q_glFormatFromConfig(EGLDisplay display, const EGLConfig config, else if (referenceFormat.renderableType() == QSurfaceFormat::DefaultRenderableType #ifndef QT_NO_OPENGL && QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL + && !strstr(eglQueryString(display, EGL_VENDOR), "NVIDIA") #endif && (renderableType & EGL_OPENGL_BIT)) format.setRenderableType(QSurfaceFormat::OpenGL);