diff options
author | Hannu Lyytinen <hannu.lyytinen@nomovok.com> | 2012-04-12 15:15:26 +0300 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-13 08:33:40 +0200 |
commit | 2a5ade68fd4b536c766de395d2657cd37c9bb98b (patch) | |
tree | 6aadeef26b2ace279512ef7ab48ec0232a89bbe4 /src/plugins/platforms/kms/qkmsintegration.cpp | |
parent | 5ab6a3270d1121fb4d50c3f79f497a9c52d5afa8 (diff) |
Use the new udev based framework for detecting graphics cards.
Get rid of hard coded device node and support any number of graphics
cards.
Change-Id: I50f07fb1e6ea321a4ae751db8fb49ab439dce51e
Reviewed-by: Andy Nichols <andy.nichols@nokia.com>
Diffstat (limited to 'src/plugins/platforms/kms/qkmsintegration.cpp')
-rw-r--r-- | src/plugins/platforms/kms/qkmsintegration.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/plugins/platforms/kms/qkmsintegration.cpp b/src/plugins/platforms/kms/qkmsintegration.cpp index 74346e8097..0405330617 100644 --- a/src/plugins/platforms/kms/qkmsintegration.cpp +++ b/src/plugins/platforms/kms/qkmsintegration.cpp @@ -46,6 +46,8 @@ #include "qkmsbackingstore.h" #include "qkmscontext.h" #include "qkmsnativeinterface.h" +#include "qkmsudevlistener.h" +#include "qkmsudevdrmhandler.h" #include <QtPlatformSupport/private/qgenericunixprintersupport_p.h> #include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h> @@ -60,14 +62,13 @@ QKmsIntegration::QKmsIntegration() : QPlatformIntegration(), m_fontDatabase(new QGenericUnixFontDatabase()), m_eventDispatcher(createUnixEventDispatcher()), - m_nativeInterface(new QKmsNativeInterface) + m_nativeInterface(new QKmsNativeInterface), + m_udevListener(new QKmsUdevListener) { QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher); setenv("EGL_PLATFORM", "drm",1); - QStringList drmDevices = findDrmDevices(); - foreach (QString path, drmDevices) { - m_devices.append(new QKmsDevice(path, this)); - } + m_drmHandler = new QKmsUdevDRMHandler(this); + m_udevListener->addHandler(m_drmHandler); } QKmsIntegration::~QKmsIntegration() @@ -79,6 +80,14 @@ QKmsIntegration::~QKmsIntegration() delete screen; } delete m_fontDatabase; + delete m_udevListener; +} + +QObject *QKmsIntegration::createDevice(const char *path) +{ + QKmsDevice *device = new QKmsDevice(path, this); + m_devices.append(device); + return device; } bool QKmsIntegration::hasCapability(QPlatformIntegration::Capability cap) const @@ -112,14 +121,6 @@ QPlatformFontDatabase *QKmsIntegration::fontDatabase() const return m_fontDatabase; } -QStringList QKmsIntegration::findDrmDevices() -{ - //Return a list addresses of DRM supported devices - //Hardcoded now, but could use udev to return a list - //of multiple devices. - return QStringList(QString::fromLatin1("/dev/dri/card0")); -} - void QKmsIntegration::addScreen(QKmsScreen *screen) { m_screens.append(screen); |