41836b065f
in glxconvenience/qglxconvenience.cpp in qtbase-opensource-src-5.2.0-allow-forcing-llvmpipe.patch
51 lines
2.1 KiB
Diff
51 lines
2.1 KiB
Diff
diff -ur qtbase-opensource-src-5.2.0/src/platformsupport/glxconvenience/qglxconvenience.cpp qtbase-opensource-src-5.2.0-allow-forcing-llvmpipe/src/platformsupport/glxconvenience/qglxconvenience.cpp
|
|
--- qtbase-opensource-src-5.2.0/src/platformsupport/glxconvenience/qglxconvenience.cpp 2013-12-08 18:09:47.000000000 +0100
|
|
+++ qtbase-opensource-src-5.2.0-allow-forcing-llvmpipe/src/platformsupport/glxconvenience/qglxconvenience.cpp 2014-01-29 18:18:47.000000000 +0100
|
|
@@ -43,6 +43,7 @@
|
|
|
|
#include <QtCore/QVector>
|
|
#include <QtCore/QVarLengthArray>
|
|
+#include <QtCore/QByteArray>
|
|
|
|
#ifndef QT_NO_XRENDER
|
|
#include <X11/extensions/Xrender.h>
|
|
@@ -116,6 +117,27 @@
|
|
|
|
GLXFBConfig qglx_findConfig(Display *display, int screen , const QSurfaceFormat &format, int drawableBit)
|
|
{
|
|
+ // Allow forcing LIBGL_ALWAYS_SOFTWARE for Qt 5 applications only.
|
|
+ // This is most useful with drivers that only support OpenGL 1.
|
|
+ // We need OpenGL 2, but the user probably doesn't want
|
|
+ // LIBGL_ALWAYS_SOFTWARE in OpenGL 1 apps.
|
|
+ static bool checkedForceSoftwareOpenGL = false;
|
|
+ static bool forceSoftwareOpenGL = false;
|
|
+ if (!checkedForceSoftwareOpenGL) {
|
|
+ // If LIBGL_ALWAYS_SOFTWARE is already set, don't mess with it.
|
|
+ // We want to unset LIBGL_ALWAYS_SOFTWARE at the end so it does not
|
|
+ // get inherited by other processes, of course only if it wasn't
|
|
+ // already set before.
|
|
+ if (!qEnvironmentVariableIsEmpty("QT_XCB_FORCE_SOFTWARE_OPENGL")
|
|
+ && !qEnvironmentVariableIsSet("LIBGL_ALWAYS_SOFTWARE"))
|
|
+ forceSoftwareOpenGL = true;
|
|
+
|
|
+ checkedForceSoftwareOpenGL = true;
|
|
+ }
|
|
+
|
|
+ if (forceSoftwareOpenGL)
|
|
+ qputenv("LIBGL_ALWAYS_SOFTWARE", QByteArrayLiteral("1"));
|
|
+
|
|
bool reduced = true;
|
|
GLXFBConfig chosenConfig = 0;
|
|
QSurfaceFormat reducedFormat = format;
|
|
@@ -159,6 +181,10 @@
|
|
reducedFormat = qglx_reduceSurfaceFormat(reducedFormat,&reduced);
|
|
}
|
|
|
|
+ // unset LIBGL_ALWAYS_SOFTWARE now so other processes don't inherit it
|
|
+ if (forceSoftwareOpenGL)
|
|
+ qunsetenv("LIBGL_ALWAYS_SOFTWARE");
|
|
+
|
|
return chosenConfig;
|
|
}
|
|
|