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
4
#
include
"qeglfskmsegldevice.h"
5
#
include
"qeglfskmsegldevicescreen.h"
6
#
include
"qeglfskmsegldeviceintegration.h"
7
#
include
"private/qeglfsintegration_p.h"
8
#
include
"private/qeglfscursor_p.h"
9
10
#
include
<
QtCore
/
private
/
qcore_unix_p
.
h
>
11
12
QT_BEGIN_NAMESPACE
13
14
QEglFSKmsEglDevice
::
QEglFSKmsEglDevice
(QEglFSKmsEglDeviceIntegration *devInt, QKmsScreenConfig *screenConfig,
const
QString &path)
15
: QEglFSKmsDevice(screenConfig, path),
16
m_devInt(devInt),
17
m_globalCursor(
nullptr
)
18
{
19
}
20
21
bool
QEglFSKmsEglDevice
::
open
()
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
39
void
QEglFSKmsEglDevice
::
close
()
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
49
void
*
QEglFSKmsEglDevice
::
nativeDisplay
()
const
50
{
51
return
m_devInt->eglDevice();
52
}
53
54
QPlatformScreen
*
QEglFSKmsEglDevice
::
createScreen
(
const
QKmsOutput &output)
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
66
void
QEglFSKmsEglDevice
::
destroyGlobalCursor
()
67
{
68
if
(m_globalCursor) {
69
qCDebug(qLcEglfsKmsDebug,
"Destroying global mouse cursor"
);
70
delete
m_globalCursor;
71
m_globalCursor =
nullptr
;
72
}
73
}
74
75
QT_END_NAMESPACE
QEglFSKmsEglDeviceScreen
Definition
qeglfskmsegldevicescreen.h:12
QEglFSKmsEglDevice
Definition
qeglfskmsegldevice.h:15
QEglFSKmsEglDevice::createScreen
QPlatformScreen * createScreen(const QKmsOutput &output) override
Definition
qeglfskmsegldevice.cpp:54
QEglFSKmsEglDevice::open
bool open() override
Definition
qeglfskmsegldevice.cpp:21
QEglFSKmsEglDevice::close
void close() override
Definition
qeglfskmsegldevice.cpp:39
QEglFSKmsEglDevice::destroyGlobalCursor
void destroyGlobalCursor()
Definition
qeglfskmsegldevice.cpp:66
QEglFSKmsEglDevice::nativeDisplay
void * nativeDisplay() const override
Definition
qeglfskmsegldevice.cpp:49
QPlatformGraphicsBufferHelper
\inmodule QtGui
qtbase
src
plugins
platforms
eglfs
deviceintegration
eglfs_kms_egldevice
qeglfskmsegldevice.cpp
Generated on
for Qt by
1.14.0