Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
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{
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
QPlatformScreen * createScreen(const QKmsOutput &output) override
void * nativeDisplay() const override
QEglFSKmsEglDevice(QEglFSKmsEglDeviceIntegration *devInt, QKmsScreenConfig *screenConfig, const QString &path)
int fd() const
void setFd(int fd)
QKmsScreenConfig * screenConfig() const
QString devicePath() const
The QPlatformScreen class provides an abstraction for visual displays.
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
void qErrnoWarning(const char *msg,...)
Combined button and popup list for selecting options.
#define Q_UNLIKELY(x)
static int qt_safe_open(const char *pathname, int flags, mode_t mode=0777)
#define qFatal
Definition qlogging.h:168
#define qCDebug(category,...)
GLuint64 GLenum GLint fd
GLsizei const GLchar *const * path
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
static char * toLocal8Bit(char *out, QStringView in, QStringConverter::State *state)
QScreen * screen
[1]
Definition main.cpp:29
static int compare(quint64 a, quint64 b)
QT_BEGIN_NAMESPACE typedef uchar * output
QObject::connect nullptr