Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qeglfskmsegldevice.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 Pelagicore AG
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
7#include "private/qeglfsintegration_p.h"
8#include "private/qeglfscursor_p.h"
9
10#include <QtCore/private/qcore_unix_p.h>
11
13
14QEglFSKmsEglDevice::QEglFSKmsEglDevice(QEglFSKmsEglDeviceIntegration *devInt, QKmsScreenConfig *screenConfig, const QString &path)
15 : QEglFSKmsDevice(screenConfig, path),
16 m_devInt(devInt),
17 m_globalCursor(nullptr)
18{
19}
20
22{
23 Q_ASSERT(fd() == -1);
24
25 int fd = -1;
26
27 if (devicePath().compare("drm-nvdc") == 0)
28 fd = drmOpen(devicePath().toLocal8Bit().constData(), nullptr);
29 else
30 fd = qt_safe_open(devicePath().toLocal8Bit().constData(), O_RDWR);
31 if (Q_UNLIKELY(fd < 0))
32 qFatal("Could not open DRM (NV) device");
33
34 setFd(fd);
35
36 return true;
37}
38
40{
41 // Note: screens are gone at this stage.
42
43 if (drmClose(fd()) == -1)
44 qErrnoWarning("Could not close DRM (NV) device");
45
46 setFd(-1);
47}
48
50{
51 return m_devInt->eglDevice();
52}
53
55{
56 QEglFSKmsScreen *screen = new QEglFSKmsEglDeviceScreen(this, output);
57#if QT_CONFIG(opengl)
58 if (!m_globalCursor && !screenConfig()->separateScreens()) {
59 qCDebug(qLcEglfsKmsDebug, "Creating new global mouse cursor");
60 m_globalCursor = new QEglFSCursor(screen);
61 }
62#endif
63 return screen;
64}
65
67{
68 if (m_globalCursor) {
69 qCDebug(qLcEglfsKmsDebug, "Destroying global mouse cursor");
70 delete m_globalCursor;
71 m_globalCursor = nullptr;
72 }
73}
74
75QT_END_NAMESPACE
QPlatformScreen * createScreen(const QKmsOutput &output) override
void * nativeDisplay() const override