Make Wayland::EGL optional again
This is needed to make KWin build-able on non-Linux, but is actually only a workaround. The dependency should also be available on non-Linux. This disables the EGL integration in the Wayland backend (QPainter still available) and the EGL fallback in the qpa plugin (preferred context sharing still available, but requires a working OpenGL Scene). REVIEW: 126202
This commit is contained in:
parent
a055e2de82
commit
d89777bcac
8 changed files with 42 additions and 4 deletions
|
@ -135,11 +135,16 @@ set_package_properties(epoxy PROPERTIES DESCRIPTION "libepoxy"
|
|||
PURPOSE "OpenGL dispatch library"
|
||||
)
|
||||
|
||||
find_package(Wayland 1.2 REQUIRED COMPONENTS Egl Cursor)
|
||||
find_package(Wayland 1.2 REQUIRED COMPONENTS Cursor OPTIONAL_COMPONENTS Egl)
|
||||
set_package_properties(Wayland PROPERTIES
|
||||
TYPE REQUIRED
|
||||
PURPOSE "Required for building KWin with Wayland support"
|
||||
)
|
||||
add_feature_info("Wayland::EGL" Wayland_Egl_FOUND "Enable building of Wayland backend and QPA with EGL support.")
|
||||
set(HAVE_WAYLAND_EGL FALSE)
|
||||
if(Wayland_Egl_FOUND)
|
||||
set(HAVE_WAYLAND_EGL TRUE)
|
||||
endif()
|
||||
|
||||
find_package(XKB 0.4.1)
|
||||
set_package_properties(XKB PROPERTIES
|
||||
|
|
|
@ -2,11 +2,18 @@ set(WAYLAND_BACKEND_SOURCES
|
|||
logging.cpp
|
||||
scene_qpainter_wayland_backend.cpp
|
||||
wayland_backend.cpp
|
||||
egl_wayland_backend.cpp
|
||||
)
|
||||
|
||||
if(HAVE_WAYLAND_EGL)
|
||||
set(WAYLAND_BACKEND_SOURCES egl_wayland_backend.cpp ${WAYLAND_BACKEND_SOURCES})
|
||||
endif()
|
||||
|
||||
add_library(KWinWaylandWaylandBackend MODULE ${WAYLAND_BACKEND_SOURCES})
|
||||
target_link_libraries(KWinWaylandWaylandBackend kwin KF5::WaylandClient Wayland::Egl)
|
||||
target_link_libraries(KWinWaylandWaylandBackend kwin KF5::WaylandClient)
|
||||
|
||||
if(HAVE_WAYLAND_EGL)
|
||||
target_link_libraries(KWinWaylandWaylandBackend Wayland::Egl)
|
||||
endif()
|
||||
|
||||
install(
|
||||
TARGETS
|
||||
|
|
|
@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*********************************************************************/
|
||||
// own
|
||||
#include "wayland_backend.h"
|
||||
#include <config-kwin.h>
|
||||
// KWin
|
||||
#include "cursor.h"
|
||||
#include "logging.h"
|
||||
|
@ -27,7 +28,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "screens.h"
|
||||
#include "wayland_server.h"
|
||||
#include "wayland_cursor_theme.h"
|
||||
#if HAVE_WAYLAND_EGL
|
||||
#include "egl_wayland_backend.h"
|
||||
#endif
|
||||
#include <KWayland/Client/buffer.h>
|
||||
#include <KWayland/Client/compositor.h>
|
||||
#include <KWayland/Client/connection_thread.h>
|
||||
|
@ -449,7 +452,11 @@ Screens *WaylandBackend::createScreens(QObject *parent)
|
|||
|
||||
OpenGLBackend *WaylandBackend::createOpenGLBackend()
|
||||
{
|
||||
#if HAVE_WAYLAND_EGL
|
||||
return new EglWaylandBackend(this);
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
QPainterBackend *WaylandBackend::createQPainterBackend()
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#cmakedefine01 HAVE_DRM
|
||||
#cmakedefine01 HAVE_GBM
|
||||
#cmakedefine01 HAVE_LIBHYBRIS
|
||||
#cmakedefine01 HAVE_WAYLAND_EGL
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#cmakedefine HAVE_UNISTD_H 1
|
||||
|
|
|
@ -18,12 +18,15 @@ add_library(KWinQpaPlugin MODULE ${QPA_SOURCES})
|
|||
target_link_libraries(KWinQpaPlugin
|
||||
kwin
|
||||
KF5::WaylandClient
|
||||
Wayland::Egl
|
||||
Qt5PlatformSupport::Qt5PlatformSupport
|
||||
${FONTCONFIG_LIBRARIES}
|
||||
${FREETYPE_LIBRARIES}
|
||||
)
|
||||
|
||||
if(HAVE_WAYLAND_EGL)
|
||||
target_link_libraries(KWinQpaPlugin Wayland::Egl)
|
||||
endif()
|
||||
|
||||
install(
|
||||
TARGETS
|
||||
KWinQpaPlugin
|
||||
|
|
|
@ -54,9 +54,11 @@ Window::~Window()
|
|||
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;
|
||||
}
|
||||
|
@ -95,9 +97,11 @@ void Window::setGeometry(const QRect &rect)
|
|||
m_resized = true;
|
||||
}
|
||||
}
|
||||
#if HAVE_WAYLAND_EGL
|
||||
if (m_eglWaylandWindow) {
|
||||
wl_egl_window_resize(m_eglWaylandWindow, geometry().width(), geometry().height(), 0, 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Window::unmap()
|
||||
|
@ -116,12 +120,14 @@ void Window::unmap()
|
|||
|
||||
void Window::createEglSurface(EGLDisplay dpy, EGLConfig config)
|
||||
{
|
||||
#if HAVE_WAYLAND_EGL
|
||||
const QSize size = window()->size();
|
||||
m_eglWaylandWindow = wl_egl_window_create(*m_surface, size.width(), size.height());
|
||||
if (!m_eglWaylandWindow) {
|
||||
return;
|
||||
}
|
||||
m_eglSurface = eglCreateWindowSurface(dpy, config, m_eglWaylandWindow, nullptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Window::bindContentFBO()
|
||||
|
|
|
@ -24,7 +24,10 @@ 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;
|
||||
|
||||
|
|
|
@ -1387,6 +1387,12 @@ QString Workspace::supportInformation() const
|
|||
support.append(yes);
|
||||
#else
|
||||
support.append(no);
|
||||
#endif
|
||||
support.append(QStringLiteral("HAVE_WAYLAND_EGL: "));
|
||||
#if HAVE_WAYLAND_EGL
|
||||
support.append(yes);
|
||||
#else
|
||||
support.append(no);
|
||||
#endif
|
||||
support.append(QStringLiteral("\n"));
|
||||
|
||||
|
|
Loading…
Reference in a new issue