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 --- 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 +++- 6 files changed, 22 insertions(+), 59 deletions(-) (limited to 'src') diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt index b49a7292..88b27b5f 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 38b129e9..d6df946b 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 da788547..2c9ba899 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 3de80eb6..0edbdc9e 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 a0abf697..ad25d88f 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 263c5026..f72bbc3e 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; -- cgit v1.2.1