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
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// Qt-Security score:significant reason:default
6
9
11
12#include <QtCore/QLoggingCategory>
13#include <QtCore/private/qcore_unix_p.h>
14
16
17Q_DECLARE_LOGGING_CATEGORY(qLcEglfsKmsDebug)
18
19QEglFSKmsVsp2Device::QEglFSKmsVsp2Device(QKmsScreenConfig *screenConfig, const QString &path)
20 : QEglFSKmsDevice(screenConfig, path)
21{
22}
23
25{
26 Q_ASSERT(fd() == -1);
27 Q_ASSERT(m_gbm_device == nullptr);
28
29 int fd = qt_safe_open(devicePath().toLocal8Bit().constData(), O_RDWR | O_CLOEXEC);
30 if (fd == -1) {
31 qErrnoWarning("Could not open DRM device %s", qPrintable(devicePath()));
32 return false;
33 }
34
35 qCDebug(qLcEglfsKmsDebug) << "Creating GBM device for file descriptor" << fd
36 << "obtained from" << devicePath();
37 m_gbm_device = gbm_create_device(fd);
38 if (!m_gbm_device) {
39 qErrnoWarning("Could not create GBM device");
40 qt_safe_close(fd);
41 fd = -1;
42 return false;
43 }
44
45 setFd(fd);
46
47 return true;
48}
49
51{
52 // Note: screens are gone at this stage.
53
54 if (m_gbm_device) {
55 gbm_device_destroy(m_gbm_device);
56 m_gbm_device = nullptr;
57 }
58
59 if (fd() != -1) {
60 qt_safe_close(fd());
61 setFd(-1);
62 }
63}
64
66{
67 return m_gbm_device;
68}
69
70gbm_device * QEglFSKmsVsp2Device::gbmDevice() const
71{
72 return m_gbm_device;
73}
74
76{
77 auto *screen = new QEglFSKmsVsp2Screen(this, output);
78
79 return screen;
80}
81
83{
84 qWarning() << Q_FUNC_INFO << "Not implemented yet";
85 return nullptr;
86}
87
88void QEglFSKmsVsp2Device::registerScreenCloning(QPlatformScreen *screen,
89 QPlatformScreen *screenThisScreenClones,
90 const QList<QPlatformScreen *> &screensCloningThisScreen)
91{
92 Q_UNUSED(screen);
93 qWarning() << Q_FUNC_INFO << "Not implemented yet";
94 if (!screenThisScreenClones && screensCloningThisScreen.isEmpty())
95 return;
96
97// auto *vsp2Screen = static_cast<QEglFSKmsVsp2Screen *>(screen);
98// vsp2Screen->initCloning(screenThisScreenClones, screensCloningThisScreen);
99}
100
101QT_END_NAMESPACE
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
Combined button and popup list for selecting options.