1 /* 2 * Cogl 3 * 4 * A Low Level GPU Graphics and Utilities API 5 * 6 * Copyright (C) 2010 Intel Corporation. 7 * 8 * Permission is hereby granted, free of charge, to any person 9 * obtaining a copy of this software and associated documentation 10 * files (the "Software"), to deal in the Software without 11 * restriction, including without limitation the rights to use, copy, 12 * modify, merge, publish, distribute, sublicense, and/or sell copies 13 * of the Software, and to permit persons to whom the Software is 14 * furnished to do so, subject to the following conditions: 15 * 16 * The above copyright notice and this permission notice shall be 17 * included in all copies or substantial portions of the Software. 18 * 19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 23 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 24 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 25 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 * SOFTWARE. 27 * 28 * 29 */ 30 31 /* This can be included multiple times with different definitions for 32 * the COGL_WINSYS_FEATURE_* functions. 33 */ 34 35 /* Macro prototypes: 36 * COGL_WINSYS_FEATURE_BEGIN (major_glx_version, minor_glx_version, 37 * name, namespaces, extension_names, 38 * implied_legacy_feature_flags, 39 * implied_winsys_feature) 40 * COGL_WINSYS_FEATURE_FUNCTION (return_type, function_name, 41 * (arguments)) 42 * ... 43 * COGL_WINSYS_FEATURE_END () 44 * 45 * Note: You can list multiple namespace and extension names if the 46 * corresponding _FEATURE_FUNCTIONS have the same semantics across 47 * the different extension variants. 48 * 49 * XXX: NB: Don't add a trailing semicolon when using these macros 50 */ 51 52 /* Base functions that we assume are always available */ 53 COGL_WINSYS_FEATURE_BEGIN (0, 0, /* always available */ 54 base_glx_functions, 55 "\0", 56 "\0", 57 0, /* no implied public feature */ 58 0 /* no winsys feature */) 59 COGL_WINSYS_FEATURE_FUNCTION (void, glXDestroyContext, 60 (Display *dpy, GLXContext ctx)) 61 COGL_WINSYS_FEATURE_FUNCTION (void, glXSwapBuffers, 62 (Display *dpy, GLXDrawable drawable)) 63 COGL_WINSYS_FEATURE_FUNCTION (Bool, glXIsDirect, 64 (Display *dpy, GLXContext ctx)) 65 COGL_WINSYS_FEATURE_FUNCTION (int, glXGetFBConfigAttrib, 66 (Display *dpy, GLXFBConfig config, 67 int attribute, int *value)) 68 COGL_WINSYS_FEATURE_FUNCTION (GLXWindow, glXCreateWindow, 69 (Display *dpy, GLXFBConfig config, 70 Window win, const int *attribList)) 71 COGL_WINSYS_FEATURE_FUNCTION (void, glXDestroyWindow, 72 (Display *dpy, GLXWindow window)) 73 COGL_WINSYS_FEATURE_FUNCTION (GLXPixmap, glXCreatePixmap, 74 (Display *dpy, GLXFBConfig config, 75 Pixmap pixmap, const int *attribList)) 76 COGL_WINSYS_FEATURE_FUNCTION (void, glXDestroyPixmap, 77 (Display *dpy, GLXPixmap pixmap)) 78 COGL_WINSYS_FEATURE_FUNCTION (GLXContext, glXCreateNewContext, 79 (Display *dpy, GLXFBConfig config, 80 int renderType, GLXContext shareList, 81 Bool direct)) 82 COGL_WINSYS_FEATURE_FUNCTION (Bool, glXMakeContextCurrent, 83 (Display *dpy, GLXDrawable draw, 84 GLXDrawable read, GLXContext ctx)) 85 COGL_WINSYS_FEATURE_FUNCTION (void, glXSelectEvent, 86 (Display *dpy, GLXDrawable drawable, 87 unsigned long mask)) 88 COGL_WINSYS_FEATURE_FUNCTION (GLXFBConfig *, glXGetFBConfigs, 89 (Display *dpy, int screen, int *nelements)) 90 COGL_WINSYS_FEATURE_FUNCTION (GLXFBConfig *, glXChooseFBConfig, 91 (Display *dpy, int screen, 92 const int *attrib_list, int *nelements)) 93 COGL_WINSYS_FEATURE_FUNCTION (XVisualInfo *, glXGetVisualFromFBConfig, 94 (Display *dpy, GLXFBConfig config)) 95 COGL_WINSYS_FEATURE_END () 96 97 COGL_WINSYS_FEATURE_BEGIN (255, 255, 98 texture_from_pixmap, 99 "EXT\0", 100 "texture_from_pixmap\0", 101 0, 102 COGL_WINSYS_FEATURE_TEXTURE_FROM_PIXMAP) 103 COGL_WINSYS_FEATURE_FUNCTION (void, glXBindTexImage, 104 (Display *display, 105 GLXDrawable drawable, 106 int buffer, 107 int *attribList)) 108 COGL_WINSYS_FEATURE_FUNCTION (void, glXReleaseTexImage, 109 (Display *display, 110 GLXDrawable drawable, 111 int buffer)) 112 COGL_WINSYS_FEATURE_END () 113 114 COGL_WINSYS_FEATURE_BEGIN (255, 255, 115 video_sync, 116 "SGI\0", 117 "video_sync\0", 118 0, 119 COGL_WINSYS_FEATURE_VBLANK_COUNTER) 120 COGL_WINSYS_FEATURE_FUNCTION (int, glXGetVideoSync, 121 (unsigned int *count)) 122 COGL_WINSYS_FEATURE_FUNCTION (int, glXWaitVideoSync, 123 (int divisor, 124 int remainder, 125 unsigned int *count)) 126 COGL_WINSYS_FEATURE_END () 127 128 COGL_WINSYS_FEATURE_BEGIN (255, 255, 129 swap_control, 130 "SGI\0", 131 "swap_control\0", 132 0, 133 0) 134 COGL_WINSYS_FEATURE_FUNCTION (int, glXSwapInterval, 135 (int interval)) 136 COGL_WINSYS_FEATURE_END () 137 138 COGL_WINSYS_FEATURE_BEGIN (255, 255, 139 sync_control, 140 "OML\0", 141 "sync_control\0", 142 0, 143 0) 144 COGL_WINSYS_FEATURE_FUNCTION (Bool, glXGetSyncValues, 145 (Display* dpy, 146 GLXDrawable drawable, 147 int64_t* ust, 148 int64_t* msc, 149 int64_t* sbc)) 150 COGL_WINSYS_FEATURE_FUNCTION (Bool, glXWaitForMsc, 151 (Display* dpy, 152 GLXDrawable drawable, 153 int64_t target_msc, 154 int64_t divisor, 155 int64_t remainder, 156 int64_t* ust, 157 int64_t* msc, 158 int64_t* sbc)) 159 COGL_WINSYS_FEATURE_END () 160 161 COGL_WINSYS_FEATURE_BEGIN (255, 255, 162 copy_sub_buffer, 163 "MESA\0", 164 "copy_sub_buffer\0", 165 0, 166 /* We initially assumed that copy_sub_buffer is synchronized on 167 * which is only the case for a subset of GPUs for example it is not 168 * synchronized on INTEL gen6 and gen7, so we remove this assumption 169 * for now 170 */ 171 #if 0 172 COGL_WINSYS_FEATURE_SWAP_REGION_SYNCHRONIZED) 173 #endif 174 0) 175 COGL_WINSYS_FEATURE_FUNCTION (void, glXCopySubBuffer, 176 (Display *dpy, 177 GLXDrawable drawable, 178 int x, int y, int width, int height)) 179 COGL_WINSYS_FEATURE_END () 180 181 COGL_WINSYS_FEATURE_BEGIN (255, 255, 182 swap_event, 183 "INTEL\0", 184 "swap_event\0", 185 0, 186 COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT) 187 188 COGL_WINSYS_FEATURE_END () 189 190 COGL_WINSYS_FEATURE_BEGIN (255, 255, 191 create_context, 192 "ARB\0", 193 "create_context", 194 0, 195 0) 196 COGL_WINSYS_FEATURE_FUNCTION (GLXContext, glXCreateContextAttribs, 197 (Display *dpy, 198 GLXFBConfig config, 199 GLXContext share_context, 200 Bool direct, 201 const int *attrib_list)) 202 COGL_WINSYS_FEATURE_END () 203 204 COGL_WINSYS_FEATURE_BEGIN (255, 255, 205 buffer_age, 206 "EXT\0", 207 "buffer_age\0", 208 0, 209 COGL_WINSYS_FEATURE_BUFFER_AGE) 210 COGL_WINSYS_FEATURE_END () 211