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// Qt-Security score:significant reason:default
4
8#include "private/qeglfsintegration_p.h"
9#include "private/qeglfscursor_p.h"
10
11#include <QtCore/private/qcore_unix_p.h>
12
14
15QEglFSKmsEglDevice::QEglFSKmsEglDevice(QEglFSKmsEglDeviceIntegration *devInt, QKmsScreenConfig *screenConfig, const QString &path)
16 : QEglFSKmsDevice(screenConfig, path),
17 m_devInt(devInt),
18 m_globalCursor(nullptr)
19{
20}
21
23{
24 Q_ASSERT(fd() == -1);
25
26 int fd = -1;
27
28 if (devicePath().compare("drm-nvdc") == 0)
29 fd = drmOpen(devicePath().toLocal8Bit().constData(), nullptr);
30 else
31 fd = qt_safe_open(devicePath().toLocal8Bit().constData(), O_RDWR);
32 if (Q_UNLIKELY(fd < 0))
33 qFatal("Could not open DRM (NV) device");
34
35 setFd(fd);
36
37 return true;
38}
39
41{
42 // Note: screens are gone at this stage.
43
44 if (drmClose(fd()) == -1)
45 qErrnoWarning("Could not close DRM (NV) device");
46
47 setFd(-1);
48}
49
51{
52 return m_devInt->eglDevice();
53}
54
56{
57 QEglFSKmsScreen *screen = new QEglFSKmsEglDeviceScreen(this, output);
58#if QT_CONFIG(opengl)
59 if (!m_globalCursor && !screenConfig()->separateScreens()) {
60 qCDebug(qLcEglfsKmsDebug, "Creating new global mouse cursor");
61 m_globalCursor = new QEglFSCursor(screen);
62 }
63#endif
64 return screen;
65}
66
68{
69 if (m_globalCursor) {
70 qCDebug(qLcEglfsKmsDebug, "Destroying global mouse cursor");
71 delete m_globalCursor;
72 m_globalCursor = nullptr;
73 }
74}
75
76QT_END_NAMESPACE
QPlatformScreen * createScreen(const QKmsOutput &output) override
void * nativeDisplay() const override
Combined button and popup list for selecting options.