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 61 typedef intptr_t EGLAttrib; 62 #endif 63 64 #ifndef EGL_EXT_platform_base 65 typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list); 66 #endif 67 68 #ifndef EGL_EXT_device_base 69 typedef void *EGLDeviceEXT; 70 #define EGL_NO_DEVICE_EXT ((EGLDeviceEXT)(0)) 71 typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICESEXTPROC) (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices); 72 typedef const char *(EGLAPIENTRYP PFNEGLQUERYDEVICESTRINGEXTPROC) (EGLDeviceEXT device, EGLint name); 73 #endif 74 75 #ifndef EGL_EXT_output_base 76 typedef void *EGLOutputLayerEXT; 77 typedef void *EGLOutputPortEXT; 78 #define EGL_NO_OUTPUT_LAYER_EXT ((EGLOutputLayerEXT)0) 79 typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTLAYERSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers); 80 typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTPORTSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports); 81 typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value); 82 typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value); 83 typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name); 84 typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value); 85 typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name); 86 #endif 87 88 #ifndef EGL_KHR_stream 89 typedef void *EGLStreamKHR; 90 typedef 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 101 typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC) (EGLDisplay dpy, const EGLint *attrib_list); 102 typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); 103 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value); 104 typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value); 105 typedef 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 114 typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list); 115 #endif 116 117 #ifndef EGL_KHR_stream_cross_process_fd 118 typedef int EGLNativeFileDescriptorKHR; 119 #define EGL_NO_FILE_DESCRIPTOR_KHR ((EGLNativeFileDescriptorKHR)(-1)) 120 typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); 121 typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor); 122 #endif 123 124 #ifndef EGL_KHR_stream_consumer_gltexture 125 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); 126 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); 127 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); 128 #endif 129 130 #ifndef EGL_EXT_stream_consumer_egloutput 131 typedef 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 152 typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMATTRIBNVPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list); 153 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSTREAMATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value); 154 typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib *value); 155 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list); 156 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list); 157 #endif 158 159 QT_BEGIN_NAMESPACE 160 161 class QEGLStreamConvenience 162 { 163 public: 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 208 QT_END_NAMESPACE 209 210 #endif 211