OpenCoverage

qeglfshooks.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/plugins/platforms/eglfs/qeglfshooks.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the qmake spec of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include "qeglfshooks.h"-
41#include <QLoggingCategory>-
42-
43QT_BEGIN_NAMESPACE-
44-
45Q_DECLARE_LOGGING_CATEGORY(qLcEglDevDebug)-
46-
47#ifdef EGLFS_PLATFORM_HOOKS-
48-
49QEGLDeviceIntegration *qt_egl_device_integration()-
50{-
51 extern QEglFSHooks *platformHooks;-
52 return platformHooks;-
53}-
54-
55#else-
56-
57class DeviceIntegration-
58{-
59public:-
60 DeviceIntegration();-
61 ~DeviceIntegration() { delete m_integration; }
never executed: end of block
0
62 QEGLDeviceIntegration *integration() { return m_integration; }
never executed: return m_integration;
0
63private:-
64 QEGLDeviceIntegration *m_integration;-
65};-
66-
67Q_GLOBAL_STATIC(DeviceIntegration, deviceIntegration)
never executed: end of block
never executed: guard.store(QtGlobalStatic::Destroyed);
never executed: return &holder.value;
guard.load() =...c::InitializedDescription
TRUEnever evaluated
FALSEnever evaluated
0
68-
69DeviceIntegration::DeviceIntegration()-
70 : m_integration(nullptr)-
71{-
72 QStringList pluginKeys = QEGLDeviceIntegrationFactory::keys();-
73 if (!pluginKeys.isEmpty()) {
!pluginKeys.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
74 // Some built-in logic: Prioritize either X11 or KMS/DRM.-
75 if (qEnvironmentVariableIsSet("DISPLAY")) {
qEnvironmentVa...Set("DISPLAY")Description
TRUEnever evaluated
FALSEnever evaluated
0
76 const QString x11key = QStringLiteral("eglfs_x11");
never executed: return qstring_literal_temp;
0
77 if (pluginKeys.contains(x11key)) {
pluginKeys.contains(x11key)Description
TRUEnever evaluated
FALSEnever evaluated
0
78 pluginKeys.removeOne(x11key);-
79 pluginKeys.prepend(x11key);-
80 }
never executed: end of block
0
81 } else {
never executed: end of block
0
82 const QString kmskey = QStringLiteral("eglfs_kms");
never executed: return qstring_literal_temp;
0
83 if (pluginKeys.contains(kmskey)) {
pluginKeys.contains(kmskey)Description
TRUEnever evaluated
FALSEnever evaluated
0
84 pluginKeys.removeOne(kmskey);-
85 pluginKeys.prepend(kmskey);-
86 }
never executed: end of block
0
87 }
never executed: end of block
0
88-
89 QByteArray requested;-
90-
91 // The environment variable can override everything.-
92 if (qEnvironmentVariableIsSet("QT_QPA_EGLFS_INTEGRATION")) {
qEnvironmentVa..._INTEGRATION")Description
TRUEnever evaluated
FALSEnever evaluated
0
93 requested = qgetenv("QT_QPA_EGLFS_INTEGRATION");-
94 } else {
never executed: end of block
0
95 // Device-specific makespecs may define a preferred plugin.-
96#ifdef EGLFS_PREFERRED_PLUGIN-
97#define DEFAULT_PLUGIN EGLFS_PREFERRED_PLUGIN-
98#define STR(s) #s-
99#define STRQ(s) STR(s)-
100 requested = STRQ(DEFAULT_PLUGIN);-
101#endif-
102 }
never executed: end of block
0
103-
104 // Treat "none" as special. There has to be a way to indicate-
105 // that plugins must be ignored when the device is known to be-
106 // functional with the default, non-specialized integration.-
107 if (requested != QByteArrayLiteral("none")) {
never executed: return ba;
requested != (...eturn ba; }())Description
TRUEnever evaluated
FALSEnever evaluated
0
108 if (!requested.isEmpty()) {
!requested.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
109 QString reqStr = QString::fromLocal8Bit(requested);-
110 pluginKeys.removeOne(reqStr);-
111 pluginKeys.prepend(reqStr);-
112 }
never executed: end of block
0
113 qCDebug(qLcEglDevDebug) << "EGL device integration plugin keys (sorted):" << pluginKeys;
never executed: QMessageLogger(__FILE__, 113, __PRETTY_FUNCTION__, qLcEglDevDebug().categoryName()).debug() << "EGL device integration plugin keys (sorted):" << pluginKeys;
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
0
114 while (!m_integration && !pluginKeys.isEmpty()) {
!m_integrationDescription
TRUEnever evaluated
FALSEnever evaluated
!pluginKeys.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
115 QString key = pluginKeys.takeFirst();-
116 qCDebug(qLcEglDevDebug) << "Trying to load device EGL integration" << key;
never executed: QMessageLogger(__FILE__, 116, __PRETTY_FUNCTION__, qLcEglDevDebug().categoryName()).debug() << "Trying to load device EGL integration" << key;
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
0
117 m_integration = QEGLDeviceIntegrationFactory::create(key);-
118 }
never executed: end of block
0
119 }
never executed: end of block
0
120 }
never executed: end of block
0
121-
122 if (!m_integration) {
!m_integrationDescription
TRUEnever evaluated
FALSEnever evaluated
0
123 // Use a default, non-specialized device integration when no plugin is available.-
124 // For some systems this is sufficient.-
125 qCDebug(qLcEglDevDebug) << "Using base device integration";
never executed: QMessageLogger(__FILE__, 125, __PRETTY_FUNCTION__, qLcEglDevDebug().categoryName()).debug() << "Using base device integration";
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
0
126 m_integration = new QEGLDeviceIntegration;-
127 }
never executed: end of block
0
128}
never executed: end of block
0
129-
130QEGLDeviceIntegration *qt_egl_device_integration()-
131{-
132 return deviceIntegration()->integration();
never executed: return deviceIntegration()->integration();
0
133}-
134-
135#endif // EGLFS_PLATFORM_HOOKS-
136-
137QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

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