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
qeglfsvivintegration.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#include <EGL/eglvivante.h>
6#include <QDebug>
7
8#ifdef Q_OS_INTEGRITY
9extern "C" void VivanteInit(void);
10#endif
11
13
15{
17
18 int width, height;
19
20 bool multiBufferNotEnabledYet = qEnvironmentVariableIsEmpty("FB_MULTI_BUFFER");
21 bool multiBuffer = qEnvironmentVariableIsEmpty("QT_EGLFS_IMX6_NO_FB_MULTI_BUFFER");
22 if (multiBufferNotEnabledYet && multiBuffer) {
23 qWarning() << "QEglFSVivIntegration will set environment variable FB_MULTI_BUFFER=2 to enable double buffering and vsync.\n"
24 << "If this is not desired, you can override this via: export QT_EGLFS_IMX6_NO_FB_MULTI_BUFFER=1";
25 qputenv("FB_MULTI_BUFFER", "2");
26 }
27
28#ifdef Q_OS_INTEGRITY
29 VivanteInit();
30 mNativeDisplay = fbGetDisplay();
31#else
32 mNativeDisplay = static_cast<EGLNativeDisplayType>(fbGetDisplayByIndex(framebufferIndex()));
33#endif
34
35 fbGetDisplayGeometry(mNativeDisplay, &width, &height);
36 mScreenSize.setHeight(height);
37 mScreenSize.setWidth(width);
38}
39
41{
42 return mScreenSize;
43}
44
45EGLNativeDisplayType QEglFSVivIntegration::platformDisplay() const
46{
47 return mNativeDisplay;
48}
49
51{
54
55 EGLNativeWindowType eglWindow = static_cast<EGLNativeWindowType>(fbCreateWindow(mNativeDisplay, 0, 0, size.width(), size.height()));
56 return eglWindow;
57}
58
60{
61 fbDestroyWindow(window);
62}
63
void destroyNativeWindow(EGLNativeWindowType window) override
QSize screenSize() const override
EGLNativeDisplayType platformDisplay() const 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
constexpr void setWidth(int w) noexcept
Sets the width to the given width.
Definition qsize.h:136
constexpr void setHeight(int h) noexcept
Sets the height to the given height.
Definition qsize.h:139
The QSurfaceFormat class represents the format of a QSurface. \inmodule QtGui.
Combined button and popup list for selecting options.
#define qWarning
Definition qlogging.h:166
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei width
GLint GLsizei GLsizei GLenum format
bool qputenv(const char *varName, QByteArrayView raw)
Q_CORE_EXPORT bool qEnvironmentVariableIsEmpty(const char *varName) noexcept
#define Q_UNUSED(x)
aWidget window() -> setWindowTitle("New Window Title")
[2]