summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/kms/qkmsintegration.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/kms/qkmsintegration.cpp')
-rw-r--r--src/plugins/platforms/kms/qkmsintegration.cpp43
1 files changed, 32 insertions, 11 deletions
diff --git a/src/plugins/platforms/kms/qkmsintegration.cpp b/src/plugins/platforms/kms/qkmsintegration.cpp
index 8210b54535..539363722d 100644
--- a/src/plugins/platforms/kms/qkmsintegration.cpp
+++ b/src/plugins/platforms/kms/qkmsintegration.cpp
@@ -46,10 +46,14 @@
#include "qkmsbackingstore.h"
#include "qkmscontext.h"
#include "qkmsnativeinterface.h"
-#include "qkmsudevlistener.h"
-#include "qkmsudevdrmhandler.h"
#include "qkmsvthandler.h"
+#if !defined(QT_NO_EVDEV)
+#include <QtPlatformSupport/private/qevdevmousemanager_p.h>
+#include <QtPlatformSupport/private/qevdevkeyboardmanager_p.h>
+#include <QtPlatformSupport/private/qevdevtouch_p.h>
+#endif
+
#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
#include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h>
#include <QtGui/private/qguiapplication_p.h>
@@ -62,18 +66,32 @@ QKmsIntegration::QKmsIntegration()
: QPlatformIntegration(),
m_fontDatabase(new QGenericUnixFontDatabase()),
m_eventDispatcher(createUnixEventDispatcher()),
- m_nativeInterface(new QKmsNativeInterface),
- m_udevListener(new QKmsUdevListener)
+ m_nativeInterface(new QKmsNativeInterface)
{
QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher);
setenv("EGL_PLATFORM", "drm",1);
m_vtHandler = new QKmsVTHandler;
- m_drmHandler = new QKmsUdevDRMHandler(this);
- m_udevListener->addHandler(m_drmHandler);
+
+ m_deviceDiscovery = QDeviceDiscovery::create(QDeviceDiscovery::Device_DRM | QDeviceDiscovery::Device_DRM_PrimaryGPU, 0);
+ if (m_deviceDiscovery) {
+ QStringList devices = m_deviceDiscovery->scanConnectedDevices();
+ foreach (QString device, devices)
+ addDevice(device);
+
+ connect(m_deviceDiscovery, SIGNAL(deviceDetected(QString)), this, SLOT(addDevice(QString)));
+ connect(m_deviceDiscovery, SIGNAL(deviceRemoved(QString)), this, SLOT(removeDevice(QString)));
+ }
+
+#if !defined(QT_NO_EVDEV)
+ new QEvdevKeyboardManager(QLatin1String("EvdevKeyboard"), QString() /* spec */, this);
+ new QEvdevMouseManager(QLatin1String("EvdevMouse"), QString() /* spec */, this);
+ new QEvdevTouchScreenHandlerThread(QString() /* spec */, this);
+#endif
}
QKmsIntegration::~QKmsIntegration()
{
+ delete m_deviceDiscovery;
foreach (QKmsDevice *device, m_devices) {
delete device;
}
@@ -81,15 +99,18 @@ QKmsIntegration::~QKmsIntegration()
delete screen;
}
delete m_fontDatabase;
- delete m_udevListener;
delete m_vtHandler;
}
-QObject *QKmsIntegration::createDevice(const char *path)
+void QKmsIntegration::addDevice(const QString &deviceNode)
+{
+ m_devices.append(new QKmsDevice(deviceNode, this));
+}
+
+void QKmsIntegration::removeDevice(const QString &deviceNode)
{
- QKmsDevice *device = new QKmsDevice(path, this);
- m_devices.append(device);
- return device;
+ // TODO: support hot-plugging some day?
+ Q_UNUSED(deviceNode);
}
bool QKmsIntegration::hasCapability(QPlatformIntegration::Capability cap) const