Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qeglfsmaliintegration.cpp
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
#
include
"qeglfsmaliintegration.h"
6
7
#
include
<
unistd
.
h
>
8
#
include
<
fcntl
.
h
>
9
#
include
<
sys
/
ioctl
.
h
>
10
#
include
<
linux
/
fb
.
h
>
11
12
#
include
<
private
/
qcore_unix_p
.
h
>
13
14
QT_BEGIN_NAMESPACE
15
16
struct
shadow_fbdev_window {
17
unsigned
short
width;
18
unsigned
short
height;
19
};
20
21
void
QEglFSMaliIntegration::platformInit()
22
{
23
// Keep the non-overridden base class functions based on fb0 working.
24
QEglFSDeviceIntegration::platformInit();
25
26
int
fd = qt_safe_open(
"/dev/fb0"
, O_RDWR, 0);
27
if
(fd == -1)
28
qWarning(
"Failed to open fb to detect screen resolution!"
);
29
30
struct
fb_var_screeninfo vinfo;
31
memset(&vinfo, 0,
sizeof
(vinfo));
32
if
(ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) == -1)
33
qWarning(
"Could not get variable screen info"
);
34
35
vinfo.bits_per_pixel = 32;
36
vinfo.red.length = 8;
37
vinfo.green.length = 8;
38
vinfo.blue.length = 8;
39
vinfo.transp.length = 8;
40
vinfo.blue.offset = 0;
41
vinfo.green.offset = 8;
42
vinfo.red.offset = 16;
43
vinfo.transp.offset = 24;
44
#
if
0
45
vinfo.yres_virtual = 2 * vinfo.yres;
46
#
endif
47
48
if
(ioctl(fd, FBIOPUT_VSCREENINFO, &vinfo) == -1)
49
qErrnoWarning(errno,
"Unable to set double buffer mode!"
);
50
51
qt_safe_close(fd);
52
}
53
54
EGLNativeWindowType QEglFSMaliIntegration::createNativeWindow(QPlatformWindow *window,
const
QSize &size,
const
QSurfaceFormat &format)
55
{
56
Q_UNUSED(window);
57
Q_UNUSED(format);
58
59
shadow_fbdev_window *fbwin =
reinterpret_cast
<shadow_fbdev_window *>(malloc(
sizeof
(shadow_fbdev_window)));
60
if
(NULL == fbwin)
61
return
0;
62
63
fbwin->width = size.width();
64
fbwin->height = size.height();
65
return
(EGLNativeWindowType)fbwin;
66
}
67
68
void
QEglFSMaliIntegration::destroyNativeWindow(EGLNativeWindowType window)
69
{
70
free((
void
*)window);
71
}
72
73
QT_END_NAMESPACE
qtbase
src
plugins
platforms
eglfs
deviceintegration
eglfs_mali
qeglfsmaliintegration.cpp
Generated on
for Qt by
1.18.0