summaryrefslogtreecommitdiff
path: root/src/hardwareintegration
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-08-05 12:27:10 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-08-19 14:58:10 +0200
commiteca2eb2c19fdbb4ed5003d636d935fbf83968d70 (patch)
tree4fb4f04fc738b12b9b3b348a99a59626a24bc9fc /src/hardwareintegration
parent396444d657e44cc9fae03b1dc053d521501cda00 (diff)
downloadqtwayland-eca2eb2c19fdbb4ed5003d636d935fbf83968d70.tar.gz
Update to match qtbase changes to platform headers
Change-Id: I8e39d87361728c81b526f1ad89b45136500c9913 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/hardwareintegration')
-rw-r--r--src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.cpp26
-rw-r--r--src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.h6
2 files changed, 22 insertions, 10 deletions
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 <QWaylandQuickOutput>
#include <QQuickWindow>
-#include <QtPlatformHeaders/qeglfsfunctions.h>
+#include <qpa/qlatformscreen_p.h>
+
+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<QVsp2Screen*>(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<QVsp2Screen*>(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;