Brian Paul | 192c988 | 2004-03-22 23:31:29 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 3 | * Copyright 2007-2008 Red Hat, Inc. |
Brian Paul | 192c988 | 2004-03-22 23:31:29 +0000 | [diff] [blame] | 4 | * (C) Copyright IBM Corporation 2004 |
| 5 | * All Rights Reserved. |
| 6 | * |
| 7 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 8 | * copy of this software and associated documentation files (the "Software"), |
| 9 | * to deal in the Software without restriction, including without limitation |
| 10 | * on the rights to use, copy, modify, merge, publish, distribute, sub |
| 11 | * license, and/or sell copies of the Software, and to permit persons to whom |
| 12 | * the Software is furnished to do so, subject to the following conditions: |
| 13 | * |
| 14 | * The above copyright notice and this permission notice (including the next |
| 15 | * paragraph) shall be included in all copies or substantial portions of the |
| 16 | * Software. |
| 17 | * |
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL |
| 21 | * THE COPYRIGHT HOLDERS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, |
| 22 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
| 23 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE |
| 24 | * USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 25 | */ |
| 26 | |
| 27 | /** |
| 28 | * \file dri_interface.h |
| 29 | * |
| 30 | * This file contains all the types and functions that define the interface |
| 31 | * between a DRI driver and driver loader. Currently, the most common driver |
| 32 | * loader is the XFree86 libGL.so. However, other loaders do exist, and in |
| 33 | * the future the server-side libglx.a will also be a loader. |
| 34 | * |
| 35 | * \author Kevin E. Martin <kevin@precisioninsight.com> |
| 36 | * \author Ian Romanick <idr@us.ibm.com> |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 37 | * \author Kristian Høgsberg <krh@redhat.com> |
Brian Paul | 192c988 | 2004-03-22 23:31:29 +0000 | [diff] [blame] | 38 | */ |
| 39 | |
Keith Whitwell | 74d563c | 2004-04-29 12:23:39 +0000 | [diff] [blame] | 40 | #ifndef DRI_INTERFACE_H |
| 41 | #define DRI_INTERFACE_H |
| 42 | |
Emil Velikov | 0efd773 | 2015-07-07 15:13:46 +0100 | [diff] [blame] | 43 | #ifdef HAVE_LIBDRM |
Ian Romanick | fabe2b9 | 2004-06-01 16:38:56 +0000 | [diff] [blame] | 44 | #include <drm.h> |
Jeremy Huddleston | 01ac454 | 2008-08-08 02:19:52 -0700 | [diff] [blame] | 45 | #else |
| 46 | typedef unsigned int drm_context_t; |
| 47 | typedef unsigned int drm_drawable_t; |
| 48 | typedef struct drm_clip_rect drm_clip_rect_t; |
| 49 | #endif |
Brian Paul | 192c988 | 2004-03-22 23:31:29 +0000 | [diff] [blame] | 50 | |
| 51 | /** |
| 52 | * \name DRI interface structures |
| 53 | * |
| 54 | * The following structures define the interface between the GLX client |
| 55 | * side library and the DRI (direct rendering infrastructure). |
| 56 | */ |
| 57 | /*@{*/ |
Kristian Høgsberg | 4a22ae8 | 2007-01-07 08:12:01 -0500 | [diff] [blame] | 58 | typedef struct __DRIdisplayRec __DRIdisplay; |
| 59 | typedef struct __DRIscreenRec __DRIscreen; |
| 60 | typedef struct __DRIcontextRec __DRIcontext; |
| 61 | typedef struct __DRIdrawableRec __DRIdrawable; |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 62 | typedef struct __DRIconfigRec __DRIconfig; |
Kristian Høgsberg | 4a22ae8 | 2007-01-07 08:12:01 -0500 | [diff] [blame] | 63 | typedef struct __DRIframebufferRec __DRIframebuffer; |
| 64 | typedef struct __DRIversionRec __DRIversion; |
Kristian Høgsberg | f616a26 | 2007-05-15 12:31:31 -0400 | [diff] [blame] | 65 | |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 66 | typedef struct __DRIcoreExtensionRec __DRIcoreExtension; |
Kristian Høgsberg | 78a6aa5 | 2007-05-16 14:10:29 -0400 | [diff] [blame] | 67 | typedef struct __DRIextensionRec __DRIextension; |
Kristian Høgsberg | ac3e838 | 2007-05-15 15:17:30 -0400 | [diff] [blame] | 68 | typedef struct __DRIcopySubBufferExtensionRec __DRIcopySubBufferExtension; |
Kristian Høgsberg | efaf90b | 2007-05-15 16:09:44 -0400 | [diff] [blame] | 69 | typedef struct __DRIswapControlExtensionRec __DRIswapControlExtension; |
Kristian Høgsberg | a7a0a2b | 2007-05-16 15:50:40 -0400 | [diff] [blame] | 70 | typedef struct __DRIframeTrackingExtensionRec __DRIframeTrackingExtension; |
Kristian Høgsberg | 106a6f2 | 2007-05-16 18:13:41 -0400 | [diff] [blame] | 71 | typedef struct __DRImediaStreamCounterExtensionRec __DRImediaStreamCounterExtension; |
Kristian Høgsberg | f29f0ae | 2007-05-22 12:26:02 -0400 | [diff] [blame] | 72 | typedef struct __DRItexOffsetExtensionRec __DRItexOffsetExtension; |
Kristian Høgsberg | 6d48779 | 2008-02-14 22:12:51 -0500 | [diff] [blame] | 73 | typedef struct __DRItexBufferExtensionRec __DRItexBufferExtension; |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 74 | typedef struct __DRIlegacyExtensionRec __DRIlegacyExtension; |
George Sapountzis | 280bf89 | 2008-05-11 14:43:40 +0300 | [diff] [blame] | 75 | typedef struct __DRIswrastExtensionRec __DRIswrastExtension; |
Kristian Høgsberg | f56b569 | 2008-08-13 11:46:25 -0400 | [diff] [blame] | 76 | typedef struct __DRIbufferRec __DRIbuffer; |
| 77 | typedef struct __DRIdri2ExtensionRec __DRIdri2Extension; |
| 78 | typedef struct __DRIdri2LoaderExtensionRec __DRIdri2LoaderExtension; |
Alan Hourihane | 6556245 | 2009-02-19 18:39:08 +0000 | [diff] [blame] | 79 | typedef struct __DRI2flushExtensionRec __DRI2flushExtension; |
Thomas Hellstrom | 511dc29 | 2011-10-10 16:38:19 +0200 | [diff] [blame] | 80 | typedef struct __DRI2throttleExtensionRec __DRI2throttleExtension; |
Marek Olšák | b02a5bf | 2015-04-10 10:43:26 +0200 | [diff] [blame] | 81 | typedef struct __DRI2fenceExtensionRec __DRI2fenceExtension; |
Kristian Høgsberg | f56b569 | 2008-08-13 11:46:25 -0400 | [diff] [blame] | 82 | |
Keith Packard | 4424420 | 2013-11-04 18:09:51 -0800 | [diff] [blame] | 83 | |
| 84 | typedef struct __DRIimageLoaderExtensionRec __DRIimageLoaderExtension; |
| 85 | typedef struct __DRIimageDriverExtensionRec __DRIimageDriverExtension; |
| 86 | |
Brian Paul | 192c988 | 2004-03-22 23:31:29 +0000 | [diff] [blame] | 87 | /*@}*/ |
| 88 | |
| 89 | |
| 90 | /** |
Kristian Høgsberg | f616a26 | 2007-05-15 12:31:31 -0400 | [diff] [blame] | 91 | * Extension struct. Drivers 'inherit' from this struct by embedding |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 92 | * it as the first element in the extension struct. |
Kristian Høgsberg | ccff0cb | 2007-06-07 19:35:54 -0400 | [diff] [blame] | 93 | * |
| 94 | * We never break API in for a DRI extension. If we need to change |
| 95 | * the way things work in a non-backwards compatible manner, we |
| 96 | * introduce a new extension. During a transition period, we can |
| 97 | * leave both the old and the new extension in the driver, which |
| 98 | * allows us to move to the new interface without having to update the |
| 99 | * loader(s) in lock step. |
| 100 | * |
| 101 | * However, we can add entry points to an extension over time as long |
| 102 | * as we don't break the old ones. As we add entry points to an |
| 103 | * extension, we increase the version number. The corresponding |
| 104 | * #define can be used to guard code that accesses the new entry |
| 105 | * points at compile time and the version field in the extension |
| 106 | * struct can be used at run-time to determine how to use the |
| 107 | * extension. |
Kristian Høgsberg | f616a26 | 2007-05-15 12:31:31 -0400 | [diff] [blame] | 108 | */ |
| 109 | struct __DRIextensionRec { |
| 110 | const char *name; |
Kristian Høgsberg | ccff0cb | 2007-06-07 19:35:54 -0400 | [diff] [blame] | 111 | int version; |
Kristian Høgsberg | f616a26 | 2007-05-15 12:31:31 -0400 | [diff] [blame] | 112 | }; |
| 113 | |
Kristian Høgsberg | ac3e838 | 2007-05-15 15:17:30 -0400 | [diff] [blame] | 114 | /** |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 115 | * The first set of extension are the screen extensions, returned by |
| 116 | * __DRIcore::getExtensions(). This entry point will return a list of |
| 117 | * extensions and the loader can use the ones it knows about by |
| 118 | * casting them to more specific extensions and advertising any GLX |
| 119 | * extensions the DRI extensions enables. |
| 120 | */ |
| 121 | |
| 122 | /** |
Kristian Høgsberg | f968f67 | 2007-05-17 14:39:06 -0400 | [diff] [blame] | 123 | * Used by drivers to indicate support for setting the read drawable. |
| 124 | */ |
| 125 | #define __DRI_READ_DRAWABLE "DRI_ReadDrawable" |
Kristian Høgsberg | ccff0cb | 2007-06-07 19:35:54 -0400 | [diff] [blame] | 126 | #define __DRI_READ_DRAWABLE_VERSION 1 |
Kristian Høgsberg | f968f67 | 2007-05-17 14:39:06 -0400 | [diff] [blame] | 127 | |
| 128 | /** |
Kristian Høgsberg | ac3e838 | 2007-05-15 15:17:30 -0400 | [diff] [blame] | 129 | * Used by drivers that implement the GLX_MESA_copy_sub_buffer extension. |
| 130 | */ |
| 131 | #define __DRI_COPY_SUB_BUFFER "DRI_CopySubBuffer" |
Kristian Høgsberg | ccff0cb | 2007-06-07 19:35:54 -0400 | [diff] [blame] | 132 | #define __DRI_COPY_SUB_BUFFER_VERSION 1 |
Kristian Høgsberg | ac3e838 | 2007-05-15 15:17:30 -0400 | [diff] [blame] | 133 | struct __DRIcopySubBufferExtensionRec { |
| 134 | __DRIextension base; |
| 135 | void (*copySubBuffer)(__DRIdrawable *drawable, int x, int y, int w, int h); |
| 136 | }; |
| 137 | |
Kristian Høgsberg | efaf90b | 2007-05-15 16:09:44 -0400 | [diff] [blame] | 138 | /** |
| 139 | * Used by drivers that implement the GLX_SGI_swap_control or |
| 140 | * GLX_MESA_swap_control extension. |
| 141 | */ |
| 142 | #define __DRI_SWAP_CONTROL "DRI_SwapControl" |
Kristian Høgsberg | ccff0cb | 2007-06-07 19:35:54 -0400 | [diff] [blame] | 143 | #define __DRI_SWAP_CONTROL_VERSION 1 |
Kristian Høgsberg | efaf90b | 2007-05-15 16:09:44 -0400 | [diff] [blame] | 144 | struct __DRIswapControlExtensionRec { |
| 145 | __DRIextension base; |
| 146 | void (*setSwapInterval)(__DRIdrawable *drawable, unsigned int inteval); |
| 147 | unsigned int (*getSwapInterval)(__DRIdrawable *drawable); |
| 148 | }; |
Kristian Høgsberg | f616a26 | 2007-05-15 12:31:31 -0400 | [diff] [blame] | 149 | |
| 150 | /** |
Kristian Høgsberg | a7a0a2b | 2007-05-16 15:50:40 -0400 | [diff] [blame] | 151 | * Used by drivers that implement the GLX_MESA_swap_frame_usage extension. |
| 152 | */ |
| 153 | #define __DRI_FRAME_TRACKING "DRI_FrameTracking" |
Kristian Høgsberg | ccff0cb | 2007-06-07 19:35:54 -0400 | [diff] [blame] | 154 | #define __DRI_FRAME_TRACKING_VERSION 1 |
Kristian Høgsberg | a7a0a2b | 2007-05-16 15:50:40 -0400 | [diff] [blame] | 155 | struct __DRIframeTrackingExtensionRec { |
| 156 | __DRIextension base; |
| 157 | |
| 158 | /** |
| 159 | * Enable or disable frame usage tracking. |
| 160 | * |
| 161 | * \since Internal API version 20030317. |
| 162 | */ |
| 163 | int (*frameTracking)(__DRIdrawable *drawable, GLboolean enable); |
| 164 | |
| 165 | /** |
| 166 | * Retrieve frame usage information. |
| 167 | * |
| 168 | * \since Internal API version 20030317. |
| 169 | */ |
| 170 | int (*queryFrameTracking)(__DRIdrawable *drawable, |
| 171 | int64_t * sbc, int64_t * missedFrames, |
| 172 | float * lastMissedUsage, float * usage); |
| 173 | }; |
| 174 | |
Kristian Høgsberg | 106a6f2 | 2007-05-16 18:13:41 -0400 | [diff] [blame] | 175 | |
| 176 | /** |
| 177 | * Used by drivers that implement the GLX_SGI_video_sync extension. |
| 178 | */ |
| 179 | #define __DRI_MEDIA_STREAM_COUNTER "DRI_MediaStreamCounter" |
Kristian Høgsberg | 6e8d21d | 2008-02-25 16:14:37 -0500 | [diff] [blame] | 180 | #define __DRI_MEDIA_STREAM_COUNTER_VERSION 1 |
Kristian Høgsberg | 106a6f2 | 2007-05-16 18:13:41 -0400 | [diff] [blame] | 181 | struct __DRImediaStreamCounterExtensionRec { |
| 182 | __DRIextension base; |
| 183 | |
| 184 | /** |
Kristian Høgsberg | 106a6f2 | 2007-05-16 18:13:41 -0400 | [diff] [blame] | 185 | * Wait for the MSC to equal target_msc, or, if that has already passed, |
| 186 | * the next time (MSC % divisor) is equal to remainder. If divisor is |
| 187 | * zero, the function will return as soon as MSC is greater than or equal |
| 188 | * to target_msc. |
| 189 | */ |
| 190 | int (*waitForMSC)(__DRIdrawable *drawable, |
| 191 | int64_t target_msc, int64_t divisor, int64_t remainder, |
| 192 | int64_t * msc, int64_t * sbc); |
Jesse Barnes | 38fdb47 | 2007-10-29 11:56:31 -0700 | [diff] [blame] | 193 | |
| 194 | /** |
Jesse Barnes | 38fdb47 | 2007-10-29 11:56:31 -0700 | [diff] [blame] | 195 | * Get the number of vertical refreshes since some point in time before |
| 196 | * this function was first called (i.e., system start up). |
Jesse Barnes | 38fdb47 | 2007-10-29 11:56:31 -0700 | [diff] [blame] | 197 | */ |
Kristian Høgsberg | 6e8d21d | 2008-02-25 16:14:37 -0500 | [diff] [blame] | 198 | int (*getDrawableMSC)(__DRIscreen *screen, __DRIdrawable *drawable, |
Jesse Barnes | 38fdb47 | 2007-10-29 11:56:31 -0700 | [diff] [blame] | 199 | int64_t *msc); |
Kristian Høgsberg | 106a6f2 | 2007-05-16 18:13:41 -0400 | [diff] [blame] | 200 | }; |
| 201 | |
| 202 | |
Kristian Høgsberg | f29f0ae | 2007-05-22 12:26:02 -0400 | [diff] [blame] | 203 | #define __DRI_TEX_OFFSET "DRI_TexOffset" |
Kristian Høgsberg | ccff0cb | 2007-06-07 19:35:54 -0400 | [diff] [blame] | 204 | #define __DRI_TEX_OFFSET_VERSION 1 |
Kristian Høgsberg | f29f0ae | 2007-05-22 12:26:02 -0400 | [diff] [blame] | 205 | struct __DRItexOffsetExtensionRec { |
| 206 | __DRIextension base; |
| 207 | |
| 208 | /** |
| 209 | * Method to override base texture image with a driver specific 'offset'. |
| 210 | * The depth passed in allows e.g. to ignore the alpha channel of texture |
| 211 | * images where the non-alpha components don't occupy a whole texel. |
| 212 | * |
| 213 | * For GLX_EXT_texture_from_pixmap with AIGLX. |
| 214 | */ |
| 215 | void (*setTexOffset)(__DRIcontext *pDRICtx, GLint texname, |
| 216 | unsigned long long offset, GLint depth, GLuint pitch); |
| 217 | }; |
| 218 | |
| 219 | |
Kristian Høgsberg | debf00e | 2010-02-09 15:26:14 -0500 | [diff] [blame] | 220 | /* Valid values for format in the setTexBuffer2 function below. These |
| 221 | * values match the GLX tokens for compatibility reasons, but we |
| 222 | * define them here since the DRI interface can't depend on GLX. */ |
| 223 | #define __DRI_TEXTURE_FORMAT_NONE 0x20D8 |
| 224 | #define __DRI_TEXTURE_FORMAT_RGB 0x20D9 |
| 225 | #define __DRI_TEXTURE_FORMAT_RGBA 0x20DA |
| 226 | |
Kristian Høgsberg | 6d48779 | 2008-02-14 22:12:51 -0500 | [diff] [blame] | 227 | #define __DRI_TEX_BUFFER "DRI_TexBuffer" |
Emil Velikov | 9b42fd1 | 2014-02-18 03:04:03 +0000 | [diff] [blame] | 228 | #define __DRI_TEX_BUFFER_VERSION 3 |
Kristian Høgsberg | 6d48779 | 2008-02-14 22:12:51 -0500 | [diff] [blame] | 229 | struct __DRItexBufferExtensionRec { |
| 230 | __DRIextension base; |
| 231 | |
| 232 | /** |
Kristian Høgsberg | dcbe215 | 2008-03-09 21:28:04 -0400 | [diff] [blame] | 233 | * Method to override base texture image with the contents of a |
| 234 | * __DRIdrawable. |
Kristian Høgsberg | 6d48779 | 2008-02-14 22:12:51 -0500 | [diff] [blame] | 235 | * |
Eric Anholt | 66175aa | 2009-03-18 12:07:09 -0700 | [diff] [blame] | 236 | * For GLX_EXT_texture_from_pixmap with AIGLX. Deprecated in favor of |
| 237 | * setTexBuffer2 in version 2 of this interface |
Kristian Høgsberg | 6d48779 | 2008-02-14 22:12:51 -0500 | [diff] [blame] | 238 | */ |
| 239 | void (*setTexBuffer)(__DRIcontext *pDRICtx, |
Kristian Høgsberg | dcbe215 | 2008-03-09 21:28:04 -0400 | [diff] [blame] | 240 | GLint target, |
| 241 | __DRIdrawable *pDraw); |
Eric Anholt | 66175aa | 2009-03-18 12:07:09 -0700 | [diff] [blame] | 242 | |
| 243 | /** |
| 244 | * Method to override base texture image with the contents of a |
| 245 | * __DRIdrawable, including the required texture format attribute. |
| 246 | * |
| 247 | * For GLX_EXT_texture_from_pixmap with AIGLX. |
Emil Velikov | c9fff07 | 2014-02-12 19:00:21 +0000 | [diff] [blame] | 248 | * |
| 249 | * \since 2 |
Eric Anholt | 66175aa | 2009-03-18 12:07:09 -0700 | [diff] [blame] | 250 | */ |
| 251 | void (*setTexBuffer2)(__DRIcontext *pDRICtx, |
| 252 | GLint target, |
| 253 | GLint format, |
| 254 | __DRIdrawable *pDraw); |
Juan Zhao | e59fa4c | 2011-01-09 12:03:02 -0500 | [diff] [blame] | 255 | /** |
| 256 | * Method to release texture buffer in case some special platform |
| 257 | * need this. |
| 258 | * |
| 259 | * For GLX_EXT_texture_from_pixmap with AIGLX. |
Emil Velikov | c9fff07 | 2014-02-12 19:00:21 +0000 | [diff] [blame] | 260 | * |
| 261 | * \since 3 |
Juan Zhao | e59fa4c | 2011-01-09 12:03:02 -0500 | [diff] [blame] | 262 | */ |
| 263 | void (*releaseTexBuffer)(__DRIcontext *pDRICtx, |
| 264 | GLint target, |
| 265 | __DRIdrawable *pDraw); |
Kristian Høgsberg | 6d48779 | 2008-02-14 22:12:51 -0500 | [diff] [blame] | 266 | }; |
| 267 | |
Alan Hourihane | 6556245 | 2009-02-19 18:39:08 +0000 | [diff] [blame] | 268 | /** |
| 269 | * Used by drivers that implement DRI2 |
| 270 | */ |
| 271 | #define __DRI2_FLUSH "DRI2_Flush" |
Marek Olšák | 4a486f8 | 2012-11-23 18:31:42 +0100 | [diff] [blame] | 272 | #define __DRI2_FLUSH_VERSION 4 |
| 273 | |
| 274 | #define __DRI2_FLUSH_DRAWABLE (1 << 0) /* the drawable should be flushed. */ |
| 275 | #define __DRI2_FLUSH_CONTEXT (1 << 1) /* glFlush should be called */ |
Eric Anholt | 70e8ccc | 2014-12-21 11:51:33 -0800 | [diff] [blame] | 276 | #define __DRI2_FLUSH_INVALIDATE_ANCILLARY (1 << 2) |
Marek Olšák | 4a486f8 | 2012-11-23 18:31:42 +0100 | [diff] [blame] | 277 | |
Chad Versace | e5f1f8d | 2012-12-01 17:03:59 -0800 | [diff] [blame] | 278 | enum __DRI2throttleReason { |
| 279 | __DRI2_THROTTLE_SWAPBUFFER, |
| 280 | __DRI2_THROTTLE_COPYSUBBUFFER, |
| 281 | __DRI2_THROTTLE_FLUSHFRONT |
| 282 | }; |
Marek Olšák | 4a486f8 | 2012-11-23 18:31:42 +0100 | [diff] [blame] | 283 | |
Alan Hourihane | 6556245 | 2009-02-19 18:39:08 +0000 | [diff] [blame] | 284 | struct __DRI2flushExtensionRec { |
| 285 | __DRIextension base; |
| 286 | void (*flush)(__DRIdrawable *drawable); |
Jesse Barnes | a35f6bb | 2009-07-17 03:30:29 -0400 | [diff] [blame] | 287 | |
| 288 | /** |
Francisco Jerez | 61d26bc | 2010-02-08 19:27:56 +0100 | [diff] [blame] | 289 | * Ask the driver to call getBuffers/getBuffersWithFormat before |
| 290 | * it starts rendering again. |
Jesse Barnes | a35f6bb | 2009-07-17 03:30:29 -0400 | [diff] [blame] | 291 | * |
Francisco Jerez | 61d26bc | 2010-02-08 19:27:56 +0100 | [diff] [blame] | 292 | * \param drawable the drawable to invalidate |
Jesse Barnes | a35f6bb | 2009-07-17 03:30:29 -0400 | [diff] [blame] | 293 | * |
Francisco Jerez | 61d26bc | 2010-02-08 19:27:56 +0100 | [diff] [blame] | 294 | * \since 3 |
Jesse Barnes | a35f6bb | 2009-07-17 03:30:29 -0400 | [diff] [blame] | 295 | */ |
Francisco Jerez | 61d26bc | 2010-02-08 19:27:56 +0100 | [diff] [blame] | 296 | void (*invalidate)(__DRIdrawable *drawable); |
Marek Olšák | 4a486f8 | 2012-11-23 18:31:42 +0100 | [diff] [blame] | 297 | |
| 298 | /** |
| 299 | * This function reduces the number of flushes in the driver by combining |
| 300 | * several operations into one call. |
| 301 | * |
| 302 | * It can: |
| 303 | * - throttle |
| 304 | * - flush a drawable |
| 305 | * - flush a context |
| 306 | * |
| 307 | * \param context the context |
| 308 | * \param drawable the drawable to flush |
| 309 | * \param flags a combination of _DRI2_FLUSH_xxx flags |
| 310 | * \param throttle_reason the reason for throttling, 0 = no throttling |
| 311 | * |
| 312 | * \since 4 |
| 313 | */ |
| 314 | void (*flush_with_flags)(__DRIcontext *ctx, |
| 315 | __DRIdrawable *drawable, |
| 316 | unsigned flags, |
| 317 | enum __DRI2throttleReason throttle_reason); |
Alan Hourihane | 6556245 | 2009-02-19 18:39:08 +0000 | [diff] [blame] | 318 | }; |
| 319 | |
Kristian Høgsberg | 6d48779 | 2008-02-14 22:12:51 -0500 | [diff] [blame] | 320 | |
Kristian Høgsberg | a7a0a2b | 2007-05-16 15:50:40 -0400 | [diff] [blame] | 321 | /** |
Thomas Hellstrom | 511dc29 | 2011-10-10 16:38:19 +0200 | [diff] [blame] | 322 | * Extension that the driver uses to request |
| 323 | * throttle callbacks. |
| 324 | */ |
| 325 | |
| 326 | #define __DRI2_THROTTLE "DRI2_Throttle" |
| 327 | #define __DRI2_THROTTLE_VERSION 1 |
| 328 | |
Thomas Hellstrom | 511dc29 | 2011-10-10 16:38:19 +0200 | [diff] [blame] | 329 | struct __DRI2throttleExtensionRec { |
| 330 | __DRIextension base; |
| 331 | void (*throttle)(__DRIcontext *ctx, |
| 332 | __DRIdrawable *drawable, |
| 333 | enum __DRI2throttleReason reason); |
| 334 | }; |
| 335 | |
Marek Olšák | b02a5bf | 2015-04-10 10:43:26 +0200 | [diff] [blame] | 336 | |
| 337 | /** |
| 338 | * Extension for fences / synchronization objects. |
| 339 | */ |
| 340 | |
| 341 | #define __DRI2_FENCE "DRI2_Fence" |
| 342 | #define __DRI2_FENCE_VERSION 1 |
| 343 | |
| 344 | #define __DRI2_FENCE_TIMEOUT_INFINITE 0xffffffffffffffffllu |
| 345 | |
| 346 | #define __DRI2_FENCE_FLAG_FLUSH_COMMANDS (1 << 0) |
| 347 | |
| 348 | struct __DRI2fenceExtensionRec { |
| 349 | __DRIextension base; |
| 350 | |
| 351 | /** |
| 352 | * Create and insert a fence into the command stream of the context. |
| 353 | */ |
| 354 | void *(*create_fence)(__DRIcontext *ctx); |
| 355 | |
| 356 | /** |
| 357 | * Get a fence associated with the OpenCL event object. |
| 358 | * This can be NULL, meaning that OpenCL interoperability is not supported. |
| 359 | */ |
| 360 | void *(*get_fence_from_cl_event)(__DRIscreen *screen, intptr_t cl_event); |
| 361 | |
| 362 | /** |
| 363 | * Destroy a fence. |
| 364 | */ |
| 365 | void (*destroy_fence)(__DRIscreen *screen, void *fence); |
| 366 | |
| 367 | /** |
| 368 | * This function waits and doesn't return until the fence is signalled |
| 369 | * or the timeout expires. It returns true if the fence has been signaled. |
| 370 | * |
| 371 | * \param ctx the context where commands are flushed |
| 372 | * \param fence the fence |
| 373 | * \param flags a combination of __DRI2_FENCE_FLAG_xxx flags |
| 374 | * \param timeout the timeout in ns or __DRI2_FENCE_TIMEOUT_INFINITE |
| 375 | */ |
| 376 | GLboolean (*client_wait_sync)(__DRIcontext *ctx, void *fence, |
| 377 | unsigned flags, uint64_t timeout); |
| 378 | |
| 379 | /** |
| 380 | * This function enqueues a wait command into the command stream of |
| 381 | * the context and then returns. When the execution reaches the wait |
| 382 | * command, no further execution will be done in the context until |
| 383 | * the fence is signaled. This is a no-op if the device doesn't support |
| 384 | * parallel execution of contexts. |
| 385 | * |
| 386 | * \param ctx the context where the waiting is done |
| 387 | * \param fence the fence |
| 388 | * \param flags a combination of __DRI2_FENCE_FLAG_xxx flags that make |
| 389 | * sense with this function (right now there are none) |
| 390 | */ |
| 391 | void (*server_wait_sync)(__DRIcontext *ctx, void *fence, unsigned flags); |
| 392 | }; |
| 393 | |
| 394 | |
Brian Paul | 192c988 | 2004-03-22 23:31:29 +0000 | [diff] [blame] | 395 | /*@}*/ |
| 396 | |
Kristian Høgsberg | 6cb3f5c | 2008-02-28 10:32:28 -0500 | [diff] [blame] | 397 | /** |
| 398 | * The following extensions describe loader features that the DRI |
| 399 | * driver can make use of. Some of these are mandatory, such as the |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 400 | * getDrawableInfo extension for DRI and the DRI Loader extensions for |
Kristian Høgsberg | 6cb3f5c | 2008-02-28 10:32:28 -0500 | [diff] [blame] | 401 | * DRI2, while others are optional, and if present allow the driver to |
| 402 | * expose certain features. The loader pass in a NULL terminated |
| 403 | * array of these extensions to the driver in the createNewScreen |
| 404 | * constructor. |
| 405 | */ |
Ian Romanick | 5f1ba3e | 2005-07-26 02:44:01 +0000 | [diff] [blame] | 406 | |
Kristian Høgsberg | 6cb3f5c | 2008-02-28 10:32:28 -0500 | [diff] [blame] | 407 | typedef struct __DRIgetDrawableInfoExtensionRec __DRIgetDrawableInfoExtension; |
| 408 | typedef struct __DRIsystemTimeExtensionRec __DRIsystemTimeExtension; |
| 409 | typedef struct __DRIdamageExtensionRec __DRIdamageExtension; |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 410 | typedef struct __DRIloaderExtensionRec __DRIloaderExtension; |
George Sapountzis | 280bf89 | 2008-05-11 14:43:40 +0300 | [diff] [blame] | 411 | typedef struct __DRIswrastLoaderExtensionRec __DRIswrastLoaderExtension; |
Ian Romanick | 5f1ba3e | 2005-07-26 02:44:01 +0000 | [diff] [blame] | 412 | |
Ian Romanick | 5f1ba3e | 2005-07-26 02:44:01 +0000 | [diff] [blame] | 413 | |
Kristian Høgsberg | 6cb3f5c | 2008-02-28 10:32:28 -0500 | [diff] [blame] | 414 | /** |
| 415 | * Callback to getDrawableInfo protocol |
| 416 | */ |
| 417 | #define __DRI_GET_DRAWABLE_INFO "DRI_GetDrawableInfo" |
| 418 | #define __DRI_GET_DRAWABLE_INFO_VERSION 1 |
| 419 | struct __DRIgetDrawableInfoExtensionRec { |
| 420 | __DRIextension base; |
Ian Romanick | 5f1ba3e | 2005-07-26 02:44:01 +0000 | [diff] [blame] | 421 | |
| 422 | /** |
Ian Romanick | 5f1ba3e | 2005-07-26 02:44:01 +0000 | [diff] [blame] | 423 | * This function is used to get information about the position, size, and |
| 424 | * clip rects of a drawable. |
| 425 | */ |
Kristian Høgsberg | 4ff95e7 | 2007-05-10 17:14:38 -0400 | [diff] [blame] | 426 | GLboolean (* getDrawableInfo) ( __DRIdrawable *drawable, |
Kristian Høgsberg | aceccda | 2007-05-10 15:52:22 -0400 | [diff] [blame] | 427 | unsigned int * index, unsigned int * stamp, |
Ian Romanick | 5f1ba3e | 2005-07-26 02:44:01 +0000 | [diff] [blame] | 428 | int * x, int * y, int * width, int * height, |
| 429 | int * numClipRects, drm_clip_rect_t ** pClipRects, |
| 430 | int * backX, int * backY, |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 431 | int * numBackClipRects, drm_clip_rect_t ** pBackClipRects, |
| 432 | void *loaderPrivate); |
Kristian Høgsberg | 6cb3f5c | 2008-02-28 10:32:28 -0500 | [diff] [blame] | 433 | }; |
Ian Romanick | 5f1ba3e | 2005-07-26 02:44:01 +0000 | [diff] [blame] | 434 | |
Kristian Høgsberg | 6cb3f5c | 2008-02-28 10:32:28 -0500 | [diff] [blame] | 435 | /** |
| 436 | * Callback to get system time for media stream counter extensions. |
| 437 | */ |
| 438 | #define __DRI_SYSTEM_TIME "DRI_SystemTime" |
| 439 | #define __DRI_SYSTEM_TIME_VERSION 1 |
| 440 | struct __DRIsystemTimeExtensionRec { |
| 441 | __DRIextension base; |
Ian Romanick | 5f1ba3e | 2005-07-26 02:44:01 +0000 | [diff] [blame] | 442 | |
| 443 | /** |
Ian Romanick | 5f1ba3e | 2005-07-26 02:44:01 +0000 | [diff] [blame] | 444 | * Get the 64-bit unadjusted system time (UST). |
| 445 | */ |
| 446 | int (*getUST)(int64_t * ust); |
| 447 | |
| 448 | /** |
| 449 | * Get the media stream counter (MSC) rate. |
| 450 | * |
| 451 | * Matching the definition in GLX_OML_sync_control, this function returns |
| 452 | * the rate of the "media stream counter". In practical terms, this is |
| 453 | * the frame refresh rate of the display. |
| 454 | */ |
Kristian Høgsberg | aceccda | 2007-05-10 15:52:22 -0400 | [diff] [blame] | 455 | GLboolean (*getMSCRate)(__DRIdrawable *draw, |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 456 | int32_t * numerator, int32_t * denominator, |
| 457 | void *loaderPrivate); |
Kristian Høgsberg | 6cb3f5c | 2008-02-28 10:32:28 -0500 | [diff] [blame] | 458 | }; |
| 459 | |
| 460 | /** |
| 461 | * Damage reporting |
| 462 | */ |
| 463 | #define __DRI_DAMAGE "DRI_Damage" |
| 464 | #define __DRI_DAMAGE_VERSION 1 |
| 465 | struct __DRIdamageExtensionRec { |
| 466 | __DRIextension base; |
Eric Anholt | c2b185c | 2007-01-05 18:19:58 -0800 | [diff] [blame] | 467 | |
| 468 | /** |
| 469 | * Reports areas of the given drawable which have been modified by the |
| 470 | * driver. |
| 471 | * |
| 472 | * \param drawable which the drawing was done to. |
| 473 | * \param rects rectangles affected, with the drawable origin as the |
| 474 | * origin. |
| 475 | * \param x X offset of the drawable within the screen (used in the |
| 476 | * front_buffer case) |
| 477 | * \param y Y offset of the drawable within the screen. |
| 478 | * \param front_buffer boolean flag for whether the drawing to the |
| 479 | * drawable was actually done directly to the front buffer (instead |
| 480 | * of backing storage, for example) |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 481 | * \param loaderPrivate the data passed in at createNewDrawable time |
Eric Anholt | c2b185c | 2007-01-05 18:19:58 -0800 | [diff] [blame] | 482 | */ |
Kristian Høgsberg | aceccda | 2007-05-10 15:52:22 -0400 | [diff] [blame] | 483 | void (*reportDamage)(__DRIdrawable *draw, |
Eric Anholt | c2b185c | 2007-01-05 18:19:58 -0800 | [diff] [blame] | 484 | int x, int y, |
| 485 | drm_clip_rect_t *rects, int num_rects, |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 486 | GLboolean front_buffer, |
| 487 | void *loaderPrivate); |
Kristian Høgsberg | 6cb3f5c | 2008-02-28 10:32:28 -0500 | [diff] [blame] | 488 | }; |
| 489 | |
George Sapountzis | 280bf89 | 2008-05-11 14:43:40 +0300 | [diff] [blame] | 490 | #define __DRI_SWRAST_IMAGE_OP_DRAW 1 |
| 491 | #define __DRI_SWRAST_IMAGE_OP_CLEAR 2 |
| 492 | #define __DRI_SWRAST_IMAGE_OP_SWAP 3 |
| 493 | |
| 494 | /** |
| 495 | * SWRast Loader extension. |
| 496 | */ |
| 497 | #define __DRI_SWRAST_LOADER "DRI_SWRastLoader" |
Dave Airlie | 2b67657 | 2015-10-09 01:38:08 +0100 | [diff] [blame] | 498 | #define __DRI_SWRAST_LOADER_VERSION 3 |
George Sapountzis | 280bf89 | 2008-05-11 14:43:40 +0300 | [diff] [blame] | 499 | struct __DRIswrastLoaderExtensionRec { |
| 500 | __DRIextension base; |
| 501 | |
| 502 | /* |
| 503 | * Drawable position and size |
| 504 | */ |
| 505 | void (*getDrawableInfo)(__DRIdrawable *drawable, |
| 506 | int *x, int *y, int *width, int *height, |
| 507 | void *loaderPrivate); |
| 508 | |
| 509 | /** |
| 510 | * Put image to drawable |
| 511 | */ |
| 512 | void (*putImage)(__DRIdrawable *drawable, int op, |
George Sapountzis | f4e561c | 2010-03-27 20:32:52 +0200 | [diff] [blame] | 513 | int x, int y, int width, int height, |
| 514 | char *data, void *loaderPrivate); |
George Sapountzis | 280bf89 | 2008-05-11 14:43:40 +0300 | [diff] [blame] | 515 | |
| 516 | /** |
George Sapountzis | f4e561c | 2010-03-27 20:32:52 +0200 | [diff] [blame] | 517 | * Get image from readable |
George Sapountzis | 280bf89 | 2008-05-11 14:43:40 +0300 | [diff] [blame] | 518 | */ |
George Sapountzis | f4e561c | 2010-03-27 20:32:52 +0200 | [diff] [blame] | 519 | void (*getImage)(__DRIdrawable *readable, |
| 520 | int x, int y, int width, int height, |
| 521 | char *data, void *loaderPrivate); |
Dave Airlie | ba00f2f | 2013-11-28 11:08:11 +1000 | [diff] [blame] | 522 | |
| 523 | /** |
| 524 | * Put image to drawable |
Emil Velikov | acf2fae | 2014-02-18 02:31:27 +0000 | [diff] [blame] | 525 | * |
| 526 | * \since 2 |
Dave Airlie | ba00f2f | 2013-11-28 11:08:11 +1000 | [diff] [blame] | 527 | */ |
| 528 | void (*putImage2)(__DRIdrawable *drawable, int op, |
| 529 | int x, int y, int width, int height, int stride, |
| 530 | char *data, void *loaderPrivate); |
Dave Airlie | 2b67657 | 2015-10-09 01:38:08 +0100 | [diff] [blame] | 531 | |
| 532 | /** |
| 533 | * Put image to drawable |
| 534 | * |
| 535 | * \since 3 |
| 536 | */ |
| 537 | void (*getImage2)(__DRIdrawable *readable, |
| 538 | int x, int y, int width, int height, int stride, |
| 539 | char *data, void *loaderPrivate); |
George Sapountzis | 280bf89 | 2008-05-11 14:43:40 +0300 | [diff] [blame] | 540 | }; |
| 541 | |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 542 | /** |
Kristian Høgsberg | 97a6cbc | 2010-05-11 09:09:30 -0400 | [diff] [blame] | 543 | * Invalidate loader extension. The presence of this extension |
| 544 | * indicates to the DRI driver that the loader will call invalidate in |
| 545 | * the __DRI2_FLUSH extension, whenever the needs to query for new |
| 546 | * buffers. This means that the DRI driver can drop the polling in |
| 547 | * glViewport(). |
| 548 | * |
| 549 | * The extension doesn't provide any functionality, it's only use to |
| 550 | * indicate to the driver that it can use the new semantics. A DRI |
| 551 | * driver can use this to switch between the different semantics or |
| 552 | * just refuse to initialize if this extension isn't present. |
| 553 | */ |
| 554 | #define __DRI_USE_INVALIDATE "DRI_UseInvalidate" |
| 555 | #define __DRI_USE_INVALIDATE_VERSION 1 |
| 556 | |
| 557 | typedef struct __DRIuseInvalidateExtensionRec __DRIuseInvalidateExtension; |
| 558 | struct __DRIuseInvalidateExtensionRec { |
| 559 | __DRIextension base; |
| 560 | }; |
| 561 | |
| 562 | /** |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 563 | * The remaining extensions describe driver extensions, immediately |
| 564 | * available interfaces provided by the driver. To start using the |
| 565 | * driver, dlsym() for the __DRI_DRIVER_EXTENSIONS symbol and look for |
| 566 | * the extension you need in the array. |
| 567 | */ |
| 568 | #define __DRI_DRIVER_EXTENSIONS "__driDriverExtensions" |
| 569 | |
| 570 | /** |
Eric Anholt | fcb57a8 | 2013-09-23 14:44:10 -0700 | [diff] [blame] | 571 | * This symbol replaces the __DRI_DRIVER_EXTENSIONS symbol, and will be |
| 572 | * suffixed by "_drivername", allowing multiple drivers to be built into one |
| 573 | * library, and also giving the driver the chance to return a variable driver |
| 574 | * extensions struct depending on the driver name being loaded or any other |
| 575 | * system state. |
| 576 | * |
| 577 | * The function prototype is: |
| 578 | * |
| 579 | * const __DRIextension **__driDriverGetExtensions_drivername(void); |
| 580 | */ |
| 581 | #define __DRI_DRIVER_GET_EXTENSIONS "__driDriverGetExtensions" |
| 582 | |
| 583 | /** |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 584 | * Tokens for __DRIconfig attribs. A number of attributes defined by |
| 585 | * GLX or EGL standards are not in the table, as they must be provided |
| 586 | * by the loader. For example, FBConfig ID or visual ID, drawable type. |
| 587 | */ |
| 588 | |
| 589 | #define __DRI_ATTRIB_BUFFER_SIZE 1 |
| 590 | #define __DRI_ATTRIB_LEVEL 2 |
| 591 | #define __DRI_ATTRIB_RED_SIZE 3 |
| 592 | #define __DRI_ATTRIB_GREEN_SIZE 4 |
| 593 | #define __DRI_ATTRIB_BLUE_SIZE 5 |
| 594 | #define __DRI_ATTRIB_LUMINANCE_SIZE 6 |
| 595 | #define __DRI_ATTRIB_ALPHA_SIZE 7 |
| 596 | #define __DRI_ATTRIB_ALPHA_MASK_SIZE 8 |
| 597 | #define __DRI_ATTRIB_DEPTH_SIZE 9 |
| 598 | #define __DRI_ATTRIB_STENCIL_SIZE 10 |
| 599 | #define __DRI_ATTRIB_ACCUM_RED_SIZE 11 |
| 600 | #define __DRI_ATTRIB_ACCUM_GREEN_SIZE 12 |
| 601 | #define __DRI_ATTRIB_ACCUM_BLUE_SIZE 13 |
| 602 | #define __DRI_ATTRIB_ACCUM_ALPHA_SIZE 14 |
| 603 | #define __DRI_ATTRIB_SAMPLE_BUFFERS 15 |
| 604 | #define __DRI_ATTRIB_SAMPLES 16 |
| 605 | #define __DRI_ATTRIB_RENDER_TYPE 17 |
| 606 | #define __DRI_ATTRIB_CONFIG_CAVEAT 18 |
| 607 | #define __DRI_ATTRIB_CONFORMANT 19 |
| 608 | #define __DRI_ATTRIB_DOUBLE_BUFFER 20 |
| 609 | #define __DRI_ATTRIB_STEREO 21 |
| 610 | #define __DRI_ATTRIB_AUX_BUFFERS 22 |
| 611 | #define __DRI_ATTRIB_TRANSPARENT_TYPE 23 |
| 612 | #define __DRI_ATTRIB_TRANSPARENT_INDEX_VALUE 24 |
| 613 | #define __DRI_ATTRIB_TRANSPARENT_RED_VALUE 25 |
| 614 | #define __DRI_ATTRIB_TRANSPARENT_GREEN_VALUE 26 |
| 615 | #define __DRI_ATTRIB_TRANSPARENT_BLUE_VALUE 27 |
| 616 | #define __DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE 28 |
| 617 | #define __DRI_ATTRIB_FLOAT_MODE 29 |
| 618 | #define __DRI_ATTRIB_RED_MASK 30 |
| 619 | #define __DRI_ATTRIB_GREEN_MASK 31 |
| 620 | #define __DRI_ATTRIB_BLUE_MASK 32 |
| 621 | #define __DRI_ATTRIB_ALPHA_MASK 33 |
| 622 | #define __DRI_ATTRIB_MAX_PBUFFER_WIDTH 34 |
| 623 | #define __DRI_ATTRIB_MAX_PBUFFER_HEIGHT 35 |
| 624 | #define __DRI_ATTRIB_MAX_PBUFFER_PIXELS 36 |
| 625 | #define __DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH 37 |
| 626 | #define __DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT 38 |
| 627 | #define __DRI_ATTRIB_VISUAL_SELECT_GROUP 39 |
| 628 | #define __DRI_ATTRIB_SWAP_METHOD 40 |
| 629 | #define __DRI_ATTRIB_MAX_SWAP_INTERVAL 41 |
| 630 | #define __DRI_ATTRIB_MIN_SWAP_INTERVAL 42 |
| 631 | #define __DRI_ATTRIB_BIND_TO_TEXTURE_RGB 43 |
| 632 | #define __DRI_ATTRIB_BIND_TO_TEXTURE_RGBA 44 |
| 633 | #define __DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE 45 |
| 634 | #define __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS 46 |
| 635 | #define __DRI_ATTRIB_YINVERTED 47 |
Dave Airlie | 476db2b | 2011-01-28 11:44:51 +1000 | [diff] [blame] | 636 | #define __DRI_ATTRIB_FRAMEBUFFER_SRGB_CAPABLE 48 |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 637 | |
| 638 | /* __DRI_ATTRIB_RENDER_TYPE */ |
| 639 | #define __DRI_ATTRIB_RGBA_BIT 0x01 |
| 640 | #define __DRI_ATTRIB_COLOR_INDEX_BIT 0x02 |
| 641 | #define __DRI_ATTRIB_LUMINANCE_BIT 0x04 |
Tomasz Lis | c37c367 | 2013-07-17 13:49:21 +0200 | [diff] [blame] | 642 | #define __DRI_ATTRIB_FLOAT_BIT 0x08 |
| 643 | #define __DRI_ATTRIB_UNSIGNED_FLOAT_BIT 0x10 |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 644 | |
| 645 | /* __DRI_ATTRIB_CONFIG_CAVEAT */ |
| 646 | #define __DRI_ATTRIB_SLOW_BIT 0x01 |
| 647 | #define __DRI_ATTRIB_NON_CONFORMANT_CONFIG 0x02 |
| 648 | |
| 649 | /* __DRI_ATTRIB_TRANSPARENT_TYPE */ |
| 650 | #define __DRI_ATTRIB_TRANSPARENT_RGB 0x00 |
| 651 | #define __DRI_ATTRIB_TRANSPARENT_INDEX 0x01 |
| 652 | |
| 653 | /* __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS */ |
| 654 | #define __DRI_ATTRIB_TEXTURE_1D_BIT 0x01 |
| 655 | #define __DRI_ATTRIB_TEXTURE_2D_BIT 0x02 |
| 656 | #define __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT 0x04 |
| 657 | |
| 658 | /** |
| 659 | * This extension defines the core DRI functionality. |
| 660 | */ |
| 661 | #define __DRI_CORE "DRI_Core" |
| 662 | #define __DRI_CORE_VERSION 1 |
| 663 | |
| 664 | struct __DRIcoreExtensionRec { |
| 665 | __DRIextension base; |
| 666 | |
| 667 | __DRIscreen *(*createNewScreen)(int screen, int fd, |
| 668 | unsigned int sarea_handle, |
| 669 | const __DRIextension **extensions, |
| 670 | const __DRIconfig ***driverConfigs, |
| 671 | void *loaderPrivate); |
| 672 | |
| 673 | void (*destroyScreen)(__DRIscreen *screen); |
| 674 | |
| 675 | const __DRIextension **(*getExtensions)(__DRIscreen *screen); |
| 676 | |
| 677 | int (*getConfigAttrib)(const __DRIconfig *config, |
| 678 | unsigned int attrib, |
| 679 | unsigned int *value); |
| 680 | |
| 681 | int (*indexConfigAttrib)(const __DRIconfig *config, int index, |
| 682 | unsigned int *attrib, unsigned int *value); |
| 683 | |
| 684 | __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen, |
| 685 | const __DRIconfig *config, |
| 686 | unsigned int drawable_id, |
| 687 | unsigned int head, |
| 688 | void *loaderPrivate); |
| 689 | |
| 690 | void (*destroyDrawable)(__DRIdrawable *drawable); |
| 691 | |
| 692 | void (*swapBuffers)(__DRIdrawable *drawable); |
| 693 | |
| 694 | __DRIcontext *(*createNewContext)(__DRIscreen *screen, |
| 695 | const __DRIconfig *config, |
| 696 | __DRIcontext *shared, |
| 697 | void *loaderPrivate); |
| 698 | |
| 699 | int (*copyContext)(__DRIcontext *dest, |
| 700 | __DRIcontext *src, |
| 701 | unsigned long mask); |
| 702 | |
| 703 | void (*destroyContext)(__DRIcontext *context); |
| 704 | |
| 705 | int (*bindContext)(__DRIcontext *ctx, |
| 706 | __DRIdrawable *pdraw, |
| 707 | __DRIdrawable *pread); |
| 708 | |
| 709 | int (*unbindContext)(__DRIcontext *ctx); |
| 710 | }; |
| 711 | |
| 712 | /** |
| 713 | * Stored version of some component (i.e., server-side DRI module, kernel-side |
| 714 | * DRM, etc.). |
| 715 | * |
| 716 | * \todo |
| 717 | * There are several data structures that explicitly store a major version, |
| 718 | * minor version, and patch level. These structures should be modified to |
| 719 | * have a \c __DRIversionRec instead. |
| 720 | */ |
| 721 | struct __DRIversionRec { |
| 722 | int major; /**< Major version number. */ |
| 723 | int minor; /**< Minor version number. */ |
| 724 | int patch; /**< Patch-level. */ |
| 725 | }; |
| 726 | |
Brian Paul | 192c988 | 2004-03-22 23:31:29 +0000 | [diff] [blame] | 727 | /** |
| 728 | * Framebuffer information record. Used by libGL to communicate information |
| 729 | * about the framebuffer to the driver's \c __driCreateNewScreen function. |
| 730 | * |
| 731 | * In XFree86, most of this information is derrived from data returned by |
| 732 | * calling \c XF86DRIGetDeviceInfo. |
| 733 | * |
| 734 | * \sa XF86DRIGetDeviceInfo __DRIdisplayRec::createNewScreen |
| 735 | * __driUtilCreateNewScreen CallCreateNewScreen |
| 736 | * |
| 737 | * \bug This structure could be better named. |
| 738 | */ |
| 739 | struct __DRIframebufferRec { |
| 740 | unsigned char *base; /**< Framebuffer base address in the CPU's |
| 741 | * address space. This value is calculated by |
| 742 | * calling \c drmMap on the framebuffer handle |
| 743 | * returned by \c XF86DRIGetDeviceInfo (or a |
| 744 | * similar function). |
| 745 | */ |
| 746 | int size; /**< Framebuffer size, in bytes. */ |
| 747 | int stride; /**< Number of bytes from one line to the next. */ |
| 748 | int width; /**< Pixel width of the framebuffer. */ |
| 749 | int height; /**< Pixel height of the framebuffer. */ |
| 750 | int dev_priv_size; /**< Size of the driver's dev-priv structure. */ |
| 751 | void *dev_priv; /**< Pointer to the driver's dev-priv structure. */ |
| 752 | }; |
| 753 | |
| 754 | |
| 755 | /** |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 756 | * This extension provides alternative screen, drawable and context |
| 757 | * constructors for legacy DRI functionality. This is used in |
| 758 | * conjunction with the core extension. |
Brian Paul | 192c988 | 2004-03-22 23:31:29 +0000 | [diff] [blame] | 759 | */ |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 760 | #define __DRI_LEGACY "DRI_Legacy" |
| 761 | #define __DRI_LEGACY_VERSION 1 |
Brian Paul | 192c988 | 2004-03-22 23:31:29 +0000 | [diff] [blame] | 762 | |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 763 | struct __DRIlegacyExtensionRec { |
| 764 | __DRIextension base; |
Kristian Høgsberg | f616a26 | 2007-05-15 12:31:31 -0400 | [diff] [blame] | 765 | |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 766 | __DRIscreen *(*createNewScreen)(int screen, |
| 767 | const __DRIversion *ddx_version, |
| 768 | const __DRIversion *dri_version, |
| 769 | const __DRIversion *drm_version, |
| 770 | const __DRIframebuffer *frame_buffer, |
| 771 | void *pSAREA, int fd, |
| 772 | const __DRIextension **extensions, |
| 773 | const __DRIconfig ***driver_configs, |
| 774 | void *loaderPrivate); |
Brian Paul | 192c988 | 2004-03-22 23:31:29 +0000 | [diff] [blame] | 775 | |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 776 | __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen, |
| 777 | const __DRIconfig *config, |
| 778 | drm_drawable_t hwDrawable, |
| 779 | int renderType, const int *attrs, |
| 780 | void *loaderPrivate); |
Brian Paul | 192c988 | 2004-03-22 23:31:29 +0000 | [diff] [blame] | 781 | |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 782 | __DRIcontext *(*createNewContext)(__DRIscreen *screen, |
| 783 | const __DRIconfig *config, |
| 784 | int render_type, |
| 785 | __DRIcontext *shared, |
| 786 | drm_context_t hwContext, |
| 787 | void *loaderPrivate); |
Brian Paul | 192c988 | 2004-03-22 23:31:29 +0000 | [diff] [blame] | 788 | }; |
Keith Whitwell | 74d563c | 2004-04-29 12:23:39 +0000 | [diff] [blame] | 789 | |
George Sapountzis | 280bf89 | 2008-05-11 14:43:40 +0300 | [diff] [blame] | 790 | /** |
| 791 | * This extension provides alternative screen, drawable and context |
| 792 | * constructors for swrast DRI functionality. This is used in |
| 793 | * conjunction with the core extension. |
| 794 | */ |
| 795 | #define __DRI_SWRAST "DRI_SWRast" |
Eric Anholt | f93533d | 2013-09-27 11:39:25 -0700 | [diff] [blame] | 796 | #define __DRI_SWRAST_VERSION 4 |
George Sapountzis | 280bf89 | 2008-05-11 14:43:40 +0300 | [diff] [blame] | 797 | |
| 798 | struct __DRIswrastExtensionRec { |
| 799 | __DRIextension base; |
| 800 | |
| 801 | __DRIscreen *(*createNewScreen)(int screen, |
| 802 | const __DRIextension **extensions, |
| 803 | const __DRIconfig ***driver_configs, |
| 804 | void *loaderPrivate); |
| 805 | |
| 806 | __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen, |
| 807 | const __DRIconfig *config, |
| 808 | void *loaderPrivate); |
Haitao Feng | b43a147 | 2011-01-30 16:03:35 +0800 | [diff] [blame] | 809 | |
| 810 | /* Since version 2 */ |
| 811 | __DRIcontext *(*createNewContextForAPI)(__DRIscreen *screen, |
| 812 | int api, |
| 813 | const __DRIconfig *config, |
| 814 | __DRIcontext *shared, |
| 815 | void *data); |
Ian Romanick | b5b2081 | 2011-12-01 13:56:38 -0800 | [diff] [blame] | 816 | |
| 817 | /** |
| 818 | * Create a context for a particular API with a set of attributes |
| 819 | * |
| 820 | * \since version 3 |
| 821 | * |
| 822 | * \sa __DRIdri2ExtensionRec::createContextAttribs |
| 823 | */ |
| 824 | __DRIcontext *(*createContextAttribs)(__DRIscreen *screen, |
| 825 | int api, |
| 826 | const __DRIconfig *config, |
| 827 | __DRIcontext *shared, |
| 828 | unsigned num_attribs, |
| 829 | const uint32_t *attribs, |
| 830 | unsigned *error, |
| 831 | void *loaderPrivate); |
Eric Anholt | f93533d | 2013-09-27 11:39:25 -0700 | [diff] [blame] | 832 | |
| 833 | /** |
| 834 | * createNewScreen() with the driver extensions passed in. |
| 835 | * |
| 836 | * \since version 4 |
| 837 | */ |
| 838 | __DRIscreen *(*createNewScreen2)(int screen, |
| 839 | const __DRIextension **loader_extensions, |
| 840 | const __DRIextension **driver_extensions, |
| 841 | const __DRIconfig ***driver_configs, |
| 842 | void *loaderPrivate); |
| 843 | |
George Sapountzis | 280bf89 | 2008-05-11 14:43:40 +0300 | [diff] [blame] | 844 | }; |
| 845 | |
Keith Packard | f66a6c5 | 2013-06-03 20:49:25 -0700 | [diff] [blame] | 846 | /** Common DRI function definitions, shared among DRI2 and Image extensions |
| 847 | */ |
| 848 | |
| 849 | typedef __DRIscreen * |
| 850 | (*__DRIcreateNewScreen2Func)(int screen, int fd, |
| 851 | const __DRIextension **extensions, |
| 852 | const __DRIextension **driver_extensions, |
| 853 | const __DRIconfig ***driver_configs, |
| 854 | void *loaderPrivate); |
| 855 | |
| 856 | typedef __DRIdrawable * |
| 857 | (*__DRIcreateNewDrawableFunc)(__DRIscreen *screen, |
| 858 | const __DRIconfig *config, |
| 859 | void *loaderPrivate); |
| 860 | |
| 861 | typedef __DRIcontext * |
Keith Packard | f66a6c5 | 2013-06-03 20:49:25 -0700 | [diff] [blame] | 862 | (*__DRIcreateContextAttribsFunc)(__DRIscreen *screen, |
| 863 | int api, |
| 864 | const __DRIconfig *config, |
| 865 | __DRIcontext *shared, |
| 866 | unsigned num_attribs, |
| 867 | const uint32_t *attribs, |
| 868 | unsigned *error, |
| 869 | void *loaderPrivate); |
| 870 | |
| 871 | typedef unsigned int |
| 872 | (*__DRIgetAPIMaskFunc)(__DRIscreen *screen); |
| 873 | |
Kristian Høgsberg | f56b569 | 2008-08-13 11:46:25 -0400 | [diff] [blame] | 874 | /** |
| 875 | * DRI2 Loader extension. |
| 876 | */ |
| 877 | #define __DRI_BUFFER_FRONT_LEFT 0 |
| 878 | #define __DRI_BUFFER_BACK_LEFT 1 |
| 879 | #define __DRI_BUFFER_FRONT_RIGHT 2 |
| 880 | #define __DRI_BUFFER_BACK_RIGHT 3 |
| 881 | #define __DRI_BUFFER_DEPTH 4 |
| 882 | #define __DRI_BUFFER_STENCIL 5 |
| 883 | #define __DRI_BUFFER_ACCUM 6 |
Alan Hourihane | 396711b | 2009-01-19 15:40:30 +0000 | [diff] [blame] | 884 | #define __DRI_BUFFER_FAKE_FRONT_LEFT 7 |
| 885 | #define __DRI_BUFFER_FAKE_FRONT_RIGHT 8 |
Ian Romanick | dbf87f2 | 2009-04-20 20:55:56 -0700 | [diff] [blame] | 886 | #define __DRI_BUFFER_DEPTH_STENCIL 9 /**< Only available with DRI2 1.1 */ |
Chad Versace | 4501a5d | 2011-05-26 16:50:30 -0700 | [diff] [blame] | 887 | #define __DRI_BUFFER_HIZ 10 |
Kristian Høgsberg | f56b569 | 2008-08-13 11:46:25 -0400 | [diff] [blame] | 888 | |
Benjamin Franzke | 8c40940 | 2011-08-15 09:50:19 +0200 | [diff] [blame] | 889 | /* Inofficial and for internal use. Increase when adding a new buffer token. */ |
| 890 | #define __DRI_BUFFER_COUNT 11 |
| 891 | |
Kristian Høgsberg | f56b569 | 2008-08-13 11:46:25 -0400 | [diff] [blame] | 892 | struct __DRIbufferRec { |
| 893 | unsigned int attachment; |
| 894 | unsigned int name; |
| 895 | unsigned int pitch; |
| 896 | unsigned int cpp; |
| 897 | unsigned int flags; |
| 898 | }; |
| 899 | |
| 900 | #define __DRI_DRI2_LOADER "DRI_DRI2Loader" |
Ian Romanick | dbf87f2 | 2009-04-20 20:55:56 -0700 | [diff] [blame] | 901 | #define __DRI_DRI2_LOADER_VERSION 3 |
Kristian Høgsberg | f56b569 | 2008-08-13 11:46:25 -0400 | [diff] [blame] | 902 | struct __DRIdri2LoaderExtensionRec { |
| 903 | __DRIextension base; |
| 904 | |
| 905 | __DRIbuffer *(*getBuffers)(__DRIdrawable *driDrawable, |
| 906 | int *width, int *height, |
| 907 | unsigned int *attachments, int count, |
| 908 | int *out_count, void *loaderPrivate); |
Ian Romanick | 82634ee | 2009-04-06 12:44:18 -0700 | [diff] [blame] | 909 | |
| 910 | /** |
| 911 | * Flush pending front-buffer rendering |
| 912 | * |
| 913 | * Any rendering that has been performed to the |
| 914 | * \c __DRI_BUFFER_FAKE_FRONT_LEFT will be flushed to the |
| 915 | * \c __DRI_BUFFER_FRONT_LEFT. |
| 916 | * |
| 917 | * \param driDrawable Drawable whose front-buffer is to be flushed |
| 918 | * \param loaderPrivate Loader's private data that was previously passed |
| 919 | * into __DRIdri2ExtensionRec::createNewDrawable |
Emil Velikov | 6dffab2 | 2014-02-12 19:05:08 +0000 | [diff] [blame] | 920 | * |
| 921 | * \since 2 |
Ian Romanick | 82634ee | 2009-04-06 12:44:18 -0700 | [diff] [blame] | 922 | */ |
| 923 | void (*flushFrontBuffer)(__DRIdrawable *driDrawable, void *loaderPrivate); |
Ian Romanick | dbf87f2 | 2009-04-20 20:55:56 -0700 | [diff] [blame] | 924 | |
| 925 | |
| 926 | /** |
| 927 | * Get list of buffers from the server |
| 928 | * |
| 929 | * Gets a list of buffer for the specified set of attachments. Unlike |
| 930 | * \c ::getBuffers, this function takes a list of attachments paired with |
| 931 | * opaque \c unsigned \c int value describing the format of the buffer. |
| 932 | * It is the responsibility of the caller to know what the service that |
| 933 | * allocates the buffers will expect to receive for the format. |
| 934 | * |
| 935 | * \param driDrawable Drawable whose buffers are being queried. |
| 936 | * \param width Output where the width of the buffers is stored. |
| 937 | * \param height Output where the height of the buffers is stored. |
| 938 | * \param attachments List of pairs of attachment ID and opaque format |
| 939 | * requested for the drawable. |
| 940 | * \param count Number of attachment / format pairs stored in |
| 941 | * \c attachments. |
| 942 | * \param loaderPrivate Loader's private data that was previously passed |
| 943 | * into __DRIdri2ExtensionRec::createNewDrawable. |
Emil Velikov | 6dffab2 | 2014-02-12 19:05:08 +0000 | [diff] [blame] | 944 | * |
| 945 | * \since 3 |
Ian Romanick | dbf87f2 | 2009-04-20 20:55:56 -0700 | [diff] [blame] | 946 | */ |
| 947 | __DRIbuffer *(*getBuffersWithFormat)(__DRIdrawable *driDrawable, |
| 948 | int *width, int *height, |
| 949 | unsigned int *attachments, int count, |
| 950 | int *out_count, void *loaderPrivate); |
Kristian Høgsberg | f56b569 | 2008-08-13 11:46:25 -0400 | [diff] [blame] | 951 | }; |
| 952 | |
| 953 | /** |
| 954 | * This extension provides alternative screen, drawable and context |
| 955 | * constructors for DRI2. |
| 956 | */ |
| 957 | #define __DRI_DRI2 "DRI_DRI2" |
Eric Anholt | f93533d | 2013-09-27 11:39:25 -0700 | [diff] [blame] | 958 | #define __DRI_DRI2_VERSION 4 |
Kristian Høgsberg | a7a9a91 | 2010-04-27 11:04:51 -0400 | [diff] [blame] | 959 | |
Ian Romanick | 1ab5454 | 2011-11-30 12:16:19 -0800 | [diff] [blame] | 960 | #define __DRI_API_OPENGL 0 /**< OpenGL compatibility profile */ |
Ian Romanick | a2ce2eb | 2012-07-18 14:29:29 -0700 | [diff] [blame] | 961 | #define __DRI_API_GLES 1 /**< OpenGL ES 1.x */ |
Chad Versace | e90c08e | 2012-11-20 13:27:14 -0800 | [diff] [blame] | 962 | #define __DRI_API_GLES2 2 /**< OpenGL ES 2.x */ |
Ian Romanick | 1ab5454 | 2011-11-30 12:16:19 -0800 | [diff] [blame] | 963 | #define __DRI_API_OPENGL_CORE 3 /**< OpenGL 3.2+ core profile */ |
Chad Versace | e90c08e | 2012-11-20 13:27:14 -0800 | [diff] [blame] | 964 | #define __DRI_API_GLES3 4 /**< OpenGL ES 3.x */ |
Ian Romanick | 1ab5454 | 2011-11-30 12:16:19 -0800 | [diff] [blame] | 965 | |
| 966 | #define __DRI_CTX_ATTRIB_MAJOR_VERSION 0 |
| 967 | #define __DRI_CTX_ATTRIB_MINOR_VERSION 1 |
| 968 | #define __DRI_CTX_ATTRIB_FLAGS 2 |
| 969 | |
Ian Romanick | a8724d8 | 2012-07-03 11:32:59 -0700 | [diff] [blame] | 970 | /** |
| 971 | * \requires __DRI2_ROBUSTNESS. |
| 972 | */ |
| 973 | #define __DRI_CTX_ATTRIB_RESET_STRATEGY 3 |
| 974 | |
Ian Romanick | 1ab5454 | 2011-11-30 12:16:19 -0800 | [diff] [blame] | 975 | #define __DRI_CTX_FLAG_DEBUG 0x00000001 |
| 976 | #define __DRI_CTX_FLAG_FORWARD_COMPATIBLE 0x00000002 |
| 977 | |
| 978 | /** |
Ian Romanick | a8724d8 | 2012-07-03 11:32:59 -0700 | [diff] [blame] | 979 | * \requires __DRI2_ROBUSTNESS. |
| 980 | */ |
| 981 | #define __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS 0x00000004 |
| 982 | |
| 983 | /** |
| 984 | * \name Context reset strategies. |
| 985 | */ |
| 986 | /*@{*/ |
| 987 | #define __DRI_CTX_RESET_NO_NOTIFICATION 0 |
| 988 | #define __DRI_CTX_RESET_LOSE_CONTEXT 1 |
| 989 | /*@}*/ |
| 990 | |
| 991 | /** |
Ian Romanick | 1ab5454 | 2011-11-30 12:16:19 -0800 | [diff] [blame] | 992 | * \name Reasons that __DRIdri2Extension::createContextAttribs might fail |
| 993 | */ |
| 994 | /*@{*/ |
| 995 | /** Success! */ |
| 996 | #define __DRI_CTX_ERROR_SUCCESS 0 |
| 997 | |
| 998 | /** Memory allocation failure */ |
| 999 | #define __DRI_CTX_ERROR_NO_MEMORY 1 |
| 1000 | |
| 1001 | /** Client requested an API (e.g., OpenGL ES 2.0) that the driver can't do. */ |
| 1002 | #define __DRI_CTX_ERROR_BAD_API 2 |
| 1003 | |
| 1004 | /** Client requested an API version that the driver can't do. */ |
| 1005 | #define __DRI_CTX_ERROR_BAD_VERSION 3 |
| 1006 | |
| 1007 | /** Client requested a flag or combination of flags the driver can't do. */ |
| 1008 | #define __DRI_CTX_ERROR_BAD_FLAG 4 |
| 1009 | |
| 1010 | /** Client requested an attribute the driver doesn't understand. */ |
| 1011 | #define __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE 5 |
| 1012 | |
| 1013 | /** Client requested a flag the driver doesn't understand. */ |
| 1014 | #define __DRI_CTX_ERROR_UNKNOWN_FLAG 6 |
| 1015 | /*@}*/ |
Kristian Høgsberg | f56b569 | 2008-08-13 11:46:25 -0400 | [diff] [blame] | 1016 | |
| 1017 | struct __DRIdri2ExtensionRec { |
| 1018 | __DRIextension base; |
| 1019 | |
| 1020 | __DRIscreen *(*createNewScreen)(int screen, int fd, |
| 1021 | const __DRIextension **extensions, |
| 1022 | const __DRIconfig ***driver_configs, |
| 1023 | void *loaderPrivate); |
| 1024 | |
Keith Packard | f66a6c5 | 2013-06-03 20:49:25 -0700 | [diff] [blame] | 1025 | __DRIcreateNewDrawableFunc createNewDrawable; |
Kristian Høgsberg | e048953 | 2013-11-11 16:35:35 -0800 | [diff] [blame] | 1026 | __DRIcontext *(*createNewContext)(__DRIscreen *screen, |
| 1027 | const __DRIconfig *config, |
| 1028 | __DRIcontext *shared, |
| 1029 | void *loaderPrivate); |
Kristian Høgsberg | f56b569 | 2008-08-13 11:46:25 -0400 | [diff] [blame] | 1030 | |
Kristian Høgsberg | a7a9a91 | 2010-04-27 11:04:51 -0400 | [diff] [blame] | 1031 | /* Since version 2 */ |
Keith Packard | f66a6c5 | 2013-06-03 20:49:25 -0700 | [diff] [blame] | 1032 | __DRIgetAPIMaskFunc getAPIMask; |
Kristian Høgsberg | a7a9a91 | 2010-04-27 11:04:51 -0400 | [diff] [blame] | 1033 | |
| 1034 | __DRIcontext *(*createNewContextForAPI)(__DRIscreen *screen, |
| 1035 | int api, |
| 1036 | const __DRIconfig *config, |
| 1037 | __DRIcontext *shared, |
| 1038 | void *data); |
Benjamin Franzke | 1b8ef94 | 2011-02-04 11:59:12 +0100 | [diff] [blame] | 1039 | |
| 1040 | __DRIbuffer *(*allocateBuffer)(__DRIscreen *screen, |
| 1041 | unsigned int attachment, |
| 1042 | unsigned int format, |
| 1043 | int width, |
| 1044 | int height); |
| 1045 | void (*releaseBuffer)(__DRIscreen *screen, |
| 1046 | __DRIbuffer *buffer); |
Ian Romanick | 1ab5454 | 2011-11-30 12:16:19 -0800 | [diff] [blame] | 1047 | |
| 1048 | /** |
| 1049 | * Create a context for a particular API with a set of attributes |
| 1050 | * |
| 1051 | * \since version 3 |
Ian Romanick | b5b2081 | 2011-12-01 13:56:38 -0800 | [diff] [blame] | 1052 | * |
| 1053 | * \sa __DRIswrastExtensionRec::createContextAttribs |
Ian Romanick | 1ab5454 | 2011-11-30 12:16:19 -0800 | [diff] [blame] | 1054 | */ |
Keith Packard | f66a6c5 | 2013-06-03 20:49:25 -0700 | [diff] [blame] | 1055 | __DRIcreateContextAttribsFunc createContextAttribs; |
Eric Anholt | f93533d | 2013-09-27 11:39:25 -0700 | [diff] [blame] | 1056 | |
| 1057 | /** |
| 1058 | * createNewScreen with the driver's extension list passed in. |
| 1059 | * |
| 1060 | * \since version 4 |
| 1061 | */ |
Keith Packard | f66a6c5 | 2013-06-03 20:49:25 -0700 | [diff] [blame] | 1062 | __DRIcreateNewScreen2Func createNewScreen2; |
Kristian Høgsberg | f56b569 | 2008-08-13 11:46:25 -0400 | [diff] [blame] | 1063 | }; |
| 1064 | |
Kristian Høgsberg | 79cbcb6 | 2010-02-11 17:45:24 -0500 | [diff] [blame] | 1065 | |
| 1066 | /** |
| 1067 | * This extension provides functionality to enable various EGLImage |
| 1068 | * extensions. |
| 1069 | */ |
| 1070 | #define __DRI_IMAGE "DRI_IMAGE" |
Dave Airlie | 8f7338f | 2014-03-03 13:57:16 +1000 | [diff] [blame] | 1071 | #define __DRI_IMAGE_VERSION 11 |
Kristian Høgsberg | 79cbcb6 | 2010-02-11 17:45:24 -0500 | [diff] [blame] | 1072 | |
| 1073 | /** |
| 1074 | * These formats correspond to the similarly named MESA_FORMAT_* |
| 1075 | * tokens, except in the native endian of the CPU. For example, on |
| 1076 | * little endian __DRI_IMAGE_FORMAT_XRGB8888 corresponds to |
| 1077 | * MESA_FORMAT_XRGB8888, but MESA_FORMAT_XRGB8888_REV on big endian. |
Kristian Høgsberg | c029834 | 2012-07-04 22:56:09 -0400 | [diff] [blame] | 1078 | * |
| 1079 | * __DRI_IMAGE_FORMAT_NONE is for images that aren't directly usable |
| 1080 | * by the driver (YUV planar formats) but serve as a base image for |
| 1081 | * creating sub-images for the different planes within the image. |
Jakob Bornecrantz | 6a7dea9 | 2012-08-31 19:48:26 +0200 | [diff] [blame] | 1082 | * |
| 1083 | * R8, GR88 and NONE should not be used with createImageFormName or |
| 1084 | * createImage, and are returned by query from sub images created with |
| 1085 | * createImageFromNames (NONE, see above) and fromPlane (R8 & GR88). |
Kristian Høgsberg | 79cbcb6 | 2010-02-11 17:45:24 -0500 | [diff] [blame] | 1086 | */ |
| 1087 | #define __DRI_IMAGE_FORMAT_RGB565 0x1001 |
| 1088 | #define __DRI_IMAGE_FORMAT_XRGB8888 0x1002 |
| 1089 | #define __DRI_IMAGE_FORMAT_ARGB8888 0x1003 |
Chia-I Wu | e3cf7b6 | 2011-08-21 21:22:41 +0800 | [diff] [blame] | 1090 | #define __DRI_IMAGE_FORMAT_ABGR8888 0x1004 |
Sean V Kelley | 81f95ce | 2012-04-24 07:49:09 -0700 | [diff] [blame] | 1091 | #define __DRI_IMAGE_FORMAT_XBGR8888 0x1005 |
Kristian Høgsberg | c029834 | 2012-07-04 22:56:09 -0400 | [diff] [blame] | 1092 | #define __DRI_IMAGE_FORMAT_R8 0x1006 /* Since version 5 */ |
| 1093 | #define __DRI_IMAGE_FORMAT_GR88 0x1007 |
| 1094 | #define __DRI_IMAGE_FORMAT_NONE 0x1008 |
Kristian Høgsberg | 3160ec3 | 2013-09-14 23:31:08 -0700 | [diff] [blame] | 1095 | #define __DRI_IMAGE_FORMAT_XRGB2101010 0x1009 |
| 1096 | #define __DRI_IMAGE_FORMAT_ARGB2101010 0x100a |
Keith Packard | aba6b84 | 2013-11-04 17:27:43 -0800 | [diff] [blame] | 1097 | #define __DRI_IMAGE_FORMAT_SARGB8 0x100b |
Kristian Høgsberg | 79cbcb6 | 2010-02-11 17:45:24 -0500 | [diff] [blame] | 1098 | |
Kristian Høgsberg | 5aaa53e | 2010-06-03 21:36:40 -0400 | [diff] [blame] | 1099 | #define __DRI_IMAGE_USE_SHARE 0x0001 |
| 1100 | #define __DRI_IMAGE_USE_SCANOUT 0x0002 |
Jakob Bornecrantz | 6bb71b8 | 2012-08-15 11:37:18 +0200 | [diff] [blame] | 1101 | #define __DRI_IMAGE_USE_CURSOR 0x0004 /* Depricated */ |
Axel Davy | e8f9195 | 2013-08-15 12:47:58 +0200 | [diff] [blame] | 1102 | #define __DRI_IMAGE_USE_LINEAR 0x0008 |
Axel Davy | d943ac4 | 2015-10-21 12:28:00 +0200 | [diff] [blame^] | 1103 | /* The buffer will only be read by an external process after SwapBuffers, |
| 1104 | * in contrary to gbm buffers, front buffers and fake front buffers, which |
| 1105 | * could be read after a flush." |
| 1106 | */ |
| 1107 | #define __DRI_IMAGE_USE_BACKBUFFER 0x0010 |
Kristian Høgsberg | 5aaa53e | 2010-06-03 21:36:40 -0400 | [diff] [blame] | 1108 | |
Jakob Bornecrantz | 6a7dea9 | 2012-08-31 19:48:26 +0200 | [diff] [blame] | 1109 | |
| 1110 | /** |
Chad Versace | 56f1f47 | 2015-06-23 15:48:40 -0700 | [diff] [blame] | 1111 | * Four CC formats that matches with WL_DRM_FORMAT_* from wayland_drm.h, |
| 1112 | * GBM_FORMAT_* from gbm.h, and DRM_FORMAT_* from drm_fourcc.h. Used with |
| 1113 | * createImageFromNames. |
Jakob Bornecrantz | 6a7dea9 | 2012-08-31 19:48:26 +0200 | [diff] [blame] | 1114 | * |
| 1115 | * \since 5 |
| 1116 | */ |
| 1117 | |
Chad Versace | 56f1f47 | 2015-06-23 15:48:40 -0700 | [diff] [blame] | 1118 | #define __DRI_IMAGE_FOURCC_R8 0x20203852 |
| 1119 | #define __DRI_IMAGE_FOURCC_GR88 0x38385247 |
Jakob Bornecrantz | 6a7dea9 | 2012-08-31 19:48:26 +0200 | [diff] [blame] | 1120 | #define __DRI_IMAGE_FOURCC_RGB565 0x36314752 |
| 1121 | #define __DRI_IMAGE_FOURCC_ARGB8888 0x34325241 |
| 1122 | #define __DRI_IMAGE_FOURCC_XRGB8888 0x34325258 |
| 1123 | #define __DRI_IMAGE_FOURCC_ABGR8888 0x34324241 |
| 1124 | #define __DRI_IMAGE_FOURCC_XBGR8888 0x34324258 |
Keith Packard | aea4757 | 2013-11-21 20:08:35 -0800 | [diff] [blame] | 1125 | #define __DRI_IMAGE_FOURCC_SARGB8888 0x83324258 |
Jakob Bornecrantz | 6a7dea9 | 2012-08-31 19:48:26 +0200 | [diff] [blame] | 1126 | #define __DRI_IMAGE_FOURCC_YUV410 0x39565559 |
| 1127 | #define __DRI_IMAGE_FOURCC_YUV411 0x31315559 |
| 1128 | #define __DRI_IMAGE_FOURCC_YUV420 0x32315559 |
| 1129 | #define __DRI_IMAGE_FOURCC_YUV422 0x36315559 |
| 1130 | #define __DRI_IMAGE_FOURCC_YUV444 0x34325559 |
| 1131 | #define __DRI_IMAGE_FOURCC_NV12 0x3231564e |
| 1132 | #define __DRI_IMAGE_FOURCC_NV16 0x3631564e |
| 1133 | #define __DRI_IMAGE_FOURCC_YUYV 0x56595559 |
| 1134 | |
| 1135 | |
| 1136 | /** |
| 1137 | * Queryable on images created by createImageFromNames. |
| 1138 | * |
| 1139 | * RGB and RGBA are may be usable directly as images but its still |
| 1140 | * recommended to call fromPlanar with plane == 0. |
| 1141 | * |
| 1142 | * Y_U_V, Y_UV and Y_XUXV all requires call to fromPlanar to create |
| 1143 | * usable sub-images, sampling from images return raw YUV data and |
| 1144 | * color conversion needs to be done in the shader. |
| 1145 | * |
| 1146 | * \since 5 |
| 1147 | */ |
| 1148 | |
| 1149 | #define __DRI_IMAGE_COMPONENTS_RGB 0x3001 |
| 1150 | #define __DRI_IMAGE_COMPONENTS_RGBA 0x3002 |
| 1151 | #define __DRI_IMAGE_COMPONENTS_Y_U_V 0x3003 |
| 1152 | #define __DRI_IMAGE_COMPONENTS_Y_UV 0x3004 |
| 1153 | #define __DRI_IMAGE_COMPONENTS_Y_XUXV 0x3005 |
Chad Versace | 56f1f47 | 2015-06-23 15:48:40 -0700 | [diff] [blame] | 1154 | #define __DRI_IMAGE_COMPONENTS_R 0x3006 |
| 1155 | #define __DRI_IMAGE_COMPONENTS_RG 0x3007 |
Jakob Bornecrantz | 6a7dea9 | 2012-08-31 19:48:26 +0200 | [diff] [blame] | 1156 | |
| 1157 | |
Kristian Høgsberg | 5aaa53e | 2010-06-03 21:36:40 -0400 | [diff] [blame] | 1158 | /** |
| 1159 | * queryImage attributes |
| 1160 | */ |
| 1161 | |
| 1162 | #define __DRI_IMAGE_ATTRIB_STRIDE 0x2000 |
| 1163 | #define __DRI_IMAGE_ATTRIB_HANDLE 0x2001 |
| 1164 | #define __DRI_IMAGE_ATTRIB_NAME 0x2002 |
Jesse Barnes | 8de5c35 | 2012-02-21 12:53:09 -0800 | [diff] [blame] | 1165 | #define __DRI_IMAGE_ATTRIB_FORMAT 0x2003 /* available in versions 3+ */ |
Jakob Bornecrantz | 93ebec8 | 2012-08-21 18:01:55 +0200 | [diff] [blame] | 1166 | #define __DRI_IMAGE_ATTRIB_WIDTH 0x2004 /* available in versions 4+ */ |
Kristian Høgsberg | 44f066b | 2012-07-13 11:19:24 -0400 | [diff] [blame] | 1167 | #define __DRI_IMAGE_ATTRIB_HEIGHT 0x2005 |
Jakob Bornecrantz | 6a7dea9 | 2012-08-31 19:48:26 +0200 | [diff] [blame] | 1168 | #define __DRI_IMAGE_ATTRIB_COMPONENTS 0x2006 /* available in versions 5+ */ |
Kristian Høgsberg | 2356e28 | 2013-02-02 08:38:07 -0500 | [diff] [blame] | 1169 | #define __DRI_IMAGE_ATTRIB_FD 0x2007 /* available in versions |
| 1170 | * 7+. Each query will return a |
| 1171 | * new fd. */ |
Dave Airlie | 8f7338f | 2014-03-03 13:57:16 +1000 | [diff] [blame] | 1172 | #define __DRI_IMAGE_ATTRIB_FOURCC 0x2008 /* available in versions 11 */ |
| 1173 | #define __DRI_IMAGE_ATTRIB_NUM_PLANES 0x2009 /* available in versions 11 */ |
Kristian Høgsberg | 5aaa53e | 2010-06-03 21:36:40 -0400 | [diff] [blame] | 1174 | |
Topi Pohjolainen | 674dedc | 2013-03-26 15:14:20 +0200 | [diff] [blame] | 1175 | enum __DRIYUVColorSpace { |
| 1176 | __DRI_YUV_COLOR_SPACE_UNDEFINED = 0, |
| 1177 | __DRI_YUV_COLOR_SPACE_ITU_REC601 = 0x327F, |
| 1178 | __DRI_YUV_COLOR_SPACE_ITU_REC709 = 0x3280, |
| 1179 | __DRI_YUV_COLOR_SPACE_ITU_REC2020 = 0x3281 |
| 1180 | }; |
| 1181 | |
| 1182 | enum __DRISampleRange { |
| 1183 | __DRI_YUV_RANGE_UNDEFINED = 0, |
| 1184 | __DRI_YUV_FULL_RANGE = 0x3282, |
| 1185 | __DRI_YUV_NARROW_RANGE = 0x3283 |
| 1186 | }; |
| 1187 | |
| 1188 | enum __DRIChromaSiting { |
| 1189 | __DRI_YUV_CHROMA_SITING_UNDEFINED = 0, |
| 1190 | __DRI_YUV_CHROMA_SITING_0 = 0x3284, |
| 1191 | __DRI_YUV_CHROMA_SITING_0_5 = 0x3285 |
| 1192 | }; |
| 1193 | |
Abdiel Janulgue | 7b7af48 | 2012-11-27 15:19:54 +0200 | [diff] [blame] | 1194 | /** |
Frank Binns | cfc3200 | 2015-07-31 09:11:46 +0100 | [diff] [blame] | 1195 | * \name Reasons that __DRIimageExtensionRec::createImageFromTexture or |
| 1196 | * __DRIimageExtensionRec::createImageFromDmaBufs might fail |
Abdiel Janulgue | 7b7af48 | 2012-11-27 15:19:54 +0200 | [diff] [blame] | 1197 | */ |
| 1198 | /*@{*/ |
| 1199 | /** Success! */ |
| 1200 | #define __DRI_IMAGE_ERROR_SUCCESS 0 |
| 1201 | |
| 1202 | /** Memory allocation failure */ |
| 1203 | #define __DRI_IMAGE_ERROR_BAD_ALLOC 1 |
| 1204 | |
Frank Binns | cfc3200 | 2015-07-31 09:11:46 +0100 | [diff] [blame] | 1205 | /** Client requested an invalid attribute */ |
Abdiel Janulgue | 7b7af48 | 2012-11-27 15:19:54 +0200 | [diff] [blame] | 1206 | #define __DRI_IMAGE_ERROR_BAD_MATCH 2 |
| 1207 | |
| 1208 | /** Client requested an invalid texture object */ |
| 1209 | #define __DRI_IMAGE_ERROR_BAD_PARAMETER 3 |
Frank Binns | cfc3200 | 2015-07-31 09:11:46 +0100 | [diff] [blame] | 1210 | |
| 1211 | /** Client requested an invalid pitch and/or offset */ |
| 1212 | #define __DRI_IMAGE_ERROR_BAD_ACCESS 4 |
Abdiel Janulgue | 7b7af48 | 2012-11-27 15:19:54 +0200 | [diff] [blame] | 1213 | /*@}*/ |
| 1214 | |
Axel Davy | 8a66a5d | 2014-06-18 23:27:35 -0400 | [diff] [blame] | 1215 | /** |
Giovanni Campagna | e57ad3d | 2014-07-23 19:28:52 +0100 | [diff] [blame] | 1216 | * \name Capabilities that might be returned by __DRIimageExtensionRec::getCapabilities |
| 1217 | */ |
| 1218 | /*@{*/ |
| 1219 | #define __DRI_IMAGE_CAP_GLOBAL_NAMES 1 |
| 1220 | /*@}*/ |
| 1221 | |
| 1222 | /** |
Axel Davy | 8a66a5d | 2014-06-18 23:27:35 -0400 | [diff] [blame] | 1223 | * blitImage flags |
| 1224 | */ |
| 1225 | |
| 1226 | #define __BLIT_FLAG_FLUSH 0x0001 |
| 1227 | #define __BLIT_FLAG_FINISH 0x0002 |
| 1228 | |
Kristian Høgsberg | 79cbcb6 | 2010-02-11 17:45:24 -0500 | [diff] [blame] | 1229 | typedef struct __DRIimageRec __DRIimage; |
| 1230 | typedef struct __DRIimageExtensionRec __DRIimageExtension; |
| 1231 | struct __DRIimageExtensionRec { |
| 1232 | __DRIextension base; |
| 1233 | |
Kristian Høgsberg | 9ec0b2a | 2010-09-22 15:07:15 -0400 | [diff] [blame] | 1234 | __DRIimage *(*createImageFromName)(__DRIscreen *screen, |
Kristian Høgsberg | 79cbcb6 | 2010-02-11 17:45:24 -0500 | [diff] [blame] | 1235 | int width, int height, int format, |
| 1236 | int name, int pitch, |
| 1237 | void *loaderPrivate); |
| 1238 | |
| 1239 | __DRIimage *(*createImageFromRenderbuffer)(__DRIcontext *context, |
| 1240 | int renderbuffer, |
| 1241 | void *loaderPrivate); |
| 1242 | |
| 1243 | void (*destroyImage)(__DRIimage *image); |
Kristian Høgsberg | 5aaa53e | 2010-06-03 21:36:40 -0400 | [diff] [blame] | 1244 | |
| 1245 | __DRIimage *(*createImage)(__DRIscreen *screen, |
| 1246 | int width, int height, int format, |
| 1247 | unsigned int use, |
| 1248 | void *loaderPrivate); |
| 1249 | |
| 1250 | GLboolean (*queryImage)(__DRIimage *image, int attrib, int *value); |
Benjamin Franzke | 5fbbd4c | 2011-03-09 20:47:42 +0100 | [diff] [blame] | 1251 | |
| 1252 | /** |
| 1253 | * The new __DRIimage will share the content with the old one, see dup(2). |
| 1254 | */ |
| 1255 | __DRIimage *(*dupImage)(__DRIimage *image, void *loaderPrivate); |
Kristian Høgsberg | 221c678 | 2012-01-18 15:32:35 -0500 | [diff] [blame] | 1256 | |
| 1257 | /** |
| 1258 | * Validate that a __DRIimage can be used a certain way. |
| 1259 | * |
| 1260 | * \since 2 |
| 1261 | */ |
| 1262 | GLboolean (*validateUsage)(__DRIimage *image, unsigned int use); |
Kristian Høgsberg | 4fddb2b | 2012-05-02 15:30:13 -0400 | [diff] [blame] | 1263 | |
| 1264 | /** |
Jakob Bornecrantz | 6a7dea9 | 2012-08-31 19:48:26 +0200 | [diff] [blame] | 1265 | * Unlike createImageFromName __DRI_IMAGE_FORMAT is not but instead |
| 1266 | * __DRI_IMAGE_FOURCC and strides are in bytes not pixels. Stride is |
| 1267 | * also per block and not per pixel (for non-RGB, see gallium blocks). |
| 1268 | * |
| 1269 | * \since 5 |
| 1270 | */ |
| 1271 | __DRIimage *(*createImageFromNames)(__DRIscreen *screen, |
| 1272 | int width, int height, int fourcc, |
| 1273 | int *names, int num_names, |
| 1274 | int *strides, int *offsets, |
| 1275 | void *loaderPrivate); |
| 1276 | |
| 1277 | /** |
Kristian Høgsberg | c029834 | 2012-07-04 22:56:09 -0400 | [diff] [blame] | 1278 | * Create an image out of a sub-region of a parent image. This |
| 1279 | * entry point lets us create individual __DRIimages for different |
| 1280 | * planes in a planar buffer (typically yuv), for example. While a |
| 1281 | * sub-image shares the underlying buffer object with the parent |
| 1282 | * image and other sibling sub-images, the life times of parent and |
| 1283 | * sub-images are not dependent. Destroying the parent or a |
| 1284 | * sub-image doesn't affect other images. The underlying buffer |
| 1285 | * object is free when no __DRIimage remains that references it. |
| 1286 | * |
| 1287 | * Sub-images may overlap, but rendering to overlapping sub-images |
| 1288 | * is undefined. |
| 1289 | * |
| 1290 | * \since 5 |
| 1291 | */ |
Jakob Bornecrantz | 6a7dea9 | 2012-08-31 19:48:26 +0200 | [diff] [blame] | 1292 | __DRIimage *(*fromPlanar)(__DRIimage *image, int plane, |
| 1293 | void *loaderPrivate); |
Abdiel Janulgue | 7b7af48 | 2012-11-27 15:19:54 +0200 | [diff] [blame] | 1294 | |
| 1295 | /** |
| 1296 | * Create image from texture. |
| 1297 | * |
| 1298 | * \since 6 |
| 1299 | */ |
| 1300 | __DRIimage *(*createImageFromTexture)(__DRIcontext *context, |
| 1301 | int target, |
| 1302 | unsigned texture, |
| 1303 | int depth, |
| 1304 | int level, |
| 1305 | unsigned *error, |
| 1306 | void *loaderPrivate); |
Kristian Høgsberg | 2356e28 | 2013-02-02 08:38:07 -0500 | [diff] [blame] | 1307 | /** |
| 1308 | * Like createImageFromNames, but takes a prime fd instead. |
| 1309 | * |
| 1310 | * \since 7 |
| 1311 | */ |
| 1312 | __DRIimage *(*createImageFromFds)(__DRIscreen *screen, |
| 1313 | int width, int height, int fourcc, |
| 1314 | int *fds, int num_fds, |
| 1315 | int *strides, int *offsets, |
| 1316 | void *loaderPrivate); |
Topi Pohjolainen | 674dedc | 2013-03-26 15:14:20 +0200 | [diff] [blame] | 1317 | |
| 1318 | /** |
| 1319 | * Like createImageFromFds, but takes additional attributes. |
| 1320 | * |
| 1321 | * For EGL_EXT_image_dma_buf_import. |
| 1322 | * |
| 1323 | * \since 8 |
| 1324 | */ |
| 1325 | __DRIimage *(*createImageFromDmaBufs)(__DRIscreen *screen, |
| 1326 | int width, int height, int fourcc, |
| 1327 | int *fds, int num_fds, |
| 1328 | int *strides, int *offsets, |
| 1329 | enum __DRIYUVColorSpace color_space, |
| 1330 | enum __DRISampleRange sample_range, |
| 1331 | enum __DRIChromaSiting horiz_siting, |
| 1332 | enum __DRIChromaSiting vert_siting, |
| 1333 | unsigned *error, |
| 1334 | void *loaderPrivate); |
Axel Davy | 8a66a5d | 2014-06-18 23:27:35 -0400 | [diff] [blame] | 1335 | |
| 1336 | /** |
| 1337 | * Blit a part of a __DRIimage to another and flushes |
| 1338 | * |
| 1339 | * flush_flag: |
| 1340 | * 0: no flush |
| 1341 | * __BLIT_FLAG_FLUSH: flush after the blit operation |
| 1342 | * __BLIT_FLAG_FINISH: flush and wait the blit finished |
| 1343 | * |
| 1344 | * \since 9 |
| 1345 | */ |
| 1346 | void (*blitImage)(__DRIcontext *context, __DRIimage *dst, __DRIimage *src, |
| 1347 | int dstx0, int dsty0, int dstwidth, int dstheight, |
| 1348 | int srcx0, int srcy0, int srcwidth, int srcheight, |
| 1349 | int flush_flag); |
Giovanni Campagna | e57ad3d | 2014-07-23 19:28:52 +0100 | [diff] [blame] | 1350 | |
| 1351 | /** |
| 1352 | * Query for general capabilities of the driver that concern |
| 1353 | * buffer sharing and image importing. |
| 1354 | * |
| 1355 | * \since 10 |
| 1356 | */ |
| 1357 | int (*getCapabilities)(__DRIscreen *screen); |
Kristian Høgsberg | 79cbcb6 | 2010-02-11 17:45:24 -0500 | [diff] [blame] | 1358 | }; |
| 1359 | |
Kristian Høgsberg | 5aaa53e | 2010-06-03 21:36:40 -0400 | [diff] [blame] | 1360 | |
Kristian Høgsberg | 79cbcb6 | 2010-02-11 17:45:24 -0500 | [diff] [blame] | 1361 | /** |
| 1362 | * This extension must be implemented by the loader and passed to the |
| 1363 | * driver at screen creation time. The EGLImage entry points in the |
| 1364 | * various client APIs take opaque EGLImage handles and use this |
| 1365 | * extension to map them to a __DRIimage. At version 1, this |
| 1366 | * extensions allows mapping EGLImage pointers to __DRIimage pointers, |
| 1367 | * but future versions could support other EGLImage-like, opaque types |
| 1368 | * with new lookup functions. |
| 1369 | */ |
| 1370 | #define __DRI_IMAGE_LOOKUP "DRI_IMAGE_LOOKUP" |
| 1371 | #define __DRI_IMAGE_LOOKUP_VERSION 1 |
| 1372 | |
| 1373 | typedef struct __DRIimageLookupExtensionRec __DRIimageLookupExtension; |
| 1374 | struct __DRIimageLookupExtensionRec { |
| 1375 | __DRIextension base; |
| 1376 | |
Kristian Høgsberg | 17eace5 | 2010-09-22 22:01:17 -0400 | [diff] [blame] | 1377 | __DRIimage *(*lookupEGLImage)(__DRIscreen *screen, void *image, |
Kristian Høgsberg | 79cbcb6 | 2010-02-11 17:45:24 -0500 | [diff] [blame] | 1378 | void *loaderPrivate); |
| 1379 | }; |
| 1380 | |
Jesse Barnes | 234286c | 2010-04-22 12:47:41 -0700 | [diff] [blame] | 1381 | /** |
| 1382 | * This extension allows for common DRI2 options |
| 1383 | */ |
| 1384 | #define __DRI2_CONFIG_QUERY "DRI_CONFIG_QUERY" |
| 1385 | #define __DRI2_CONFIG_QUERY_VERSION 1 |
| 1386 | |
| 1387 | typedef struct __DRI2configQueryExtensionRec __DRI2configQueryExtension; |
| 1388 | struct __DRI2configQueryExtensionRec { |
| 1389 | __DRIextension base; |
| 1390 | |
Dave Airlie | 8392179 | 2014-07-02 08:24:05 +1000 | [diff] [blame] | 1391 | int (*configQueryb)(__DRIscreen *screen, const char *var, unsigned char *val); |
Dave Airlie | 29800e6 | 2014-06-27 13:23:24 +1000 | [diff] [blame] | 1392 | int (*configQueryi)(__DRIscreen *screen, const char *var, int *val); |
| 1393 | int (*configQueryf)(__DRIscreen *screen, const char *var, float *val); |
Jesse Barnes | 234286c | 2010-04-22 12:47:41 -0700 | [diff] [blame] | 1394 | }; |
Ian Romanick | a8724d8 | 2012-07-03 11:32:59 -0700 | [diff] [blame] | 1395 | |
| 1396 | /** |
| 1397 | * Robust context driver extension. |
| 1398 | * |
| 1399 | * Existence of this extension means the driver can accept the |
| 1400 | * \c __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS flag and the |
| 1401 | * \c __DRI_CTX_ATTRIB_RESET_STRATEGY attribute in |
| 1402 | * \c __DRIdri2ExtensionRec::createContextAttribs. |
| 1403 | */ |
| 1404 | #define __DRI2_ROBUSTNESS "DRI_Robustness" |
| 1405 | #define __DRI2_ROBUSTNESS_VERSION 1 |
| 1406 | |
| 1407 | typedef struct __DRIrobustnessExtensionRec __DRIrobustnessExtension; |
| 1408 | struct __DRIrobustnessExtensionRec { |
| 1409 | __DRIextension base; |
| 1410 | }; |
| 1411 | |
Eric Anholt | cf5d8fc | 2013-06-26 15:15:57 -0700 | [diff] [blame] | 1412 | /** |
| 1413 | * DRI config options extension. |
| 1414 | * |
| 1415 | * This extension provides the XML string containing driver options for use by |
| 1416 | * the loader in supporting the driconf application. |
| 1417 | */ |
| 1418 | #define __DRI_CONFIG_OPTIONS "DRI_ConfigOptions" |
| 1419 | #define __DRI_CONFIG_OPTIONS_VERSION 1 |
| 1420 | |
| 1421 | typedef struct __DRIconfigOptionsExtensionRec { |
| 1422 | __DRIextension base; |
| 1423 | const char *xml; |
| 1424 | } __DRIconfigOptionsExtension; |
| 1425 | |
Eric Anholt | 4e54751 | 2013-09-26 10:51:29 -0700 | [diff] [blame] | 1426 | /** |
| 1427 | * This extension provides a driver vtable to a set of common driver helper |
| 1428 | * functions (driCoreExtension, driDRI2Extension) within the driver |
| 1429 | * implementation, as opposed to having to pass them through a global |
| 1430 | * variable. |
| 1431 | * |
| 1432 | * It is not intended to be public API to the actual loader, and the vtable |
| 1433 | * layout may change at any time. |
| 1434 | */ |
| 1435 | #define __DRI_DRIVER_VTABLE "DRI_DriverVtable" |
| 1436 | #define __DRI_DRIVER_VTABLE_VERSION 1 |
| 1437 | |
| 1438 | typedef struct __DRIDriverVtableExtensionRec { |
| 1439 | __DRIextension base; |
| 1440 | const struct __DriverAPIRec *vtable; |
| 1441 | } __DRIDriverVtableExtension; |
| 1442 | |
Ian Romanick | 64bb1e8 | 2013-02-14 15:51:52 -0800 | [diff] [blame] | 1443 | /** |
| 1444 | * Query renderer driver extension |
| 1445 | * |
| 1446 | * This allows the window system layer (either EGL or GLX) to query aspects of |
| 1447 | * hardware and driver support without creating a context. |
| 1448 | */ |
| 1449 | #define __DRI2_RENDERER_QUERY "DRI_RENDERER_QUERY" |
| 1450 | #define __DRI2_RENDERER_QUERY_VERSION 1 |
| 1451 | |
| 1452 | #define __DRI2_RENDERER_VENDOR_ID 0x0000 |
| 1453 | #define __DRI2_RENDERER_DEVICE_ID 0x0001 |
| 1454 | #define __DRI2_RENDERER_VERSION 0x0002 |
| 1455 | #define __DRI2_RENDERER_ACCELERATED 0x0003 |
| 1456 | #define __DRI2_RENDERER_VIDEO_MEMORY 0x0004 |
| 1457 | #define __DRI2_RENDERER_UNIFIED_MEMORY_ARCHITECTURE 0x0005 |
| 1458 | #define __DRI2_RENDERER_PREFERRED_PROFILE 0x0006 |
| 1459 | #define __DRI2_RENDERER_OPENGL_CORE_PROFILE_VERSION 0x0007 |
| 1460 | #define __DRI2_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION 0x0008 |
| 1461 | #define __DRI2_RENDERER_OPENGL_ES_PROFILE_VERSION 0x0009 |
| 1462 | #define __DRI2_RENDERER_OPENGL_ES2_PROFILE_VERSION 0x000a |
Marek Olšák | 4f57ccd | 2015-06-10 14:45:58 +0200 | [diff] [blame] | 1463 | #define __DRI2_RENDERER_HAS_TEXTURE_3D 0x000b |
| 1464 | /* Whether there is an sRGB format support for every supported 32-bit UNORM |
| 1465 | * color format. |
| 1466 | */ |
| 1467 | #define __DRI2_RENDERER_HAS_FRAMEBUFFER_SRGB 0x000c |
Ian Romanick | 64bb1e8 | 2013-02-14 15:51:52 -0800 | [diff] [blame] | 1468 | |
| 1469 | typedef struct __DRI2rendererQueryExtensionRec __DRI2rendererQueryExtension; |
| 1470 | struct __DRI2rendererQueryExtensionRec { |
| 1471 | __DRIextension base; |
| 1472 | |
| 1473 | int (*queryInteger)(__DRIscreen *screen, int attribute, unsigned int *val); |
| 1474 | int (*queryString)(__DRIscreen *screen, int attribute, const char **val); |
| 1475 | }; |
| 1476 | |
Keith Packard | 4424420 | 2013-11-04 18:09:51 -0800 | [diff] [blame] | 1477 | /** |
| 1478 | * Image Loader extension. Drivers use this to allocate color buffers |
| 1479 | */ |
| 1480 | |
| 1481 | enum __DRIimageBufferMask { |
| 1482 | __DRI_IMAGE_BUFFER_BACK = (1 << 0), |
| 1483 | __DRI_IMAGE_BUFFER_FRONT = (1 << 1) |
| 1484 | }; |
| 1485 | |
| 1486 | struct __DRIimageList { |
| 1487 | uint32_t image_mask; |
| 1488 | __DRIimage *back; |
| 1489 | __DRIimage *front; |
| 1490 | }; |
| 1491 | |
| 1492 | #define __DRI_IMAGE_LOADER "DRI_IMAGE_LOADER" |
| 1493 | #define __DRI_IMAGE_LOADER_VERSION 1 |
| 1494 | |
| 1495 | struct __DRIimageLoaderExtensionRec { |
| 1496 | __DRIextension base; |
| 1497 | |
| 1498 | /** |
| 1499 | * Allocate color buffers. |
| 1500 | * |
| 1501 | * \param driDrawable |
| 1502 | * \param width Width of allocated buffers |
| 1503 | * \param height Height of allocated buffers |
| 1504 | * \param format one of __DRI_IMAGE_FORMAT_* |
| 1505 | * \param stamp Address of variable to be updated when |
| 1506 | * getBuffers must be called again |
| 1507 | * \param loaderPrivate The loaderPrivate for driDrawable |
| 1508 | * \param buffer_mask Set of buffers to allocate |
| 1509 | * \param buffers Returned buffers |
| 1510 | */ |
| 1511 | int (*getBuffers)(__DRIdrawable *driDrawable, |
| 1512 | unsigned int format, |
| 1513 | uint32_t *stamp, |
| 1514 | void *loaderPrivate, |
| 1515 | uint32_t buffer_mask, |
| 1516 | struct __DRIimageList *buffers); |
| 1517 | |
| 1518 | /** |
| 1519 | * Flush pending front-buffer rendering |
| 1520 | * |
| 1521 | * Any rendering that has been performed to the |
| 1522 | * fake front will be flushed to the front |
| 1523 | * |
| 1524 | * \param driDrawable Drawable whose front-buffer is to be flushed |
| 1525 | * \param loaderPrivate Loader's private data that was previously passed |
| 1526 | * into __DRIdri2ExtensionRec::createNewDrawable |
| 1527 | */ |
| 1528 | void (*flushFrontBuffer)(__DRIdrawable *driDrawable, void *loaderPrivate); |
| 1529 | }; |
| 1530 | |
| 1531 | /** |
| 1532 | * DRI extension. |
| 1533 | */ |
| 1534 | |
| 1535 | #define __DRI_IMAGE_DRIVER "DRI_IMAGE_DRIVER" |
| 1536 | #define __DRI_IMAGE_DRIVER_VERSION 1 |
| 1537 | |
| 1538 | struct __DRIimageDriverExtensionRec { |
| 1539 | __DRIextension base; |
| 1540 | |
| 1541 | /* Common DRI functions, shared with DRI2 */ |
| 1542 | __DRIcreateNewScreen2Func createNewScreen2; |
| 1543 | __DRIcreateNewDrawableFunc createNewDrawable; |
Keith Packard | 4424420 | 2013-11-04 18:09:51 -0800 | [diff] [blame] | 1544 | __DRIcreateContextAttribsFunc createContextAttribs; |
| 1545 | __DRIgetAPIMaskFunc getAPIMask; |
| 1546 | }; |
| 1547 | |
Keith Whitwell | 74d563c | 2004-04-29 12:23:39 +0000 | [diff] [blame] | 1548 | #endif |