Merge remote branch 'origin/master' into nv50-compiler
[mesa.git] / src / egl / main / eglapi.h
1 #ifndef EGLAPI_INCLUDED
2 #define EGLAPI_INCLUDED
3
4 /**
5 * A generic function ptr type
6 */
7 typedef void (*_EGLProc)(void);
8
9
10 /**
11 * Typedefs for all EGL API entrypoint functions.
12 */
13
14 /* driver funcs */
15 typedef EGLBoolean (*Initialize_t)(_EGLDriver *, _EGLDisplay *dpy, EGLint *major, EGLint *minor);
16 typedef EGLBoolean (*Terminate_t)(_EGLDriver *, _EGLDisplay *dpy);
17
18 /* config funcs */
19 typedef EGLBoolean (*GetConfigs_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
20 typedef EGLBoolean (*ChooseConfig_t)(_EGLDriver *drv, _EGLDisplay *dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
21 typedef EGLBoolean (*GetConfigAttrib_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *config, EGLint attribute, EGLint *value);
22
23 /* context funcs */
24 typedef _EGLContext *(*CreateContext_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *config, _EGLContext *share_list, const EGLint *attrib_list);
25 typedef EGLBoolean (*DestroyContext_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx);
26 /* this is the only function (other than Initialize) that may be called with an uninitialized display */
27 typedef EGLBoolean (*MakeCurrent_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw, _EGLSurface *read, _EGLContext *ctx);
28 typedef EGLBoolean (*QueryContext_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx, EGLint attribute, EGLint *value);
29
30 /* surface funcs */
31 typedef _EGLSurface *(*CreateWindowSurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *config, EGLNativeWindowType window, const EGLint *attrib_list);
32 typedef _EGLSurface *(*CreatePixmapSurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *config, EGLNativePixmapType pixmap, const EGLint *attrib_list);
33 typedef _EGLSurface *(*CreatePbufferSurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *config, const EGLint *attrib_list);
34 typedef EGLBoolean (*DestroySurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface);
35 typedef EGLBoolean (*QuerySurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, EGLint attribute, EGLint *value);
36 typedef EGLBoolean (*SurfaceAttrib_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, EGLint attribute, EGLint value);
37 typedef EGLBoolean (*BindTexImage_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, EGLint buffer);
38 typedef EGLBoolean (*ReleaseTexImage_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, EGLint buffer);
39 typedef EGLBoolean (*SwapInterval_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint interval);
40 typedef EGLBoolean (*SwapBuffers_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw);
41 typedef EGLBoolean (*CopyBuffers_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, EGLNativePixmapType target);
42
43 /* misc funcs */
44 typedef const char *(*QueryString_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLint name);
45 typedef EGLBoolean (*WaitClient_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx);
46 typedef EGLBoolean (*WaitNative_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLint engine);
47
48 /* this function may be called from multiple threads at the same time */
49 typedef _EGLProc (*GetProcAddress_t)(_EGLDriver *drv, const char *procname);
50
51
52
53 #ifdef EGL_MESA_screen_surface
54 typedef EGLBoolean (*ChooseModeMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
55 typedef EGLBoolean (*GetModesMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, EGLModeMESA *modes, EGLint mode_size, EGLint *num_mode);
56 typedef EGLBoolean (*GetModeAttribMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLMode *mode, EGLint attribute, EGLint *value);
57 typedef EGLBoolean (*CopyContextMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *source, _EGLContext *dest, EGLint mask);
58 typedef EGLBoolean (*GetScreensMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens);
59 typedef _EGLSurface *(*CreateScreenSurfaceMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *config, const EGLint *attrib_list);
60 typedef EGLBoolean (*ShowScreenSurfaceMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, _EGLSurface *surface, _EGLMode *mode);
61 typedef EGLBoolean (*ScreenPositionMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, EGLint x, EGLint y);
62 typedef EGLBoolean (*QueryScreenMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, EGLint attribute, EGLint *value);
63 typedef EGLBoolean (*QueryScreenSurfaceMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, _EGLSurface **surface);
64 typedef EGLBoolean (*QueryScreenModeMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, _EGLMode **mode);
65 typedef const char * (*QueryModeStringMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLMode *mode);
66 #endif /* EGL_MESA_screen_surface */
67
68
69 #ifdef EGL_VERSION_1_2
70 typedef _EGLSurface *(*CreatePbufferFromClientBuffer_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLenum buftype, EGLClientBuffer buffer, _EGLConfig *config, const EGLint *attrib_list);
71 #endif /* EGL_VERSION_1_2 */
72
73
74 #ifdef EGL_KHR_image_base
75 typedef _EGLImage *(*CreateImageKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attr_list);
76 typedef EGLBoolean (*DestroyImageKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLImage *image);
77 #endif /* EGL_KHR_image_base */
78
79
80 #ifdef EGL_KHR_reusable_sync
81 typedef _EGLSync *(*CreateSyncKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLenum type, const EGLint *attrib_list);
82 typedef EGLBoolean (*DestroySyncKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync);
83 typedef EGLint (*ClientWaitSyncKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, EGLint flags, EGLTimeKHR timeout);
84 typedef EGLBoolean (*SignalSyncKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, EGLenum mode);
85 typedef EGLBoolean (*GetSyncAttribKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, EGLint attribute, EGLint *value);
86 #endif /* EGL_KHR_reusable_sync */
87
88
89 #ifdef EGL_NOK_swap_region
90 typedef EGLBoolean (*SwapBuffersRegionNOK_t)(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf, EGLint numRects, const EGLint *rects);
91 #endif
92
93 #ifdef EGL_MESA_drm_image
94 typedef _EGLImage *(*CreateDRMImageMESA_t)(_EGLDriver *drv, _EGLDisplay *disp, const EGLint *attr_list);
95 typedef EGLBoolean (*ExportDRMImageMESA_t)(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *img, EGLint *name, EGLint *handle, EGLint *stride);
96 #endif
97
98 /**
99 * The API dispatcher jumps through these functions
100 */
101 struct _egl_api
102 {
103 Initialize_t Initialize;
104 Terminate_t Terminate;
105
106 GetConfigs_t GetConfigs;
107 ChooseConfig_t ChooseConfig;
108 GetConfigAttrib_t GetConfigAttrib;
109
110 CreateContext_t CreateContext;
111 DestroyContext_t DestroyContext;
112 MakeCurrent_t MakeCurrent;
113 QueryContext_t QueryContext;
114
115 CreateWindowSurface_t CreateWindowSurface;
116 CreatePixmapSurface_t CreatePixmapSurface;
117 CreatePbufferSurface_t CreatePbufferSurface;
118 DestroySurface_t DestroySurface;
119 QuerySurface_t QuerySurface;
120 SurfaceAttrib_t SurfaceAttrib;
121 BindTexImage_t BindTexImage;
122 ReleaseTexImage_t ReleaseTexImage;
123 SwapInterval_t SwapInterval;
124 SwapBuffers_t SwapBuffers;
125 CopyBuffers_t CopyBuffers;
126
127 QueryString_t QueryString;
128 WaitClient_t WaitClient;
129 WaitNative_t WaitNative;
130 GetProcAddress_t GetProcAddress;
131
132 #ifdef EGL_MESA_screen_surface
133 ChooseModeMESA_t ChooseModeMESA;
134 GetModesMESA_t GetModesMESA;
135 GetModeAttribMESA_t GetModeAttribMESA;
136 CopyContextMESA_t CopyContextMESA;
137 GetScreensMESA_t GetScreensMESA;
138 CreateScreenSurfaceMESA_t CreateScreenSurfaceMESA;
139 ShowScreenSurfaceMESA_t ShowScreenSurfaceMESA;
140 ScreenPositionMESA_t ScreenPositionMESA;
141 QueryScreenMESA_t QueryScreenMESA;
142 QueryScreenSurfaceMESA_t QueryScreenSurfaceMESA;
143 QueryScreenModeMESA_t QueryScreenModeMESA;
144 QueryModeStringMESA_t QueryModeStringMESA;
145 #endif /* EGL_MESA_screen_surface */
146
147 #ifdef EGL_VERSION_1_2
148 CreatePbufferFromClientBuffer_t CreatePbufferFromClientBuffer;
149 #endif
150
151 #ifdef EGL_KHR_image_base
152 CreateImageKHR_t CreateImageKHR;
153 DestroyImageKHR_t DestroyImageKHR;
154 #endif /* EGL_KHR_image_base */
155
156 #ifdef EGL_KHR_reusable_sync
157 CreateSyncKHR_t CreateSyncKHR;
158 DestroySyncKHR_t DestroySyncKHR;
159 ClientWaitSyncKHR_t ClientWaitSyncKHR;
160 SignalSyncKHR_t SignalSyncKHR;
161 GetSyncAttribKHR_t GetSyncAttribKHR;
162 #endif /* EGL_KHR_reusable_sync */
163
164 #ifdef EGL_NOK_swap_region
165 SwapBuffersRegionNOK_t SwapBuffersRegionNOK;
166 #endif
167
168 #ifdef EGL_MESA_drm_image
169 CreateDRMImageMESA_t CreateDRMImageMESA;
170 ExportDRMImageMESA_t ExportDRMImageMESA;
171 #endif
172 };
173
174 #endif /* EGLAPI_INCLUDED */