qeglconvenience.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/platformsupport/eglconvenience/qeglconvenience.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11-
12QVector<EGLint> q_createConfigAttributesFromFormat(const QSurfaceFormat &format)-
13{-
14 int redSize = format.redBufferSize();-
15 int greenSize = format.greenBufferSize();-
16 int blueSize = format.blueBufferSize();-
17 int alphaSize = format.alphaBufferSize();-
18 int depthSize = format.depthBufferSize();-
19 int stencilSize = format.stencilBufferSize();-
20 int sampleCount = format.samples();-
21-
22 QVector<EGLint> configAttributes;-
23 configAttributes.append(0x3024);-
24 configAttributes.append(redSize > 0 ? redSize : 0);-
25-
26 configAttributes.append(0x3023);-
27 configAttributes.append(greenSize > 0 ? greenSize : 0);-
28-
29 configAttributes.append(0x3022);-
30 configAttributes.append(blueSize > 0 ? blueSize : 0);-
31-
32 configAttributes.append(0x3021);-
33 configAttributes.append(alphaSize > 0 ? alphaSize : 0);-
34-
35 configAttributes.append(0x3025);-
36 configAttributes.append(depthSize > 0 ? depthSize : 0);-
37-
38 configAttributes.append(0x3026);-
39 configAttributes.append(stencilSize > 0 ? stencilSize : 0);-
40-
41 configAttributes.append(0x3031);-
42 configAttributes.append(sampleCount > 0 ? sampleCount : 0);-
43-
44 configAttributes.append(0x3032);-
45 configAttributes.append(sampleCount > 0);-
46-
47 return
never executed: return configAttributes;
configAttributes;
never executed: return configAttributes;
0
48}-
49-
50bool q_reduceConfigAttributes(QVector<EGLint> *configAttributes)-
51{-
52 int i = -1;-
53-
54-
55-
56-
57-
58 i = configAttributes->indexOf(0x3093);-
59 if (i >= 0
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
60 configAttributes->remove(i,2);-
61 }
never executed: end of block
0
62-
63-
64-
65-
66-
67 i = configAttributes->indexOf(0x3033);-
68 if (i >= 0
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
69 EGLint surfaceType = configAttributes->at(i +1);-
70 if (surfaceType & 0x0040
surfaceType & 0x0040Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
71 surfaceType ^= 0x0040;-
72 configAttributes->replace(i+1,surfaceType);-
73 return
never executed: return true;
true;
never executed: return true;
0
74 }-
75 }
never executed: end of block
0
76-
77-
78-
79-
80-
81-
82-
83 i = configAttributes->indexOf(0x3020);-
84 if (i >= 0
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
85 if (configAttributes->at(i+1) == 16
configAttribut...>at(i+1) == 16Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
86 configAttributes->remove(i,2);-
87 return
never executed: return true;
true;
never executed: return true;
0
88 }-
89 }
never executed: end of block
0
90-
91 i = configAttributes->indexOf(0x3031);-
92 if (i >= 0
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
93 EGLint value = configAttributes->value(i+1, 0);-
94 if (value > 1
value > 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
95 configAttributes->replace(i+1, qMin(EGLint(16), value / 2));
never executed: configAttributes->replace(i+1, qMin(EGLint(16), value / 2));
0
96 else-
97 configAttributes->remove(i, 2);
never executed: configAttributes->remove(i, 2);
0
98 return
never executed: return true;
true;
never executed: return true;
0
99 }-
100-
101 i = configAttributes->indexOf(0x3032);-
102 if (i >= 0
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
103 configAttributes->remove(i,2);-
104 return
never executed: return true;
true;
never executed: return true;
0
105 }-
106-
107 i = configAttributes->indexOf(0x3025);-
108 if (i >= 0
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
109 if (configAttributes->at(i + 1) >= 32
configAttribut...t(i + 1) >= 32Description
TRUEnever evaluated
FALSEnever evaluated
)
0
110 configAttributes->replace(i + 1, 24);
never executed: configAttributes->replace(i + 1, 24);
0
111 else if (configAttributes->at(i + 1) > 1
configAttribut...>at(i + 1) > 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
112 configAttributes->replace(i + 1, 1);
never executed: configAttributes->replace(i + 1, 1);
0
113 else-
114 configAttributes->remove(i, 2);
never executed: configAttributes->remove(i, 2);
0
115 return
never executed: return true;
true;
never executed: return true;
0
116 }-
117-
118 i = configAttributes->indexOf(0x3021);-
119 if (i >= 0
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
120 configAttributes->remove(i,2);-
121-
122 i = configAttributes->indexOf(0x303A);-
123 if (i >= 0
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
124 configAttributes->replace(i,0x3039);-
125 configAttributes->replace(i+1,true);-
126-
127 }
never executed: end of block
0
128-
129 return
never executed: return true;
true;
never executed: return true;
0
130 }-
131-
132 i = configAttributes->indexOf(0x3026);-
133 if (i >= 0
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
134 if (configAttributes->at(i + 1) > 1
configAttribut...>at(i + 1) > 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
135 configAttributes->replace(i + 1, 1);
never executed: configAttributes->replace(i + 1, 1);
0
136 else-
137 configAttributes->remove(i, 2);
never executed: configAttributes->remove(i, 2);
0
138 return
never executed: return true;
true;
never executed: return true;
0
139 }-
140-
141-
142 i = configAttributes->indexOf(0x3039);-
143 if (i >= 0
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
144 configAttributes->remove(i,2);-
145 return
never executed: return true;
true;
never executed: return true;
0
146 }-
147-
148-
149 return
never executed: return false;
false;
never executed: return false;
0
150}-
151-
152QEglConfigChooser::QEglConfigChooser(EGLDisplay display)-
153 : m_display(display)-
154 , m_surfaceType(0x0004)-
155 , m_ignore(false)-
156 , m_confAttrRed(0)-
157 , m_confAttrGreen(0)-
158 , m_confAttrBlue(0)-
159 , m_confAttrAlpha(0)-
160{-
161}
never executed: end of block
0
162-
163QEglConfigChooser::~QEglConfigChooser()-
164{-
165}-
166-
167EGLConfig QEglConfigChooser::chooseConfig()-
168{-
169 QVector<EGLint> configureAttributes = q_createConfigAttributesFromFormat(m_format);-
170 configureAttributes.append(0x3033);-
171 configureAttributes.append(surfaceType());-
172-
173 configureAttributes.append(0x3040);-
174 bool needsES2Plus = false;-
175 switch (m_format.renderableType()) {-
176 case
never executed: case QSurfaceFormat::OpenVG:
QSurfaceFormat::OpenVG:
never executed: case QSurfaceFormat::OpenVG:
0
177 configureAttributes.append(0x0002);-
178 break;
never executed: break;
0
179-
180 case
never executed: case QSurfaceFormat::DefaultRenderableType:
QSurfaceFormat::DefaultRenderableType:
never executed: case QSurfaceFormat::DefaultRenderableType:
0
181-
182 if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL
QOpenGLContext...Context::LibGLDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
183 configureAttributes.append(0x0008);
never executed: configureAttributes.append(0x0008);
0
184 else-
185-
186 needsES2Plus = true;
never executed: needsES2Plus = true;
0
187 break;
never executed: break;
0
188 case
never executed: case QSurfaceFormat::OpenGL:
QSurfaceFormat::OpenGL:
never executed: case QSurfaceFormat::OpenGL:
0
189 configureAttributes.append(0x0008);-
190 break;
never executed: break;
0
191-
192 case
never executed: case QSurfaceFormat::OpenGLES:
QSurfaceFormat::OpenGLES:
never executed: case QSurfaceFormat::OpenGLES:
0
193 if (m_format.majorVersion() == 1
m_format.majorVersion() == 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
194 configureAttributes.append(0x0001);-
195 break;
never executed: break;
0
196 }-
197-
198 default
never executed: default:
:
never executed: default:
code before this statement never executed: default:
0
199 needsES2Plus = true;-
200 break;
never executed: break;
0
201 }-
202 if (needsES2Plus
needsES2PlusDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
203 if (m_format.majorVersion() >= 3
m_format.majorVersion() >= 3Description
TRUEnever evaluated
FALSEnever evaluated
&& q_hasEglExtension(display(), "EGL_KHR_create_context")
q_hasEglExtens...eate_context")Description
TRUEnever evaluated
FALSEnever evaluated
)
0
204 configureAttributes.append(0x00000040);
never executed: configureAttributes.append(0x00000040);
0
205 else-
206 configureAttributes.append(0x0004);
never executed: configureAttributes.append(0x0004);
0
207 }-
208 configureAttributes.append(0x3038);-
209-
210 EGLConfig cfg = 0;-
211 do {-
212-
213 EGLint matching = 0;-
214 if (!eglChooseConfig(display(), configureAttributes.constData(), 0, 0, &matching)
!eglChooseConf... 0, &matching)Description
TRUEnever evaluated
FALSEnever evaluated
|| !matching
!matchingDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
215 continue;
never executed: continue;
0
216-
217-
218-
219 int i = configureAttributes.indexOf(0x3024);-
220 m_confAttrRed = configureAttributes.at(i+1);-
221 i = configureAttributes.indexOf(0x3023);-
222 m_confAttrGreen = configureAttributes.at(i+1);-
223 i = configureAttributes.indexOf(0x3022);-
224 m_confAttrBlue = configureAttributes.at(i+1);-
225 i = configureAttributes.indexOf(0x3021);-
226 m_confAttrAlpha = i == -1
i == -1Description
TRUEnever evaluated
FALSEnever evaluated
? 0 : configureAttributes.at(i+1);
0
227-
228 QVector<EGLConfig> configs(matching);-
229 eglChooseConfig(display(), configureAttributes.constData(), configs.data(), configs.size(), &matching);-
230 if (!cfg
!cfgDescription
TRUEnever evaluated
FALSEnever evaluated
&& matching > 0
matching > 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
231 cfg = configs.first();
never executed: cfg = configs.first();
0
232 for (int i = 0; i < configs.size()
i < configs.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
233 if (filterConfig(configs[i])
filterConfig(configs[i])Description
TRUEnever evaluated
FALSEnever evaluated
)
0
234 return
never executed: return configs.at(i);
configs.at(i);
never executed: return configs.at(i);
0
235 }
never executed: end of block
0
236 }
never executed: end of block
while (q_reduceConfigAttributes(&configureAttributes)
q_reduceConfig...ureAttributes)Description
TRUEnever evaluated
FALSEnever evaluated
);
0
237-
238 if (!cfg
!cfgDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
239 QMessageLogger(__FILE__, 315, __PRETTY_FUNCTION__).warning("Cannot find EGLConfig, returning null config");
never executed: QMessageLogger(__FILE__, 315, __PRETTY_FUNCTION__).warning("Cannot find EGLConfig, returning null config");
0
240 return
never executed: return cfg;
cfg;
never executed: return cfg;
0
241}-
242-
243bool QEglConfigChooser::filterConfig(EGLConfig config) const-
244{-
245-
246-
247 if (m_ignore
m_ignoreDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
248 return
never executed: return true;
true;
never executed: return true;
0
249-
250 EGLint red = 0;-
251 EGLint green = 0;-
252 EGLint blue = 0;-
253 EGLint alpha = 0;-
254-
255-
256 if (m_confAttrRed
m_confAttrRedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
257 eglGetConfigAttrib(display(), config, 0x3024, &red);
never executed: eglGetConfigAttrib(display(), config, 0x3024, &red);
0
258 if (m_confAttrGreen
m_confAttrGreenDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
259 eglGetConfigAttrib(display(), config, 0x3023, &green);
never executed: eglGetConfigAttrib(display(), config, 0x3023, &green);
0
260 if (m_confAttrBlue
m_confAttrBlueDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
261 eglGetConfigAttrib(display(), config, 0x3022, &blue);
never executed: eglGetConfigAttrib(display(), config, 0x3022, &blue);
0
262 if (m_confAttrAlpha
m_confAttrAlphaDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
263 eglGetConfigAttrib(display(), config, 0x3021, &alpha);
never executed: eglGetConfigAttrib(display(), config, 0x3021, &alpha);
0
264-
265 return
never executed: return red == m_confAttrRed && green == m_confAttrGreen && blue == m_confAttrBlue && alpha == m_confAttrAlpha;
red == m_confAttrRed && green == m_confAttrGreen
never executed: return red == m_confAttrRed && green == m_confAttrGreen && blue == m_confAttrBlue && alpha == m_confAttrAlpha;
0
266 && blue == m_confAttrBlue && alpha == m_confAttrAlpha;
never executed: return red == m_confAttrRed && green == m_confAttrGreen && blue == m_confAttrBlue && alpha == m_confAttrAlpha;
0
267}-
268-
269EGLConfig q_configFromGLFormat(EGLDisplay display, const QSurfaceFormat &format, bool highestPixelFormat, int surfaceType)-
270{-
271 QEglConfigChooser chooser(display);-
272 chooser.setSurfaceFormat(format);-
273 chooser.setSurfaceType(surfaceType);-
274 chooser.setIgnoreColorChannels(highestPixelFormat);-
275-
276 return
never executed: return chooser.chooseConfig();
chooser.chooseConfig();
never executed: return chooser.chooseConfig();
0
277}-
278-
279QSurfaceFormat q_glFormatFromConfig(EGLDisplay display, const EGLConfig config, const QSurfaceFormat &referenceFormat)-
280{-
281 QSurfaceFormat format;-
282 EGLint redSize = 0;-
283 EGLint greenSize = 0;-
284 EGLint blueSize = 0;-
285 EGLint alphaSize = 0;-
286 EGLint depthSize = 0;-
287 EGLint stencilSize = 0;-
288 EGLint sampleCount = 0;-
289 EGLint renderableType = 0;-
290-
291 eglGetConfigAttrib(display, config, 0x3024, &redSize);-
292 eglGetConfigAttrib(display, config, 0x3023, &greenSize);-
293 eglGetConfigAttrib(display, config, 0x3022, &blueSize);-
294 eglGetConfigAttrib(display, config, 0x3021, &alphaSize);-
295 eglGetConfigAttrib(display, config, 0x3025, &depthSize);-
296 eglGetConfigAttrib(display, config, 0x3026, &stencilSize);-
297 eglGetConfigAttrib(display, config, 0x3031, &sampleCount);-
298 eglGetConfigAttrib(display, config, 0x3040, &renderableType);-
299-
300 if (referenceFormat.renderableType() == QSurfaceFormat::OpenVG
referenceForma...Format::OpenVGDescription
TRUEnever evaluated
FALSEnever evaluated
&& (
(renderableType & 0x0002)Description
TRUEnever evaluated
FALSEnever evaluated
renderableType & 0x0002)
(renderableType & 0x0002)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
301 format.setRenderableType(QSurfaceFormat::OpenVG);
never executed: format.setRenderableType(QSurfaceFormat::OpenVG);
0
302-
303 else if (referenceFormat.renderableType() == QSurfaceFormat::OpenGL
referenceForma...Format::OpenGLDescription
TRUEnever evaluated
FALSEnever evaluated
0
304 && (
(renderableType & 0x0008)Description
TRUEnever evaluated
FALSEnever evaluated
renderableType & 0x0008)
(renderableType & 0x0008)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
305 format.setRenderableType(QSurfaceFormat::OpenGL);
never executed: format.setRenderableType(QSurfaceFormat::OpenGL);
0
306 else if (referenceFormat.renderableType() == QSurfaceFormat::DefaultRenderableType
referenceForma...RenderableTypeDescription
TRUEnever evaluated
FALSEnever evaluated
0
307-
308 && QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL
QOpenGLContext...Context::LibGLDescription
TRUEnever evaluated
FALSEnever evaluated
0
309-
310 && (
(renderableType & 0x0008)Description
TRUEnever evaluated
FALSEnever evaluated
renderableType & 0x0008)
(renderableType & 0x0008)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
311 format.setRenderableType(QSurfaceFormat::OpenGL);
never executed: format.setRenderableType(QSurfaceFormat::OpenGL);
0
312-
313 else-
314 format.setRenderableType(QSurfaceFormat::OpenGLES);
never executed: format.setRenderableType(QSurfaceFormat::OpenGLES);
0
315-
316 format.setRedBufferSize(redSize);-
317 format.setGreenBufferSize(greenSize);-
318 format.setBlueBufferSize(blueSize);-
319 format.setAlphaBufferSize(alphaSize);-
320 format.setDepthBufferSize(depthSize);-
321 format.setStencilBufferSize(stencilSize);-
322 format.setSamples(sampleCount);-
323 format.setStereo(false);-
324 format.setSwapInterval(referenceFormat.swapInterval());-
325-
326-
327-
328-
329 eglGetError();-
330-
331 return
never executed: return format;
format;
never executed: return format;
0
332}-
333-
334bool q_hasEglExtension(EGLDisplay display, const char* extensionName)-
335{-
336 QList<QByteArray> extensions =-
337 QByteArray(reinterpret_cast<const char *>-
338 (eglQueryString(display, 0x3055))).split(' ');-
339 return
never executed: return extensions.contains(extensionName);
extensions.contains(extensionName);
never executed: return extensions.contains(extensionName);
0
340}-
341-
342struct AttrInfo { EGLint attr; const char *name; };-
343static struct AttrInfo attrs[] = {-
344 {0x3020, "EGL_BUFFER_SIZE"},-
345 {0x3021, "EGL_ALPHA_SIZE"},-
346 {0x3022, "EGL_BLUE_SIZE"},-
347 {0x3023, "EGL_GREEN_SIZE"},-
348 {0x3024, "EGL_RED_SIZE"},-
349 {0x3025, "EGL_DEPTH_SIZE"},-
350 {0x3026, "EGL_STENCIL_SIZE"},-
351 {0x3027, "EGL_CONFIG_CAVEAT"},-
352 {0x3028, "EGL_CONFIG_ID"},-
353 {0x3029, "EGL_LEVEL"},-
354 {0x302A, "EGL_MAX_PBUFFER_HEIGHT"},-
355 {0x302B, "EGL_MAX_PBUFFER_PIXELS"},-
356 {0x302C, "EGL_MAX_PBUFFER_WIDTH"},-
357 {0x302D, "EGL_NATIVE_RENDERABLE"},-
358 {0x302E, "EGL_NATIVE_VISUAL_ID"},-
359 {0x302F, "EGL_NATIVE_VISUAL_TYPE"},-
360 {0x3031, "EGL_SAMPLES"},-
361 {0x3032, "EGL_SAMPLE_BUFFERS"},-
362 {0x3033, "EGL_SURFACE_TYPE"},-
363 {0x3034, "EGL_TRANSPARENT_TYPE"},-
364 {0x3035, "EGL_TRANSPARENT_BLUE_VALUE"},-
365 {0x3036, "EGL_TRANSPARENT_GREEN_VALUE"},-
366 {0x3037, "EGL_TRANSPARENT_RED_VALUE"},-
367 {0x3039, "EGL_BIND_TO_TEXTURE_RGB"},-
368 {0x303A, "EGL_BIND_TO_TEXTURE_RGBA"},-
369 {0x303B, "EGL_MIN_SWAP_INTERVAL"},-
370 {0x303C, "EGL_MAX_SWAP_INTERVAL"},-
371 {-1, 0}};-
372-
373void q_printEglConfig(EGLDisplay display, EGLConfig config)-
374{-
375 EGLint index;-
376 for (index = 0; attrs[index].attr != -1
attrs[index].attr != -1Description
TRUEnever evaluated
FALSEnever evaluated
; ++index) {
0
377 EGLint value;-
378 if (eglGetConfigAttrib(display, config, attrs[index].attr, &value)
eglGetConfigAt....attr, &value)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
379 QMessageLogger(__FILE__, 455, __PRETTY_FUNCTION__).debug("\t%s: %d", attrs[index].name, (int)value);-
380 }
never executed: end of block
0
381 }
never executed: end of block
0
382}
never executed: end of block
0
383-
384-
385-
386QSizeF q_physicalScreenSizeFromFb(int framebufferDevice, const QSize &screenSize)-
387{-
388-
389-
390-
391 const int defaultPhysicalDpi = 100;-
392 static QSizeF size;-
393-
394 if (size.isEmpty()
size.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
395-
396 int width = qEnvironmentVariableIntValue("QT_QPA_EGLFS_PHYSICAL_WIDTH");-
397 int height = qEnvironmentVariableIntValue("QT_QPA_EGLFS_PHYSICAL_HEIGHT");-
398-
399 if (width
widthDescription
TRUEnever evaluated
FALSEnever evaluated
&& height
heightDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
400 size.setWidth(width);-
401 size.setHeight(height);-
402 return
never executed: return size;
size;
never executed: return size;
0
403 }-
404-
405 int w = -1;-
406 int h = -1;-
407 QSize screenResolution;-
408-
409 struct fb_var_screeninfo vinfo;-
410-
411 if (framebufferDevice != -1
framebufferDevice != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
412 if (ioctl(framebufferDevice, 0x4600, &vinfo) == -1
ioctl(framebuf... &vinfo) == -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
413 QMessageLogger(__FILE__, 489, __PRETTY_FUNCTION__).warning("eglconvenience: Could not query screen info");-
414 }
never executed: end of block
else {
0
415 w = vinfo.width;-
416 h = vinfo.height;-
417 screenResolution = QSize(vinfo.xres, vinfo.yres);-
418 }
never executed: end of block
0
419 } else-
420-
421 {-
422-
423-
424 screenResolution = screenSize.isEmpty()
screenSize.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
? q_screenSizeFromFb(framebufferDevice) : screenSize;
0
425 }
never executed: end of block
0
426-
427 size.setWidth(w <= 0 ? screenResolution.width() * Q_MM_PER_INCH / defaultPhysicalDpi : qreal(w));-
428 size.setHeight(h <= 0 ? screenResolution.height() * Q_MM_PER_INCH / defaultPhysicalDpi : qreal(h));-
429-
430 if (w <= 0
w <= 0Description
TRUEnever evaluated
FALSEnever evaluated
|| h <= 0
h <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
431 QMessageLogger(__FILE__, 507, __PRETTY_FUNCTION__).warning("Unable to query physical screen size, defaulting to %d dpi.\n"
never executed: QMessageLogger(__FILE__, 507, __PRETTY_FUNCTION__).warning("Unable to query physical screen size, defaulting to %d dpi.\n" "To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH " "and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).", defaultPhysicalDpi);
0
432 "To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH "
never executed: QMessageLogger(__FILE__, 507, __PRETTY_FUNCTION__).warning("Unable to query physical screen size, defaulting to %d dpi.\n" "To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH " "and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).", defaultPhysicalDpi);
0
433 "and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).", defaultPhysicalDpi);
never executed: QMessageLogger(__FILE__, 507, __PRETTY_FUNCTION__).warning("Unable to query physical screen size, defaulting to %d dpi.\n" "To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH " "and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).", defaultPhysicalDpi);
0
434 }
never executed: end of block
0
435-
436 return
never executed: return size;
size;
never executed: return size;
0
437}-
438-
439QSize q_screenSizeFromFb(int framebufferDevice)-
440{-
441-
442-
443-
444 const int defaultWidth = 800;-
445 const int defaultHeight = 600;-
446 static QSize size;-
447-
448 if (size.isEmpty()
size.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
449 int width = qEnvironmentVariableIntValue("QT_QPA_EGLFS_WIDTH");-
450 int height = qEnvironmentVariableIntValue("QT_QPA_EGLFS_HEIGHT");-
451-
452 if (width
widthDescription
TRUEnever evaluated
FALSEnever evaluated
&& height
heightDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
453 size.setWidth(width);-
454 size.setHeight(height);-
455 return
never executed: return size;
size;
never executed: return size;
0
456 }-
457-
458-
459 struct fb_var_screeninfo vinfo;-
460 int xres = -1;-
461 int yres = -1;-
462-
463 if (framebufferDevice != -1
framebufferDevice != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
464 if (ioctl(framebufferDevice, 0x4600, &vinfo) == -1
ioctl(framebuf... &vinfo) == -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
465 QMessageLogger(__FILE__, 541, __PRETTY_FUNCTION__).warning("eglconvenience: Could not read screen info");-
466 }
never executed: end of block
else {
0
467 xres = vinfo.xres;-
468 yres = vinfo.yres;-
469 }
never executed: end of block
0
470 }-
471-
472 size.setWidth(xres <= 0 ? defaultWidth : xres);-
473 size.setHeight(yres <= 0 ? defaultHeight : yres);-
474-
475-
476-
477-
478 }
never executed: end of block
0
479-
480 return
never executed: return size;
size;
never executed: return size;
0
481}-
482-
483int q_screenDepthFromFb(int framebufferDevice)-
484{-
485-
486-
487-
488 const int defaultDepth = 32;-
489 static int depth = qEnvironmentVariableIntValue("QT_QPA_EGLFS_DEPTH");-
490-
491 if (depth == 0
depth == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
492-
493 struct fb_var_screeninfo vinfo;-
494-
495 if (framebufferDevice != -1
framebufferDevice != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
496 if (ioctl(framebufferDevice, 0x4600, &vinfo) == -1
ioctl(framebuf... &vinfo) == -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
497 QMessageLogger(__FILE__, 573, __PRETTY_FUNCTION__).warning("eglconvenience: Could not query screen info");
never executed: QMessageLogger(__FILE__, 573, __PRETTY_FUNCTION__).warning("eglconvenience: Could not query screen info");
0
498 else-
499 depth = vinfo.bits_per_pixel;
never executed: depth = vinfo.bits_per_pixel;
0
500 }-
501-
502 if (depth <= 0
depth <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
503 depth = defaultDepth;
never executed: depth = defaultDepth;
0
504-
505-
506-
507 }
never executed: end of block
0
508-
509 return
never executed: return depth;
depth;
never executed: return depth;
0
510}-
511-
512qreal q_refreshRateFromFb(int framebufferDevice)-
513{-
514-
515-
516-
517-
518 static qreal rate = 0;-
519-
520-
521 if (rate == 0
rate == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
522 if (framebufferDevice != -1
framebufferDevice != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
523 struct fb_var_screeninfo vinfo;-
524 if (ioctl(framebufferDevice, 0x4600, &vinfo) != -1
ioctl(framebuf... &vinfo) != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
525 const quint64 quot = quint64(vinfo.left_margin + vinfo.right_margin + vinfo.xres + vinfo.hsync_len)-
526 * quint64(vinfo.upper_margin + vinfo.lower_margin + vinfo.yres + vinfo.vsync_len)-
527 * vinfo.pixclock;-
528 if (quot
quotDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
529 rate = 1000000000000LLU / quot;
never executed: rate = 1000000000000LLU / quot;
0
530 }
never executed: end of block
else {
0
531 QMessageLogger(__FILE__, 607, __PRETTY_FUNCTION__).warning("eglconvenience: Could not query screen info");-
532 }
never executed: end of block
0
533 }-
534 }
never executed: end of block
0
535-
536-
537 if (rate == 0
rate == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
538 rate = 60;
never executed: rate = 60;
0
539-
540 return
never executed: return rate;
rate;
never executed: return rate;
0
541}-
542-
543-
544-
545-
Switch to Source codePreprocessed file

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