[qpa] Drop PlatformContextWayland which uses wayland egl for OpenGL
Summary: Using the Wayland protocol for OpenGL is no longer used or useful. KWin internal windows only use OpenGL through QtQuick. We either have the sharing context (KWin uses OpenGL for compositing) or we have the QPainter compositor which also turns QtQuick to use software renderer. Thus a situation where the Wayland platform context is useful doesn't exist any more. Removing it helps getting the QPA plugin Wayland free. Test Plan: Run nested KWin triggering Outline once with OpenGL and once with QPainter compositor. Reviewers: #kwin Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D19012
This commit is contained in:
parent
47be4be020
commit
e48d9df14f
7 changed files with 1 additions and 217 deletions
|
@ -7,7 +7,6 @@ set(QPA_SOURCES
|
|||
integration.cpp
|
||||
main.cpp
|
||||
nativeinterface.cpp
|
||||
platformcontextwayland.cpp
|
||||
platformcursor.cpp
|
||||
screen.cpp
|
||||
sharingplatformcontext.cpp
|
||||
|
@ -34,10 +33,6 @@ target_link_libraries(KWinQpaPlugin
|
|||
${FREETYPE_LIBRARIES}
|
||||
)
|
||||
|
||||
if(HAVE_WAYLAND_EGL)
|
||||
target_link_libraries(KWinQpaPlugin Wayland::Egl)
|
||||
endif()
|
||||
|
||||
install(
|
||||
TARGETS
|
||||
KWinQpaPlugin
|
||||
|
|
|
@ -22,7 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "platform.h"
|
||||
#include "backingstore.h"
|
||||
#include "nativeinterface.h"
|
||||
#include "platformcontextwayland.h"
|
||||
#include "screen.h"
|
||||
#include "sharingplatformcontext.h"
|
||||
#include "window.h"
|
||||
|
@ -192,13 +191,7 @@ QPlatformOpenGLContext *Integration::createPlatformOpenGLContext(QOpenGLContext
|
|||
return new SharingPlatformContext(context, s, kwinApp()->platform()->sceneEglConfig());
|
||||
}
|
||||
}
|
||||
if (m_eglDisplay == EGL_NO_DISPLAY) {
|
||||
const_cast<Integration*>(this)->initEgl();
|
||||
}
|
||||
if (m_eglDisplay == EGL_NO_DISPLAY) {
|
||||
return nullptr;
|
||||
}
|
||||
return new PlatformContextWayland(context, const_cast<Integration*>(this));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Integration::initScreens()
|
||||
|
@ -252,38 +245,6 @@ EGLDisplay Integration::eglDisplay() const
|
|||
return m_eglDisplay;
|
||||
}
|
||||
|
||||
void Integration::initEgl()
|
||||
{
|
||||
Q_ASSERT(m_eglDisplay == EGL_NO_DISPLAY);
|
||||
// This variant uses Wayland as the EGL platform
|
||||
qputenv("EGL_PLATFORM", "wayland");
|
||||
m_eglDisplay = eglGetDisplay(waylandServer()->internalClientConection()->display());
|
||||
if (m_eglDisplay == EGL_NO_DISPLAY) {
|
||||
return;
|
||||
}
|
||||
// call eglInitialize in a thread to not block
|
||||
QFuture<bool> future = QtConcurrent::run([this] () -> bool {
|
||||
EGLint major, minor;
|
||||
if (eglInitialize(m_eglDisplay, &major, &minor) == EGL_FALSE) {
|
||||
return false;
|
||||
}
|
||||
EGLint error = eglGetError();
|
||||
if (error != EGL_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
// TODO: make this better
|
||||
while (!future.isFinished()) {
|
||||
waylandServer()->internalClientConection()->flush();
|
||||
QCoreApplication::processEvents(QEventLoop::WaitForMoreEvents);
|
||||
}
|
||||
if (!future.result()) {
|
||||
eglTerminate(m_eglDisplay);
|
||||
m_eglDisplay = EGL_NO_DISPLAY;
|
||||
}
|
||||
}
|
||||
|
||||
QPlatformInputContext *Integration::inputContext() const
|
||||
{
|
||||
return m_inputContext.data();
|
||||
|
|
|
@ -69,7 +69,6 @@ public:
|
|||
|
||||
private:
|
||||
void initScreens();
|
||||
void initEgl();
|
||||
KWayland::Client::Shell *shell() const;
|
||||
|
||||
QPlatformFontDatabase *m_fontDb;
|
||||
|
|
|
@ -1,77 +0,0 @@
|
|||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2015 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "platformcontextwayland.h"
|
||||
#include "integration.h"
|
||||
#include "window.h"
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
namespace QPA
|
||||
{
|
||||
|
||||
PlatformContextWayland::PlatformContextWayland(QOpenGLContext *context, Integration *integration)
|
||||
: AbstractPlatformContext(context, integration, integration->eglDisplay())
|
||||
{
|
||||
create();
|
||||
}
|
||||
|
||||
bool PlatformContextWayland::makeCurrent(QPlatformSurface *surface)
|
||||
{
|
||||
Window *window = static_cast<Window*>(surface);
|
||||
EGLSurface s = window->eglSurface();
|
||||
if (s == EGL_NO_SURFACE) {
|
||||
window->createEglSurface(eglDisplay(), config());
|
||||
s = window->eglSurface();
|
||||
if (s == EGL_NO_SURFACE) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return eglMakeCurrent(eglDisplay(), s, s, eglContext());
|
||||
}
|
||||
|
||||
bool PlatformContextWayland::isSharing() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void PlatformContextWayland::swapBuffers(QPlatformSurface *surface)
|
||||
{
|
||||
Window *window = static_cast<Window*>(surface);
|
||||
EGLSurface s = window->eglSurface();
|
||||
if (s == EGL_NO_SURFACE) {
|
||||
return;
|
||||
}
|
||||
eglSwapBuffers(eglDisplay(), s);
|
||||
}
|
||||
|
||||
void PlatformContextWayland::create()
|
||||
{
|
||||
if (config() == 0) {
|
||||
return;
|
||||
}
|
||||
if (!bindApi()) {
|
||||
return;
|
||||
}
|
||||
createContext();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2015 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#ifndef KWIN_QPA_PLATFORMCONTEXTWAYLAND_H
|
||||
#define KWIN_QPA_PLATFORMCONTEXTWAYLAND_H
|
||||
|
||||
#include "abstractplatformcontext.h"
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
namespace QPA
|
||||
{
|
||||
class Integration;
|
||||
|
||||
class PlatformContextWayland : public AbstractPlatformContext
|
||||
{
|
||||
public:
|
||||
explicit PlatformContextWayland(QOpenGLContext *context, Integration *integration);
|
||||
|
||||
void swapBuffers(QPlatformSurface *surface) override;
|
||||
|
||||
bool makeCurrent(QPlatformSurface *surface) override;
|
||||
|
||||
bool isSharing() const override;
|
||||
|
||||
private:
|
||||
void create();
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -17,7 +17,6 @@ GNU General Public License for more details.
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#define WL_EGL_PLATFORM 1
|
||||
#include "integration.h"
|
||||
#include "window.h"
|
||||
#include "screens.h"
|
||||
|
@ -57,14 +56,6 @@ Window::Window(QWindow *window, KWayland::Client::Surface *surface, KWayland::Cl
|
|||
Window::~Window()
|
||||
{
|
||||
unmap();
|
||||
if (m_eglSurface != EGL_NO_SURFACE) {
|
||||
eglDestroySurface(m_integration->eglDisplay(), m_eglSurface);
|
||||
}
|
||||
#if HAVE_WAYLAND_EGL
|
||||
if (m_eglWaylandWindow) {
|
||||
wl_egl_window_destroy(m_eglWaylandWindow);
|
||||
}
|
||||
#endif
|
||||
delete m_shellSurface;
|
||||
delete m_surface;
|
||||
}
|
||||
|
@ -106,11 +97,6 @@ void Window::setGeometry(const QRect &rect)
|
|||
m_resized = true;
|
||||
}
|
||||
}
|
||||
#if HAVE_WAYLAND_EGL
|
||||
if (m_eglWaylandWindow) {
|
||||
wl_egl_window_resize(m_eglWaylandWindow, nativeSize.width(), nativeSize.height(), 0, 0);
|
||||
}
|
||||
#endif
|
||||
QWindowSystemInterface::handleGeometryChange(window(), geometry());
|
||||
}
|
||||
|
||||
|
@ -128,21 +114,6 @@ void Window::unmap()
|
|||
}
|
||||
}
|
||||
|
||||
void Window::createEglSurface(EGLDisplay dpy, EGLConfig config)
|
||||
{
|
||||
#if HAVE_WAYLAND_EGL
|
||||
const QSize size = window()->size() * m_scale;
|
||||
m_eglWaylandWindow = wl_egl_window_create(*m_surface, size.width(), size.height());
|
||||
if (!m_eglWaylandWindow) {
|
||||
return;
|
||||
}
|
||||
m_eglSurface = eglCreateWindowSurface(dpy, config, m_eglWaylandWindow, nullptr);
|
||||
#else
|
||||
Q_UNUSED(dpy)
|
||||
Q_UNUSED(config)
|
||||
#endif
|
||||
}
|
||||
|
||||
void Window::bindContentFBO()
|
||||
{
|
||||
if (m_resized || !m_contentFBO) {
|
||||
|
|
|
@ -25,17 +25,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
#include <fixx11h.h>
|
||||
#include <qpa/qplatformwindow.h>
|
||||
// wayland
|
||||
#include <config-kwin.h>
|
||||
#if HAVE_WAYLAND_EGL
|
||||
#include <wayland-egl.h>
|
||||
#endif
|
||||
|
||||
class QOpenGLFramebufferObject;
|
||||
|
||||
#if HAVE_WAYLAND_EGL
|
||||
struct wl_egl_window;
|
||||
#endif
|
||||
|
||||
namespace KWayland
|
||||
{
|
||||
|
@ -69,10 +61,6 @@ public:
|
|||
KWayland::Client::Surface *surface() const {
|
||||
return m_surface;
|
||||
}
|
||||
EGLSurface eglSurface() const {
|
||||
return m_eglSurface;
|
||||
}
|
||||
void createEglSurface(EGLDisplay dpy, EGLConfig config);
|
||||
|
||||
int scale() const;
|
||||
qreal devicePixelRatio() const override;
|
||||
|
@ -90,13 +78,9 @@ private:
|
|||
|
||||
KWayland::Client::Surface *m_surface;
|
||||
KWayland::Client::ShellSurface *m_shellSurface;
|
||||
EGLSurface m_eglSurface = EGL_NO_SURFACE;
|
||||
QSharedPointer<QOpenGLFramebufferObject> m_contentFBO;
|
||||
bool m_resized = false;
|
||||
ShellClient *m_shellClient = nullptr;
|
||||
#if HAVE_WAYLAND_EGL
|
||||
wl_egl_window *m_eglWaylandWindow = nullptr;
|
||||
#endif
|
||||
quint32 m_windowId;
|
||||
const Integration *m_integration;
|
||||
int m_scale = 1;
|
||||
|
|
Loading…
Reference in a new issue