kwin: drop wayland support

altought it would be nice to have support for it, wayland is not
yet ready for prime time. it breaks from time to time and with
version 1.6.0 it can cause serious issues (kwin crashes). there is
xwayland and I doubt X11/X.Org/XFree86/whatever will be gone, not
just yet.
This commit is contained in:
Ivailo Monev 2015-01-28 21:15:11 +00:00
parent 924ac888d3
commit bacc29fa74
7 changed files with 0 additions and 1468 deletions

View file

@ -67,13 +67,6 @@ set_package_properties(UDev PROPERTIES DESCRIPTION "The UDev Libraries"
PURPOSE "Allows support for UPower backend in PowerDevil - STRONGLY RECOMMENDED"
)
macro_optional_find_package(Wayland)
set_package_properties(Wayland PROPERTIES DESCRIPTION "The Wayland Client and Server libraries"
URL "http://wayland.freedesktop.org"
TYPE OPTIONAL
PURPOSE "Required for building KWin with Wayland support"
)
if(Q_WS_X11)
find_package(XCB REQUIRED)
set_package_properties(XCB PROPERTIES DESCRIPTION "X protocol C-language Binding"

View file

@ -1,62 +0,0 @@
# Try to find Wayland on a Unix system
#
# This will define:
#
# WAYLAND_FOUND - True if Wayland is found
# WAYLAND_LIBRARIES - Link these to use Wayland
# WAYLAND_INCLUDE_DIR - Include directory for Wayland
# WAYLAND_DEFINITIONS - Compiler flags for using Wayland
#
# In addition the following more fine grained variables will be defined:
#
# WAYLAND_CLIENT_FOUND WAYLAND_CLIENT_INCLUDE_DIR WAYLAND_CLIENT_LIBRARIES
# WAYLAND_SERVER_FOUND WAYLAND_SERVER_INCLUDE_DIR WAYLAND_SERVER_LIBRARIES
# WAYLAND_EGL_FOUND WAYLAND_EGL_INCLUDE_DIR WAYLAND_EGL_LIBRARIES
#
# Copyright (c) 2013 Martin Gräßlin <mgraesslin@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
IF (NOT WIN32)
IF (WAYLAND_INCLUDE_DIR AND WAYLAND_LIBRARIES)
# In the cache already
SET(WAYLAND_FIND_QUIETLY TRUE)
ENDIF ()
# Use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
FIND_PACKAGE(PkgConfig)
PKG_CHECK_MODULES(PKG_WAYLAND QUIET wayland-client wayland-server wayland-egl)
SET(WAYLAND_DEFINITIONS ${PKG_WAYLAND_CFLAGS})
FIND_PATH(WAYLAND_CLIENT_INCLUDE_DIR NAMES wayland-client.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS})
FIND_PATH(WAYLAND_SERVER_INCLUDE_DIR NAMES wayland-server.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS})
FIND_PATH(WAYLAND_EGL_INCLUDE_DIR NAMES wayland-egl.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS})
FIND_LIBRARY(WAYLAND_CLIENT_LIBRARIES NAMES wayland-client HINTS ${PKG_WAYLAND_LIBRARY_DIRS})
FIND_LIBRARY(WAYLAND_SERVER_LIBRARIES NAMES wayland-server HINTS ${PKG_WAYLAND_LIBRARY_DIRS})
FIND_LIBRARY(WAYLAND_EGL_LIBRARIES NAMES wayland-egl HINTS ${PKG_WAYLAND_LIBRARY_DIRS})
set(WAYLAND_INCLUDE_DIR ${WAYLAND_CLIENT_INCLUDE_DIR} ${WAYLAND_SERVER_INCLUDE_DIR} ${WAYLAND_EGL_INCLUDE_DIR})
set(WAYLAND_LIBRARIES ${WAYLAND_CLIENT_LIBRARIES} ${WAYLAND_SERVER_LIBRARIES} ${WAYLAND_EGL_LIBRARIES})
list(REMOVE_DUPLICATES WAYLAND_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_CLIENT DEFAULT_MSG WAYLAND_CLIENT_LIBRARIES WAYLAND_CLIENT_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_SERVER DEFAULT_MSG WAYLAND_SERVER_LIBRARIES WAYLAND_SERVER_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_EGL DEFAULT_MSG WAYLAND_EGL_LIBRARIES WAYLAND_EGL_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND DEFAULT_MSG WAYLAND_LIBRARIES WAYLAND_INCLUDE_DIR)
MARK_AS_ADVANCED(
WAYLAND_INCLUDE_DIR WAYLAND_LIBRARIES
WAYLAND_CLIENT_INCLUDE_DIR WAYLAND_CLIENT_LIBRARIES
WAYLAND_SERVER_INCLUDE_DIR WAYLAND_SERVER_LIBRARIES
WAYLAND_EGL_INCLUDE_DIR WAYLAND_EGL_LIBRARIES
)
ENDIF ()

View file

@ -119,9 +119,6 @@
/* Define to 1 if you have the `vsnprintf' function. */
#cmakedefine HAVE_VSNPRINTF 1
/* Define to 1 if you have the Wayland libraries. */
#cmakedefine WAYLAND_FOUND 1
/* KDE's default home directory */
#cmakedefine KDE_DEFAULT_HOME "${KDE_DEFAULT_HOME}"

View file

@ -50,10 +50,6 @@ endif()
include_directories(${XCB_INCLUDE_DIR})
if(WAYLAND_FOUND AND KWIN_HAVE_EGL)
include_directories(${WAYLAND_INCLUDE_DIR})
endif()
# for things that are also used by kwin libraries
configure_file(libkwineffects/kwinconfig.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/libkwineffects/kwinconfig.h )
# for kwin internal things
@ -168,10 +164,6 @@ if(KWIN_HAVE_EGL)
set(kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS} eglonxbackend.cpp)
endif()
if(WAYLAND_FOUND AND KWIN_HAVE_EGL)
set(kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS} egl_wayland_backend.cpp)
endif()
kde4_add_kcfg_files(kwin_KDEINIT_SRCS settings.kcfgc)
qt4_add_dbus_adaptor( kwin_KDEINIT_SRCS org.kde.KWin.xml dbusinterface.h KWin::DBusInterface )
@ -227,13 +219,6 @@ set(kwin_XCB_LIBS
${XCB_KEYSYMS_LIBRARIES}
)
set(kwin_WAYLAND_LIBS
${WAYLAND_CLIENT_LIBRARIES}
${WAYLAND_EGL_LIBRARIES}
${XCB_SHM_LIBRARIES}
${XCB_XTEST_LIBRARIES}
)
set(kwin_OPENGL_LIBS )
find_library(XF86VM_LIBRARY Xxf86vm)
@ -256,10 +241,6 @@ set(kwinLibs
${kwin_OPENGL_LIBS}
)
if(WAYLAND_FOUND AND KWIN_HAVE_EGL)
set(kwinLibs ${kwinLibs} ${kwin_WAYLAND_LIBS})
endif()
kde4_add_kdeinit_executable( kwin ${kwin_KDEINIT_SRCS})
target_link_libraries(kdeinit_kwin ${kwinLibs})

File diff suppressed because it is too large Load diff

View file

@ -1,359 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2013 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_EGL_WAYLAND_BACKEND_H
#define KWIN_EGL_WAYLAND_BACKEND_H
#include "scene_opengl.h"
// wayland
#include <wayland-client.h>
#include <wayland-egl.h>
// xcb
#include <xcb/shm.h>
class KTemporaryFile;
struct wl_buffer;
struct wl_shm;
namespace KWin
{
namespace Wayland
{
class ShmPool;
class WaylandBackend;
class CursorData
{
public:
CursorData(ShmPool *pool);
~CursorData();
bool isValid() const;
const QPoint &hotSpot() const;
const QSize &size() const;
wl_buffer *cursor() const;
private:
bool init(ShmPool *pool);
wl_buffer *m_cursor;
QPoint m_hotSpot;
QSize m_size;
bool m_valid;
};
class X11CursorTracker : public QObject
{
Q_OBJECT
public:
explicit X11CursorTracker(wl_pointer *pointer, WaylandBackend *backend, QObject* parent = 0);
virtual ~X11CursorTracker();
void setEnteredSerial(uint32_t serial);
void resetCursor();
private Q_SLOTS:
void cursorChanged(uint32_t serial);
private:
void installCursor(const CursorData &cursor);
wl_pointer *m_pointer;
QHash<uint32_t, CursorData> m_cursors;
WaylandBackend *m_backend;
wl_surface *m_cursor;
uint32_t m_enteredSerial;
uint32_t m_installedCursor;
uint32_t m_lastX11Cursor;
};
class ShmPool
{
public:
ShmPool(wl_shm *shm);
~ShmPool();
bool isValid() const;
wl_buffer *createBuffer(const QImage &image);
private:
bool createPool();
wl_shm *m_shm;
wl_shm_pool *m_pool;
void *m_poolData;
size_t m_size;
QScopedPointer<KTemporaryFile> m_tmpFile;
bool m_valid;
int m_offset;
};
class WaylandSeat
{
public:
WaylandSeat(wl_seat *seat, WaylandBackend *backend);
virtual ~WaylandSeat();
void changed(uint32_t capabilities);
wl_seat *seat();
void pointerEntered(uint32_t serial);
void resetCursor();
private:
void destroyPointer();
void destroyKeyboard();
wl_seat *m_seat;
wl_pointer *m_pointer;
wl_keyboard *m_keyboard;
QScopedPointer<X11CursorTracker> m_cursorTracker;
WaylandBackend *m_backend;
};
/**
* @brief Class encapsulating all Wayland data structures needed by the Egl backend.
*
* It creates the connection to the Wayland Compositor, set's up the registry and creates
* the Wayland surface and it's shell and egl mapping.
*/
class WaylandBackend : public QObject
{
Q_OBJECT
public:
WaylandBackend();
virtual ~WaylandBackend();
wl_display *display();
wl_registry *registry();
void setCompositor(wl_compositor *c);
wl_compositor *compositor();
void setShell(wl_shell *s);
wl_shell *shell();
wl_egl_window *overlay();
ShmPool *shmPool();
void createSeat(uint32_t name);
void createShm(uint32_t name);
void ping(uint32_t serial);
bool createSurface();
private Q_SLOTS:
void readEvents();
private:
wl_display *m_display;
wl_registry *m_registry;
wl_compositor *m_compositor;
wl_shell *m_shell;
wl_surface *m_surface;
wl_egl_window *m_overlay;
wl_shell_surface *m_shellSurface;
QScopedPointer<WaylandSeat> m_seat;
QScopedPointer<ShmPool> m_shm;
};
inline
bool CursorData::isValid() const
{
return m_valid;
}
inline
const QPoint& CursorData::hotSpot() const
{
return m_hotSpot;
}
inline
wl_buffer* CursorData::cursor() const
{
return m_cursor;
}
inline
const QSize& CursorData::size() const
{
return m_size;
}
inline
wl_seat *WaylandSeat::seat()
{
return m_seat;
}
inline
bool ShmPool::isValid() const
{
return m_valid;
}
inline
wl_display *WaylandBackend::display()
{
return m_display;
}
inline
wl_registry *WaylandBackend::registry()
{
return m_registry;
}
inline
void WaylandBackend::setCompositor(wl_compositor *c)
{
m_compositor = c;
}
inline
wl_compositor *WaylandBackend::compositor()
{
return m_compositor;
}
inline
wl_egl_window *WaylandBackend::overlay()
{
return m_overlay;
}
inline
void WaylandBackend::setShell(wl_shell *s)
{
m_shell = s;
}
inline
wl_shell *WaylandBackend::shell()
{
return m_shell;
}
inline
ShmPool* WaylandBackend::shmPool()
{
return m_shm.data();
}
} // namespace Wayland
class Shm;
/**
* @brief OpenGL Backend using Egl on a Wayland surface.
*
* This Backend is the basis for a session compositor running on top of a Wayland system compositor.
* It creates a Surface as large as the screen and maps it as a fullscreen shell surface on the
* system compositor. The OpenGL context is created on the Wayland surface, so for rendering X11 is
* not involved.
*
* At the moment the backend is still rather limited. For getting textures from pixmap it uses the
* XShm library. This is currently a hack and only as proof of concept till we support texture from
* Wayland buffers. From then on we should use XWayland for texture mapping.
*
* Also in repainting the backend is currently still rather limited. Only supported mode is fullscreen
* repaints, which is obviously not optimal. Best solution is probably to go for buffer_age extension
* and make it the only available solution next to fullscreen repaints.
**/
class EglWaylandBackend : public OpenGLBackend
{
public:
EglWaylandBackend();
virtual ~EglWaylandBackend();
virtual void screenGeometryChanged(const QSize &size);
virtual SceneOpenGL::TexturePrivate *createBackendTexture(SceneOpenGL::Texture *texture);
virtual QRegion prepareRenderingFrame();
virtual void endRenderingFrame(const QRegion &renderedRegion, const QRegion &damagedRegion);
Shm *shm();
protected:
virtual void present();
private:
void init();
bool initializeEgl();
bool initBufferConfigs();
bool initRenderingContext();
bool makeContextCurrent();
EGLDisplay m_display;
EGLConfig m_config;
EGLSurface m_surface;
EGLContext m_context;
QScopedPointer<Wayland::WaylandBackend> m_wayland;
QScopedPointer<Shm> m_shm;
friend class EglWaylandTexture;
};
/**
* @brief Texture using an EGLImageKHR.
**/
class EglWaylandTexture : public SceneOpenGL::TexturePrivate
{
public:
virtual ~EglWaylandTexture();
virtual void findTarget();
virtual bool loadTexture(const Pixmap& pix, const QSize& size, int depth);
virtual OpenGLBackend *backend();
virtual bool update(const QRegion &damage);
private:
friend class EglWaylandBackend;
EglWaylandTexture(SceneOpenGL::Texture *texture, EglWaylandBackend *backend);
SceneOpenGL::Texture *q;
EglWaylandBackend *m_backend;
/**
* The Pixmap of the window content. Get's updated in loadTexture.
*/
xcb_pixmap_t m_referencedPixmap;
};
/**
* @brief Small helper class to encapsulate SHM related functionality.
*
*/
class Shm
{
public:
Shm();
~Shm();
int shmId() const;
void *buffer() const;
xcb_shm_seg_t segment() const;
bool isValid() const;
private:
bool init();
int m_shmId;
void *m_buffer;
xcb_shm_seg_t m_segment;
bool m_valid;
};
inline
void *Shm::buffer() const
{
return m_buffer;
}
inline
bool Shm::isValid() const
{
return m_valid;
}
inline
xcb_shm_seg_t Shm::segment() const
{
return m_segment;
}
inline
int Shm::shmId() const
{
return m_shmId;
}
} // namespace
#endif // KWIN_EGL_ON_X_BACKEND_H

View file

@ -26,9 +26,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "eglonxbackend.h"
// for Wayland
#include "config-workspace.h"
#ifdef WAYLAND_FOUND
#include "egl_wayland_backend.h"
#endif
#endif
#ifndef KWIN_HAVE_OPENGLES
#include "glxbackend.h"
@ -224,15 +221,7 @@ SceneOpenGL *SceneOpenGL::createScene()
break;
case EglPlatformInterface:
#ifdef KWIN_HAVE_EGL
#ifdef WAYLAND_FOUND
if (qstrcmp(envOpenGLInterface, "egl_wayland") == 0) {
backend = new EglWaylandBackend();
} else {
backend = new EglOnXBackend();
}
#else
backend = new EglOnXBackend();
#endif
#endif
break;
default: