radeonsi: Inhibit clock-gating for perf counters.
[mesa.git] / src / egl / main / eglapi.h
1 /**************************************************************************
2 *
3 * Copyright 2008 VMware, Inc.
4 * Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
5 * Copyright 2010-2011 LunarG, Inc.
6 * All Rights Reserved.
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the
10 * "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sub license, and/or sell copies of the Software, and to
13 * permit persons to whom the Software is furnished to do so, subject to
14 * the following conditions:
15 *
16 * The above copyright notice and this permission notice (including the
17 * next paragraph) shall be included in all copies or substantial portions
18 * of the Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26 * DEALINGS IN THE SOFTWARE.
27 *
28 **************************************************************************/
29
30
31 #ifndef EGLAPI_INCLUDED
32 #define EGLAPI_INCLUDED
33
34 #include "egltypedefs.h"
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40 /**
41 * A generic function ptr type
42 */
43 typedef void (*_EGLProc)(void);
44
45 struct wl_display;
46 struct mesa_glinterop_device_info;
47 struct mesa_glinterop_export_in;
48 struct mesa_glinterop_export_out;
49
50 /**
51 * The API dispatcher jumps through these functions
52 */
53 struct _egl_api
54 {
55 /* driver funcs */
56 EGLBoolean (*Initialize)(_EGLDriver *, _EGLDisplay *disp);
57 EGLBoolean (*Terminate)(_EGLDriver *, _EGLDisplay *disp);
58 const char *(*QueryDriverName)(_EGLDisplay *disp);
59 char *(*QueryDriverConfig)(_EGLDisplay *disp);
60
61 /* context funcs */
62 _EGLContext *(*CreateContext)(_EGLDriver *drv, _EGLDisplay *disp,
63 _EGLConfig *config, _EGLContext *share_list,
64 const EGLint *attrib_list);
65 EGLBoolean (*DestroyContext)(_EGLDriver *drv, _EGLDisplay *disp,
66 _EGLContext *ctx);
67 /* this is the only function (other than Initialize) that may be called
68 * with an uninitialized display
69 */
70 EGLBoolean (*MakeCurrent)(_EGLDriver *drv, _EGLDisplay *disp,
71 _EGLSurface *draw, _EGLSurface *read,
72 _EGLContext *ctx);
73
74 /* surface funcs */
75 _EGLSurface *(*CreateWindowSurface)(_EGLDriver *drv, _EGLDisplay *disp,
76 _EGLConfig *config, void *native_window,
77 const EGLint *attrib_list);
78 _EGLSurface *(*CreatePixmapSurface)(_EGLDriver *drv, _EGLDisplay *disp,
79 _EGLConfig *config, void *native_pixmap,
80 const EGLint *attrib_list);
81 _EGLSurface *(*CreatePbufferSurface)(_EGLDriver *drv, _EGLDisplay *disp,
82 _EGLConfig *config,
83 const EGLint *attrib_list);
84 EGLBoolean (*DestroySurface)(_EGLDriver *drv, _EGLDisplay *disp,
85 _EGLSurface *surface);
86 EGLBoolean (*QuerySurface)(_EGLDriver *drv, _EGLDisplay *disp,
87 _EGLSurface *surface, EGLint attribute,
88 EGLint *value);
89 EGLBoolean (*BindTexImage)(_EGLDriver *drv, _EGLDisplay *disp,
90 _EGLSurface *surface, EGLint buffer);
91 EGLBoolean (*ReleaseTexImage)(_EGLDriver *drv, _EGLDisplay *disp,
92 _EGLSurface *surface, EGLint buffer);
93 EGLBoolean (*SwapInterval)(_EGLDriver *drv, _EGLDisplay *disp,
94 _EGLSurface *surf, EGLint interval);
95 EGLBoolean (*SwapBuffers)(_EGLDriver *drv, _EGLDisplay *disp,
96 _EGLSurface *draw);
97 EGLBoolean (*CopyBuffers)(_EGLDriver *drv, _EGLDisplay *disp,
98 _EGLSurface *surface, void *native_pixmap_target);
99 EGLBoolean (*SetDamageRegion)(_EGLDriver *drv, _EGLDisplay *disp,
100 _EGLSurface *surface, EGLint *rects, EGLint n_rects);
101
102 /* misc functions */
103 EGLBoolean (*WaitClient)(_EGLDriver *drv, _EGLDisplay *disp,
104 _EGLContext *ctx);
105 EGLBoolean (*WaitNative)(_EGLDriver *drv, _EGLDisplay *disp,
106 EGLint engine);
107
108 /* this function may be called from multiple threads at the same time */
109 _EGLProc (*GetProcAddress)(_EGLDriver *drv, const char *procname);
110
111 _EGLImage *(*CreateImageKHR)(_EGLDriver *drv, _EGLDisplay *disp,
112 _EGLContext *ctx, EGLenum target,
113 EGLClientBuffer buffer,
114 const EGLint *attr_list);
115 EGLBoolean (*DestroyImageKHR)(_EGLDriver *drv, _EGLDisplay *disp,
116 _EGLImage *image);
117
118 _EGLSync *(*CreateSyncKHR)(_EGLDriver *drv, _EGLDisplay *disp, EGLenum type,
119 const EGLAttrib *attrib_list);
120 EGLBoolean (*DestroySyncKHR)(_EGLDriver *drv, _EGLDisplay *disp,
121 _EGLSync *sync);
122 EGLint (*ClientWaitSyncKHR)(_EGLDriver *drv, _EGLDisplay *disp,
123 _EGLSync *sync, EGLint flags, EGLTime timeout);
124 EGLint (*WaitSyncKHR)(_EGLDriver *drv, _EGLDisplay *disp, _EGLSync *sync);
125 EGLBoolean (*SignalSyncKHR)(_EGLDriver *drv, _EGLDisplay *disp,
126 _EGLSync *sync, EGLenum mode);
127 EGLint (*DupNativeFenceFDANDROID)(_EGLDriver *drv, _EGLDisplay *disp,
128 _EGLSync *sync);
129
130 EGLBoolean (*SwapBuffersRegionNOK)(_EGLDriver *drv, _EGLDisplay *disp,
131 _EGLSurface *surf, EGLint numRects,
132 const EGLint *rects);
133
134 _EGLImage *(*CreateDRMImageMESA)(_EGLDriver *drv, _EGLDisplay *disp,
135 const EGLint *attr_list);
136 EGLBoolean (*ExportDRMImageMESA)(_EGLDriver *drv, _EGLDisplay *disp,
137 _EGLImage *img, EGLint *name,
138 EGLint *handle, EGLint *stride);
139
140 EGLBoolean (*BindWaylandDisplayWL)(_EGLDriver *drv, _EGLDisplay *disp,
141 struct wl_display *display);
142 EGLBoolean (*UnbindWaylandDisplayWL)(_EGLDriver *drv, _EGLDisplay *disp,
143 struct wl_display *display);
144 EGLBoolean (*QueryWaylandBufferWL)(_EGLDriver *drv, _EGLDisplay *displ,
145 struct wl_resource *buffer,
146 EGLint attribute, EGLint *value);
147
148 struct wl_buffer *(*CreateWaylandBufferFromImageWL)(_EGLDriver *drv,
149 _EGLDisplay *disp,
150 _EGLImage *img);
151
152 EGLBoolean (*SwapBuffersWithDamageEXT)(_EGLDriver *drv, _EGLDisplay *disp,
153 _EGLSurface *surface,
154 const EGLint *rects, EGLint n_rects);
155
156 EGLBoolean (*PostSubBufferNV)(_EGLDriver *drv, _EGLDisplay *disp,
157 _EGLSurface *surface, EGLint x, EGLint y,
158 EGLint width, EGLint height);
159
160 EGLint (*QueryBufferAge)(_EGLDriver *drv,
161 _EGLDisplay *disp, _EGLSurface *surface);
162 EGLBoolean (*GetSyncValuesCHROMIUM)(_EGLDisplay *disp, _EGLSurface *surface,
163 EGLuint64KHR *ust, EGLuint64KHR *msc,
164 EGLuint64KHR *sbc);
165
166 EGLBoolean (*ExportDMABUFImageQueryMESA)(_EGLDriver *drv, _EGLDisplay *disp,
167 _EGLImage *img, EGLint *fourcc,
168 EGLint *nplanes,
169 EGLuint64KHR *modifiers);
170 EGLBoolean (*ExportDMABUFImageMESA)(_EGLDriver *drv, _EGLDisplay *disp,
171 _EGLImage *img, EGLint *fds,
172 EGLint *strides, EGLint *offsets);
173
174 int (*GLInteropQueryDeviceInfo)(_EGLDisplay *disp, _EGLContext *ctx,
175 struct mesa_glinterop_device_info *out);
176 int (*GLInteropExportObject)(_EGLDisplay *disp, _EGLContext *ctx,
177 struct mesa_glinterop_export_in *in,
178 struct mesa_glinterop_export_out *out);
179
180 EGLBoolean (*QueryDmaBufFormatsEXT)(_EGLDriver *drv, _EGLDisplay *disp,
181 EGLint max_formats, EGLint *formats,
182 EGLint *num_formats);
183 EGLBoolean (*QueryDmaBufModifiersEXT) (_EGLDriver *drv, _EGLDisplay *disp,
184 EGLint format, EGLint max_modifiers,
185 EGLuint64KHR *modifiers,
186 EGLBoolean *external_only,
187 EGLint *num_modifiers);
188
189 void (*SetBlobCacheFuncsANDROID) (_EGLDriver *drv, _EGLDisplay *disp,
190 EGLSetBlobFuncANDROID set,
191 EGLGetBlobFuncANDROID get);
192 };
193
194 #ifdef __cplusplus
195 }
196 #endif
197
198 #endif /* EGLAPI_INCLUDED */