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 QEGLSTREAMCONVENIENCE_H
41#define QEGLSTREAMCONVENIENCE_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 <qglobal.h>
55#include <QtEglSupport/private/qt_egl_p.h>
56
57// This provides runtime EGLDevice/Output/Stream support even when eglext.h in
58// the sysroot is not up-to-date.
59
60#ifndef EGL_VERSION_1_5
61typedef intptr_t EGLAttrib;
62#endif
63
64#ifndef EGL_EXT_platform_base
65typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list);
66#endif
67
68#ifndef EGL_EXT_device_base
69typedef void *EGLDeviceEXT;
70#define EGL_NO_DEVICE_EXT ((EGLDeviceEXT)(0))
71typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICESEXTPROC) (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices);
72typedef const char *(EGLAPIENTRYP PFNEGLQUERYDEVICESTRINGEXTPROC) (EGLDeviceEXT device, EGLint name);
73#endif
74
75#ifndef EGL_EXT_output_base
76typedef void *EGLOutputLayerEXT;
77typedef void *EGLOutputPortEXT;
78#define EGL_NO_OUTPUT_LAYER_EXT ((EGLOutputLayerEXT)0)
79typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTLAYERSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers);
80typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTPORTSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports);
81typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value);
82typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value);
83typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name);
84typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value);
85typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name);
86#endif
87
88#ifndef EGL_KHR_stream
89typedef void *EGLStreamKHR;
90typedef quint64 EGLuint64KHR;
91#define EGL_NO_STREAM_KHR ((EGLStreamKHR)0)
92#define EGL_STREAM_STATE_KHR 0x3214
93#define EGL_STREAM_STATE_CREATED_KHR 0x3215
94#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216
95#define EGL_STREAM_STATE_EMPTY_KHR 0x3217
96#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218
97#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219
98#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A
99#define EGL_BAD_STREAM_KHR 0x321B
100#define EGL_BAD_STATE_KHR 0x321C
101typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC) (EGLDisplay dpy, const EGLint *attrib_list);
102typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
103typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
104typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
105typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
106#endif
107
108#ifndef EGL_KHR_stream_fifo
109#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC
110#endif
111
112#ifndef EGL_KHR_stream_producer_eglsurface
113#define EGL_STREAM_BIT_KHR 0x0800
114typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
115#endif
116
117#ifndef EGL_KHR_stream_cross_process_fd
118typedef int EGLNativeFileDescriptorKHR;
119#define EGL_NO_FILE_DESCRIPTOR_KHR ((EGLNativeFileDescriptorKHR)(-1))
120typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
121typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
122#endif
123
124#ifndef EGL_KHR_stream_consumer_gltexture
125typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
126typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
127typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
128#endif
129
130#ifndef EGL_EXT_stream_consumer_egloutput
131typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer);
132#endif
133
134#ifndef EGL_EXT_platform_device
135#define EGL_PLATFORM_DEVICE_EXT 0x313F
136#endif
137
138#ifndef EGL_EXT_device_drm
139#define EGL_DRM_DEVICE_FILE_EXT 0x3233
140#endif
141
142#ifndef EGL_EXT_output_drm
143#define EGL_DRM_CRTC_EXT 0x3234
144#define EGL_DRM_PLANE_EXT 0x3235
145#endif
146
147#ifndef EGL_PLATFORM_X11_KHR
148#define EGL_PLATFORM_X11_KHR 0x31D5
149#endif
150
151#ifndef EGL_NV_stream_attrib
152typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMATTRIBNVPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list);
153typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSTREAMATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value);
154typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib *value);
155typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
156typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
157#endif
158
159QT_BEGIN_NAMESPACE
160
161class QEGLStreamConvenience
162{
163public:
164 QEGLStreamConvenience();
165 void initialize(EGLDisplay dpy);
166
167 PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display;
168 PFNEGLQUERYDEVICESEXTPROC query_devices;
169 PFNEGLQUERYDEVICESTRINGEXTPROC query_device_string;
170 PFNEGLCREATESTREAMKHRPROC create_stream;
171 PFNEGLCREATESTREAMATTRIBNVPROC create_stream_attrib_nv;
172 PFNEGLSETSTREAMATTRIBNVPROC set_stream_attrib_nv;
173 PFNEGLQUERYSTREAMATTRIBNVPROC query_stream_attrib_nv;
174 PFNEGLSTREAMCONSUMERACQUIREATTRIBNVPROC acquire_stream_attrib_nv;
175 PFNEGLSTREAMCONSUMERRELEASEATTRIBNVPROC release_stream_attrib_nv;
176 PFNEGLDESTROYSTREAMKHRPROC destroy_stream;
177 PFNEGLSTREAMATTRIBKHRPROC stream_attrib;
178 PFNEGLQUERYSTREAMKHRPROC query_stream;
179 PFNEGLQUERYSTREAMU64KHRPROC query_stream_u64;
180 PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC create_stream_producer_surface;
181 PFNEGLSTREAMCONSUMEROUTPUTEXTPROC stream_consumer_output;
182 PFNEGLGETOUTPUTLAYERSEXTPROC get_output_layers;
183 PFNEGLGETOUTPUTPORTSEXTPROC get_output_ports;
184 PFNEGLOUTPUTLAYERATTRIBEXTPROC output_layer_attrib;
185 PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC query_output_layer_attrib;
186 PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC query_output_layer_string;
187 PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC query_output_port_attrib;
188 PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC query_output_port_string;
189 PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC get_stream_file_descriptor;
190 PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC create_stream_from_file_descriptor;
191 PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC stream_consumer_gltexture;
192 PFNEGLSTREAMCONSUMERACQUIREKHRPROC stream_consumer_acquire;
193 PFNEGLSTREAMCONSUMERRELEASEKHRPROC stream_consumer_release;
194
195 bool initialized;
196
197 bool has_egl_platform_device;
198 bool has_egl_device_base;
199 bool has_egl_stream;
200 bool has_egl_stream_producer_eglsurface;
201 bool has_egl_stream_consumer_egloutput;
202 bool has_egl_output_drm;
203 bool has_egl_output_base;
204 bool has_egl_stream_cross_process_fd;
205 bool has_egl_stream_consumer_gltexture;
206};
207
208QT_END_NAMESPACE
209
210#endif
211

source code of qtbase/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h