Core uses runtime checks for whether we are on OpenGLES

This commit is contained in:
Martin Gräßlin 2015-10-30 13:18:30 +01:00
parent 14d943caea
commit 004b928c8d
5 changed files with 25 additions and 24 deletions

View file

@ -51,6 +51,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QMenu>
#include <QTimerEvent>
#include <QDateTime>
#include <QOpenGLContext>
#include <KGlobalAccel>
#include <KLocalizedString>
#include <KNotification>
@ -207,14 +208,12 @@ void Compositor::slotCompositingOptionsInitialized()
else {
unsafeConfig.writeEntry(openGLIsUnsafe, true);
unsafeConfig.sync();
#ifndef KWIN_HAVE_OPENGLES
if (!kwinApp()->shouldUseWaylandForCompositing() && !CompositingPrefs::hasGlx()) {
if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL && !kwinApp()->shouldUseWaylandForCompositing() && !CompositingPrefs::hasGlx()) {
unsafeConfig.writeEntry(openGLIsUnsafe, false);
unsafeConfig.sync();
qCDebug(KWIN_CORE) << "No glx extensions available";
break;
}
#endif
m_scene = SceneOpenGL::createScene(this);

View file

@ -30,6 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <ksharedconfig.h>
#include <QDebug>
#include <QOpenGLContext>
#include <QStandardPaths>
#include <qprocess.h>
@ -82,9 +83,9 @@ bool CompositingPrefs::compositingPossible()
if (Xcb::Extensions::self()->isRenderAvailable() && Xcb::Extensions::self()->isFixesAvailable())
return true;
#endif
#ifdef KWIN_HAVE_OPENGLES
return true;
#endif
if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES) {
return true;
}
qCDebug(KWIN_CORE) << "No OpenGL or XRender/XFixes support";
return false;
}

View file

@ -37,6 +37,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#endif
// Qt
#include <QOpenGLContext>
#include <QDBusServiceWatcher>
namespace KWin
@ -200,11 +201,11 @@ QString CompositorDBusInterface::compositingType() const
case XRenderCompositing:
return QStringLiteral("xrender");
case OpenGL2Compositing:
#ifdef KWIN_HAVE_OPENGLES
return QStringLiteral("gles");
#else
return QStringLiteral("gl2");
#endif
if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES) {
return QStringLiteral("gles");
} else {
return QStringLiteral("gl2");
}
case QPainterCompositing:
return QStringLiteral("qpainter");
case NoCompositing:
@ -245,9 +246,9 @@ QStringList CompositorDBusInterface::supportedOpenGLPlatformInterfaces() const
#if HAVE_EPOXY_GLX
supportsGlx = (kwinApp()->operationMode() == Application::OperationModeX11);
#endif
#ifdef KWIN_HAVE_OPENGLES
supportsGlx = false;
#endif
if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES) {
supportsGlx = false;
}
if (supportsGlx) {
interfaces << QStringLiteral("glx");
}

View file

@ -33,6 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "settings.h"
#include "xcbutils.h"
#include <kwinglplatform.h>
#include <QOpenGLContext>
#endif //KCMRULES
@ -768,10 +769,10 @@ void Options::setGlPlatformInterface(OpenGLPlatformInterface interface)
qCDebug(KWIN_CORE) << "Forcing EGL native interface as compiled without GLX support";
interface = EglPlatformInterface;
#endif
#ifdef KWIN_HAVE_OPENGLES
qCDebug(KWIN_CORE) << "Forcing EGL native interface as compiled against OpenGL ES";
interface = EglPlatformInterface;
#endif
if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES) {
qCDebug(KWIN_CORE) << "Forcing EGL native interface as Qt uses OpenGL ES";
interface = EglPlatformInterface;
}
if (m_glPlatformInterface == interface) {
return;

View file

@ -1477,13 +1477,12 @@ QString Workspace::supportInformation() const
switch (effects->compositingType()) {
case OpenGL2Compositing:
case OpenGLCompositing: {
#ifdef KWIN_HAVE_OPENGLES
support.append(QStringLiteral("Compositing Type: OpenGL ES 2.0\n"));
#else
support.append(QStringLiteral("Compositing Type: OpenGL\n"));
#endif
GLPlatform *platform = GLPlatform::instance();
if (platform->isGLES()) {
support.append(QStringLiteral("Compositing Type: OpenGL ES 2.0\n"));
} else {
support.append(QStringLiteral("Compositing Type: OpenGL\n"));
}
support.append(QStringLiteral("OpenGL vendor string: ") + QString::fromUtf8(platform->glVendorString()) + QStringLiteral("\n"));
support.append(QStringLiteral("OpenGL renderer string: ") + QString::fromUtf8(platform->glRendererString()) + QStringLiteral("\n"));
support.append(QStringLiteral("OpenGL version string: ") + QString::fromUtf8(platform->glVersionString()) + QStringLiteral("\n"));