Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/x11/common/eglonxbackend.cpp
Show All 16 Lines | |||||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | #include "eglonxbackend.h" | 20 | #include "eglonxbackend.h" | ||
21 | // kwin | 21 | // kwin | ||
22 | #include "main.h" | 22 | #include "main.h" | ||
23 | #include "options.h" | 23 | #include "options.h" | ||
24 | #include "overlaywindow.h" | 24 | #include "overlaywindow.h" | ||
25 | #include "platform.h" | ||||
25 | #include "screens.h" | 26 | #include "screens.h" | ||
26 | #include "xcbutils.h" | 27 | #include "xcbutils.h" | ||
27 | // kwin libs | 28 | // kwin libs | ||
28 | #include <kwinglplatform.h> | 29 | #include <kwinglplatform.h> | ||
29 | // Qt | 30 | // Qt | ||
30 | #include <QDebug> | 31 | #include <QDebug> | ||
31 | #include <QOpenGLContext> | 32 | #include <QOpenGLContext> | ||
32 | // system | 33 | // system | ||
▲ Show 20 Lines • Show All 133 Lines • ▼ Show 20 Line(s) | 94 | { | |||
166 | } | 167 | } | ||
167 | 168 | | |||
168 | initWayland(); | 169 | initWayland(); | ||
169 | } | 170 | } | ||
170 | 171 | | |||
171 | bool EglOnXBackend::initRenderingContext() | 172 | bool EglOnXBackend::initRenderingContext() | ||
172 | { | 173 | { | ||
173 | initClientExtensions(); | 174 | initClientExtensions(); | ||
174 | EGLDisplay dpy; | 175 | EGLDisplay dpy = kwinApp()->platform()->sceneEglDisplay(); | ||
175 | 176 | | |||
176 | // Use eglGetPlatformDisplayEXT() to get the display pointer | 177 | // Use eglGetPlatformDisplayEXT() to get the display pointer | ||
177 | // if the implementation supports it. | 178 | // if the implementation supports it. | ||
179 | if (display == EGL_NO_DISPLAY) { | ||||
178 | const bool havePlatformBase = hasClientExtension(QByteArrayLiteral("EGL_EXT_platform_base")); | 180 | const bool havePlatformBase = hasClientExtension(QByteArrayLiteral("EGL_EXT_platform_base")); | ||
179 | setHavePlatformBase(havePlatformBase); | 181 | setHavePlatformBase(havePlatformBase); | ||
180 | if (havePlatformBase) { | 182 | if (havePlatformBase) { | ||
181 | // Make sure that the X11 platform is supported | 183 | // Make sure that the X11 platform is supported | ||
182 | if (!hasClientExtension(QByteArrayLiteral("EGL_EXT_platform_x11"))) { | 184 | if (!hasClientExtension(QByteArrayLiteral("EGL_EXT_platform_x11"))) { | ||
183 | qCWarning(KWIN_CORE) << "EGL_EXT_platform_base is supported, but EGL_EXT_platform_x11 is not. Cannot create EGLDisplay on X11"; | 185 | qCWarning(KWIN_CORE) << "EGL_EXT_platform_base is supported, but EGL_EXT_platform_x11 is not. Cannot create EGLDisplay on X11"; | ||
184 | return false; | 186 | return false; | ||
185 | } | 187 | } | ||
186 | 188 | | |||
187 | const int attribs[] = { | 189 | const int attribs[] = { | ||
188 | EGL_PLATFORM_X11_SCREEN_EXT, m_x11ScreenNumber, | 190 | EGL_PLATFORM_X11_SCREEN_EXT, m_x11ScreenNumber, | ||
189 | EGL_NONE | 191 | EGL_NONE | ||
190 | }; | 192 | }; | ||
191 | 193 | | |||
192 | dpy = eglGetPlatformDisplayEXT(EGL_PLATFORM_X11_EXT, m_x11Display, attribs); | 194 | dpy = eglGetPlatformDisplayEXT(EGL_PLATFORM_X11_EXT, m_x11Display, attribs); | ||
193 | } else { | 195 | } else { | ||
194 | dpy = eglGetDisplay(m_x11Display); | 196 | dpy = eglGetDisplay(m_x11Display); | ||
195 | } | 197 | } | ||
198 | } | ||||
196 | 199 | | |||
197 | if (dpy == EGL_NO_DISPLAY) { | 200 | if (dpy == EGL_NO_DISPLAY) { | ||
198 | qCWarning(KWIN_CORE) << "Failed to get the EGLDisplay"; | 201 | qCWarning(KWIN_CORE) << "Failed to get the EGLDisplay"; | ||
199 | return false; | 202 | return false; | ||
200 | } | 203 | } | ||
201 | setEglDisplay(dpy); | 204 | setEglDisplay(dpy); | ||
202 | initEglAPI(); | 205 | initEglAPI(); | ||
203 | 206 | | |||
▲ Show 20 Lines • Show All 335 Lines • Show Last 20 Lines |