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 9b323a1 commit 4c426cd
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 @@ -37,14 +36,6 @@ bool LastCheckCrashed/* = false*/;
ANGLE ResolvedANGLE/* = ANGLE::Auto*/;
#endif // Q_OS_WIN

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 @@ -55,8 +46,6 @@ void CrashCheckStart() {

} // namespace

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

Capabilities CheckCapabilities(QWidget *widget) {
if (!Platform::IsMac()) {
if (ForceDisabled) {
Expand Down Expand Up @@ -98,9 +87,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 @@ -175,18 +163,6 @@ Capabilities CheckCapabilities(QWidget *widget) {
LOG(("EGL Extensions: %1").arg(egllist.join(", ")));
#endif // Q_OS_WIN

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 @@ -12,8 +12,6 @@ class QOpenGLContext;

namespace Ui::GL {

extern const char kOptionAllowX11NvidiaOpenGL[];

enum class Backend {
Raster,
OpenGL,
Expand Down

0 comments on commit 4c426cd

Please sign in to comment.