Add AllowLinuxNvidiaOpenGL option.
This commit is contained in:
parent
dbbec068a8
commit
bbae1c2ae7
2 changed files with 19 additions and 2 deletions
|
|
@ -9,6 +9,7 @@
|
||||||
#include "ui/gl/gl_shader.h"
|
#include "ui/gl/gl_shader.h"
|
||||||
#include "ui/integration.h"
|
#include "ui/integration.h"
|
||||||
#include "base/debug_log.h"
|
#include "base/debug_log.h"
|
||||||
|
#include "base/options.h"
|
||||||
|
|
||||||
#include <QtCore/QSet>
|
#include <QtCore/QSet>
|
||||||
#include <QtCore/QFile>
|
#include <QtCore/QFile>
|
||||||
|
|
@ -34,6 +35,14 @@ bool ForceDisabled/* = false*/;
|
||||||
ANGLE ResolvedANGLE = ANGLE::Auto;
|
ANGLE ResolvedANGLE = ANGLE::Auto;
|
||||||
#endif // Q_OS_WIN
|
#endif // Q_OS_WIN
|
||||||
|
|
||||||
|
base::options::toggle AllowLinuxNvidiaOpenGL({
|
||||||
|
.id = kOptionAllowLinuxNvidiaOpenGL,
|
||||||
|
.name = "Allow OpenGL on the NVIDIA drivers (Linux)",
|
||||||
|
.description = "Qt+OpenGL have problems on Linux with NVIDIA drivers.",
|
||||||
|
.scope = base::options::linux,
|
||||||
|
.restartRequired = true,
|
||||||
|
});
|
||||||
|
|
||||||
void CrashCheckStart() {
|
void CrashCheckStart() {
|
||||||
auto f = QFile(Integration::Instance().openglCheckFilePath());
|
auto f = QFile(Integration::Instance().openglCheckFilePath());
|
||||||
if (f.open(QIODevice::WriteOnly)) {
|
if (f.open(QIODevice::WriteOnly)) {
|
||||||
|
|
@ -44,6 +53,8 @@ void CrashCheckStart() {
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
const char kOptionAllowLinuxNvidiaOpenGL[] = "allow-linux-nvidia-opengl";
|
||||||
|
|
||||||
Capabilities CheckCapabilities(QWidget *widget) {
|
Capabilities CheckCapabilities(QWidget *widget) {
|
||||||
if (ForceDisabled) {
|
if (ForceDisabled) {
|
||||||
LOG_ONCE(("OpenGL: Force-disabled."));
|
LOG_ONCE(("OpenGL: Force-disabled."));
|
||||||
|
|
@ -169,8 +180,12 @@ Capabilities CheckCapabilities(QWidget *widget) {
|
||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
if (version && QByteArray(version).contains("NVIDIA")) {
|
if (version && QByteArray(version).contains("NVIDIA")) {
|
||||||
// https://github.com/telegramdesktop/tdesktop/issues/16830
|
// https://github.com/telegramdesktop/tdesktop/issues/16830
|
||||||
LOG_ONCE(("OpenGL: Disable on NVIDIA driver on Linux."));
|
if (AllowLinuxNvidiaOpenGL.value()) {
|
||||||
return false;
|
LOG_ONCE(("OpenGL: Allow on NVIDIA driver (experimental)."));
|
||||||
|
} else {
|
||||||
|
LOG_ONCE(("OpenGL: Disable on NVIDIA driver on Linux."));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif // Q_OS_LINUX
|
#endif // Q_OS_LINUX
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,8 @@ class QOpenGLContext;
|
||||||
|
|
||||||
namespace Ui::GL {
|
namespace Ui::GL {
|
||||||
|
|
||||||
|
extern const char kOptionAllowLinuxNvidiaOpenGL[];
|
||||||
|
|
||||||
enum class Backend {
|
enum class Backend {
|
||||||
Raster,
|
Raster,
|
||||||
OpenGL,
|
OpenGL,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue