viewer: detect nouveau and warn
Nouveau has poor compatibility with Olive (and most other graphically intensive applications). For user benefit, we throw a warning messagebox if we detect the user is using Nouveau.
This commit is contained in:
@@ -28,6 +28,10 @@
|
||||
#include "render/backend/opengl/openglrenderfunctions.h"
|
||||
#include "render/backend/opengl/openglshader.h"
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
bool ViewerGLWidget::nouveau_check_done_ = false;
|
||||
#endif
|
||||
|
||||
ViewerGLWidget::ViewerGLWidget(QWidget *parent) :
|
||||
QOpenGLWidget(parent),
|
||||
texture_(0),
|
||||
@@ -132,6 +136,21 @@ void ViewerGLWidget::initializeGL()
|
||||
SetupColorProcessor();
|
||||
|
||||
connect(context(), SIGNAL(aboutToBeDestroyed()), this, SLOT(ContextCleanup()), Qt::DirectConnection);
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
if (!nouveau_check_done_) {
|
||||
const char* vendor = reinterpret_cast<const char*>(context()->functions()->glGetString(GL_VENDOR));
|
||||
|
||||
if (!strcmp(vendor, "nouveau")) {
|
||||
// Working with Qt widgets in this function segfaults, so we queue the messagebox for later
|
||||
QMetaObject::invokeMethod(this,
|
||||
"ShowNouveauWarning",
|
||||
Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
nouveau_check_done_ = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void ViewerGLWidget::paintGL()
|
||||
@@ -185,6 +204,18 @@ void ViewerGLWidget::RefreshColorPipeline()
|
||||
update();
|
||||
}
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
void ViewerGLWidget::ShowNouveauWarning()
|
||||
{
|
||||
QMessageBox::warning(this,
|
||||
tr("Driver Warning"),
|
||||
tr("Olive has detected your system is using the Nouveau graphics driver.\n\nThis driver is "
|
||||
"known to have stability and performance issues with Olive. It is highly recommended "
|
||||
"you install the proprietary NVIDIA driver before continuing to use Olive."),
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
#endif
|
||||
|
||||
void ViewerGLWidget::SetupColorProcessor()
|
||||
{
|
||||
if (!context()) {
|
||||
|
||||
@@ -186,6 +186,10 @@ private:
|
||||
*/
|
||||
QMatrix4x4 matrix_;
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
static bool nouveau_check_done_;
|
||||
#endif
|
||||
|
||||
private slots:
|
||||
/**
|
||||
* @brief Slot to connect just before the OpenGL context is destroyed to clean up resources
|
||||
@@ -197,6 +201,13 @@ private slots:
|
||||
*/
|
||||
void RefreshColorPipeline();
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
/**
|
||||
* @brief Shows warning messagebox if Nouveau is detected
|
||||
*/
|
||||
void ShowNouveauWarning();
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#endif // VIEWERGLWIDGET_H
|
||||
|
||||
Reference in New Issue
Block a user