1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
|
/*
* Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef WAYLAND_EGLHANDLE_H
#define WAYLAND_EGLHANDLE_H
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include "wayland-external-exports.h"
#include "wayland-egl-ext.h"
#include <pthread.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Define function pointers for EGL core functions
*/
typedef const char* (*PWLEGLFNQUERYSTRINGCOREPROC) (EGLDisplay dpy, EGLint name);
typedef EGLContext (*PWLEGLFNGETCURRENTCONTEXTCOREPROC) (void);
typedef EGLSurface (*PWLEGLFNGETCURRENTSURFACECOREPROC) (EGLint readdraw);
typedef EGLBoolean (*PWLEGLFNRELEASETHREADCOREPROC) (void);
typedef EGLint (*PWLEGLFNGETERRORCOREPROC) (void);
typedef void* (*PWLEGLFNGETPROCADDRESSCOREPROC) (const char *name);
typedef EGLBoolean (*PWLEGLFNINITIALIZECOREPROC) (EGLDisplay dpy, EGLint *major, EGLint *minor);
typedef EGLBoolean (*PWLEGLFNTERMINATECOREPROC) (EGLDisplay dpy);
typedef EGLBoolean (*PWLEGLFNCHOOSECONFIGCOREPROC) (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
typedef EGLBoolean (*PWLEGLFNGETCONFIGATTRIBCOREPROC) (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
typedef EGLSurface (*PWLEGLFNCREATEPBUFFERSURFACECOREPROC) (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
typedef EGLBoolean (*PWLEGLFNDESTROYSURFACECOREPROC) (EGLDisplay dpy, EGLSurface surface);
typedef EGLBoolean (*PWLEGLFNMAKECURRENTCOREPROC) (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
typedef EGLBoolean (*PWLEGLFNSWAPBUFFERSCOREPROC) (EGLDisplay dpy, EGLSurface surface);
typedef EGLBoolean (*PWLEGLFNSWAPBUFFERSWITHDAMAGEKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
typedef EGLBoolean (*PWLEGLFNSWAPINTERVALCOREPROC) (EGLDisplay dpy, EGLint interval);
/*
* WlEglPlatformData structure
*
* Keeps all EGL driver-specific methods provided by a specific EGL
* implementation that are required by the Wayland external platform
* implementation to manage resources associated with a specific backing
* EGLDisplay.
*/
typedef struct WlEglPlatformDataRec {
/* Application-facing callbacks fetched from the EGL driver */
struct {
int major;
int minor;
PWLEGLFNQUERYSTRINGCOREPROC queryString;
PFNEGLQUERYDEVICESEXTPROC queryDevices;
PFNEGLGETPLATFORMDISPLAYEXTPROC getPlatformDisplay;
PWLEGLFNINITIALIZECOREPROC initialize;
PWLEGLFNTERMINATECOREPROC terminate;
PWLEGLFNCHOOSECONFIGCOREPROC chooseConfig;
PWLEGLFNGETCONFIGATTRIBCOREPROC getConfigAttrib;
PFNEGLQUERYSURFACEPROC querySurface;
PWLEGLFNGETCURRENTCONTEXTCOREPROC getCurrentContext;
PWLEGLFNGETCURRENTSURFACECOREPROC getCurrentSurface;
PWLEGLFNMAKECURRENTCOREPROC makeCurrent;
PFNEGLCREATESTREAMKHRPROC createStream;
PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC createStreamFromFD;
PFNEGLCREATESTREAMATTRIBNVPROC createStreamAttrib;
PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC getStreamFileDescriptor;
PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC createStreamProducerSurface;
PWLEGLFNCREATEPBUFFERSURFACECOREPROC createPbufferSurface;
PFNEGLDESTROYSTREAMKHRPROC destroyStream;
PWLEGLFNDESTROYSURFACECOREPROC destroySurface;
PWLEGLFNSWAPBUFFERSCOREPROC swapBuffers;
PWLEGLFNSWAPBUFFERSWITHDAMAGEKHRPROC swapBuffersWithDamage;
PWLEGLFNSWAPINTERVALCOREPROC swapInterval;
PWLEGLFNGETERRORCOREPROC getError;
PWLEGLFNRELEASETHREADCOREPROC releaseThread;
PFNEGLQUERYDISPLAYATTRIBEXTPROC queryDisplayAttrib;
PFNEGLQUERYDEVICESTRINGEXTPROC queryDeviceString;
/* Used for fifo_synchronous support */
PFNEGLQUERYSTREAMKHRPROC queryStream;
PFNEGLQUERYSTREAMU64KHRPROC queryStreamu64;
PFNEGLCREATESTREAMSYNCNVPROC createStreamSync;
PFNEGLCLIENTWAITSYNCKHRPROC clientWaitSync;
PFNEGLSIGNALSYNCKHRPROC signalSync;
PFNEGLDESTROYSYNCKHRPROC destroySync;
PFNEGLSTREAMFLUSHNVPROC streamFlush;
/* Used for dma-buf surfaces */
PFNEGLSTREAMIMAGECONSUMERCONNECTNVPROC streamImageConsumerConnect;
PFNEGLSTREAMACQUIREIMAGENVPROC streamAcquireImage;
PFNEGLSTREAMRELEASEIMAGENVPROC streamReleaseImage;
PFNEGLQUERYSTREAMCONSUMEREVENTNVPROC queryStreamConsumerEvent;
PFNEGLEXPORTDMABUFIMAGEMESAPROC exportDMABUFImage;
PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC exportDMABUFImageQuery;
PFNEGLCREATEIMAGEKHRPROC createImage;
PFNEGLDESTROYIMAGEKHRPROC destroyImage;
} egl;
/* Non-application-facing callbacks provided by the EGL driver */
struct {
PEGLEXTFNSETERROR setError;
PEGLEXTFNSTREAMSWAPINTERVAL streamSwapInterval;
} callbacks;
/* True if the driver supports the EGL_KHR_display_reference extension. */
EGLBoolean supportsDisplayReference;
/* A linked list of WlEglDeviceDpy structs. */
struct wl_list deviceDpyList;
/* pthread key for TLS */
pthread_key_t tlsKey;
} WlEglPlatformData;
/*
* wlEglCreatePlatformData()
*
* Creates a new platform data structure and fills it out with all the required
* application-facing EGL methods provided by <driver>.
*
* <apiMajor>.<apiMinor> correspond to the EGL External Platform interface
* version supported by the driver.
*
* Returns a pointer to the newly created structure upon success; otherwise,
* returns NULL.
*/
WlEglPlatformData*
wlEglCreatePlatformData(int apiMajor, int apiMinor, const EGLExtDriver *driver);
/*
* wlEglDestroyPlatformData()
*
* Destroys the given platform data, previously created with
* wlEglCreatePlatformData().
*/
void wlEglDestroyPlatformData(WlEglPlatformData *data);
void* wlEglGetInternalHandleExport(EGLDisplay dpy, EGLenum type, void *handle);
#ifdef __cplusplus
}
#endif
#endif
|