summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/platformsupport/kmsconvenience/qkmsdevice.cpp23
-rw-r--r--src/platformsupport/kmsconvenience/qkmsdevice_p.h4
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsintegration.cpp4
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsintegration_p.h2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp3
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h1
-rw-r--r--src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp7
7 files changed, 31 insertions, 13 deletions
diff --git a/src/platformsupport/kmsconvenience/qkmsdevice.cpp b/src/platformsupport/kmsconvenience/qkmsdevice.cpp
index 319c7f3d9b..669abab331 100644
--- a/src/platformsupport/kmsconvenience/qkmsdevice.cpp
+++ b/src/platformsupport/kmsconvenience/qkmsdevice.cpp
@@ -204,6 +204,8 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources,
if (vposComp.count() == 2)
vinfo->virtualPos = QPoint(vposComp[0].trimmed().toInt(), vposComp[1].trimmed().toInt());
}
+ if (userConnectorConfig.value(QStringLiteral("primary")).toBool())
+ vinfo->isPrimary = true;
}
const uint32_t crtc_id = resources->crtcs[crtc];
@@ -413,8 +415,11 @@ struct OrderedScreen
QDebug operator<<(QDebug dbg, const OrderedScreen &s)
{
QDebugStateSaver saver(dbg);
- dbg.nospace() << "OrderedScreen(" << s.screen << " : " << s.vinfo.virtualIndex
- << " / " << s.vinfo.virtualPos << ")";
+ dbg.nospace() << "OrderedScreen(QPlatformScreen=" << s.screen << " (" << s.screen->name() << ") : "
+ << s.vinfo.virtualIndex
+ << " / " << s.vinfo.virtualPos
+ << " / primary: " << s.vinfo.isPrimary
+ << ")";
return dbg;
}
@@ -461,13 +466,15 @@ void QKmsDevice::createScreens()
drmModeFreeResources(resources);
- // Use stable sort to preserve the original order for outputs with unspecified indices.
+ // Use stable sort to preserve the original (DRM connector) order
+ // for outputs with unspecified indices.
std::stable_sort(screens.begin(), screens.end(), orderedScreenLessThan);
qCDebug(qLcKmsDebug) << "Sorted screen list:" << screens;
QPoint pos(0, 0);
QList<QPlatformScreen *> siblings;
QVector<QPoint> virtualPositions;
+ int primarySiblingIdx = -1;
for (const OrderedScreen &orderedScreen : screens) {
QPlatformScreen *s = orderedScreen.screen;
@@ -482,22 +489,26 @@ void QKmsDevice::createScreens()
} else {
virtualPos = orderedScreen.vinfo.virtualPos;
}
- qCDebug(qLcKmsDebug) << "Adding screen" << s << "to QPA with geometry" << s->geometry();
+ qCDebug(qLcKmsDebug) << "Adding QPlatformScren" << s << "(" << s->name() << ")"
+ << "to QPA with geometry" << s->geometry()
+ << "and isPrimary=" << orderedScreen.vinfo.isPrimary;
// The order in qguiapp's screens list will match the order set by
// virtualIndex. This is not only handy but also required since for instance
// evdevtouch relies on it when performing touch device - screen mapping.
if (!m_screenConfig->separateScreens()) {
siblings.append(s);
virtualPositions.append(virtualPos);
+ if (orderedScreen.vinfo.isPrimary)
+ primarySiblingIdx = siblings.count() - 1;
} else {
- registerScreen(s, virtualPos, QList<QPlatformScreen *>() << s);
+ registerScreen(s, orderedScreen.vinfo.isPrimary, virtualPos, QList<QPlatformScreen *>() << s);
}
}
if (!m_screenConfig->separateScreens()) {
// enable the virtual desktop
for (int i = 0; i < siblings.count(); ++i)
- registerScreen(siblings[i], virtualPositions[i], siblings);
+ registerScreen(siblings[i], i == primarySiblingIdx, virtualPositions[i], siblings);
}
}
diff --git a/src/platformsupport/kmsconvenience/qkmsdevice_p.h b/src/platformsupport/kmsconvenience/qkmsdevice_p.h
index c41448bc99..35a51c18b1 100644
--- a/src/platformsupport/kmsconvenience/qkmsdevice_p.h
+++ b/src/platformsupport/kmsconvenience/qkmsdevice_p.h
@@ -120,9 +120,10 @@ class QKmsDevice
{
public:
struct VirtualDesktopInfo {
- VirtualDesktopInfo() : virtualIndex(0) { }
+ VirtualDesktopInfo() : virtualIndex(0), isPrimary(false) { }
int virtualIndex;
QPoint virtualPos;
+ bool isPrimary;
};
QKmsDevice(QKmsScreenConfig *screenConfig, const QString &path = QString());
@@ -142,6 +143,7 @@ public:
protected:
virtual QPlatformScreen *createScreen(const QKmsOutput &output) = 0;
virtual void registerScreen(QPlatformScreen *screen,
+ bool isPrimary,
const QPoint &virtualPos,
const QList<QPlatformScreen *> &virtualSiblings) = 0;
diff --git a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp
index 0aa7a65276..73110dba61 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp
@@ -116,9 +116,9 @@ QEglFSIntegration::QEglFSIntegration()
initResources();
}
-void QEglFSIntegration::addScreen(QPlatformScreen *screen)
+void QEglFSIntegration::addScreen(QPlatformScreen *screen, bool isPrimary)
{
- screenAdded(screen);
+ screenAdded(screen, isPrimary);
}
void QEglFSIntegration::removeScreen(QPlatformScreen *screen)
diff --git a/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h b/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h
index 080c8ed332..c288876678 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h
+++ b/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h
@@ -103,7 +103,7 @@ public:
QFbVtHandler *vtHandler() { return m_vtHandler.data(); }
- void addScreen(QPlatformScreen *screen);
+ void addScreen(QPlatformScreen *screen, bool isPrimary = false);
void removeScreen(QPlatformScreen *screen);
private:
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp
index e99a6957a8..b073577797 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp
@@ -51,13 +51,14 @@ QEglFSKmsDevice::QEglFSKmsDevice(QKmsScreenConfig *screenConfig, const QString &
}
void QEglFSKmsDevice::registerScreen(QPlatformScreen *screen,
+ bool isPrimary,
const QPoint &virtualPos,
const QList<QPlatformScreen *> &virtualSiblings)
{
QEglFSKmsScreen *s = static_cast<QEglFSKmsScreen *>(screen);
s->setVirtualPosition(virtualPos);
s->setVirtualSiblings(virtualSiblings);
- static_cast<QEglFSIntegration *>(QGuiApplicationPrivate::platformIntegration())->addScreen(s);
+ static_cast<QEglFSIntegration *>(QGuiApplicationPrivate::platformIntegration())->addScreen(s, isPrimary);
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h
index 1bbea250bb..fc83a620d9 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h
@@ -52,6 +52,7 @@ public:
QEglFSKmsDevice(QKmsScreenConfig *screenConfig, const QString &path);
void registerScreen(QPlatformScreen *screen,
+ bool isPrimary,
const QPoint &virtualPos,
const QList<QPlatformScreen *> &virtualSiblings) override;
};
diff --git a/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp b/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp
index bdf2634642..2ca251c4af 100644
--- a/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp
+++ b/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp
@@ -106,6 +106,7 @@ private:
void *nativeDisplay() const override;
QPlatformScreen *createScreen(const QKmsOutput &output) override;
void registerScreen(QPlatformScreen *screen,
+ bool isPrimary,
const QPoint &virtualPos,
const QList<QPlatformScreen *> &virtualSiblings) override;
@@ -175,10 +176,12 @@ QPlatformScreen *QLinuxFbDevice::createScreen(const QKmsOutput &output)
}
void QLinuxFbDevice::registerScreen(QPlatformScreen *screen,
- const QPoint &virtualPos,
- const QList<QPlatformScreen *> &virtualSiblings)
+ bool isPrimary,
+ const QPoint &virtualPos,
+ const QList<QPlatformScreen *> &virtualSiblings)
{
Q_UNUSED(screen);
+ Q_UNUSED(isPrimary);
Q_UNUSED(virtualPos);
Q_UNUSED(virtualSiblings);
Q_UNREACHABLE();