diff --git a/app/widget/viewer/viewerglwidget.cpp b/app/widget/viewer/viewerglwidget.cpp index afcc0cb76..f092edab7 100644 --- a/app/widget/viewer/viewerglwidget.cpp +++ b/app/widget/viewer/viewerglwidget.cpp @@ -31,6 +31,10 @@ #include "render/backend/opengl/openglshader.h" #include "render/pixelservice.h" +#ifdef Q_OS_LINUX +bool ViewerGLWidget::nouveau_check_done_ = false; +#endif + ViewerGLWidget::ViewerGLWidget(QWidget *parent) : QOpenGLWidget(parent), ocio_lut_(0), @@ -170,6 +174,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(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() @@ -224,6 +243,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()) { diff --git a/app/widget/viewer/viewerglwidget.h b/app/widget/viewer/viewerglwidget.h index b26414b2c..ce925b9b6 100644 --- a/app/widget/viewer/viewerglwidget.h +++ b/app/widget/viewer/viewerglwidget.h @@ -191,6 +191,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 @@ -202,6 +206,13 @@ private slots: */ void RefreshColorPipeline(); +#ifdef Q_OS_LINUX + /** + * @brief Shows warning messagebox if Nouveau is detected + */ + void ShowNouveauWarning(); +#endif + }; #endif // VIEWERGLWIDGET_H