qeglfskmsintegration.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9const QLoggingCategory &qLcEglfsKmsDebug() { static const QLoggingCategory category("qt.qpa.eglfs.kms"); return
never executed: return category;
category;
never executed: return category;
}
0
10-
11QEglFSKmsIntegration::QEglFSKmsIntegration()-
12 : m_device(nullptr)-
13 , m_hwCursor(false)-
14 , m_pbuffers(false)-
15 , m_separateScreens(false)-
16{}
never executed: end of block
0
17-
18void QEglFSKmsIntegration::platformInit()-
19{-
20 loadConfig();-
21-
22 if (!m_devicePath.isEmpty()
!m_devicePath.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
23 for (bool qt_category_enabled = qLcEglfsKmsDebug().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 75, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Using DRM device" << m_devicePath << "specified in config file";
never executed: QMessageLogger(__FILE__, 75, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Using DRM device" << m_devicePath << "specified in config file";
0
24 }
never executed: end of block
0
25-
26 m_device = createDevice(m_devicePath);-
27 if (__builtin_expect(!!(!m_device->open()), false)
__builtin_expe...pen()), false)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
28 QMessageLogger(__FILE__, 80, __PRETTY_FUNCTION__).fatal("Could not open device %s - aborting!", QString(m_devicePath).toLocal8Bit().constData());
never executed: QMessageLogger(__FILE__, 80, __PRETTY_FUNCTION__).fatal("Could not open device %s - aborting!", QString(m_devicePath).toLocal8Bit().constData());
0
29}
never executed: end of block
0
30-
31void QEglFSKmsIntegration::platformDestroy()-
32{-
33 m_device->close();-
34 delete m_device;-
35 m_device = nullptr;-
36}
never executed: end of block
0
37-
38EGLNativeDisplayType QEglFSKmsIntegration::platformDisplay() const-
39{-
40 ((!(m_device)) ? qt_assert("m_device",__FILE__,92) : qt_noop());-
41 return
never executed: return m_device->nativeDisplay();
m_device->nativeDisplay();
never executed: return m_device->nativeDisplay();
0
42}-
43-
44bool QEglFSKmsIntegration::usesDefaultScreen()-
45{-
46 return
never executed: return false;
false;
never executed: return false;
0
47}-
48-
49void QEglFSKmsIntegration::screenInit()-
50{-
51 m_device->createScreens();-
52}
never executed: end of block
0
53-
54QSurfaceFormat QEglFSKmsIntegration::surfaceFormatFor(const QSurfaceFormat &inputFormat) const-
55{-
56 QSurfaceFormat format(inputFormat);-
57 format.setRenderableType(QSurfaceFormat::OpenGLES);-
58 format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);-
59 format.setRedBufferSize(8);-
60 format.setGreenBufferSize(8);-
61 format.setBlueBufferSize(8);-
62 return
never executed: return format;
format;
never executed: return format;
0
63}-
64-
65bool QEglFSKmsIntegration::hasCapability(QPlatformIntegration::Capability cap) const-
66{-
67 switch (cap) {-
68 case
never executed: case QPlatformIntegration::ThreadedPixmaps:
QPlatformIntegration::ThreadedPixmaps:
never executed: case QPlatformIntegration::ThreadedPixmaps:
0
69 case
never executed: case QPlatformIntegration::OpenGL:
QPlatformIntegration::OpenGL:
never executed: case QPlatformIntegration::OpenGL:
0
70 case
never executed: case QPlatformIntegration::ThreadedOpenGL:
QPlatformIntegration::ThreadedOpenGL:
never executed: case QPlatformIntegration::ThreadedOpenGL:
0
71 return
never executed: return true;
true;
never executed: return true;
0
72 default
never executed: default:
:
never executed: default:
0
73 return
never executed: return false;
false;
never executed: return false;
0
74 }-
75}-
76-
77void QEglFSKmsIntegration::waitForVSync(QPlatformSurface *surface) const-
78{-
79 QWindow *window = static_cast<QWindow *>(surface->surface());-
80 QEglFSKmsScreen *screen = static_cast<QEglFSKmsScreen *>(window->screen()->handle());-
81-
82 screen->waitForFlip();-
83}
never executed: end of block
0
84-
85bool QEglFSKmsIntegration::supportsPBuffers() const-
86{-
87 return
never executed: return m_pbuffers;
m_pbuffers;
never executed: return m_pbuffers;
0
88}-
89-
90bool QEglFSKmsIntegration::hwCursor() const-
91{-
92 return
never executed: return m_hwCursor;
m_hwCursor;
never executed: return m_hwCursor;
0
93}-
94-
95bool QEglFSKmsIntegration::separateScreens() const-
96{-
97 return
never executed: return m_separateScreens;
m_separateScreens;
never executed: return m_separateScreens;
0
98}-
99-
100QMap<QString, QVariantMap> QEglFSKmsIntegration::outputSettings() const-
101{-
102 return
never executed: return m_outputSettings;
m_outputSettings;
never executed: return m_outputSettings;
0
103}-
104-
105QEglFSKmsDevice *QEglFSKmsIntegration::device() const-
106{-
107 return
never executed: return m_device;
m_device;
never executed: return m_device;
0
108}-
109-
110void QEglFSKmsIntegration::loadConfig()-
111{-
112 static QByteArray json = qgetenv("QT_QPA_EGLFS_KMS_CONFIG");-
113 if (json.isEmpty()
json.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
114 return;
never executed: return;
0
115-
116 for (bool qt_category_enabled = qLcEglfsKmsDebug().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 168, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Loading KMS setup from" << json;
never executed: QMessageLogger(__FILE__, 168, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Loading KMS setup from" << json;
0
117-
118 QFile file(QString::fromUtf8(json));-
119 if (!file.open(QFile::ReadOnly)
!file.open(QFile::ReadOnly)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
120 for (bool qt_category_enabled = qLcEglfsKmsDebug().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 172, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Could not open config file"
never executed: QMessageLogger(__FILE__, 172, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Could not open config file" << json << "for reading";
0
121 << json << "for reading";
never executed: QMessageLogger(__FILE__, 172, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Could not open config file" << json << "for reading";
0
122 return;
never executed: return;
0
123 }-
124-
125 const QJsonDocument doc = QJsonDocument::fromJson(file.readAll());-
126 if (!doc.isObject()
!doc.isObject()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
127 for (bool qt_category_enabled = qLcEglfsKmsDebug().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 179, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Invalid config file" << json
never executed: QMessageLogger(__FILE__, 179, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Invalid config file" << json << "- no top-level JSON object";
0
128 << "- no top-level JSON object";
never executed: QMessageLogger(__FILE__, 179, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Invalid config file" << json << "- no top-level JSON object";
0
129 return;
never executed: return;
0
130 }-
131-
132 const QJsonObject object = doc.object();-
133-
134 m_hwCursor = object.value(QLatin1String("hwcursor")).toBool(m_hwCursor);-
135 m_pbuffers = object.value(QLatin1String("pbuffers")).toBool(m_pbuffers);-
136 m_devicePath = object.value(QLatin1String("device")).toString();-
137 m_separateScreens = object.value(QLatin1String("separateScreens")).toBool(m_separateScreens);-
138-
139 const QJsonArray outputs = object.value(QLatin1String("outputs")).toArray();-
140 for (int i = 0; i < outputs.size()
i < outputs.size()Description
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
141 const QVariantMap outputSettings = outputs.at(i).toObject().toVariantMap();-
142-
143 if (outputSettings.contains(([]() -> QString { enum { Size = sizeof(u"" "name")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "name" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()))
outputSettings...al_temp; }()))Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
144 const QString name = outputSettings.value(([]() -> QString { enum { Size = sizeof(u"" "name")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "name" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
never executed: return qstring_literal_temp;
qstring_literal_temp;
never executed: return qstring_literal_temp;
}())).toString();
0
145-
146 if (m_outputSettings.contains(name)
m_outputSettin...contains(name)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
147 for (bool qt_category_enabled = qLcEglfsKmsDebug().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 199, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Output" << name << "configured multiple times!";
never executed: QMessageLogger(__FILE__, 199, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Output" << name << "configured multiple times!";
0
148 }
never executed: end of block
0
149-
150 m_outputSettings.insert(name, outputSettings);-
151 }
never executed: end of block
0
152 }
never executed: end of block
0
153-
154 for (bool qt_category_enabled = qLcEglfsKmsDebug().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 206, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Configuration:\n"
never executed: QMessageLogger(__FILE__, 206, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Configuration:\n" << "\thwcursor:" << m_hwCursor << "\n" << "\tpbuffers:" << m_pbuffers << "\n" << "\tseparateScreens:" << m_separateScreens << "\n" << "\toutputs:" << m_outputSettings;
0
155 << "\thwcursor:" << m_hwCursor << "\n"
never executed: QMessageLogger(__FILE__, 206, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Configuration:\n" << "\thwcursor:" << m_hwCursor << "\n" << "\tpbuffers:" << m_pbuffers << "\n" << "\tseparateScreens:" << m_separateScreens << "\n" << "\toutputs:" << m_outputSettings;
0
156 << "\tpbuffers:" << m_pbuffers << "\n"
never executed: QMessageLogger(__FILE__, 206, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Configuration:\n" << "\thwcursor:" << m_hwCursor << "\n" << "\tpbuffers:" << m_pbuffers << "\n" << "\tseparateScreens:" << m_separateScreens << "\n" << "\toutputs:" << m_outputSettings;
0
157 << "\tseparateScreens:" << m_separateScreens << "\n"
never executed: QMessageLogger(__FILE__, 206, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Configuration:\n" << "\thwcursor:" << m_hwCursor << "\n" << "\tpbuffers:" << m_pbuffers << "\n" << "\tseparateScreens:" << m_separateScreens << "\n" << "\toutputs:" << m_outputSettings;
0
158 << "\toutputs:" << m_outputSettings;
never executed: QMessageLogger(__FILE__, 206, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Configuration:\n" << "\thwcursor:" << m_hwCursor << "\n" << "\tpbuffers:" << m_pbuffers << "\n" << "\tseparateScreens:" << m_separateScreens << "\n" << "\toutputs:" << m_outputSettings;
0
159}
never executed: end of block
0
160-
161-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9