From eca2eb2c19fdbb4ed5003d636d935fbf83968d70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 5 Aug 2020 12:27:10 +0200 Subject: Update to match qtbase changes to platform headers Change-Id: I8e39d87361728c81b526f1ad89b45136500c9913 Reviewed-by: Paul Olav Tvete --- CMakeLists.txt | 1 - src/client/CMakeLists.txt | 1 - src/client/client.pro | 2 -- src/client/qwaylandnativeinterface.cpp | 40 ---------------------- src/client/qwaylandnativeinterface_p.h | 6 ---- .../vsp2/vsp2hardwarelayerintegration.cpp | 26 +++++++++----- .../vsp2/vsp2hardwarelayerintegration.h | 6 +++- tests/manual/subsurface/main.cpp | 8 ----- 8 files changed, 22 insertions(+), 68 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 88223a419..e72c5e1c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,6 @@ find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS Core Gui OpenGL - PlatformHeaders ) find_package(Qt6 ${PROJECT_VERSION} CONFIG OPTIONAL_COMPONENTS diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt index b49a72920..88b27b5f3 100644 --- a/src/client/CMakeLists.txt +++ b/src/client/CMakeLists.txt @@ -56,7 +56,6 @@ qt_add_module(WaylandClient LIBRARIES Qt::CorePrivate Qt::GuiPrivate - Qt::PlatformHeadersPrivate PUBLIC_LIBRARIES Qt::Core Qt::Gui diff --git a/src/client/client.pro b/src/client/client.pro index 38b129e9e..d6df946b5 100644 --- a/src/client/client.pro +++ b/src/client/client.pro @@ -3,8 +3,6 @@ MODULE = waylandclient QT += core-private gui-private -QT_PRIVATE += platformheaders-private - # We have a bunch of C code with casts, so we can't have this option QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual diff --git a/src/client/qwaylandnativeinterface.cpp b/src/client/qwaylandnativeinterface.cpp index da7885477..2c9ba899f 100644 --- a/src/client/qwaylandnativeinterface.cpp +++ b/src/client/qwaylandnativeinterface.cpp @@ -55,8 +55,6 @@ #include #endif -#include - QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -194,44 +192,6 @@ void QWaylandNativeInterface::emitWindowPropertyChanged(QPlatformWindow *window, emit windowPropertyChanged(window,name); } -QFunctionPointer QWaylandNativeInterface::platformFunction(const QByteArray &resource) const -{ - if (resource == QWaylandWindowFunctions::setSyncIdentifier()) { - return QFunctionPointer(setSync); - } else if (resource == QWaylandWindowFunctions::setDeSyncIdentifier()) { - return QFunctionPointer(setDeSync); - } else if (resource == QWaylandWindowFunctions::isSyncIdentifier()) { - return QFunctionPointer(isSync); - } - return nullptr; -} - - -void QWaylandNativeInterface::setSync(QWindow *window) -{ - QWaylandWindow *ww = static_cast(window->handle()); - if (ww->subSurfaceWindow()) { - ww->subSurfaceWindow()->setSync(); - } -} - -void QWaylandNativeInterface::setDeSync(QWindow *window) -{ - QWaylandWindow *ww = static_cast(window->handle()); - if (ww->subSurfaceWindow()) { - ww->subSurfaceWindow()->setDeSync(); - } -} - -bool QWaylandNativeInterface::isSync(QWindow *window) -{ - QWaylandWindow *ww = static_cast(window->handle()); - if (ww->subSurfaceWindow()) { - return ww->subSurfaceWindow()->isSync(); - } - return false; -} - } QT_END_NAMESPACE diff --git a/src/client/qwaylandnativeinterface_p.h b/src/client/qwaylandnativeinterface_p.h index 3de80eb6a..0edbdc9e6 100644 --- a/src/client/qwaylandnativeinterface_p.h +++ b/src/client/qwaylandnativeinterface_p.h @@ -82,15 +82,9 @@ public: void emitWindowPropertyChanged(QPlatformWindow *window, const QString &name); - QFunctionPointer platformFunction(const QByteArray &resource) const override; - private: QWaylandIntegration *m_integration = nullptr; QHash m_windowProperties; - - static void setSync(QWindow *window); - static void setDeSync(QWindow *window); - static bool isSync(QWindow *window); }; } diff --git a/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.cpp b/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.cpp index a0abf6972..ad25d88ff 100644 --- a/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.cpp +++ b/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.cpp @@ -41,7 +41,9 @@ extern "C" { #include #include -#include +#include + +using namespace QPlatformInterface::Private; QT_BEGIN_NAMESPACE @@ -56,6 +58,10 @@ Vsp2Buffer::Vsp2Buffer(wl_kms_buffer *kmsBuffer) Vsp2Layer::Vsp2Layer(QWaylandQuickHardwareLayer *hwLayer, Vsp2HardwareLayerIntegration *integration) : m_hwLayer(hwLayer) { + auto *wlItem = m_hwLayer->waylandItem(); + m_screen = dynamic_cast(wlItem->window()->screen()->handle()); + Q_ASSERT(m_screen); + connect(hwLayer, &QWaylandQuickHardwareLayer::stackingLevelChanged, this, [integration](){ integration->recreateVspLayers(); }); @@ -76,16 +82,17 @@ void Vsp2Layer::enableVspLayer() m_buffer = Vsp2Buffer(kmsBuffer); updatePosition(); + + m_layerIndex = m_screen->addLayer(m_buffer.dmabufFd, m_buffer.size, m_position, m_buffer.drmPixelFormat, m_buffer.bytesPerLine); + auto *wlItem = m_hwLayer->waylandItem(); - m_screen = wlItem->window()->screen(); - m_layerIndex = QEglFSFunctions::vsp2AddLayer(m_screen, m_buffer.dmabufFd, m_buffer.size, m_position, m_buffer.drmPixelFormat, m_buffer.bytesPerLine); wlItem->surface()->frameStarted(); updateOpacity(); } void Vsp2Layer::disableVspLayer() { - QEglFSFunctions::vsp2RemoveLayer(m_screen, m_layerIndex); + m_screen->removeLayer(m_layerIndex); m_layerIndex = -1; m_screen = nullptr; } @@ -112,9 +119,9 @@ void Vsp2Layer::handleBufferCommitted() } m_buffer = newBuffer; + m_screen->setLayerBuffer(m_layerIndex, m_buffer.dmabufFd); + auto *wlItem = m_hwLayer->waylandItem(); - m_screen = wlItem->window()->screen(); - QEglFSFunctions::vsp2SetLayerBuffer(m_screen, m_layerIndex, m_buffer.dmabufFd); wlItem->surface()->frameStarted(); } @@ -147,14 +154,14 @@ void Vsp2Layer::updatePosition() m_position = globalGeometry.topLeft().toPoint(); if (isEnabled()) - QEglFSFunctions::vsp2SetLayerPosition(m_screen, m_layerIndex, m_position); + m_screen->setLayerPosition(m_layerIndex, m_position); } void Vsp2Layer::updateOpacity() { if (isEnabled()) { qreal opacity = m_hwLayer->waylandItem()->opacity(); - QEglFSFunctions::vsp2SetLayerAlpha(m_screen, m_layerIndex, opacity); + m_screen->setLayerAlpha(m_layerIndex, opacity); } } @@ -216,7 +223,8 @@ Vsp2HardwareLayerIntegration::Vsp2HardwareLayerIntegration() << "You need to set QT_QPA_PLATFORM=eglfs and QT_QPA_EGLFS_INTEGRATION=eglfs_kms_vsp2"; } static Vsp2HardwareLayerIntegration *s_instance = this; - QEglFSFunctions::vsp2AddBlendListener(QGuiApplication::primaryScreen(), [](){ + auto screen = dynamic_cast(QGuiApplication::primaryScreen()->handle()); + screen->addBlendListener([](){ s_instance->sendFrameCallbacks(); }); } diff --git a/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.h b/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.h index 263c50260..f72bbc3e3 100644 --- a/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.h +++ b/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.h @@ -40,6 +40,10 @@ struct wl_kms_buffer; QT_BEGIN_NAMESPACE +namespace QPlatformInterface::Private { +struct QVsp2Screen; +} + class QScreen; class QWaylandSurface; class QWaylandQuickHardwareLayer; @@ -95,7 +99,7 @@ public slots: private: wl_kms_buffer *nextKmsBuffer(); int m_layerIndex = -1; - QScreen *m_screen = nullptr; + QVsp2Screen *m_screen = nullptr; QPoint m_position; QWaylandQuickHardwareLayer *m_hwLayer = nullptr; QWaylandSurface *m_surface = nullptr; diff --git a/tests/manual/subsurface/main.cpp b/tests/manual/subsurface/main.cpp index 375e5d2b9..db1bd2152 100644 --- a/tests/manual/subsurface/main.cpp +++ b/tests/manual/subsurface/main.cpp @@ -54,8 +54,6 @@ #include #include -#include - #include "shmwindow.h" class Filter : public QObject @@ -84,12 +82,6 @@ public: void toggleSync(QWindow *w) { - sync = !QWaylandWindowFunctions::isSync(w); - if (QWaylandWindowFunctions::isSync(w)) - QWaylandWindowFunctions::setDeSync(w); - else - QWaylandWindowFunctions::setSync(w); - emit syncChanged(); } bool getSync() const -- cgit v1.2.3