Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
5
6#include <unistd.h>
7#include <fcntl.h>
8#include <sys/ioctl.h>
9#include <linux/fb.h>
10
11#include <private/qcore_unix_p.h>
12
14
16 unsigned short width;
17 unsigned short height;
18};
19
21{
22 // Keep the non-overridden base class functions based on fb0 working.
24
25 int fd = qt_safe_open("/dev/fb0", O_RDWR, 0);
26 if (fd == -1)
27 qWarning("Failed to open fb to detect screen resolution!");
28
29 struct fb_var_screeninfo vinfo;
30 memset(&vinfo, 0, sizeof(vinfo));
31 if (ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) == -1)
32 qWarning("Could not get variable screen info");
33
34 vinfo.bits_per_pixel = 32;
35 vinfo.red.length = 8;
36 vinfo.green.length = 8;
37 vinfo.blue.length = 8;
38 vinfo.transp.length = 8;
39 vinfo.blue.offset = 0;
40 vinfo.green.offset = 8;
41 vinfo.red.offset = 16;
42 vinfo.transp.offset = 24;
43#if 0
44 vinfo.yres_virtual = 2 * vinfo.yres;
45#endif
46
47 if (ioctl(fd, FBIOPUT_VSCREENINFO, &vinfo) == -1)
48 qErrnoWarning(errno, "Unable to set double buffer mode!");
49
51}
52
54{
57
58 shadow_fbdev_window *fbwin = reinterpret_cast<shadow_fbdev_window *>(malloc(sizeof(shadow_fbdev_window)));
59 if (NULL == fbwin)
60 return 0;
61
62 fbwin->width = size.width();
63 fbwin->height = size.height();
64 return (EGLNativeWindowType)fbwin;
65}
66
68{
69 free((void*)window);
70}
71
void destroyNativeWindow(EGLNativeWindowType window) override
EGLNativeWindowType createNativeWindow(QPlatformWindow *window, const QSize &size, const QSurfaceFormat &format) override
The QPlatformWindow class provides an abstraction for top-level windows.
\inmodule QtCore
Definition qsize.h:25
The QSurfaceFormat class represents the format of a QSurface. \inmodule QtGui.
void qErrnoWarning(const char *msg,...)
Combined button and popup list for selecting options.
static int qt_safe_open(const char *pathname, int flags, mode_t mode=0777)
static int qt_safe_close(int fd)
#define qWarning
Definition qlogging.h:166
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint64 GLenum GLint fd
GLint GLsizei GLsizei GLenum format
#define Q_UNUSED(x)
aWidget window() -> setWindowTitle("New Window Title")
[2]