Skip to content

Commit

Permalink
Uncomment making the context current in Ui::GL::CheckCapabilities
Browse files Browse the repository at this point in the history
This should properly detect the NVIDIA X11 failure
  • Loading branch information
ilya-fedin authored and john-preston committed Jun 21, 2024
1 parent 3fb4226 commit 360464f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 28 deletions.
28 changes: 2 additions & 26 deletions ui/gl/gl_detection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <QtCore/QSet>
Expand Down Expand Up @@ -50,14 +49,6 @@ QList<QByteArray> EGLExtensions(not_null<QOpenGLContext*> 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)) {
Expand All @@ -68,8 +59,6 @@ void CrashCheckStart() {

} // namespace

const char kOptionAllowX11NvidiaOpenGL[] = "allow-linux-nvidia-opengl";

Capabilities CheckCapabilities(QWidget *widget) {
if (!Platform::IsMac()) {
if (ForceDisabled) {
Expand Down Expand Up @@ -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 {};
}
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 0 additions & 2 deletions ui/gl/gl_detection.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ class QOpenGLContext;

namespace Ui::GL {

extern const char kOptionAllowX11NvidiaOpenGL[];

enum class Backend {
Raster,
OpenGL,
Expand Down

0 comments on commit 360464f

Please sign in to comment.