qeglfsdeviceintegration.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11const QLoggingCategory &qLcEglDevDebug() { static const QLoggingCategory category("qt.qpa.egldeviceintegration"); return
never executed: return category;
category;
never executed: return category;
}
0
12-
13namespace { namespace Q_QGS_loader { typedef QFactoryLoader Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
guard.load() =...c::InitializedDescription
TRUEnever evaluated
FALSEnever evaluated
) guard.store(QtGlobalStatic::Destroyed);
never executed: guard.store(QtGlobalStatic::Destroyed);
}
never executed: end of block
}; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ("org.qt-project.qt.qpa.egl.QEGLDeviceIntegrationFactoryInterface.5.5", QLatin1String("/egldeviceintegrations"), Qt::CaseInsensitive))) : value ("org.qt-project.qt.qpa.egl.QEGLDeviceIntegrationFactoryInterface.5.5", QLatin1String("/egldeviceintegrations"), Qt::CaseInsensitive) { guard.store(QtGlobalStatic::Initialized); } } holder; return
never executed: return &holder.value;
&holder.value;
never executed: return &holder.value;
} } } static QGlobalStatic<QFactoryLoader, Q_QGS_loader::innerFunction, Q_QGS_loader::guard> loader;
0
14-
15-
16-
17namespace { namespace Q_QGS_directLoader { typedef QFactoryLoader Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
guard.load() =...c::InitializedDescription
TRUEnever evaluated
FALSEnever evaluated
) guard.store(QtGlobalStatic::Destroyed);
never executed: guard.store(QtGlobalStatic::Destroyed);
}
never executed: end of block
}; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ("org.qt-project.qt.qpa.egl.QEGLDeviceIntegrationFactoryInterface.5.5", QLatin1String(""), Qt::CaseInsensitive))) : value ("org.qt-project.qt.qpa.egl.QEGLDeviceIntegrationFactoryInterface.5.5", QLatin1String(""), Qt::CaseInsensitive) { guard.store(QtGlobalStatic::Initialized); } } holder; return
never executed: return &holder.value;
&holder.value;
never executed: return &holder.value;
} } } static QGlobalStatic<QFactoryLoader, Q_QGS_directLoader::innerFunction, Q_QGS_directLoader::guard> directLoader;
0
18-
19-
20-
21QStringList QEGLDeviceIntegrationFactory::keys(const QString &pluginPath)-
22{-
23 QStringList list;-
24-
25 if (!pluginPath.isEmpty()
!pluginPath.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
26 QCoreApplication::addLibraryPath(pluginPath);-
27 list = directLoader()->keyMap().values();-
28 if (!list.isEmpty()
!list.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
29 const QString postFix = QLatin1String(" (from ")-
30 + QDir::toNativeSeparators(pluginPath)-
31 + QLatin1Char(')');-
32 const QStringList::iterator end = list.end();-
33 for (QStringList::iterator it = list.begin(); it != end
it != endDescription
TRUEnever evaluated
FALSEnever evaluated
; ++it)
0
34 (*
never executed: (*it).append(postFix);
it).append(postFix);
never executed: (*it).append(postFix);
0
35 }
never executed: end of block
0
36 }
never executed: end of block
0
37-
38-
39-
40 list.append(loader()->keyMap().values());-
41 for (bool qt_category_enabled = qLcEglDevDebug().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 94, __PRETTY_FUNCTION__, qLcEglDevDebug().categoryName()).debug() << "EGL device integration plugin keys:" << list;
never executed: QMessageLogger(__FILE__, 94, __PRETTY_FUNCTION__, qLcEglDevDebug().categoryName()).debug() << "EGL device integration plugin keys:" << list;
0
42 return
never executed: return list;
list;
never executed: return list;
0
43}-
44-
45QEGLDeviceIntegration *QEGLDeviceIntegrationFactory::create(const QString &key, const QString &pluginPath)-
46{-
47 QEGLDeviceIntegration *integration = nullptr;-
48-
49 if (!pluginPath.isEmpty()
!pluginPath.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
50 QCoreApplication::addLibraryPath(pluginPath);-
51 integration = qLoadPlugin<QEGLDeviceIntegration, QEGLDeviceIntegrationPlugin>(directLoader(), key);-
52 }
never executed: end of block
0
53-
54-
55-
56 if (!integration
!integrationDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
57 integration = qLoadPlugin<QEGLDeviceIntegration, QEGLDeviceIntegrationPlugin>(loader(), key);
never executed: integration = qLoadPlugin<QEGLDeviceIntegration, QEGLDeviceIntegrationPlugin>(loader(), key);
0
58 if (integration
integrationDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
59 for (bool qt_category_enabled = qLcEglDevDebug().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 112, __PRETTY_FUNCTION__, qLcEglDevDebug().categoryName()).debug() << "Using EGL device integration" << key;
never executed: QMessageLogger(__FILE__, 112, __PRETTY_FUNCTION__, qLcEglDevDebug().categoryName()).debug() << "Using EGL device integration" << key;
0
60 else-
61 for (bool qt_category_enabled = qLcEglDevDebug().isWarningEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 114, __PRETTY_FUNCTION__, qLcEglDevDebug().categoryName()).warning() << "Failed to load EGL device integration" << key;
never executed: QMessageLogger(__FILE__, 114, __PRETTY_FUNCTION__, qLcEglDevDebug().categoryName()).warning() << "Failed to load EGL device integration" << key;
0
62-
63 return
never executed: return integration;
integration;
never executed: return integration;
0
64}-
65-
66static int framebuffer = -1;-
67-
68QByteArray QEGLDeviceIntegration::fbDeviceName() const-
69{-
70-
71 QByteArray fbDev = qgetenv("QT_QPA_EGLFS_FB");-
72 if (fbDev.isEmpty()
fbDev.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
73 fbDev = ([]() -> QByteArray { enum { Size = sizeof("/dev/fb0") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "/dev/fb0" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return
never executed: return ba;
ba;
never executed: return ba;
}());
never executed: fbDev = ([]() -> QByteArray { enum { Size = sizeof("/dev/fb0") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "/dev/fb0" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }());
0
74-
75 return
never executed: return fbDev;
fbDev;
never executed: return fbDev;
0
76-
77-
78-
79}-
80-
81int QEGLDeviceIntegration::framebufferIndex() const-
82{-
83 int fbIndex = 0;-
84-
85 QRegularExpression fbIndexRx(QLatin1String("fb(\\d+)"));-
86 QRegularExpressionMatch match = fbIndexRx.match(QString::fromLocal8Bit(fbDeviceName()));-
87 if (match.hasMatch()
match.hasMatch()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
88 fbIndex = match.captured(1).toInt();
never executed: fbIndex = match.captured(1).toInt();
0
89-
90 return
never executed: return fbIndex;
fbIndex;
never executed: return fbIndex;
0
91}-
92-
93void QEGLDeviceIntegration::platformInit()-
94{-
95-
96 QByteArray fbDev = fbDeviceName();-
97-
98 framebuffer = qt_safe_open(fbDev, 00);-
99-
100 if (__builtin_expect(!!(framebuffer == -1), false)
__builtin_expe...== -1), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
101 QMessageLogger(__FILE__, 154, __PRETTY_FUNCTION__).warning("EGLFS: Failed to open %s", fbDev.constData());-
102 QMessageLogger(__FILE__, 155, __PRETTY_FUNCTION__).fatal("EGLFS: Can't continue without a display");-
103 }
never executed: end of block
0
104-
105-
106 ioctl(framebuffer, 0x4611, 0);-
107-
108-
109}
never executed: end of block
0
110-
111void QEGLDeviceIntegration::platformDestroy()-
112{-
113-
114 if (framebuffer != -1
framebuffer != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
115 close(framebuffer);
never executed: close(framebuffer);
0
116-
117}
never executed: end of block
0
118-
119EGLNativeDisplayType QEGLDeviceIntegration::platformDisplay() const-
120{-
121 return
never executed: return ((EGLNativeDisplayType)0);
((EGLNativeDisplayType)0);
never executed: return ((EGLNativeDisplayType)0);
0
122}-
123-
124EGLDisplay QEGLDeviceIntegration::createDisplay(EGLNativeDisplayType nativeDisplay)-
125{-
126 return
never executed: return eglGetDisplay(nativeDisplay);
eglGetDisplay(nativeDisplay);
never executed: return eglGetDisplay(nativeDisplay);
0
127}-
128-
129bool QEGLDeviceIntegration::usesDefaultScreen()-
130{-
131 return
never executed: return true;
true;
never executed: return true;
0
132}-
133-
134void QEGLDeviceIntegration::screenInit()-
135{-
136-
137}-
138-
139void QEGLDeviceIntegration::screenDestroy()-
140{-
141 QGuiApplication *app = (static_cast<QGuiApplication *>(QCoreApplication::instance()));-
142 QEglFSIntegration *platformIntegration = static_cast<QEglFSIntegration *>(-
143 QGuiApplicationPrivate::platformIntegration());-
144 while (!app->screens().isEmpty()
!app->screens().isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
145 platformIntegration->removeScreen(app->screens().last()->handle());
never executed: platformIntegration->removeScreen(app->screens().last()->handle());
0
146}
never executed: end of block
0
147-
148QSizeF QEGLDeviceIntegration::physicalScreenSize() const-
149{-
150 return
never executed: return q_physicalScreenSizeFromFb(framebuffer, screenSize());
q_physicalScreenSizeFromFb(framebuffer, screenSize());
never executed: return q_physicalScreenSizeFromFb(framebuffer, screenSize());
0
151}-
152-
153QSize QEGLDeviceIntegration::screenSize() const-
154{-
155 return
never executed: return q_screenSizeFromFb(framebuffer);
q_screenSizeFromFb(framebuffer);
never executed: return q_screenSizeFromFb(framebuffer);
0
156}-
157-
158QDpi QEGLDeviceIntegration::logicalDpi() const-
159{-
160 const QSizeF ps = physicalScreenSize();-
161 const QSize s = screenSize();-
162-
163 if (!ps.isEmpty()
!ps.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
&& !s.isEmpty()
!s.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
164 return
never executed: return QDpi(25.4 * s.width() / ps.width(), 25.4 * s.height() / ps.height());
QDpi(25.4 * s.width() / ps.width(),
never executed: return QDpi(25.4 * s.width() / ps.width(), 25.4 * s.height() / ps.height());
0
165 25.4 * s.height() / ps.height());
never executed: return QDpi(25.4 * s.width() / ps.width(), 25.4 * s.height() / ps.height());
0
166 else-
167 return
never executed: return QDpi(100, 100);
QDpi(100, 100);
never executed: return QDpi(100, 100);
0
168}-
169-
170qreal QEGLDeviceIntegration::pixelDensity() const-
171{-
172 return
never executed: return qRound(logicalDpi().first / qreal(100));
qRound(logicalDpi().first / qreal(100));
never executed: return qRound(logicalDpi().first / qreal(100));
0
173}-
174-
175Qt::ScreenOrientation QEGLDeviceIntegration::nativeOrientation() const-
176{-
177 return
never executed: return Qt::PrimaryOrientation;
Qt::PrimaryOrientation;
never executed: return Qt::PrimaryOrientation;
0
178}-
179-
180Qt::ScreenOrientation QEGLDeviceIntegration::orientation() const-
181{-
182 return
never executed: return Qt::PrimaryOrientation;
Qt::PrimaryOrientation;
never executed: return Qt::PrimaryOrientation;
0
183}-
184-
185int QEGLDeviceIntegration::screenDepth() const-
186{-
187 return
never executed: return q_screenDepthFromFb(framebuffer);
q_screenDepthFromFb(framebuffer);
never executed: return q_screenDepthFromFb(framebuffer);
0
188}-
189-
190QImage::Format QEGLDeviceIntegration::screenFormat() const-
191{-
192 return
never executed: return screenDepth() == 16 ? QImage::Format_RGB16 : QImage::Format_RGB32;
screenDepth() == 16 ? QImage::Format_RGB16 : QImage::Format_RGB32;
never executed: return screenDepth() == 16 ? QImage::Format_RGB16 : QImage::Format_RGB32;
0
193}-
194-
195qreal QEGLDeviceIntegration::refreshRate() const-
196{-
197 return
never executed: return q_refreshRateFromFb(framebuffer);
q_refreshRateFromFb(framebuffer);
never executed: return q_refreshRateFromFb(framebuffer);
0
198}-
199-
200EGLint QEGLDeviceIntegration::surfaceType() const-
201{-
202 return
never executed: return 0x0004;
0x0004;
never executed: return 0x0004;
0
203}-
204-
205QSurfaceFormat QEGLDeviceIntegration::surfaceFormatFor(const QSurfaceFormat &inputFormat) const-
206{-
207 QSurfaceFormat format = inputFormat;-
208-
209 static const bool force888 = qEnvironmentVariableIntValue("QT_QPA_EGLFS_FORCE888");-
210 if (force888
force888Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
211 format.setRedBufferSize(8);-
212 format.setGreenBufferSize(8);-
213 format.setBlueBufferSize(8);-
214 }
never executed: end of block
0
215-
216 return
never executed: return format;
format;
never executed: return format;
0
217}-
218-
219bool QEGLDeviceIntegration::filterConfig(EGLDisplay, EGLConfig) const-
220{-
221 return
never executed: return true;
true;
never executed: return true;
0
222}-
223-
224QEglFSWindow *QEGLDeviceIntegration::createWindow(QWindow *window) const-
225{-
226 return
never executed: return new QEglFSWindow(window);
new QEglFSWindow(window);
never executed: return new QEglFSWindow(window);
0
227}-
228-
229EGLNativeWindowType QEGLDeviceIntegration::createNativeWindow(QPlatformWindow *platformWindow,-
230 const QSize &size,-
231 const QSurfaceFormat &format)-
232{-
233 (void)platformWindow;;-
234 (void)size;;-
235 (void)format;;-
236 return
never executed: return 0;
0;
never executed: return 0;
0
237}-
238-
239EGLNativeWindowType QEGLDeviceIntegration::createNativeOffscreenWindow(const QSurfaceFormat &format)-
240{-
241 (void)format;;-
242 return
never executed: return 0;
0;
never executed: return 0;
0
243}-
244-
245void QEGLDeviceIntegration::destroyNativeWindow(EGLNativeWindowType window)-
246{-
247 (void)window;;-
248}
never executed: end of block
0
249-
250bool QEGLDeviceIntegration::hasCapability(QPlatformIntegration::Capability cap) const-
251{-
252 (void)cap;;-
253 return
never executed: return false;
false;
never executed: return false;
0
254}-
255-
256QPlatformCursor *QEGLDeviceIntegration::createCursor(QPlatformScreen *screen) const-
257{-
258 return
never executed: return new QEglFSCursor(screen);
new QEglFSCursor(screen);
never executed: return new QEglFSCursor(screen);
0
259}-
260-
261void QEGLDeviceIntegration::waitForVSync(QPlatformSurface *surface) const-
262{-
263 (void)surface;;-
264-
265-
266 static const bool forceSync = qEnvironmentVariableIntValue("QT_QPA_EGLFS_FORCEVSYNC");-
267 if (forceSync
forceSyncDescription
TRUEnever evaluated
FALSEnever evaluated
&& framebuffer != -1
framebuffer != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
268 int arg = 0;-
269 if (ioctl(framebuffer, (((1U) << (((0 +8)+8)+14)) | ((('F')) << (0 +8)) | (((0x20)) << 0) | ((((sizeof(__u32)))) << ((0 +8)+8))), &arg) == -1
ioctl(framebuf...), &arg) == -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
270 QMessageLogger(__FILE__, 323, __PRETTY_FUNCTION__).warning("Could not wait for vsync.");
never executed: QMessageLogger(__FILE__, 323, __PRETTY_FUNCTION__).warning("Could not wait for vsync.");
0
271 }
never executed: end of block
0
272-
273}
never executed: end of block
0
274-
275void QEGLDeviceIntegration::presentBuffer(QPlatformSurface *surface)-
276{-
277 (void)surface;;-
278}
never executed: end of block
0
279-
280bool QEGLDeviceIntegration::supportsPBuffers() const-
281{-
282 return
never executed: return true;
true;
never executed: return true;
0
283}-
284-
285bool QEGLDeviceIntegration::supportsSurfacelessContexts() const-
286{-
287 return
never executed: return true;
true;
never executed: return true;
0
288}-
289-
290void *QEGLDeviceIntegration::wlDisplay() const-
291{-
292 return
never executed: return nullptr;
nullptr;
never executed: return nullptr;
0
293}-
294-
295-
Switch to Source codePreprocessed file

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