1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the plugins of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#ifndef QEGLFSDEVICEINTEGRATION_H
41#define QEGLFSDEVICEINTEGRATION_H
42
43//
44// W A R N I N G
45// -------------
46//
47// This file is not part of the Qt API. It exists purely as an
48// implementation detail. This header file may change from version to
49// version without notice, or even be removed.
50//
51// We mean it.
52//
53
54#include "qeglfsglobal_p.h"
55#include <qpa/qplatformintegration.h>
56#include <qpa/qplatformscreen.h>
57#include <QtCore/QString>
58#include <QtGui/QSurfaceFormat>
59#include <QtGui/QImage>
60
61QT_BEGIN_NAMESPACE
62
63class QPlatformSurface;
64class QEglFSWindow;
65
66#define QEglFSDeviceIntegrationFactoryInterface_iid "org.qt-project.qt.qpa.egl.QEglFSDeviceIntegrationFactoryInterface.5.5"
67
68class Q_EGLFS_EXPORT QEglFSDeviceIntegration
69{
70public:
71 virtual ~QEglFSDeviceIntegration() { }
72
73 virtual void platformInit();
74 virtual void platformDestroy();
75 virtual EGLNativeDisplayType platformDisplay() const;
76 virtual EGLDisplay createDisplay(EGLNativeDisplayType nativeDisplay);
77 virtual bool usesDefaultScreen();
78 virtual void screenInit();
79 virtual void screenDestroy();
80 virtual QSizeF physicalScreenSize() const;
81 virtual QSize screenSize() const;
82 virtual QDpi logicalDpi() const;
83 virtual qreal pixelDensity() const;
84 virtual Qt::ScreenOrientation nativeOrientation() const;
85 virtual Qt::ScreenOrientation orientation() const;
86 virtual int screenDepth() const;
87 virtual QImage::Format screenFormat() const;
88 virtual qreal refreshRate() const;
89 virtual QSurfaceFormat surfaceFormatFor(const QSurfaceFormat &inputFormat) const;
90 virtual EGLint surfaceType() const;
91 virtual QEglFSWindow *createWindow(QWindow *window) const;
92 virtual EGLNativeWindowType createNativeWindow(QPlatformWindow *platformWindow,
93 const QSize &size,
94 const QSurfaceFormat &format);
95 virtual EGLNativeWindowType createNativeOffscreenWindow(const QSurfaceFormat &format);
96 virtual void destroyNativeWindow(EGLNativeWindowType window);
97 virtual bool hasCapability(QPlatformIntegration::Capability cap) const;
98 virtual QPlatformCursor *createCursor(QPlatformScreen *screen) const;
99 virtual bool filterConfig(EGLDisplay display, EGLConfig config) const;
100 virtual void waitForVSync(QPlatformSurface *surface) const;
101 virtual void presentBuffer(QPlatformSurface *surface);
102 virtual QByteArray fbDeviceName() const;
103 virtual int framebufferIndex() const;
104 virtual bool supportsPBuffers() const;
105 virtual bool supportsSurfacelessContexts() const;
106 virtual QFunctionPointer platformFunction(const QByteArray &function) const;
107 virtual void *nativeResourceForIntegration(const QByteArray &name);
108 virtual void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen);
109 virtual void *wlDisplay() const;
110
111#if QT_CONFIG(vulkan)
112 virtual QPlatformVulkanInstance *createPlatformVulkanInstance(QVulkanInstance *instance);
113#endif
114
115 static EGLConfig chooseConfig(EGLDisplay display, const QSurfaceFormat &format);
116};
117
118class Q_EGLFS_EXPORT QEglFSDeviceIntegrationPlugin : public QObject
119{
120 Q_OBJECT
121
122public:
123 virtual QEglFSDeviceIntegration *create() = 0;
124
125 // the pattern expected by qLoadPlugin calls for a QString argument.
126 // we don't need it, so don't bother subclasses with it:
127 QEglFSDeviceIntegration *create(const QString &) { return create(); }
128};
129
130class Q_EGLFS_EXPORT QEglFSDeviceIntegrationFactory
131{
132public:
133 static QStringList keys(const QString &pluginPath = QString());
134 static QEglFSDeviceIntegration *create(const QString &name, const QString &platformPluginPath = QString());
135};
136
137QT_END_NAMESPACE
138
139#endif // QEGLDEVICEINTEGRATION_H
140

source code of qtbase/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h