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 QEGLFSFUNCTIONS_H
41#define QEGLFSFUNCTIONS_H
42
43#include <QtCore/QByteArray>
44#include <QtGui/QGuiApplication>
45
46QT_BEGIN_NAMESPACE
47
48class QEglFSFunctions
49{
50public:
51 typedef void (*LoadKeymapType)(const QString &filename);
52 typedef void (*SwitchLangType)();
53 static QByteArray loadKeymapTypeIdentifier() { return QByteArrayLiteral("EglFSLoadKeymap"); }
54 static QByteArray switchLangTypeIdentifier() { return QByteArrayLiteral("EglFSSwitchLang"); }
55
56 static void loadKeymap(const QString &filename)
57 {
58 LoadKeymapType func = reinterpret_cast<LoadKeymapType>(QGuiApplication::platformFunction(function: loadKeymapTypeIdentifier()));
59 if (func)
60 func(filename);
61 }
62
63 static void switchLang()
64 {
65 SwitchLangType func = reinterpret_cast<SwitchLangType>(QGuiApplication::platformFunction(function: switchLangTypeIdentifier()));
66 if (func)
67 func();
68 }
69
70 typedef int (*Vsp2AddLayerType)(const QScreen *screen, int dmabufFd, const QSize &size, const QPoint &position, uint drmPixelFormat, uint bytesPerLine);
71 static QByteArray vsp2AddLayerTypeIdentifier() { return QByteArrayLiteral("EglFSVsp2AddLayer"); }
72
73 //vsp2 functions are currently internal and preliminary (see qdoc file)
74 static int vsp2AddLayer(const QScreen *screen, int dmabufFd, const QSize &size, const QPoint &position, uint drmPixelFormat, uint bytesPerLine)
75 {
76 auto func = reinterpret_cast<Vsp2AddLayerType>(QGuiApplication::platformFunction(function: vsp2AddLayerTypeIdentifier()));
77 if (func)
78 return func(screen, dmabufFd, size, position, drmPixelFormat, bytesPerLine);
79 return 0;
80 }
81
82 typedef bool (*Vsp2RemoveLayerType)(const QScreen *screen, int id);
83 static QByteArray vsp2RemoveLayerTypeIdentifier() { return QByteArrayLiteral("EglFSVsp2RemoveLayer"); }
84
85 static bool vsp2RemoveLayer(const QScreen *screen, int id)
86 {
87 auto func = reinterpret_cast<Vsp2RemoveLayerType>(QGuiApplication::platformFunction(function: vsp2RemoveLayerTypeIdentifier()));
88 return func && func(screen, id);
89 }
90
91 typedef void (*Vsp2SetLayerBufferType)(const QScreen *screen, int id, int dmabufFd);
92 static QByteArray vsp2SetLayerBufferTypeIdentifier() { return QByteArrayLiteral("EglFSVsp2SetLayerBuffer"); }
93
94 static void vsp2SetLayerBuffer(const QScreen *screen, int id, int dmabufFd)
95 {
96 auto func = reinterpret_cast<Vsp2SetLayerBufferType>(QGuiApplication::platformFunction(function: vsp2SetLayerBufferTypeIdentifier()));
97 if (func)
98 func(screen, id, dmabufFd);
99 }
100
101 typedef bool (*Vsp2SetLayerPositionType)(const QScreen *screen, int id, const QPoint &position);
102 static QByteArray vsp2SetLayerPositionTypeIdentifier() { return QByteArrayLiteral("EglFSVsp2SetLayerPosition"); }
103
104 static bool vsp2SetLayerPosition(const QScreen *screen, int id, const QPoint &position)
105 {
106 auto func = reinterpret_cast<Vsp2SetLayerPositionType>(QGuiApplication::platformFunction(function: vsp2SetLayerPositionTypeIdentifier()));
107 return func && func(screen, id, position);
108 }
109
110 typedef bool (*Vsp2SetLayerAlphaType)(const QScreen *screen, int id, qreal alpha);
111 static QByteArray vsp2SetLayerAlphaTypeIdentifier() { return QByteArrayLiteral("EglFSVsp2SetLayerAlpha"); }
112
113 static bool vsp2SetLayerAlpha(const QScreen *screen, int id, qreal alpha)
114 {
115 auto func = reinterpret_cast<Vsp2SetLayerAlphaType>(QGuiApplication::platformFunction(function: vsp2SetLayerAlphaTypeIdentifier()));
116 return func && func(screen, id, alpha);
117 }
118
119 typedef void (*Vsp2AddBlendListenerType)(const QScreen *screen, void(*callback)());
120 static QByteArray vsp2AddBlendListenerTypeIdentifier() { return QByteArrayLiteral("EglFSVsp2AddBlendListener"); }
121
122 static void vsp2AddBlendListener(const QScreen *screen, void(*callback)())
123 {
124 auto func = reinterpret_cast<Vsp2AddBlendListenerType>(QGuiApplication::platformFunction(function: vsp2AddBlendListenerTypeIdentifier()));
125 if (func)
126 func(screen, callback);
127 }
128};
129
130
131QT_END_NAMESPACE
132
133#endif // QEGLFSFUNCTIONS_H
134

source code of qtbase/src/platformheaders/eglfsfunctions/qeglfsfunctions.h