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
qeglfsvivwlintegration.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#include <wayland-server.h>
9
11
13{
15
16 int width, height;
17
18 bool multiBufferNotEnabledYet = qEnvironmentVariableIsEmpty("FB_MULTI_BUFFER");
19 bool multiBuffer = qEnvironmentVariableIsEmpty("QT_EGLFS_IMX6_NO_FB_MULTI_BUFFER");
20 if (multiBufferNotEnabledYet && multiBuffer) {
21 qWarning() << "QEglFSVivWaylandIntegration will set environment variable FB_MULTI_BUFFER=2 to enable double buffering and vsync.\n"
22 << "If this is not desired, you can override this via: export QT_EGLFS_IMX6_NO_FB_MULTI_BUFFER=1";
23 qputenv("FB_MULTI_BUFFER", "2");
24 }
25
26 mWaylandDisplay = wl_display_create();
27 mNativeDisplay = static_cast<EGLNativeDisplayType>(fbGetDisplay(mWaylandDisplay));
28 fbGetDisplayGeometry(mNativeDisplay, &width, &height);
29 mScreenSize.setHeight(height);
30 mScreenSize.setWidth(width);
31}
32
34{
35 wl_display_destroy(mWaylandDisplay);
36}
37
39{
40 return mScreenSize;
41}
42
44{
45 return mNativeDisplay;
46}
47
49{
52
53 EGLNativeWindowType eglWindow = static_cast<EGLNativeWindowType>(fbCreateWindow(mNativeDisplay, 0, 0, size.width(), size.height()));
54 return eglWindow;
55}
56
58{
59 fbDestroyWindow(window);
60}
61
63{
64 return mWaylandDisplay;
65}
66
67
EGLNativeDisplayType platformDisplay() const override
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
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]