summaryrefslogtreecommitdiff
path: root/cogl/winsys/cogl-winsys-glx-feature-functions.h
blob: 36ff02f5277712895d01d030518e8ba02d52c135 (plain)
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
/*
 * Cogl
 *
 * A Low-Level GPU Graphics and Utilities API
 *
 * Copyright (C) 2010 Intel Corporation.
 *
 * 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.
 *
 *
 */

/* This can be included multiple times with different definitions for
 * the COGL_WINSYS_FEATURE_* functions.
 */

/* Macro prototypes:
 * COGL_WINSYS_FEATURE_BEGIN (major_glx_version, minor_glx_version,
 *                            name, namespaces, extension_names,
 *                            implied_winsys_feature)
 * COGL_WINSYS_FEATURE_FUNCTION (return_type, function_name,
 *                               (arguments))
 * ...
 * COGL_WINSYS_FEATURE_END ()
 *
 * Note: You can list multiple namespace and extension names if the
 * corresponding _FEATURE_FUNCTIONS have the same semantics accross
 * the different extension variants.
 *
 * XXX: NB: Don't add a trailing semicolon when using these macros
 */

/* Base functions that we assume are always available */
COGL_WINSYS_FEATURE_BEGIN (0, 0, /* always available */
                           base_glx_functions,
                           "\0",
                           "\0",
                           0 /* no winsys feature */)
COGL_WINSYS_FEATURE_FUNCTION (void, glXDestroyContext,
                              (Display *dpy, GLXContext ctx))
COGL_WINSYS_FEATURE_FUNCTION (void, glXSwapBuffers,
                              (Display *dpy, GLXDrawable drawable))
COGL_WINSYS_FEATURE_FUNCTION (Bool, glXIsDirect,
                              (Display *dpy, GLXContext ctx))
COGL_WINSYS_FEATURE_FUNCTION (int, glXGetFBConfigAttrib,
                              (Display *dpy, GLXFBConfig config,
                               int attribute, int *value))
COGL_WINSYS_FEATURE_FUNCTION (GLXWindow, glXCreateWindow,
                              (Display *dpy, GLXFBConfig config,
                               Window win, const int *attribList))
COGL_WINSYS_FEATURE_FUNCTION (void, glXDestroyWindow,
                              (Display *dpy, GLXWindow window))
COGL_WINSYS_FEATURE_FUNCTION (GLXPixmap, glXCreatePixmap,
                              (Display *dpy, GLXFBConfig config,
                               Pixmap pixmap, const int *attribList))
COGL_WINSYS_FEATURE_FUNCTION (void, glXDestroyPixmap,
                              (Display *dpy, GLXPixmap pixmap))
COGL_WINSYS_FEATURE_FUNCTION (GLXContext, glXCreateNewContext,
                              (Display *dpy, GLXFBConfig config,
                           int renderType, GLXContext shareList,
                               Bool direct))
COGL_WINSYS_FEATURE_FUNCTION (Bool, glXMakeContextCurrent,
                              (Display *dpy, GLXDrawable draw,
                               GLXDrawable read, GLXContext ctx))
COGL_WINSYS_FEATURE_FUNCTION (void, glXSelectEvent,
                              (Display *dpy, GLXDrawable drawable,
                               unsigned long mask))
COGL_WINSYS_FEATURE_FUNCTION (GLXFBConfig *, glXGetFBConfigs,
                              (Display *dpy, int screen, int *nelements))
COGL_WINSYS_FEATURE_FUNCTION (GLXFBConfig *, glXChooseFBConfig,
                              (Display *dpy, int screen,
                               const int *attrib_list, int *nelements))
COGL_WINSYS_FEATURE_FUNCTION (XVisualInfo *, glXGetVisualFromFBConfig,
                              (Display *dpy, GLXFBConfig config))
COGL_WINSYS_FEATURE_END ()

COGL_WINSYS_FEATURE_BEGIN (255, 255,
                           texture_from_pixmap,
                           "EXT\0",
                           "texture_from_pixmap\0",
                           COGL_WINSYS_FEATURE_TEXTURE_FROM_PIXMAP)
COGL_WINSYS_FEATURE_FUNCTION (void, glXBindTexImage,
                              (Display *display,
                               GLXDrawable drawable,
                               int buffer,
                               int *attribList))
COGL_WINSYS_FEATURE_FUNCTION (void, glXReleaseTexImage,
                              (Display *display,
                               GLXDrawable drawable,
                               int buffer))
COGL_WINSYS_FEATURE_END ()

COGL_WINSYS_FEATURE_BEGIN (255, 255,
                           video_sync,
                           "SGI\0",
                           "video_sync\0",
                           COGL_WINSYS_FEATURE_VBLANK_COUNTER)
COGL_WINSYS_FEATURE_FUNCTION (int, glXGetVideoSync,
                              (unsigned int *count))
COGL_WINSYS_FEATURE_FUNCTION (int, glXWaitVideoSync,
                              (int divisor,
                               int remainder,
                               unsigned int *count))
COGL_WINSYS_FEATURE_END ()

COGL_WINSYS_FEATURE_BEGIN (255, 255,
                           swap_control,
                           "SGI\0",
                           "swap_control\0",
                           COGL_WINSYS_FEATURE_SWAP_THROTTLE)
COGL_WINSYS_FEATURE_FUNCTION (int, glXSwapInterval,
                              (int interval))
COGL_WINSYS_FEATURE_END ()

COGL_WINSYS_FEATURE_BEGIN (255, 255,
                           sync_control,
                           "OML\0",
                           "sync_control\0",
                           0)
COGL_WINSYS_FEATURE_FUNCTION (Bool, glXGetSyncValues,
                              (Display* dpy,
                               GLXDrawable drawable,
                               int64_t* ust,
                               int64_t* msc,
                               int64_t* sbc))
COGL_WINSYS_FEATURE_FUNCTION (Bool, glXWaitForMsc,
                              (Display* dpy,
                               GLXDrawable drawable,
                               int64_t target_msc,
                               int64_t divisor,
                               int64_t remainder,
                               int64_t* ust,
                               int64_t* msc,
                               int64_t* sbc))
COGL_WINSYS_FEATURE_END ()

COGL_WINSYS_FEATURE_BEGIN (255, 255,
                           copy_sub_buffer,
                           "MESA\0",
                           "copy_sub_buffer\0",
/* We initially assumed that copy_sub_buffer is synchronized on
 * which is only the case for a subset of GPUs for example it is not
 * synchronized on INTEL gen6 and gen7, so we remove this assumption
 * for now
 */
#if 0
                           COGL_WINSYS_FEATURE_SWAP_REGION_SYNCHRONIZED)
#endif
                           0)
COGL_WINSYS_FEATURE_FUNCTION (void, glXCopySubBuffer,
                              (Display *dpy,
                               GLXDrawable drawable,
                               int x, int y, int width, int height))
COGL_WINSYS_FEATURE_END ()

COGL_WINSYS_FEATURE_BEGIN (255, 255,
                           swap_event,
                           "INTEL\0",
                           "swap_event\0",
                           COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT)

COGL_WINSYS_FEATURE_END ()

COGL_WINSYS_FEATURE_BEGIN (255, 255,
                           create_context,
                           "ARB\0",
                           "create_context",
                           0)
COGL_WINSYS_FEATURE_FUNCTION (GLXContext, glXCreateContextAttribs,
                              (Display *dpy,
                               GLXFBConfig config,
                               GLXContext share_context,
                               Bool direct,
                               const int *attrib_list))
COGL_WINSYS_FEATURE_END ()

COGL_WINSYS_FEATURE_BEGIN (255, 255,
                           buffer_age,
                           "EXT\0",
                           "buffer_age\0",
                           COGL_WINSYS_FEATURE_BUFFER_AGE)
COGL_WINSYS_FEATURE_END ()