Debian Codegraph @

src/gui/opengl/platform/egl/qeglstreamconvenience_p.h

raw
1 // Copyright (C) 2020 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
4 #ifndef QEGLSTREAMCONVENIENCE_H
5 #define QEGLSTREAMCONVENIENCE_H
6
7 //
8 // W A R N I N G
9 // -------------
10 //
11 // This file is not part of the Qt API. It exists purely as an
12 // implementation detail. This header file may change from version to
13 // version without notice, or even be removed.
14 //
15 // We mean it.
16 //
17
18 #include <QtGui/qtguiglobal.h>
19
20 #include <QtGui/private/qt_egl_p.h>
21
22 // This provides runtime EGLDevice/Output/Stream support even when eglext.h in
23 // the sysroot is not up-to-date.
24
25 #ifndef EGL_VERSION_1_5
26 typedef intptr_t EGLAttrib;
27 #endif
28
29 #ifndef EGL_EXT_platform_base
30 typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list);
31 #endif
32
33 #ifndef EGL_EXT_device_base
34 typedef void *EGLDeviceEXT;
35 #define EGL_NO_DEVICE_EXT ((EGLDeviceEXT)(0))
36 typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICESEXTPROC) (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices);
37 typedef const char *(EGLAPIENTRYP PFNEGLQUERYDEVICESTRINGEXTPROC) (EGLDeviceEXT device, EGLint name);
38 #endif
39
40 #ifndef EGL_EXT_output_base
41 typedef void *EGLOutputLayerEXT;
42 typedef void *EGLOutputPortEXT;
43 #define EGL_NO_OUTPUT_LAYER_EXT ((EGLOutputLayerEXT)0)
44 typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTLAYERSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers);
45 typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTPORTSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports);
46 typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value);
47 typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value);
48 typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name);
49 typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value);
50 typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name);
51 #endif
52
53 #ifndef EGL_KHR_stream
54 typedef void *EGLStreamKHR;
55 typedef quint64 EGLuint64KHR;
56 #define EGL_NO_STREAM_KHR ((EGLStreamKHR)0)
57 #define EGL_STREAM_STATE_KHR 0x3214
58 #define EGL_STREAM_STATE_CREATED_KHR 0x3215
59 #define EGL_STREAM_STATE_CONNECTING_KHR 0x3216
60 #define EGL_STREAM_STATE_EMPTY_KHR 0x3217
61 #define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218
62 #define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219
63 #define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A
64 #define EGL_BAD_STREAM_KHR 0x321B
65 #define EGL_BAD_STATE_KHR 0x321C
66 typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC) (EGLDisplay dpy, const EGLint *attrib_list);
67 typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
68 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
69 typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
70 typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
71 #endif
72
73 #ifndef EGL_KHR_stream_fifo
74 #define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC
75 #endif
76
77 #ifndef EGL_KHR_stream_producer_eglsurface
78 #define EGL_STREAM_BIT_KHR 0x0800
79 typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
80 #endif
81
82 #ifndef EGL_KHR_stream_cross_process_fd
83 typedef int EGLNativeFileDescriptorKHR;
84 #define EGL_NO_FILE_DESCRIPTOR_KHR ((EGLNativeFileDescriptorKHR)(-1))
85 typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
86 typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
87 #endif
88
89 #ifndef EGL_KHR_stream_consumer_gltexture
90 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
91 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
92 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
93 #endif
94
95 #ifndef EGL_EXT_stream_consumer_egloutput
96 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer);
97 #endif
98
99 #ifndef EGL_EXT_platform_device
100 #define EGL_PLATFORM_DEVICE_EXT 0x313F
101 #endif
102
103 #ifndef EGL_EXT_device_drm
104 #define EGL_DRM_DEVICE_FILE_EXT 0x3233
105 #endif
106
107 #ifndef EGL_EXT_output_drm
108 #define EGL_DRM_CRTC_EXT 0x3234
109 #define EGL_DRM_PLANE_EXT 0x3235
110 #endif
111
112 #ifndef EGL_PLATFORM_X11_KHR
113 #define EGL_PLATFORM_X11_KHR 0x31D5
114 #endif
115
116 #ifndef EGL_PLATFORM_XCB_KHR
117 #define EGL_PLATFORM_XCB_KHR 0x31DC
118 #endif
119
120 #ifndef EGL_NV_stream_attrib
121 typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMATTRIBNVPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list);
122 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSTREAMATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value);
123 typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib *value);
124 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
125 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
126 #endif
127
128 QT_BEGIN_NAMESPACE
129
130 class Q_GUI_EXPORT QEGLStreamConvenience
131 {
132 public:
133 QEGLStreamConvenience();
134 void initialize(EGLDisplay dpy);
135
136 PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display;
137 PFNEGLQUERYDEVICESEXTPROC query_devices;
138 PFNEGLQUERYDEVICESTRINGEXTPROC query_device_string;
139 PFNEGLCREATESTREAMKHRPROC create_stream;
140 PFNEGLCREATESTREAMATTRIBNVPROC create_stream_attrib_nv;
141 PFNEGLSETSTREAMATTRIBNVPROC set_stream_attrib_nv;
142 PFNEGLQUERYSTREAMATTRIBNVPROC query_stream_attrib_nv;
143 PFNEGLSTREAMCONSUMERACQUIREATTRIBNVPROC acquire_stream_attrib_nv;
144 PFNEGLSTREAMCONSUMERRELEASEATTRIBNVPROC release_stream_attrib_nv;
145 PFNEGLDESTROYSTREAMKHRPROC destroy_stream;
146 PFNEGLSTREAMATTRIBKHRPROC stream_attrib;
147 PFNEGLQUERYSTREAMKHRPROC query_stream;
148 PFNEGLQUERYSTREAMU64KHRPROC query_stream_u64;
149 PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC create_stream_producer_surface;
150 PFNEGLSTREAMCONSUMEROUTPUTEXTPROC stream_consumer_output;
151 PFNEGLGETOUTPUTLAYERSEXTPROC get_output_layers;
152 PFNEGLGETOUTPUTPORTSEXTPROC get_output_ports;
153 PFNEGLOUTPUTLAYERATTRIBEXTPROC output_layer_attrib;
154 PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC query_output_layer_attrib;
155 PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC query_output_layer_string;
156 PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC query_output_port_attrib;
157 PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC query_output_port_string;
158 PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC get_stream_file_descriptor;
159 PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC create_stream_from_file_descriptor;
160 PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC stream_consumer_gltexture;
161 PFNEGLSTREAMCONSUMERACQUIREKHRPROC stream_consumer_acquire;
162 PFNEGLSTREAMCONSUMERRELEASEKHRPROC stream_consumer_release;
163
164 bool initialized;
165
166 bool has_egl_platform_device;
167 bool has_egl_device_base;
168 bool has_egl_stream;
169 bool has_egl_stream_producer_eglsurface;
170 bool has_egl_stream_consumer_egloutput;
171 bool has_egl_output_drm;
172 bool has_egl_output_base;
173 bool has_egl_stream_cross_process_fd;
174 bool has_egl_stream_consumer_gltexture;
175 };
176
177 QT_END_NAMESPACE
178
179 #endif