From 360464fd9d073d3919783ed800fb3b3682a261a0 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 21 Jun 2024 05:00:17 +0400 Subject: [PATCH] Uncomment making the context current in Ui::GL::CheckCapabilities This should properly detect the NVIDIA X11 failure --- ui/gl/gl_detection.cpp | 28 ++-------------------------- ui/gl/gl_detection.h | 2 -- 2 files changed, 2 insertions(+), 28 deletions(-) diff --git a/ui/gl/gl_detection.cpp b/ui/gl/gl_detection.cpp index 91738b2e..e927ff65 100644 --- a/ui/gl/gl_detection.cpp +++ b/ui/gl/gl_detection.cpp @@ -9,7 +9,6 @@ #include "ui/gl/gl_shader.h" #include "ui/integration.h" #include "base/debug_log.h" -#include "base/options.h" #include "base/platform/base_platform_info.h" #include @@ -50,14 +49,6 @@ QList EGLExtensions(not_null context) { } #endif // DESKTOP_APP_USE_ANGLE -base::options::toggle AllowX11NvidiaOpenGL({ - .id = kOptionAllowX11NvidiaOpenGL, - .name = "Allow OpenGL on the NVIDIA drivers (X11)", - .description = "Qt+OpenGL have problems on X11 with NVIDIA drivers.", - .scope = Platform::IsX11, - .restartRequired = true, -}); - void CrashCheckStart() { auto f = QFile(Integration::Instance().openglCheckFilePath()); if (f.open(QIODevice::WriteOnly)) { @@ -68,8 +59,6 @@ void CrashCheckStart() { } // namespace -const char kOptionAllowX11NvidiaOpenGL[] = "allow-linux-nvidia-opengl"; - Capabilities CheckCapabilities(QWidget *widget) { if (!Platform::IsMac()) { if (ForceDisabled) { @@ -111,9 +100,8 @@ Capabilities CheckCapabilities(QWidget *widget) { const auto context = tester.context(); if (!context - || !context->isValid()/* - // This check doesn't work for a widget with WA_NativeWindow. - || !context->makeCurrent(tester.window()->windowHandle())*/) { + || !context->isValid() + || !context->makeCurrent(tester.window()->windowHandle())) { LOG_ONCE(("OpenGL: Could not create widget in a window.")); return {}; } @@ -188,18 +176,6 @@ Capabilities CheckCapabilities(QWidget *widget) { LOG(("EGL Extensions: %1").arg(egllist.join(", "))); #endif // DESKTOP_APP_USE_ANGLE - if (::Platform::IsX11() - && version - && QByteArray(version).contains("NVIDIA")) { - // https://github.com/telegramdesktop/tdesktop/issues/16830 - if (AllowX11NvidiaOpenGL.value()) { - LOG_ONCE(("OpenGL: Allow on NVIDIA driver (experimental).")); - } else { - LOG_ONCE(("OpenGL: Disable on NVIDIA driver on X11.")); - return false; - } - } - return true; }(); if (!checkVendor) { diff --git a/ui/gl/gl_detection.h b/ui/gl/gl_detection.h index d067fa88..633fba30 100644 --- a/ui/gl/gl_detection.h +++ b/ui/gl/gl_detection.h @@ -17,8 +17,6 @@ class QOpenGLContext; namespace Ui::GL { -extern const char kOptionAllowX11NvidiaOpenGL[]; - enum class Backend { Raster, OpenGL,