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
qeglfskmsvsp2device.cpp
Go to the documentation of this file.
1// Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
2// Copyright (C) 2017 The Qt Company Ltd.
3// Copyright (C) 2016 Pelagicore AG
4// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
5
8
10
11#include <QtCore/QLoggingCategory>
12#include <QtCore/private/qcore_unix_p.h>
13
15
16Q_DECLARE_LOGGING_CATEGORY(qLcEglfsKmsDebug)
17
19 : QEglFSKmsDevice(screenConfig, path)
20{
21}
22
24{
25 Q_ASSERT(fd() == -1);
26 Q_ASSERT(m_gbm_device == nullptr);
27
28 int fd = qt_safe_open(devicePath().toLocal8Bit().constData(), O_RDWR | O_CLOEXEC);
29 if (fd == -1) {
30 qErrnoWarning("Could not open DRM device %s", qPrintable(devicePath()));
31 return false;
32 }
33
34 qCDebug(qLcEglfsKmsDebug) << "Creating GBM device for file descriptor" << fd
35 << "obtained from" << devicePath();
36 m_gbm_device = gbm_create_device(fd);
37 if (!m_gbm_device) {
38 qErrnoWarning("Could not create GBM device");
40 fd = -1;
41 return false;
42 }
43
44 setFd(fd);
45
46 return true;
47}
48
50{
51 // Note: screens are gone at this stage.
52
53 if (m_gbm_device) {
54 gbm_device_destroy(m_gbm_device);
55 m_gbm_device = nullptr;
56 }
57
58 if (fd() != -1) {
60 setFd(-1);
61 }
62}
63
65{
66 return m_gbm_device;
67}
68
70{
71 return m_gbm_device;
72}
73
80
82{
83 qWarning() << Q_FUNC_INFO << "Not implemented yet";
84 return nullptr;
85}
86
88 QPlatformScreen *screenThisScreenClones,
89 const QList<QPlatformScreen *> &screensCloningThisScreen)
90{
92 qWarning() << Q_FUNC_INFO << "Not implemented yet";
93 if (!screenThisScreenClones && screensCloningThisScreen.isEmpty())
94 return;
95
96// auto *vsp2Screen = static_cast<QEglFSKmsVsp2Screen *>(screen);
97// vsp2Screen->initCloning(screenThisScreenClones, screensCloningThisScreen);
98}
99
gbm_device * gbmDevice() const
void * nativeDisplay() const override
void registerScreenCloning(QPlatformScreen *screen, QPlatformScreen *screenThisScreenClones, const QList< QPlatformScreen * > &screensCloningThisScreen) override
QPlatformScreen * createHeadlessScreen() override
QPlatformScreen * createScreen(const QKmsOutput &output) override
int fd() const
void setFd(int fd)
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_FUNC_INFO
static int qt_safe_open(const char *pathname, int flags, mode_t mode=0777)
static int qt_safe_close(int fd)
#define qWarning
Definition qlogging.h:166
#define qCDebug(category,...)
#define Q_DECLARE_LOGGING_CATEGORY(name)
GLuint64 GLenum GLint fd
GLsizei const GLchar *const * path
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
#define qPrintable(string)
Definition qstring.h:1531
static char * toLocal8Bit(char *out, QStringView in, QStringConverter::State *state)
QScreen * screen
[1]
Definition main.cpp:29
#define Q_UNUSED(x)
QT_BEGIN_NAMESPACE typedef uchar * output