Commit graph

2 commits

Author SHA1 Message Date
Martin Gräßlin
8909f8780b [plugins/qpa] Call makeCurrent on the QOpenGLContext instead of the one in the platform context
Summary:
SharingPlatformContext::swapBuffers needs to make the context current.
For this is calls makeCurrent. Later on this tries to bind a fbo, which
checks calls into the current QOpenGLContext. As we called makeCurrent on
our own platform context Qt doesn't know that the context is current and
returns in the worst case a nullptr and crashes.

This change calls makeCurrent on the QOpenGLContext so that Qt also knows
that this context is current now. The QOpenGLContext calls makeCurrent on
the platform context, so what our code tried to do is still being done.

In addition the method context() in AbstractPlatformContext is renamed to
eglContext to no longer shadow the method in QPlatformContext.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2582
2016-08-26 07:38:04 +02:00
Martin Gräßlin
26b3569a0b [wayland] Add a QPA plugin for kwin_wayland
This introduces an own QPA plugin for KWin. QtWayland's plugin is not
a good solution for KWin as QtWayland is meant for Wayland clients and
not for a Wayland server. Given that it makes more sense to have a very
minimal QPA plugin which supports the use cases we actually have.

With our own QPA plugin we should be able to improve the following
areas:
* no need to create Wayland server before QApplication
* Qt::BypassWindowManagerHint can be supported
* no workaround for creating OpenGL context in main thread
* sharing OpenGL context with Qt
* OpenGL context for Qt on libhybris backend

The plugin supports so far the following features:
* creating a QPlatformWindow using KWayland::Client (ShellSurface)
* creating a QPlatformBackingStore using a ShmPool
* creating a QPlatformOpenGLContext with Wayland::EGL
* or creating a QPlatformOpenGLContext which shares with KWin's scene
* creating a QPlatformScreen for each KWayland::Client::Output
* QPlatformNativeInterface compatible to QtWayland
2015-08-25 14:33:50 +02:00