Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/x11/standalone/x11_platform.cpp
Show All 21 Lines | |||||
22 | #include <kwinconfig.h> | 22 | #include <kwinconfig.h> | ||
23 | #if HAVE_EPOXY_GLX | 23 | #if HAVE_EPOXY_GLX | ||
24 | #include "glxbackend.h" | 24 | #include "glxbackend.h" | ||
25 | #endif | 25 | #endif | ||
26 | #include "eglonxbackend.h" | 26 | #include "eglonxbackend.h" | ||
27 | #include "screens_xrandr.h" | 27 | #include "screens_xrandr.h" | ||
28 | #include "options.h" | 28 | #include "options.h" | ||
29 | 29 | | |||
30 | #include <KConfigGroup> | ||||
31 | #include <KLocalizedString> | ||||
32 | | ||||
33 | #include <QOpenGLContext> | ||||
30 | #include <QX11Info> | 34 | #include <QX11Info> | ||
31 | 35 | | |||
32 | namespace KWin | 36 | namespace KWin | ||
33 | { | 37 | { | ||
34 | 38 | | |||
35 | X11StandalonePlatform::X11StandalonePlatform(QObject *parent) | 39 | X11StandalonePlatform::X11StandalonePlatform(QObject *parent) | ||
36 | : Platform(parent) | 40 | : Platform(parent) | ||
37 | { | 41 | { | ||
Show All 36 Lines | 77 | { | |||
74 | return new WindowBasedEdge(edges); | 78 | return new WindowBasedEdge(edges); | ||
75 | } | 79 | } | ||
76 | 80 | | |||
77 | bool X11StandalonePlatform::requiresCompositing() const | 81 | bool X11StandalonePlatform::requiresCompositing() const | ||
78 | { | 82 | { | ||
79 | return false; | 83 | return false; | ||
80 | } | 84 | } | ||
81 | 85 | | |||
86 | bool X11StandalonePlatform::openGLCompositingIsBroken() const | ||||
87 | { | ||||
88 | const QString unsafeKey(QLatin1String("OpenGLIsUnsafe") + (kwinApp()->isX11MultiHead() ? QString::number(kwinApp()->x11ScreenNumber()) : QString())); | ||||
89 | return KConfigGroup(kwinApp()->config(), "Compositing").readEntry(unsafeKey, false); | ||||
90 | } | ||||
91 | | ||||
92 | QString X11StandalonePlatform::compositingNotPossibleReason() const | ||||
93 | { | ||||
94 | // first off, check whether we figured that we'll crash on detection because of a buggy driver | ||||
95 | KConfigGroup gl_workaround_group(kwinApp()->config(), "Compositing"); | ||||
96 | const QString unsafeKey(QLatin1String("OpenGLIsUnsafe") + (kwinApp()->isX11MultiHead() ? QString::number(kwinApp()->x11ScreenNumber()) : QString())); | ||||
97 | if (gl_workaround_group.readEntry("Backend", "OpenGL") == QLatin1String("OpenGL") && | ||||
98 | gl_workaround_group.readEntry(unsafeKey, false)) | ||||
99 | return i18n("<b>OpenGL compositing (the default) has crashed KWin in the past.</b><br>" | ||||
100 | "This was most likely due to a driver bug." | ||||
101 | "<p>If you think that you have meanwhile upgraded to a stable driver,<br>" | ||||
102 | "you can reset this protection but <b>be aware that this might result in an immediate crash!</b></p>" | ||||
103 | "<p>Alternatively, you might want to use the XRender backend instead.</p>"); | ||||
104 | | ||||
105 | if (!Xcb::Extensions::self()->isCompositeAvailable() || !Xcb::Extensions::self()->isDamageAvailable()) { | ||||
106 | return i18n("Required X extensions (XComposite and XDamage) are not available."); | ||||
107 | } | ||||
108 | #if !defined( KWIN_HAVE_XRENDER_COMPOSITING ) | ||||
109 | if (!hasGlx()) | ||||
110 | return i18n("GLX/OpenGL are not available and only OpenGL support is compiled."); | ||||
111 | #else | ||||
112 | if (!(hasGlx() | ||||
113 | || (Xcb::Extensions::self()->isRenderAvailable() && Xcb::Extensions::self()->isFixesAvailable()))) { | ||||
114 | return i18n("GLX/OpenGL and XRender/XFixes are not available."); | ||||
115 | } | ||||
116 | #endif | ||||
117 | return QString(); | ||||
118 | } | ||||
119 | | ||||
120 | bool X11StandalonePlatform::compositingPossible() const | ||||
121 | { | ||||
122 | // first off, check whether we figured that we'll crash on detection because of a buggy driver | ||||
123 | KConfigGroup gl_workaround_group(kwinApp()->config(), "Compositing"); | ||||
124 | const QString unsafeKey(QLatin1String("OpenGLIsUnsafe") + (kwinApp()->isX11MultiHead() ? QString::number(kwinApp()->x11ScreenNumber()) : QString())); | ||||
125 | if (gl_workaround_group.readEntry("Backend", "OpenGL") == QLatin1String("OpenGL") && | ||||
126 | gl_workaround_group.readEntry(unsafeKey, false)) | ||||
127 | return false; | ||||
128 | | ||||
129 | | ||||
130 | if (!Xcb::Extensions::self()->isCompositeAvailable()) { | ||||
131 | qCDebug(KWIN_CORE) << "No composite extension available"; | ||||
132 | return false; | ||||
133 | } | ||||
134 | if (!Xcb::Extensions::self()->isDamageAvailable()) { | ||||
135 | qCDebug(KWIN_CORE) << "No damage extension available"; | ||||
136 | return false; | ||||
137 | } | ||||
138 | if (hasGlx()) | ||||
139 | return true; | ||||
140 | #ifdef KWIN_HAVE_XRENDER_COMPOSITING | ||||
141 | if (Xcb::Extensions::self()->isRenderAvailable() && Xcb::Extensions::self()->isFixesAvailable()) | ||||
142 | return true; | ||||
143 | #endif | ||||
144 | if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES) { | ||||
145 | return true; | ||||
146 | } else if (qstrcmp(qgetenv("KWIN_COMPOSE"), "O2ES") == 0) { | ||||
147 | return true; | ||||
148 | } | ||||
149 | qCDebug(KWIN_CORE) << "No OpenGL or XRender/XFixes support"; | ||||
150 | return false; | ||||
151 | } | ||||
152 | | ||||
153 | bool X11StandalonePlatform::hasGlx() | ||||
154 | { | ||||
155 | return Xcb::Extensions::self()->hasGlx(); | ||||
156 | } | ||||
82 | 157 | | |||
83 | } | 158 | } |