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 | |
Emil Velikov | e396265 | 2017-08-22 11:39:36 +0100 | [diff] [blame] | 51 | #include <stdint.h> |
| 52 | |
Brian Paul | 192c988 | 2004-03-22 23:31:29 +0000 | [diff] [blame] | 53 | /** |
| 54 | * \name DRI interface structures |
| 55 | * |
| 56 | * The following structures define the interface between the GLX client |
| 57 | * side library and the DRI (direct rendering infrastructure). |
| 58 | */ |
| 59 | /*@{*/ |
Kristian Høgsberg | 4a22ae8 | 2007-01-07 08:12:01 -0500 | [diff] [blame] | 60 | typedef struct __DRIdisplayRec __DRIdisplay; |
| 61 | typedef struct __DRIscreenRec __DRIscreen; |
| 62 | typedef struct __DRIcontextRec __DRIcontext; |
| 63 | typedef struct __DRIdrawableRec __DRIdrawable; |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 64 | typedef struct __DRIconfigRec __DRIconfig; |
Kristian Høgsberg | 4a22ae8 | 2007-01-07 08:12:01 -0500 | [diff] [blame] | 65 | typedef struct __DRIframebufferRec __DRIframebuffer; |
| 66 | typedef struct __DRIversionRec __DRIversion; |
Kristian Høgsberg | f616a26 | 2007-05-15 12:31:31 -0400 | [diff] [blame] | 67 | |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 68 | typedef struct __DRIcoreExtensionRec __DRIcoreExtension; |
Kristian Høgsberg | 78a6aa5 | 2007-05-16 14:10:29 -0400 | [diff] [blame] | 69 | typedef struct __DRIextensionRec __DRIextension; |
Kristian Høgsberg | ac3e838 | 2007-05-15 15:17:30 -0400 | [diff] [blame] | 70 | typedef struct __DRIcopySubBufferExtensionRec __DRIcopySubBufferExtension; |
Kristian Høgsberg | efaf90b | 2007-05-15 16:09:44 -0400 | [diff] [blame] | 71 | typedef struct __DRIswapControlExtensionRec __DRIswapControlExtension; |
Kristian Høgsberg | a7a0a2b | 2007-05-16 15:50:40 -0400 | [diff] [blame] | 72 | typedef struct __DRIframeTrackingExtensionRec __DRIframeTrackingExtension; |
Kristian Høgsberg | 106a6f2 | 2007-05-16 18:13:41 -0400 | [diff] [blame] | 73 | typedef struct __DRImediaStreamCounterExtensionRec __DRImediaStreamCounterExtension; |
Kristian Høgsberg | f29f0ae | 2007-05-22 12:26:02 -0400 | [diff] [blame] | 74 | typedef struct __DRItexOffsetExtensionRec __DRItexOffsetExtension; |
Kristian Høgsberg | 6d48779 | 2008-02-14 22:12:51 -0500 | [diff] [blame] | 75 | typedef struct __DRItexBufferExtensionRec __DRItexBufferExtension; |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 76 | typedef struct __DRIlegacyExtensionRec __DRIlegacyExtension; |
George Sapountzis | 280bf89 | 2008-05-11 14:43:40 +0300 | [diff] [blame] | 77 | typedef struct __DRIswrastExtensionRec __DRIswrastExtension; |
Kristian Høgsberg | f56b569 | 2008-08-13 11:46:25 -0400 | [diff] [blame] | 78 | typedef struct __DRIbufferRec __DRIbuffer; |
| 79 | typedef struct __DRIdri2ExtensionRec __DRIdri2Extension; |
| 80 | typedef struct __DRIdri2LoaderExtensionRec __DRIdri2LoaderExtension; |
Alan Hourihane | 6556245 | 2009-02-19 18:39:08 +0000 | [diff] [blame] | 81 | typedef struct __DRI2flushExtensionRec __DRI2flushExtension; |
Thomas Hellstrom | 511dc29 | 2011-10-10 16:38:19 +0200 | [diff] [blame] | 82 | typedef struct __DRI2throttleExtensionRec __DRI2throttleExtension; |
Marek Olšák | b02a5bf | 2015-04-10 10:43:26 +0200 | [diff] [blame] | 83 | typedef struct __DRI2fenceExtensionRec __DRI2fenceExtension; |
Marek Olšák | 5e9ed26 | 2016-02-29 23:19:18 +0100 | [diff] [blame] | 84 | typedef struct __DRI2interopExtensionRec __DRI2interopExtension; |
Kristian Høgsberg | f56b569 | 2008-08-13 11:46:25 -0400 | [diff] [blame] | 85 | |
Keith Packard | 4424420 | 2013-11-04 18:09:51 -0800 | [diff] [blame] | 86 | |
| 87 | typedef struct __DRIimageLoaderExtensionRec __DRIimageLoaderExtension; |
| 88 | typedef struct __DRIimageDriverExtensionRec __DRIimageDriverExtension; |
| 89 | |
Brian Paul | 192c988 | 2004-03-22 23:31:29 +0000 | [diff] [blame] | 90 | /*@}*/ |
| 91 | |
| 92 | |
| 93 | /** |
Kristian Høgsberg | f616a26 | 2007-05-15 12:31:31 -0400 | [diff] [blame] | 94 | * Extension struct. Drivers 'inherit' from this struct by embedding |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 95 | * it as the first element in the extension struct. |
Kristian Høgsberg | ccff0cb | 2007-06-07 19:35:54 -0400 | [diff] [blame] | 96 | * |
| 97 | * We never break API in for a DRI extension. If we need to change |
| 98 | * the way things work in a non-backwards compatible manner, we |
| 99 | * introduce a new extension. During a transition period, we can |
| 100 | * leave both the old and the new extension in the driver, which |
| 101 | * allows us to move to the new interface without having to update the |
| 102 | * loader(s) in lock step. |
| 103 | * |
| 104 | * However, we can add entry points to an extension over time as long |
| 105 | * as we don't break the old ones. As we add entry points to an |
| 106 | * extension, we increase the version number. The corresponding |
| 107 | * #define can be used to guard code that accesses the new entry |
| 108 | * points at compile time and the version field in the extension |
| 109 | * struct can be used at run-time to determine how to use the |
| 110 | * extension. |
Kristian Høgsberg | f616a26 | 2007-05-15 12:31:31 -0400 | [diff] [blame] | 111 | */ |
| 112 | struct __DRIextensionRec { |
| 113 | const char *name; |
Kristian Høgsberg | ccff0cb | 2007-06-07 19:35:54 -0400 | [diff] [blame] | 114 | int version; |
Kristian Høgsberg | f616a26 | 2007-05-15 12:31:31 -0400 | [diff] [blame] | 115 | }; |
| 116 | |
Kristian Høgsberg | ac3e838 | 2007-05-15 15:17:30 -0400 | [diff] [blame] | 117 | /** |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 118 | * The first set of extension are the screen extensions, returned by |
| 119 | * __DRIcore::getExtensions(). This entry point will return a list of |
| 120 | * extensions and the loader can use the ones it knows about by |
| 121 | * casting them to more specific extensions and advertising any GLX |
| 122 | * extensions the DRI extensions enables. |
| 123 | */ |
| 124 | |
| 125 | /** |
Kristian Høgsberg | f968f67 | 2007-05-17 14:39:06 -0400 | [diff] [blame] | 126 | * Used by drivers to indicate support for setting the read drawable. |
| 127 | */ |
| 128 | #define __DRI_READ_DRAWABLE "DRI_ReadDrawable" |
Kristian Høgsberg | ccff0cb | 2007-06-07 19:35:54 -0400 | [diff] [blame] | 129 | #define __DRI_READ_DRAWABLE_VERSION 1 |
Kristian Høgsberg | f968f67 | 2007-05-17 14:39:06 -0400 | [diff] [blame] | 130 | |
| 131 | /** |
Kristian Høgsberg | ac3e838 | 2007-05-15 15:17:30 -0400 | [diff] [blame] | 132 | * Used by drivers that implement the GLX_MESA_copy_sub_buffer extension. |
| 133 | */ |
| 134 | #define __DRI_COPY_SUB_BUFFER "DRI_CopySubBuffer" |
Kristian Høgsberg | ccff0cb | 2007-06-07 19:35:54 -0400 | [diff] [blame] | 135 | #define __DRI_COPY_SUB_BUFFER_VERSION 1 |
Kristian Høgsberg | ac3e838 | 2007-05-15 15:17:30 -0400 | [diff] [blame] | 136 | struct __DRIcopySubBufferExtensionRec { |
| 137 | __DRIextension base; |
| 138 | void (*copySubBuffer)(__DRIdrawable *drawable, int x, int y, int w, int h); |
| 139 | }; |
| 140 | |
Kristian Høgsberg | efaf90b | 2007-05-15 16:09:44 -0400 | [diff] [blame] | 141 | /** |
| 142 | * Used by drivers that implement the GLX_SGI_swap_control or |
| 143 | * GLX_MESA_swap_control extension. |
| 144 | */ |
| 145 | #define __DRI_SWAP_CONTROL "DRI_SwapControl" |
Kristian Høgsberg | ccff0cb | 2007-06-07 19:35:54 -0400 | [diff] [blame] | 146 | #define __DRI_SWAP_CONTROL_VERSION 1 |
Kristian Høgsberg | efaf90b | 2007-05-15 16:09:44 -0400 | [diff] [blame] | 147 | struct __DRIswapControlExtensionRec { |
| 148 | __DRIextension base; |
| 149 | void (*setSwapInterval)(__DRIdrawable *drawable, unsigned int inteval); |
| 150 | unsigned int (*getSwapInterval)(__DRIdrawable *drawable); |
| 151 | }; |
Kristian Høgsberg | f616a26 | 2007-05-15 12:31:31 -0400 | [diff] [blame] | 152 | |
| 153 | /** |
Kristian Høgsberg | a7a0a2b | 2007-05-16 15:50:40 -0400 | [diff] [blame] | 154 | * Used by drivers that implement the GLX_MESA_swap_frame_usage extension. |
| 155 | */ |
| 156 | #define __DRI_FRAME_TRACKING "DRI_FrameTracking" |
Kristian Høgsberg | ccff0cb | 2007-06-07 19:35:54 -0400 | [diff] [blame] | 157 | #define __DRI_FRAME_TRACKING_VERSION 1 |
Kristian Høgsberg | a7a0a2b | 2007-05-16 15:50:40 -0400 | [diff] [blame] | 158 | struct __DRIframeTrackingExtensionRec { |
| 159 | __DRIextension base; |
| 160 | |
| 161 | /** |
| 162 | * Enable or disable frame usage tracking. |
| 163 | * |
| 164 | * \since Internal API version 20030317. |
| 165 | */ |
| 166 | int (*frameTracking)(__DRIdrawable *drawable, GLboolean enable); |
| 167 | |
| 168 | /** |
| 169 | * Retrieve frame usage information. |
| 170 | * |
| 171 | * \since Internal API version 20030317. |
| 172 | */ |
| 173 | int (*queryFrameTracking)(__DRIdrawable *drawable, |
| 174 | int64_t * sbc, int64_t * missedFrames, |
| 175 | float * lastMissedUsage, float * usage); |
| 176 | }; |
| 177 | |
Kristian Høgsberg | 106a6f2 | 2007-05-16 18:13:41 -0400 | [diff] [blame] | 178 | |
| 179 | /** |
| 180 | * Used by drivers that implement the GLX_SGI_video_sync extension. |
| 181 | */ |
| 182 | #define __DRI_MEDIA_STREAM_COUNTER "DRI_MediaStreamCounter" |
Kristian Høgsberg | 6e8d21d | 2008-02-25 16:14:37 -0500 | [diff] [blame] | 183 | #define __DRI_MEDIA_STREAM_COUNTER_VERSION 1 |
Kristian Høgsberg | 106a6f2 | 2007-05-16 18:13:41 -0400 | [diff] [blame] | 184 | struct __DRImediaStreamCounterExtensionRec { |
| 185 | __DRIextension base; |
| 186 | |
| 187 | /** |
Kristian Høgsberg | 106a6f2 | 2007-05-16 18:13:41 -0400 | [diff] [blame] | 188 | * Wait for the MSC to equal target_msc, or, if that has already passed, |
| 189 | * the next time (MSC % divisor) is equal to remainder. If divisor is |
| 190 | * zero, the function will return as soon as MSC is greater than or equal |
| 191 | * to target_msc. |
| 192 | */ |
| 193 | int (*waitForMSC)(__DRIdrawable *drawable, |
| 194 | int64_t target_msc, int64_t divisor, int64_t remainder, |
| 195 | int64_t * msc, int64_t * sbc); |
Jesse Barnes | 38fdb47 | 2007-10-29 11:56:31 -0700 | [diff] [blame] | 196 | |
| 197 | /** |
Jesse Barnes | 38fdb47 | 2007-10-29 11:56:31 -0700 | [diff] [blame] | 198 | * Get the number of vertical refreshes since some point in time before |
| 199 | * this function was first called (i.e., system start up). |
Jesse Barnes | 38fdb47 | 2007-10-29 11:56:31 -0700 | [diff] [blame] | 200 | */ |
Kristian Høgsberg | 6e8d21d | 2008-02-25 16:14:37 -0500 | [diff] [blame] | 201 | int (*getDrawableMSC)(__DRIscreen *screen, __DRIdrawable *drawable, |
Jesse Barnes | 38fdb47 | 2007-10-29 11:56:31 -0700 | [diff] [blame] | 202 | int64_t *msc); |
Kristian Høgsberg | 106a6f2 | 2007-05-16 18:13:41 -0400 | [diff] [blame] | 203 | }; |
| 204 | |
| 205 | |
Kristian Høgsberg | f29f0ae | 2007-05-22 12:26:02 -0400 | [diff] [blame] | 206 | #define __DRI_TEX_OFFSET "DRI_TexOffset" |
Kristian Høgsberg | ccff0cb | 2007-06-07 19:35:54 -0400 | [diff] [blame] | 207 | #define __DRI_TEX_OFFSET_VERSION 1 |
Kristian Høgsberg | f29f0ae | 2007-05-22 12:26:02 -0400 | [diff] [blame] | 208 | struct __DRItexOffsetExtensionRec { |
| 209 | __DRIextension base; |
| 210 | |
| 211 | /** |
| 212 | * Method to override base texture image with a driver specific 'offset'. |
| 213 | * The depth passed in allows e.g. to ignore the alpha channel of texture |
| 214 | * images where the non-alpha components don't occupy a whole texel. |
| 215 | * |
| 216 | * For GLX_EXT_texture_from_pixmap with AIGLX. |
| 217 | */ |
| 218 | void (*setTexOffset)(__DRIcontext *pDRICtx, GLint texname, |
| 219 | unsigned long long offset, GLint depth, GLuint pitch); |
| 220 | }; |
| 221 | |
| 222 | |
Kristian Høgsberg | debf00e | 2010-02-09 15:26:14 -0500 | [diff] [blame] | 223 | /* Valid values for format in the setTexBuffer2 function below. These |
| 224 | * values match the GLX tokens for compatibility reasons, but we |
| 225 | * define them here since the DRI interface can't depend on GLX. */ |
| 226 | #define __DRI_TEXTURE_FORMAT_NONE 0x20D8 |
| 227 | #define __DRI_TEXTURE_FORMAT_RGB 0x20D9 |
| 228 | #define __DRI_TEXTURE_FORMAT_RGBA 0x20DA |
| 229 | |
Kristian Høgsberg | 6d48779 | 2008-02-14 22:12:51 -0500 | [diff] [blame] | 230 | #define __DRI_TEX_BUFFER "DRI_TexBuffer" |
Emil Velikov | 9b42fd1 | 2014-02-18 03:04:03 +0000 | [diff] [blame] | 231 | #define __DRI_TEX_BUFFER_VERSION 3 |
Kristian Høgsberg | 6d48779 | 2008-02-14 22:12:51 -0500 | [diff] [blame] | 232 | struct __DRItexBufferExtensionRec { |
| 233 | __DRIextension base; |
| 234 | |
| 235 | /** |
Kristian Høgsberg | dcbe215 | 2008-03-09 21:28:04 -0400 | [diff] [blame] | 236 | * Method to override base texture image with the contents of a |
| 237 | * __DRIdrawable. |
Kristian Høgsberg | 6d48779 | 2008-02-14 22:12:51 -0500 | [diff] [blame] | 238 | * |
Eric Anholt | 66175aa | 2009-03-18 12:07:09 -0700 | [diff] [blame] | 239 | * For GLX_EXT_texture_from_pixmap with AIGLX. Deprecated in favor of |
| 240 | * setTexBuffer2 in version 2 of this interface |
Kristian Høgsberg | 6d48779 | 2008-02-14 22:12:51 -0500 | [diff] [blame] | 241 | */ |
| 242 | void (*setTexBuffer)(__DRIcontext *pDRICtx, |
Kristian Høgsberg | dcbe215 | 2008-03-09 21:28:04 -0400 | [diff] [blame] | 243 | GLint target, |
| 244 | __DRIdrawable *pDraw); |
Eric Anholt | 66175aa | 2009-03-18 12:07:09 -0700 | [diff] [blame] | 245 | |
| 246 | /** |
| 247 | * Method to override base texture image with the contents of a |
| 248 | * __DRIdrawable, including the required texture format attribute. |
| 249 | * |
| 250 | * For GLX_EXT_texture_from_pixmap with AIGLX. |
Emil Velikov | c9fff07 | 2014-02-12 19:00:21 +0000 | [diff] [blame] | 251 | * |
| 252 | * \since 2 |
Eric Anholt | 66175aa | 2009-03-18 12:07:09 -0700 | [diff] [blame] | 253 | */ |
| 254 | void (*setTexBuffer2)(__DRIcontext *pDRICtx, |
| 255 | GLint target, |
| 256 | GLint format, |
| 257 | __DRIdrawable *pDraw); |
Juan Zhao | e59fa4c | 2011-01-09 12:03:02 -0500 | [diff] [blame] | 258 | /** |
| 259 | * Method to release texture buffer in case some special platform |
| 260 | * need this. |
| 261 | * |
| 262 | * For GLX_EXT_texture_from_pixmap with AIGLX. |
Emil Velikov | c9fff07 | 2014-02-12 19:00:21 +0000 | [diff] [blame] | 263 | * |
| 264 | * \since 3 |
Juan Zhao | e59fa4c | 2011-01-09 12:03:02 -0500 | [diff] [blame] | 265 | */ |
| 266 | void (*releaseTexBuffer)(__DRIcontext *pDRICtx, |
| 267 | GLint target, |
| 268 | __DRIdrawable *pDraw); |
Kristian Høgsberg | 6d48779 | 2008-02-14 22:12:51 -0500 | [diff] [blame] | 269 | }; |
| 270 | |
Alan Hourihane | 6556245 | 2009-02-19 18:39:08 +0000 | [diff] [blame] | 271 | /** |
| 272 | * Used by drivers that implement DRI2 |
| 273 | */ |
| 274 | #define __DRI2_FLUSH "DRI2_Flush" |
Marek Olšák | 4a486f8 | 2012-11-23 18:31:42 +0100 | [diff] [blame] | 275 | #define __DRI2_FLUSH_VERSION 4 |
| 276 | |
| 277 | #define __DRI2_FLUSH_DRAWABLE (1 << 0) /* the drawable should be flushed. */ |
| 278 | #define __DRI2_FLUSH_CONTEXT (1 << 1) /* glFlush should be called */ |
Eric Anholt | 70e8ccc | 2014-12-21 11:51:33 -0800 | [diff] [blame] | 279 | #define __DRI2_FLUSH_INVALIDATE_ANCILLARY (1 << 2) |
Marek Olšák | 4a486f8 | 2012-11-23 18:31:42 +0100 | [diff] [blame] | 280 | |
Chad Versace | e5f1f8d | 2012-12-01 17:03:59 -0800 | [diff] [blame] | 281 | enum __DRI2throttleReason { |
| 282 | __DRI2_THROTTLE_SWAPBUFFER, |
| 283 | __DRI2_THROTTLE_COPYSUBBUFFER, |
| 284 | __DRI2_THROTTLE_FLUSHFRONT |
| 285 | }; |
Marek Olšák | 4a486f8 | 2012-11-23 18:31:42 +0100 | [diff] [blame] | 286 | |
Alan Hourihane | 6556245 | 2009-02-19 18:39:08 +0000 | [diff] [blame] | 287 | struct __DRI2flushExtensionRec { |
| 288 | __DRIextension base; |
| 289 | void (*flush)(__DRIdrawable *drawable); |
Jesse Barnes | a35f6bb | 2009-07-17 03:30:29 -0400 | [diff] [blame] | 290 | |
| 291 | /** |
Francisco Jerez | 61d26bc | 2010-02-08 19:27:56 +0100 | [diff] [blame] | 292 | * Ask the driver to call getBuffers/getBuffersWithFormat before |
| 293 | * it starts rendering again. |
Jesse Barnes | a35f6bb | 2009-07-17 03:30:29 -0400 | [diff] [blame] | 294 | * |
Francisco Jerez | 61d26bc | 2010-02-08 19:27:56 +0100 | [diff] [blame] | 295 | * \param drawable the drawable to invalidate |
Jesse Barnes | a35f6bb | 2009-07-17 03:30:29 -0400 | [diff] [blame] | 296 | * |
Francisco Jerez | 61d26bc | 2010-02-08 19:27:56 +0100 | [diff] [blame] | 297 | * \since 3 |
Jesse Barnes | a35f6bb | 2009-07-17 03:30:29 -0400 | [diff] [blame] | 298 | */ |
Francisco Jerez | 61d26bc | 2010-02-08 19:27:56 +0100 | [diff] [blame] | 299 | void (*invalidate)(__DRIdrawable *drawable); |
Marek Olšák | 4a486f8 | 2012-11-23 18:31:42 +0100 | [diff] [blame] | 300 | |
| 301 | /** |
| 302 | * This function reduces the number of flushes in the driver by combining |
| 303 | * several operations into one call. |
| 304 | * |
| 305 | * It can: |
| 306 | * - throttle |
| 307 | * - flush a drawable |
| 308 | * - flush a context |
| 309 | * |
| 310 | * \param context the context |
| 311 | * \param drawable the drawable to flush |
| 312 | * \param flags a combination of _DRI2_FLUSH_xxx flags |
| 313 | * \param throttle_reason the reason for throttling, 0 = no throttling |
| 314 | * |
| 315 | * \since 4 |
| 316 | */ |
| 317 | void (*flush_with_flags)(__DRIcontext *ctx, |
| 318 | __DRIdrawable *drawable, |
| 319 | unsigned flags, |
| 320 | enum __DRI2throttleReason throttle_reason); |
Alan Hourihane | 6556245 | 2009-02-19 18:39:08 +0000 | [diff] [blame] | 321 | }; |
| 322 | |
Kristian Høgsberg | 6d48779 | 2008-02-14 22:12:51 -0500 | [diff] [blame] | 323 | |
Kristian Høgsberg | a7a0a2b | 2007-05-16 15:50:40 -0400 | [diff] [blame] | 324 | /** |
Thomas Hellstrom | 511dc29 | 2011-10-10 16:38:19 +0200 | [diff] [blame] | 325 | * Extension that the driver uses to request |
| 326 | * throttle callbacks. |
| 327 | */ |
| 328 | |
| 329 | #define __DRI2_THROTTLE "DRI2_Throttle" |
| 330 | #define __DRI2_THROTTLE_VERSION 1 |
| 331 | |
Thomas Hellstrom | 511dc29 | 2011-10-10 16:38:19 +0200 | [diff] [blame] | 332 | struct __DRI2throttleExtensionRec { |
| 333 | __DRIextension base; |
| 334 | void (*throttle)(__DRIcontext *ctx, |
| 335 | __DRIdrawable *drawable, |
| 336 | enum __DRI2throttleReason reason); |
| 337 | }; |
| 338 | |
Marek Olšák | b02a5bf | 2015-04-10 10:43:26 +0200 | [diff] [blame] | 339 | |
| 340 | /** |
| 341 | * Extension for fences / synchronization objects. |
| 342 | */ |
| 343 | |
| 344 | #define __DRI2_FENCE "DRI2_Fence" |
Rob Clark | 21b1acf | 2016-11-18 08:39:32 -0500 | [diff] [blame] | 345 | #define __DRI2_FENCE_VERSION 2 |
Marek Olšák | b02a5bf | 2015-04-10 10:43:26 +0200 | [diff] [blame] | 346 | |
Marek Olšák | aaee0d1 | 2017-07-06 02:23:46 +0200 | [diff] [blame] | 347 | #define __DRI2_FENCE_TIMEOUT_INFINITE 0xffffffffffffffffull |
Marek Olšák | b02a5bf | 2015-04-10 10:43:26 +0200 | [diff] [blame] | 348 | |
| 349 | #define __DRI2_FENCE_FLAG_FLUSH_COMMANDS (1 << 0) |
| 350 | |
Rob Clark | 21b1acf | 2016-11-18 08:39:32 -0500 | [diff] [blame] | 351 | /** |
| 352 | * \name Capabilities that might be returned by __DRI2fenceExtensionRec::get_capabilities |
| 353 | */ |
| 354 | /*@{*/ |
| 355 | #define __DRI_FENCE_CAP_NATIVE_FD 1 |
| 356 | /*@}*/ |
| 357 | |
Marek Olšák | b02a5bf | 2015-04-10 10:43:26 +0200 | [diff] [blame] | 358 | struct __DRI2fenceExtensionRec { |
| 359 | __DRIextension base; |
| 360 | |
| 361 | /** |
| 362 | * Create and insert a fence into the command stream of the context. |
| 363 | */ |
| 364 | void *(*create_fence)(__DRIcontext *ctx); |
| 365 | |
| 366 | /** |
| 367 | * Get a fence associated with the OpenCL event object. |
| 368 | * This can be NULL, meaning that OpenCL interoperability is not supported. |
| 369 | */ |
| 370 | void *(*get_fence_from_cl_event)(__DRIscreen *screen, intptr_t cl_event); |
| 371 | |
| 372 | /** |
| 373 | * Destroy a fence. |
| 374 | */ |
| 375 | void (*destroy_fence)(__DRIscreen *screen, void *fence); |
| 376 | |
| 377 | /** |
| 378 | * This function waits and doesn't return until the fence is signalled |
| 379 | * or the timeout expires. It returns true if the fence has been signaled. |
| 380 | * |
| 381 | * \param ctx the context where commands are flushed |
| 382 | * \param fence the fence |
| 383 | * \param flags a combination of __DRI2_FENCE_FLAG_xxx flags |
| 384 | * \param timeout the timeout in ns or __DRI2_FENCE_TIMEOUT_INFINITE |
| 385 | */ |
| 386 | GLboolean (*client_wait_sync)(__DRIcontext *ctx, void *fence, |
| 387 | unsigned flags, uint64_t timeout); |
| 388 | |
| 389 | /** |
| 390 | * This function enqueues a wait command into the command stream of |
| 391 | * the context and then returns. When the execution reaches the wait |
| 392 | * command, no further execution will be done in the context until |
| 393 | * the fence is signaled. This is a no-op if the device doesn't support |
| 394 | * parallel execution of contexts. |
| 395 | * |
| 396 | * \param ctx the context where the waiting is done |
| 397 | * \param fence the fence |
| 398 | * \param flags a combination of __DRI2_FENCE_FLAG_xxx flags that make |
| 399 | * sense with this function (right now there are none) |
| 400 | */ |
| 401 | void (*server_wait_sync)(__DRIcontext *ctx, void *fence, unsigned flags); |
Rob Clark | 21b1acf | 2016-11-18 08:39:32 -0500 | [diff] [blame] | 402 | |
| 403 | /** |
| 404 | * Query for general capabilities of the driver that concern fences. |
| 405 | * Returns a bitmask of __DRI_FENCE_CAP_x |
| 406 | * |
| 407 | * \since 2 |
| 408 | */ |
| 409 | unsigned (*get_capabilities)(__DRIscreen *screen); |
| 410 | |
| 411 | /** |
| 412 | * Create an fd (file descriptor) associated fence. If the fence fd |
| 413 | * is -1, this behaves similarly to create_fence() except that when |
| 414 | * rendering is flushed the driver creates a fence fd. Otherwise, |
| 415 | * the driver wraps an existing fence fd. |
| 416 | * |
| 417 | * This is used to implement the EGL_ANDROID_native_fence_sync extension. |
| 418 | * |
| 419 | * \since 2 |
| 420 | * |
| 421 | * \param ctx the context associated with the fence |
| 422 | * \param fd the fence fd or -1 |
| 423 | */ |
| 424 | void *(*create_fence_fd)(__DRIcontext *ctx, int fd); |
| 425 | |
| 426 | /** |
| 427 | * For fences created with create_fence_fd(), after rendering is flushed, |
| 428 | * this retrieves the native fence fd. Caller takes ownership of the |
| 429 | * fd and will close() it when it is no longer needed. |
| 430 | * |
| 431 | * \since 2 |
| 432 | * |
| 433 | * \param screen the screen associated with the fence |
| 434 | * \param fence the fence |
| 435 | */ |
| 436 | int (*get_fence_fd)(__DRIscreen *screen, void *fence); |
Marek Olšák | b02a5bf | 2015-04-10 10:43:26 +0200 | [diff] [blame] | 437 | }; |
| 438 | |
| 439 | |
Marek Olšák | 5e9ed26 | 2016-02-29 23:19:18 +0100 | [diff] [blame] | 440 | /** |
| 441 | * Extension for API interop. |
| 442 | * See GL/mesa_glinterop.h. |
| 443 | */ |
| 444 | |
| 445 | #define __DRI2_INTEROP "DRI2_Interop" |
| 446 | #define __DRI2_INTEROP_VERSION 1 |
| 447 | |
Emil Velikov | 13faddb | 2016-05-30 10:56:33 +0100 | [diff] [blame] | 448 | struct mesa_glinterop_device_info; |
| 449 | struct mesa_glinterop_export_in; |
| 450 | struct mesa_glinterop_export_out; |
Marek Olšák | 5e9ed26 | 2016-02-29 23:19:18 +0100 | [diff] [blame] | 451 | |
| 452 | struct __DRI2interopExtensionRec { |
| 453 | __DRIextension base; |
| 454 | |
| 455 | /** Same as MesaGLInterop*QueryDeviceInfo. */ |
| 456 | int (*query_device_info)(__DRIcontext *ctx, |
Emil Velikov | 13faddb | 2016-05-30 10:56:33 +0100 | [diff] [blame] | 457 | struct mesa_glinterop_device_info *out); |
Marek Olšák | 5e9ed26 | 2016-02-29 23:19:18 +0100 | [diff] [blame] | 458 | |
| 459 | /** Same as MesaGLInterop*ExportObject. */ |
| 460 | int (*export_object)(__DRIcontext *ctx, |
Emil Velikov | 13faddb | 2016-05-30 10:56:33 +0100 | [diff] [blame] | 461 | struct mesa_glinterop_export_in *in, |
| 462 | struct mesa_glinterop_export_out *out); |
Marek Olšák | 5e9ed26 | 2016-02-29 23:19:18 +0100 | [diff] [blame] | 463 | }; |
| 464 | |
Brian Paul | 192c988 | 2004-03-22 23:31:29 +0000 | [diff] [blame] | 465 | /*@}*/ |
| 466 | |
Kristian Høgsberg | 6cb3f5c | 2008-02-28 10:32:28 -0500 | [diff] [blame] | 467 | /** |
| 468 | * The following extensions describe loader features that the DRI |
| 469 | * 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] | 470 | * getDrawableInfo extension for DRI and the DRI Loader extensions for |
Kristian Høgsberg | 6cb3f5c | 2008-02-28 10:32:28 -0500 | [diff] [blame] | 471 | * DRI2, while others are optional, and if present allow the driver to |
| 472 | * expose certain features. The loader pass in a NULL terminated |
| 473 | * array of these extensions to the driver in the createNewScreen |
| 474 | * constructor. |
| 475 | */ |
Ian Romanick | 5f1ba3e | 2005-07-26 02:44:01 +0000 | [diff] [blame] | 476 | |
Kristian Høgsberg | 6cb3f5c | 2008-02-28 10:32:28 -0500 | [diff] [blame] | 477 | typedef struct __DRIgetDrawableInfoExtensionRec __DRIgetDrawableInfoExtension; |
| 478 | typedef struct __DRIsystemTimeExtensionRec __DRIsystemTimeExtension; |
| 479 | typedef struct __DRIdamageExtensionRec __DRIdamageExtension; |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 480 | typedef struct __DRIloaderExtensionRec __DRIloaderExtension; |
George Sapountzis | 280bf89 | 2008-05-11 14:43:40 +0300 | [diff] [blame] | 481 | typedef struct __DRIswrastLoaderExtensionRec __DRIswrastLoaderExtension; |
Ian Romanick | 5f1ba3e | 2005-07-26 02:44:01 +0000 | [diff] [blame] | 482 | |
Ian Romanick | 5f1ba3e | 2005-07-26 02:44:01 +0000 | [diff] [blame] | 483 | |
Kristian Høgsberg | 6cb3f5c | 2008-02-28 10:32:28 -0500 | [diff] [blame] | 484 | /** |
| 485 | * Callback to getDrawableInfo protocol |
| 486 | */ |
| 487 | #define __DRI_GET_DRAWABLE_INFO "DRI_GetDrawableInfo" |
| 488 | #define __DRI_GET_DRAWABLE_INFO_VERSION 1 |
| 489 | struct __DRIgetDrawableInfoExtensionRec { |
| 490 | __DRIextension base; |
Ian Romanick | 5f1ba3e | 2005-07-26 02:44:01 +0000 | [diff] [blame] | 491 | |
| 492 | /** |
Ian Romanick | 5f1ba3e | 2005-07-26 02:44:01 +0000 | [diff] [blame] | 493 | * This function is used to get information about the position, size, and |
| 494 | * clip rects of a drawable. |
| 495 | */ |
Kristian Høgsberg | 4ff95e7 | 2007-05-10 17:14:38 -0400 | [diff] [blame] | 496 | GLboolean (* getDrawableInfo) ( __DRIdrawable *drawable, |
Kristian Høgsberg | aceccda | 2007-05-10 15:52:22 -0400 | [diff] [blame] | 497 | unsigned int * index, unsigned int * stamp, |
Ian Romanick | 5f1ba3e | 2005-07-26 02:44:01 +0000 | [diff] [blame] | 498 | int * x, int * y, int * width, int * height, |
| 499 | int * numClipRects, drm_clip_rect_t ** pClipRects, |
| 500 | int * backX, int * backY, |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 501 | int * numBackClipRects, drm_clip_rect_t ** pBackClipRects, |
| 502 | void *loaderPrivate); |
Kristian Høgsberg | 6cb3f5c | 2008-02-28 10:32:28 -0500 | [diff] [blame] | 503 | }; |
Ian Romanick | 5f1ba3e | 2005-07-26 02:44:01 +0000 | [diff] [blame] | 504 | |
Kristian Høgsberg | 6cb3f5c | 2008-02-28 10:32:28 -0500 | [diff] [blame] | 505 | /** |
| 506 | * Callback to get system time for media stream counter extensions. |
| 507 | */ |
| 508 | #define __DRI_SYSTEM_TIME "DRI_SystemTime" |
| 509 | #define __DRI_SYSTEM_TIME_VERSION 1 |
| 510 | struct __DRIsystemTimeExtensionRec { |
| 511 | __DRIextension base; |
Ian Romanick | 5f1ba3e | 2005-07-26 02:44:01 +0000 | [diff] [blame] | 512 | |
| 513 | /** |
Ian Romanick | 5f1ba3e | 2005-07-26 02:44:01 +0000 | [diff] [blame] | 514 | * Get the 64-bit unadjusted system time (UST). |
| 515 | */ |
| 516 | int (*getUST)(int64_t * ust); |
| 517 | |
| 518 | /** |
| 519 | * Get the media stream counter (MSC) rate. |
| 520 | * |
| 521 | * Matching the definition in GLX_OML_sync_control, this function returns |
| 522 | * the rate of the "media stream counter". In practical terms, this is |
| 523 | * the frame refresh rate of the display. |
| 524 | */ |
Kristian Høgsberg | aceccda | 2007-05-10 15:52:22 -0400 | [diff] [blame] | 525 | GLboolean (*getMSCRate)(__DRIdrawable *draw, |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 526 | int32_t * numerator, int32_t * denominator, |
| 527 | void *loaderPrivate); |
Kristian Høgsberg | 6cb3f5c | 2008-02-28 10:32:28 -0500 | [diff] [blame] | 528 | }; |
| 529 | |
| 530 | /** |
| 531 | * Damage reporting |
| 532 | */ |
| 533 | #define __DRI_DAMAGE "DRI_Damage" |
| 534 | #define __DRI_DAMAGE_VERSION 1 |
| 535 | struct __DRIdamageExtensionRec { |
| 536 | __DRIextension base; |
Eric Anholt | c2b185c | 2007-01-05 18:19:58 -0800 | [diff] [blame] | 537 | |
| 538 | /** |
| 539 | * Reports areas of the given drawable which have been modified by the |
| 540 | * driver. |
| 541 | * |
| 542 | * \param drawable which the drawing was done to. |
| 543 | * \param rects rectangles affected, with the drawable origin as the |
| 544 | * origin. |
| 545 | * \param x X offset of the drawable within the screen (used in the |
| 546 | * front_buffer case) |
| 547 | * \param y Y offset of the drawable within the screen. |
| 548 | * \param front_buffer boolean flag for whether the drawing to the |
| 549 | * drawable was actually done directly to the front buffer (instead |
| 550 | * of backing storage, for example) |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 551 | * \param loaderPrivate the data passed in at createNewDrawable time |
Eric Anholt | c2b185c | 2007-01-05 18:19:58 -0800 | [diff] [blame] | 552 | */ |
Kristian Høgsberg | aceccda | 2007-05-10 15:52:22 -0400 | [diff] [blame] | 553 | void (*reportDamage)(__DRIdrawable *draw, |
Eric Anholt | c2b185c | 2007-01-05 18:19:58 -0800 | [diff] [blame] | 554 | int x, int y, |
| 555 | drm_clip_rect_t *rects, int num_rects, |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 556 | GLboolean front_buffer, |
| 557 | void *loaderPrivate); |
Kristian Høgsberg | 6cb3f5c | 2008-02-28 10:32:28 -0500 | [diff] [blame] | 558 | }; |
| 559 | |
George Sapountzis | 280bf89 | 2008-05-11 14:43:40 +0300 | [diff] [blame] | 560 | #define __DRI_SWRAST_IMAGE_OP_DRAW 1 |
| 561 | #define __DRI_SWRAST_IMAGE_OP_CLEAR 2 |
| 562 | #define __DRI_SWRAST_IMAGE_OP_SWAP 3 |
| 563 | |
| 564 | /** |
| 565 | * SWRast Loader extension. |
| 566 | */ |
| 567 | #define __DRI_SWRAST_LOADER "DRI_SWRastLoader" |
Dave Airlie | 2b67657 | 2015-10-09 01:38:08 +0100 | [diff] [blame] | 568 | #define __DRI_SWRAST_LOADER_VERSION 3 |
George Sapountzis | 280bf89 | 2008-05-11 14:43:40 +0300 | [diff] [blame] | 569 | struct __DRIswrastLoaderExtensionRec { |
| 570 | __DRIextension base; |
| 571 | |
| 572 | /* |
| 573 | * Drawable position and size |
| 574 | */ |
| 575 | void (*getDrawableInfo)(__DRIdrawable *drawable, |
| 576 | int *x, int *y, int *width, int *height, |
| 577 | void *loaderPrivate); |
| 578 | |
| 579 | /** |
| 580 | * Put image to drawable |
| 581 | */ |
| 582 | void (*putImage)(__DRIdrawable *drawable, int op, |
George Sapountzis | f4e561c | 2010-03-27 20:32:52 +0200 | [diff] [blame] | 583 | int x, int y, int width, int height, |
| 584 | char *data, void *loaderPrivate); |
George Sapountzis | 280bf89 | 2008-05-11 14:43:40 +0300 | [diff] [blame] | 585 | |
| 586 | /** |
George Sapountzis | f4e561c | 2010-03-27 20:32:52 +0200 | [diff] [blame] | 587 | * Get image from readable |
George Sapountzis | 280bf89 | 2008-05-11 14:43:40 +0300 | [diff] [blame] | 588 | */ |
George Sapountzis | f4e561c | 2010-03-27 20:32:52 +0200 | [diff] [blame] | 589 | void (*getImage)(__DRIdrawable *readable, |
| 590 | int x, int y, int width, int height, |
| 591 | char *data, void *loaderPrivate); |
Dave Airlie | ba00f2f | 2013-11-28 11:08:11 +1000 | [diff] [blame] | 592 | |
| 593 | /** |
| 594 | * Put image to drawable |
Emil Velikov | acf2fae | 2014-02-18 02:31:27 +0000 | [diff] [blame] | 595 | * |
| 596 | * \since 2 |
Dave Airlie | ba00f2f | 2013-11-28 11:08:11 +1000 | [diff] [blame] | 597 | */ |
| 598 | void (*putImage2)(__DRIdrawable *drawable, int op, |
| 599 | int x, int y, int width, int height, int stride, |
| 600 | char *data, void *loaderPrivate); |
Dave Airlie | 2b67657 | 2015-10-09 01:38:08 +0100 | [diff] [blame] | 601 | |
| 602 | /** |
| 603 | * Put image to drawable |
| 604 | * |
| 605 | * \since 3 |
| 606 | */ |
| 607 | void (*getImage2)(__DRIdrawable *readable, |
| 608 | int x, int y, int width, int height, int stride, |
| 609 | char *data, void *loaderPrivate); |
George Sapountzis | 280bf89 | 2008-05-11 14:43:40 +0300 | [diff] [blame] | 610 | }; |
| 611 | |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 612 | /** |
Kristian Høgsberg | 97a6cbc | 2010-05-11 09:09:30 -0400 | [diff] [blame] | 613 | * Invalidate loader extension. The presence of this extension |
| 614 | * indicates to the DRI driver that the loader will call invalidate in |
| 615 | * the __DRI2_FLUSH extension, whenever the needs to query for new |
| 616 | * buffers. This means that the DRI driver can drop the polling in |
| 617 | * glViewport(). |
| 618 | * |
| 619 | * The extension doesn't provide any functionality, it's only use to |
| 620 | * indicate to the driver that it can use the new semantics. A DRI |
| 621 | * driver can use this to switch between the different semantics or |
| 622 | * just refuse to initialize if this extension isn't present. |
| 623 | */ |
| 624 | #define __DRI_USE_INVALIDATE "DRI_UseInvalidate" |
| 625 | #define __DRI_USE_INVALIDATE_VERSION 1 |
| 626 | |
| 627 | typedef struct __DRIuseInvalidateExtensionRec __DRIuseInvalidateExtension; |
| 628 | struct __DRIuseInvalidateExtensionRec { |
| 629 | __DRIextension base; |
| 630 | }; |
| 631 | |
| 632 | /** |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 633 | * The remaining extensions describe driver extensions, immediately |
| 634 | * available interfaces provided by the driver. To start using the |
| 635 | * driver, dlsym() for the __DRI_DRIVER_EXTENSIONS symbol and look for |
| 636 | * the extension you need in the array. |
| 637 | */ |
| 638 | #define __DRI_DRIVER_EXTENSIONS "__driDriverExtensions" |
| 639 | |
| 640 | /** |
Eric Anholt | fcb57a8 | 2013-09-23 14:44:10 -0700 | [diff] [blame] | 641 | * This symbol replaces the __DRI_DRIVER_EXTENSIONS symbol, and will be |
| 642 | * suffixed by "_drivername", allowing multiple drivers to be built into one |
| 643 | * library, and also giving the driver the chance to return a variable driver |
| 644 | * extensions struct depending on the driver name being loaded or any other |
| 645 | * system state. |
| 646 | * |
| 647 | * The function prototype is: |
| 648 | * |
| 649 | * const __DRIextension **__driDriverGetExtensions_drivername(void); |
| 650 | */ |
| 651 | #define __DRI_DRIVER_GET_EXTENSIONS "__driDriverGetExtensions" |
| 652 | |
| 653 | /** |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 654 | * Tokens for __DRIconfig attribs. A number of attributes defined by |
| 655 | * GLX or EGL standards are not in the table, as they must be provided |
| 656 | * by the loader. For example, FBConfig ID or visual ID, drawable type. |
| 657 | */ |
| 658 | |
| 659 | #define __DRI_ATTRIB_BUFFER_SIZE 1 |
| 660 | #define __DRI_ATTRIB_LEVEL 2 |
| 661 | #define __DRI_ATTRIB_RED_SIZE 3 |
| 662 | #define __DRI_ATTRIB_GREEN_SIZE 4 |
| 663 | #define __DRI_ATTRIB_BLUE_SIZE 5 |
| 664 | #define __DRI_ATTRIB_LUMINANCE_SIZE 6 |
| 665 | #define __DRI_ATTRIB_ALPHA_SIZE 7 |
| 666 | #define __DRI_ATTRIB_ALPHA_MASK_SIZE 8 |
| 667 | #define __DRI_ATTRIB_DEPTH_SIZE 9 |
| 668 | #define __DRI_ATTRIB_STENCIL_SIZE 10 |
| 669 | #define __DRI_ATTRIB_ACCUM_RED_SIZE 11 |
| 670 | #define __DRI_ATTRIB_ACCUM_GREEN_SIZE 12 |
| 671 | #define __DRI_ATTRIB_ACCUM_BLUE_SIZE 13 |
| 672 | #define __DRI_ATTRIB_ACCUM_ALPHA_SIZE 14 |
| 673 | #define __DRI_ATTRIB_SAMPLE_BUFFERS 15 |
| 674 | #define __DRI_ATTRIB_SAMPLES 16 |
| 675 | #define __DRI_ATTRIB_RENDER_TYPE 17 |
| 676 | #define __DRI_ATTRIB_CONFIG_CAVEAT 18 |
| 677 | #define __DRI_ATTRIB_CONFORMANT 19 |
| 678 | #define __DRI_ATTRIB_DOUBLE_BUFFER 20 |
| 679 | #define __DRI_ATTRIB_STEREO 21 |
| 680 | #define __DRI_ATTRIB_AUX_BUFFERS 22 |
| 681 | #define __DRI_ATTRIB_TRANSPARENT_TYPE 23 |
| 682 | #define __DRI_ATTRIB_TRANSPARENT_INDEX_VALUE 24 |
| 683 | #define __DRI_ATTRIB_TRANSPARENT_RED_VALUE 25 |
| 684 | #define __DRI_ATTRIB_TRANSPARENT_GREEN_VALUE 26 |
| 685 | #define __DRI_ATTRIB_TRANSPARENT_BLUE_VALUE 27 |
| 686 | #define __DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE 28 |
| 687 | #define __DRI_ATTRIB_FLOAT_MODE 29 |
| 688 | #define __DRI_ATTRIB_RED_MASK 30 |
| 689 | #define __DRI_ATTRIB_GREEN_MASK 31 |
| 690 | #define __DRI_ATTRIB_BLUE_MASK 32 |
| 691 | #define __DRI_ATTRIB_ALPHA_MASK 33 |
| 692 | #define __DRI_ATTRIB_MAX_PBUFFER_WIDTH 34 |
| 693 | #define __DRI_ATTRIB_MAX_PBUFFER_HEIGHT 35 |
| 694 | #define __DRI_ATTRIB_MAX_PBUFFER_PIXELS 36 |
| 695 | #define __DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH 37 |
| 696 | #define __DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT 38 |
| 697 | #define __DRI_ATTRIB_VISUAL_SELECT_GROUP 39 |
| 698 | #define __DRI_ATTRIB_SWAP_METHOD 40 |
| 699 | #define __DRI_ATTRIB_MAX_SWAP_INTERVAL 41 |
| 700 | #define __DRI_ATTRIB_MIN_SWAP_INTERVAL 42 |
| 701 | #define __DRI_ATTRIB_BIND_TO_TEXTURE_RGB 43 |
| 702 | #define __DRI_ATTRIB_BIND_TO_TEXTURE_RGBA 44 |
| 703 | #define __DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE 45 |
| 704 | #define __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS 46 |
| 705 | #define __DRI_ATTRIB_YINVERTED 47 |
Dave Airlie | 476db2b | 2011-01-28 11:44:51 +1000 | [diff] [blame] | 706 | #define __DRI_ATTRIB_FRAMEBUFFER_SRGB_CAPABLE 48 |
Emil Velikov | 2c60bf0 | 2017-05-01 19:37:56 +0100 | [diff] [blame] | 707 | #define __DRI_ATTRIB_MAX (__DRI_ATTRIB_FRAMEBUFFER_SRGB_CAPABLE + 1) |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 708 | |
| 709 | /* __DRI_ATTRIB_RENDER_TYPE */ |
| 710 | #define __DRI_ATTRIB_RGBA_BIT 0x01 |
| 711 | #define __DRI_ATTRIB_COLOR_INDEX_BIT 0x02 |
| 712 | #define __DRI_ATTRIB_LUMINANCE_BIT 0x04 |
Tomasz Lis | c37c367 | 2013-07-17 13:49:21 +0200 | [diff] [blame] | 713 | #define __DRI_ATTRIB_FLOAT_BIT 0x08 |
| 714 | #define __DRI_ATTRIB_UNSIGNED_FLOAT_BIT 0x10 |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 715 | |
| 716 | /* __DRI_ATTRIB_CONFIG_CAVEAT */ |
| 717 | #define __DRI_ATTRIB_SLOW_BIT 0x01 |
| 718 | #define __DRI_ATTRIB_NON_CONFORMANT_CONFIG 0x02 |
| 719 | |
| 720 | /* __DRI_ATTRIB_TRANSPARENT_TYPE */ |
| 721 | #define __DRI_ATTRIB_TRANSPARENT_RGB 0x00 |
| 722 | #define __DRI_ATTRIB_TRANSPARENT_INDEX 0x01 |
| 723 | |
| 724 | /* __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS */ |
| 725 | #define __DRI_ATTRIB_TEXTURE_1D_BIT 0x01 |
| 726 | #define __DRI_ATTRIB_TEXTURE_2D_BIT 0x02 |
| 727 | #define __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT 0x04 |
| 728 | |
Thomas Hellstrom | 2437ebd | 2017-08-09 11:25:10 +0200 | [diff] [blame] | 729 | /* __DRI_ATTRIB_SWAP_METHOD */ |
| 730 | /* Note that with the exception of __DRI_ATTRIB_SWAP_NONE, we need to define |
| 731 | * the same tokens as GLX. This is because old and current X servers will |
| 732 | * transmit the driconf value grabbed from the AIGLX driver untranslated as |
| 733 | * the GLX fbconfig value. __DRI_ATTRIB_SWAP_NONE is only used by dri drivers |
| 734 | * to signal to the dri core that the driconfig is single-buffer. |
| 735 | */ |
| 736 | #define __DRI_ATTRIB_SWAP_NONE 0x0000 |
| 737 | #define __DRI_ATTRIB_SWAP_EXCHANGE 0x8061 |
| 738 | #define __DRI_ATTRIB_SWAP_COPY 0x8062 |
| 739 | #define __DRI_ATTRIB_SWAP_UNDEFINED 0x8063 |
| 740 | |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 741 | /** |
| 742 | * This extension defines the core DRI functionality. |
Thomas Hellstrom | 08bee3e | 2017-08-09 10:50:23 +0200 | [diff] [blame] | 743 | * |
| 744 | * Version >= 2 indicates that getConfigAttrib with __DRI_ATTRIB_SWAP_METHOD |
| 745 | * returns a reliable value. |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 746 | */ |
| 747 | #define __DRI_CORE "DRI_Core" |
Thomas Hellstrom | 08bee3e | 2017-08-09 10:50:23 +0200 | [diff] [blame] | 748 | #define __DRI_CORE_VERSION 2 |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 749 | |
| 750 | struct __DRIcoreExtensionRec { |
| 751 | __DRIextension base; |
| 752 | |
| 753 | __DRIscreen *(*createNewScreen)(int screen, int fd, |
| 754 | unsigned int sarea_handle, |
| 755 | const __DRIextension **extensions, |
| 756 | const __DRIconfig ***driverConfigs, |
| 757 | void *loaderPrivate); |
| 758 | |
| 759 | void (*destroyScreen)(__DRIscreen *screen); |
| 760 | |
| 761 | const __DRIextension **(*getExtensions)(__DRIscreen *screen); |
| 762 | |
| 763 | int (*getConfigAttrib)(const __DRIconfig *config, |
| 764 | unsigned int attrib, |
| 765 | unsigned int *value); |
| 766 | |
| 767 | int (*indexConfigAttrib)(const __DRIconfig *config, int index, |
| 768 | unsigned int *attrib, unsigned int *value); |
| 769 | |
| 770 | __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen, |
| 771 | const __DRIconfig *config, |
| 772 | unsigned int drawable_id, |
| 773 | unsigned int head, |
| 774 | void *loaderPrivate); |
| 775 | |
| 776 | void (*destroyDrawable)(__DRIdrawable *drawable); |
| 777 | |
| 778 | void (*swapBuffers)(__DRIdrawable *drawable); |
| 779 | |
| 780 | __DRIcontext *(*createNewContext)(__DRIscreen *screen, |
| 781 | const __DRIconfig *config, |
| 782 | __DRIcontext *shared, |
| 783 | void *loaderPrivate); |
| 784 | |
| 785 | int (*copyContext)(__DRIcontext *dest, |
| 786 | __DRIcontext *src, |
| 787 | unsigned long mask); |
| 788 | |
| 789 | void (*destroyContext)(__DRIcontext *context); |
| 790 | |
| 791 | int (*bindContext)(__DRIcontext *ctx, |
| 792 | __DRIdrawable *pdraw, |
| 793 | __DRIdrawable *pread); |
| 794 | |
| 795 | int (*unbindContext)(__DRIcontext *ctx); |
| 796 | }; |
| 797 | |
| 798 | /** |
| 799 | * Stored version of some component (i.e., server-side DRI module, kernel-side |
| 800 | * DRM, etc.). |
| 801 | * |
| 802 | * \todo |
| 803 | * There are several data structures that explicitly store a major version, |
| 804 | * minor version, and patch level. These structures should be modified to |
| 805 | * have a \c __DRIversionRec instead. |
| 806 | */ |
| 807 | struct __DRIversionRec { |
| 808 | int major; /**< Major version number. */ |
| 809 | int minor; /**< Minor version number. */ |
| 810 | int patch; /**< Patch-level. */ |
| 811 | }; |
| 812 | |
Brian Paul | 192c988 | 2004-03-22 23:31:29 +0000 | [diff] [blame] | 813 | /** |
| 814 | * Framebuffer information record. Used by libGL to communicate information |
| 815 | * about the framebuffer to the driver's \c __driCreateNewScreen function. |
| 816 | * |
| 817 | * In XFree86, most of this information is derrived from data returned by |
| 818 | * calling \c XF86DRIGetDeviceInfo. |
| 819 | * |
| 820 | * \sa XF86DRIGetDeviceInfo __DRIdisplayRec::createNewScreen |
| 821 | * __driUtilCreateNewScreen CallCreateNewScreen |
| 822 | * |
| 823 | * \bug This structure could be better named. |
| 824 | */ |
| 825 | struct __DRIframebufferRec { |
| 826 | unsigned char *base; /**< Framebuffer base address in the CPU's |
| 827 | * address space. This value is calculated by |
| 828 | * calling \c drmMap on the framebuffer handle |
| 829 | * returned by \c XF86DRIGetDeviceInfo (or a |
| 830 | * similar function). |
| 831 | */ |
| 832 | int size; /**< Framebuffer size, in bytes. */ |
| 833 | int stride; /**< Number of bytes from one line to the next. */ |
| 834 | int width; /**< Pixel width of the framebuffer. */ |
| 835 | int height; /**< Pixel height of the framebuffer. */ |
| 836 | int dev_priv_size; /**< Size of the driver's dev-priv structure. */ |
| 837 | void *dev_priv; /**< Pointer to the driver's dev-priv structure. */ |
| 838 | }; |
| 839 | |
| 840 | |
| 841 | /** |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 842 | * This extension provides alternative screen, drawable and context |
| 843 | * constructors for legacy DRI functionality. This is used in |
| 844 | * conjunction with the core extension. |
Brian Paul | 192c988 | 2004-03-22 23:31:29 +0000 | [diff] [blame] | 845 | */ |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 846 | #define __DRI_LEGACY "DRI_Legacy" |
| 847 | #define __DRI_LEGACY_VERSION 1 |
Brian Paul | 192c988 | 2004-03-22 23:31:29 +0000 | [diff] [blame] | 848 | |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 849 | struct __DRIlegacyExtensionRec { |
| 850 | __DRIextension base; |
Kristian Høgsberg | f616a26 | 2007-05-15 12:31:31 -0400 | [diff] [blame] | 851 | |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 852 | __DRIscreen *(*createNewScreen)(int screen, |
| 853 | const __DRIversion *ddx_version, |
| 854 | const __DRIversion *dri_version, |
| 855 | const __DRIversion *drm_version, |
| 856 | const __DRIframebuffer *frame_buffer, |
| 857 | void *pSAREA, int fd, |
| 858 | const __DRIextension **extensions, |
| 859 | const __DRIconfig ***driver_configs, |
| 860 | void *loaderPrivate); |
Brian Paul | 192c988 | 2004-03-22 23:31:29 +0000 | [diff] [blame] | 861 | |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 862 | __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen, |
| 863 | const __DRIconfig *config, |
| 864 | drm_drawable_t hwDrawable, |
| 865 | int renderType, const int *attrs, |
| 866 | void *loaderPrivate); |
Brian Paul | 192c988 | 2004-03-22 23:31:29 +0000 | [diff] [blame] | 867 | |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 868 | __DRIcontext *(*createNewContext)(__DRIscreen *screen, |
| 869 | const __DRIconfig *config, |
| 870 | int render_type, |
| 871 | __DRIcontext *shared, |
| 872 | drm_context_t hwContext, |
| 873 | void *loaderPrivate); |
Brian Paul | 192c988 | 2004-03-22 23:31:29 +0000 | [diff] [blame] | 874 | }; |
Keith Whitwell | 74d563c | 2004-04-29 12:23:39 +0000 | [diff] [blame] | 875 | |
George Sapountzis | 280bf89 | 2008-05-11 14:43:40 +0300 | [diff] [blame] | 876 | /** |
| 877 | * This extension provides alternative screen, drawable and context |
| 878 | * constructors for swrast DRI functionality. This is used in |
| 879 | * conjunction with the core extension. |
| 880 | */ |
| 881 | #define __DRI_SWRAST "DRI_SWRast" |
Eric Anholt | f93533d | 2013-09-27 11:39:25 -0700 | [diff] [blame] | 882 | #define __DRI_SWRAST_VERSION 4 |
George Sapountzis | 280bf89 | 2008-05-11 14:43:40 +0300 | [diff] [blame] | 883 | |
| 884 | struct __DRIswrastExtensionRec { |
| 885 | __DRIextension base; |
| 886 | |
| 887 | __DRIscreen *(*createNewScreen)(int screen, |
| 888 | const __DRIextension **extensions, |
| 889 | const __DRIconfig ***driver_configs, |
| 890 | void *loaderPrivate); |
| 891 | |
| 892 | __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen, |
| 893 | const __DRIconfig *config, |
| 894 | void *loaderPrivate); |
Haitao Feng | b43a147 | 2011-01-30 16:03:35 +0800 | [diff] [blame] | 895 | |
| 896 | /* Since version 2 */ |
| 897 | __DRIcontext *(*createNewContextForAPI)(__DRIscreen *screen, |
| 898 | int api, |
| 899 | const __DRIconfig *config, |
| 900 | __DRIcontext *shared, |
| 901 | void *data); |
Ian Romanick | b5b2081 | 2011-12-01 13:56:38 -0800 | [diff] [blame] | 902 | |
| 903 | /** |
| 904 | * Create a context for a particular API with a set of attributes |
| 905 | * |
| 906 | * \since version 3 |
| 907 | * |
| 908 | * \sa __DRIdri2ExtensionRec::createContextAttribs |
| 909 | */ |
| 910 | __DRIcontext *(*createContextAttribs)(__DRIscreen *screen, |
| 911 | int api, |
| 912 | const __DRIconfig *config, |
| 913 | __DRIcontext *shared, |
| 914 | unsigned num_attribs, |
| 915 | const uint32_t *attribs, |
| 916 | unsigned *error, |
| 917 | void *loaderPrivate); |
Eric Anholt | f93533d | 2013-09-27 11:39:25 -0700 | [diff] [blame] | 918 | |
| 919 | /** |
| 920 | * createNewScreen() with the driver extensions passed in. |
| 921 | * |
| 922 | * \since version 4 |
| 923 | */ |
| 924 | __DRIscreen *(*createNewScreen2)(int screen, |
| 925 | const __DRIextension **loader_extensions, |
| 926 | const __DRIextension **driver_extensions, |
| 927 | const __DRIconfig ***driver_configs, |
| 928 | void *loaderPrivate); |
| 929 | |
George Sapountzis | 280bf89 | 2008-05-11 14:43:40 +0300 | [diff] [blame] | 930 | }; |
| 931 | |
Keith Packard | f66a6c5 | 2013-06-03 20:49:25 -0700 | [diff] [blame] | 932 | /** Common DRI function definitions, shared among DRI2 and Image extensions |
| 933 | */ |
| 934 | |
| 935 | typedef __DRIscreen * |
| 936 | (*__DRIcreateNewScreen2Func)(int screen, int fd, |
| 937 | const __DRIextension **extensions, |
| 938 | const __DRIextension **driver_extensions, |
| 939 | const __DRIconfig ***driver_configs, |
| 940 | void *loaderPrivate); |
| 941 | |
| 942 | typedef __DRIdrawable * |
| 943 | (*__DRIcreateNewDrawableFunc)(__DRIscreen *screen, |
| 944 | const __DRIconfig *config, |
| 945 | void *loaderPrivate); |
| 946 | |
| 947 | typedef __DRIcontext * |
Keith Packard | f66a6c5 | 2013-06-03 20:49:25 -0700 | [diff] [blame] | 948 | (*__DRIcreateContextAttribsFunc)(__DRIscreen *screen, |
| 949 | int api, |
| 950 | const __DRIconfig *config, |
| 951 | __DRIcontext *shared, |
| 952 | unsigned num_attribs, |
| 953 | const uint32_t *attribs, |
| 954 | unsigned *error, |
| 955 | void *loaderPrivate); |
| 956 | |
| 957 | typedef unsigned int |
| 958 | (*__DRIgetAPIMaskFunc)(__DRIscreen *screen); |
| 959 | |
Kristian Høgsberg | f56b569 | 2008-08-13 11:46:25 -0400 | [diff] [blame] | 960 | /** |
| 961 | * DRI2 Loader extension. |
| 962 | */ |
| 963 | #define __DRI_BUFFER_FRONT_LEFT 0 |
| 964 | #define __DRI_BUFFER_BACK_LEFT 1 |
| 965 | #define __DRI_BUFFER_FRONT_RIGHT 2 |
| 966 | #define __DRI_BUFFER_BACK_RIGHT 3 |
| 967 | #define __DRI_BUFFER_DEPTH 4 |
| 968 | #define __DRI_BUFFER_STENCIL 5 |
| 969 | #define __DRI_BUFFER_ACCUM 6 |
Alan Hourihane | 396711b | 2009-01-19 15:40:30 +0000 | [diff] [blame] | 970 | #define __DRI_BUFFER_FAKE_FRONT_LEFT 7 |
| 971 | #define __DRI_BUFFER_FAKE_FRONT_RIGHT 8 |
Ian Romanick | dbf87f2 | 2009-04-20 20:55:56 -0700 | [diff] [blame] | 972 | #define __DRI_BUFFER_DEPTH_STENCIL 9 /**< Only available with DRI2 1.1 */ |
Chad Versace | 4501a5d | 2011-05-26 16:50:30 -0700 | [diff] [blame] | 973 | #define __DRI_BUFFER_HIZ 10 |
Kristian Høgsberg | f56b569 | 2008-08-13 11:46:25 -0400 | [diff] [blame] | 974 | |
Benjamin Franzke | 8c40940 | 2011-08-15 09:50:19 +0200 | [diff] [blame] | 975 | /* Inofficial and for internal use. Increase when adding a new buffer token. */ |
| 976 | #define __DRI_BUFFER_COUNT 11 |
| 977 | |
Kristian Høgsberg | f56b569 | 2008-08-13 11:46:25 -0400 | [diff] [blame] | 978 | struct __DRIbufferRec { |
| 979 | unsigned int attachment; |
| 980 | unsigned int name; |
| 981 | unsigned int pitch; |
| 982 | unsigned int cpp; |
| 983 | unsigned int flags; |
| 984 | }; |
| 985 | |
| 986 | #define __DRI_DRI2_LOADER "DRI_DRI2Loader" |
Marek Olšák | 1bf703e | 2017-07-28 17:30:34 +0200 | [diff] [blame] | 987 | #define __DRI_DRI2_LOADER_VERSION 4 |
| 988 | |
| 989 | enum dri_loader_cap { |
| 990 | /* Whether the loader handles RGBA channel ordering correctly. If not, |
| 991 | * only BGRA ordering can be exposed. |
| 992 | */ |
| 993 | DRI_LOADER_CAP_RGBA_ORDERING, |
| 994 | }; |
| 995 | |
Kristian Høgsberg | f56b569 | 2008-08-13 11:46:25 -0400 | [diff] [blame] | 996 | struct __DRIdri2LoaderExtensionRec { |
| 997 | __DRIextension base; |
| 998 | |
| 999 | __DRIbuffer *(*getBuffers)(__DRIdrawable *driDrawable, |
| 1000 | int *width, int *height, |
| 1001 | unsigned int *attachments, int count, |
| 1002 | int *out_count, void *loaderPrivate); |
Ian Romanick | 82634ee | 2009-04-06 12:44:18 -0700 | [diff] [blame] | 1003 | |
| 1004 | /** |
| 1005 | * Flush pending front-buffer rendering |
| 1006 | * |
| 1007 | * Any rendering that has been performed to the |
| 1008 | * \c __DRI_BUFFER_FAKE_FRONT_LEFT will be flushed to the |
| 1009 | * \c __DRI_BUFFER_FRONT_LEFT. |
| 1010 | * |
| 1011 | * \param driDrawable Drawable whose front-buffer is to be flushed |
| 1012 | * \param loaderPrivate Loader's private data that was previously passed |
| 1013 | * into __DRIdri2ExtensionRec::createNewDrawable |
Emil Velikov | 6dffab2 | 2014-02-12 19:05:08 +0000 | [diff] [blame] | 1014 | * |
| 1015 | * \since 2 |
Ian Romanick | 82634ee | 2009-04-06 12:44:18 -0700 | [diff] [blame] | 1016 | */ |
| 1017 | void (*flushFrontBuffer)(__DRIdrawable *driDrawable, void *loaderPrivate); |
Ian Romanick | dbf87f2 | 2009-04-20 20:55:56 -0700 | [diff] [blame] | 1018 | |
| 1019 | |
| 1020 | /** |
| 1021 | * Get list of buffers from the server |
| 1022 | * |
| 1023 | * Gets a list of buffer for the specified set of attachments. Unlike |
| 1024 | * \c ::getBuffers, this function takes a list of attachments paired with |
| 1025 | * opaque \c unsigned \c int value describing the format of the buffer. |
| 1026 | * It is the responsibility of the caller to know what the service that |
| 1027 | * allocates the buffers will expect to receive for the format. |
| 1028 | * |
| 1029 | * \param driDrawable Drawable whose buffers are being queried. |
| 1030 | * \param width Output where the width of the buffers is stored. |
| 1031 | * \param height Output where the height of the buffers is stored. |
| 1032 | * \param attachments List of pairs of attachment ID and opaque format |
| 1033 | * requested for the drawable. |
| 1034 | * \param count Number of attachment / format pairs stored in |
| 1035 | * \c attachments. |
| 1036 | * \param loaderPrivate Loader's private data that was previously passed |
| 1037 | * into __DRIdri2ExtensionRec::createNewDrawable. |
Emil Velikov | 6dffab2 | 2014-02-12 19:05:08 +0000 | [diff] [blame] | 1038 | * |
| 1039 | * \since 3 |
Ian Romanick | dbf87f2 | 2009-04-20 20:55:56 -0700 | [diff] [blame] | 1040 | */ |
| 1041 | __DRIbuffer *(*getBuffersWithFormat)(__DRIdrawable *driDrawable, |
| 1042 | int *width, int *height, |
| 1043 | unsigned int *attachments, int count, |
| 1044 | int *out_count, void *loaderPrivate); |
Marek Olšák | 1bf703e | 2017-07-28 17:30:34 +0200 | [diff] [blame] | 1045 | |
| 1046 | /** |
| 1047 | * Return a loader capability value. If the loader doesn't know the enum, |
| 1048 | * it will return 0. |
| 1049 | * |
Marek Olšák | 6d37bcd | 2017-07-31 18:21:15 +0200 | [diff] [blame] | 1050 | * \param loaderPrivate The last parameter of createNewScreen or |
| 1051 | * createNewScreen2. |
| 1052 | * \param cap See the enum. |
| 1053 | * |
Marek Olšák | 1bf703e | 2017-07-28 17:30:34 +0200 | [diff] [blame] | 1054 | * \since 4 |
| 1055 | */ |
| 1056 | unsigned (*getCapability)(void *loaderPrivate, enum dri_loader_cap cap); |
Kristian Høgsberg | f56b569 | 2008-08-13 11:46:25 -0400 | [diff] [blame] | 1057 | }; |
| 1058 | |
| 1059 | /** |
| 1060 | * This extension provides alternative screen, drawable and context |
| 1061 | * constructors for DRI2. |
| 1062 | */ |
| 1063 | #define __DRI_DRI2 "DRI_DRI2" |
Eric Anholt | f93533d | 2013-09-27 11:39:25 -0700 | [diff] [blame] | 1064 | #define __DRI_DRI2_VERSION 4 |
Kristian Høgsberg | a7a9a91 | 2010-04-27 11:04:51 -0400 | [diff] [blame] | 1065 | |
Ian Romanick | 1ab5454 | 2011-11-30 12:16:19 -0800 | [diff] [blame] | 1066 | #define __DRI_API_OPENGL 0 /**< OpenGL compatibility profile */ |
Ian Romanick | a2ce2eb | 2012-07-18 14:29:29 -0700 | [diff] [blame] | 1067 | #define __DRI_API_GLES 1 /**< OpenGL ES 1.x */ |
Chad Versace | e90c08e | 2012-11-20 13:27:14 -0800 | [diff] [blame] | 1068 | #define __DRI_API_GLES2 2 /**< OpenGL ES 2.x */ |
Ian Romanick | 1ab5454 | 2011-11-30 12:16:19 -0800 | [diff] [blame] | 1069 | #define __DRI_API_OPENGL_CORE 3 /**< OpenGL 3.2+ core profile */ |
Chad Versace | e90c08e | 2012-11-20 13:27:14 -0800 | [diff] [blame] | 1070 | #define __DRI_API_GLES3 4 /**< OpenGL ES 3.x */ |
Ian Romanick | 1ab5454 | 2011-11-30 12:16:19 -0800 | [diff] [blame] | 1071 | |
| 1072 | #define __DRI_CTX_ATTRIB_MAJOR_VERSION 0 |
| 1073 | #define __DRI_CTX_ATTRIB_MINOR_VERSION 1 |
| 1074 | #define __DRI_CTX_ATTRIB_FLAGS 2 |
| 1075 | |
Ian Romanick | a8724d8 | 2012-07-03 11:32:59 -0700 | [diff] [blame] | 1076 | /** |
| 1077 | * \requires __DRI2_ROBUSTNESS. |
| 1078 | */ |
| 1079 | #define __DRI_CTX_ATTRIB_RESET_STRATEGY 3 |
| 1080 | |
Ian Romanick | 1ab5454 | 2011-11-30 12:16:19 -0800 | [diff] [blame] | 1081 | #define __DRI_CTX_FLAG_DEBUG 0x00000001 |
| 1082 | #define __DRI_CTX_FLAG_FORWARD_COMPATIBLE 0x00000002 |
| 1083 | |
| 1084 | /** |
Ian Romanick | a8724d8 | 2012-07-03 11:32:59 -0700 | [diff] [blame] | 1085 | * \requires __DRI2_ROBUSTNESS. |
| 1086 | */ |
| 1087 | #define __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS 0x00000004 |
| 1088 | |
| 1089 | /** |
Grigori Goronzy | 7299e82 | 2017-06-29 03:24:15 +0200 | [diff] [blame] | 1090 | * \requires __DRI2_NO_ERROR. |
| 1091 | * |
| 1092 | */ |
| 1093 | #define __DRI_CTX_FLAG_NO_ERROR 0x00000008 |
| 1094 | |
| 1095 | /** |
Ian Romanick | a8724d8 | 2012-07-03 11:32:59 -0700 | [diff] [blame] | 1096 | * \name Context reset strategies. |
| 1097 | */ |
| 1098 | /*@{*/ |
| 1099 | #define __DRI_CTX_RESET_NO_NOTIFICATION 0 |
| 1100 | #define __DRI_CTX_RESET_LOSE_CONTEXT 1 |
| 1101 | /*@}*/ |
| 1102 | |
| 1103 | /** |
Ian Romanick | 1ab5454 | 2011-11-30 12:16:19 -0800 | [diff] [blame] | 1104 | * \name Reasons that __DRIdri2Extension::createContextAttribs might fail |
| 1105 | */ |
| 1106 | /*@{*/ |
| 1107 | /** Success! */ |
| 1108 | #define __DRI_CTX_ERROR_SUCCESS 0 |
| 1109 | |
| 1110 | /** Memory allocation failure */ |
| 1111 | #define __DRI_CTX_ERROR_NO_MEMORY 1 |
| 1112 | |
| 1113 | /** Client requested an API (e.g., OpenGL ES 2.0) that the driver can't do. */ |
| 1114 | #define __DRI_CTX_ERROR_BAD_API 2 |
| 1115 | |
| 1116 | /** Client requested an API version that the driver can't do. */ |
| 1117 | #define __DRI_CTX_ERROR_BAD_VERSION 3 |
| 1118 | |
| 1119 | /** Client requested a flag or combination of flags the driver can't do. */ |
| 1120 | #define __DRI_CTX_ERROR_BAD_FLAG 4 |
| 1121 | |
| 1122 | /** Client requested an attribute the driver doesn't understand. */ |
| 1123 | #define __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE 5 |
| 1124 | |
| 1125 | /** Client requested a flag the driver doesn't understand. */ |
| 1126 | #define __DRI_CTX_ERROR_UNKNOWN_FLAG 6 |
| 1127 | /*@}*/ |
Kristian Høgsberg | f56b569 | 2008-08-13 11:46:25 -0400 | [diff] [blame] | 1128 | |
| 1129 | struct __DRIdri2ExtensionRec { |
| 1130 | __DRIextension base; |
| 1131 | |
| 1132 | __DRIscreen *(*createNewScreen)(int screen, int fd, |
| 1133 | const __DRIextension **extensions, |
| 1134 | const __DRIconfig ***driver_configs, |
| 1135 | void *loaderPrivate); |
| 1136 | |
Keith Packard | f66a6c5 | 2013-06-03 20:49:25 -0700 | [diff] [blame] | 1137 | __DRIcreateNewDrawableFunc createNewDrawable; |
Kristian Høgsberg | e048953 | 2013-11-11 16:35:35 -0800 | [diff] [blame] | 1138 | __DRIcontext *(*createNewContext)(__DRIscreen *screen, |
| 1139 | const __DRIconfig *config, |
| 1140 | __DRIcontext *shared, |
| 1141 | void *loaderPrivate); |
Kristian Høgsberg | f56b569 | 2008-08-13 11:46:25 -0400 | [diff] [blame] | 1142 | |
Kristian Høgsberg | a7a9a91 | 2010-04-27 11:04:51 -0400 | [diff] [blame] | 1143 | /* Since version 2 */ |
Keith Packard | f66a6c5 | 2013-06-03 20:49:25 -0700 | [diff] [blame] | 1144 | __DRIgetAPIMaskFunc getAPIMask; |
Kristian Høgsberg | a7a9a91 | 2010-04-27 11:04:51 -0400 | [diff] [blame] | 1145 | |
| 1146 | __DRIcontext *(*createNewContextForAPI)(__DRIscreen *screen, |
| 1147 | int api, |
| 1148 | const __DRIconfig *config, |
| 1149 | __DRIcontext *shared, |
| 1150 | void *data); |
Benjamin Franzke | 1b8ef94 | 2011-02-04 11:59:12 +0100 | [diff] [blame] | 1151 | |
| 1152 | __DRIbuffer *(*allocateBuffer)(__DRIscreen *screen, |
| 1153 | unsigned int attachment, |
| 1154 | unsigned int format, |
| 1155 | int width, |
| 1156 | int height); |
| 1157 | void (*releaseBuffer)(__DRIscreen *screen, |
| 1158 | __DRIbuffer *buffer); |
Ian Romanick | 1ab5454 | 2011-11-30 12:16:19 -0800 | [diff] [blame] | 1159 | |
| 1160 | /** |
| 1161 | * Create a context for a particular API with a set of attributes |
| 1162 | * |
| 1163 | * \since version 3 |
Ian Romanick | b5b2081 | 2011-12-01 13:56:38 -0800 | [diff] [blame] | 1164 | * |
| 1165 | * \sa __DRIswrastExtensionRec::createContextAttribs |
Ian Romanick | 1ab5454 | 2011-11-30 12:16:19 -0800 | [diff] [blame] | 1166 | */ |
Keith Packard | f66a6c5 | 2013-06-03 20:49:25 -0700 | [diff] [blame] | 1167 | __DRIcreateContextAttribsFunc createContextAttribs; |
Eric Anholt | f93533d | 2013-09-27 11:39:25 -0700 | [diff] [blame] | 1168 | |
| 1169 | /** |
| 1170 | * createNewScreen with the driver's extension list passed in. |
| 1171 | * |
| 1172 | * \since version 4 |
| 1173 | */ |
Keith Packard | f66a6c5 | 2013-06-03 20:49:25 -0700 | [diff] [blame] | 1174 | __DRIcreateNewScreen2Func createNewScreen2; |
Kristian Høgsberg | f56b569 | 2008-08-13 11:46:25 -0400 | [diff] [blame] | 1175 | }; |
| 1176 | |
Kristian Høgsberg | 79cbcb6 | 2010-02-11 17:45:24 -0500 | [diff] [blame] | 1177 | |
| 1178 | /** |
| 1179 | * This extension provides functionality to enable various EGLImage |
| 1180 | * extensions. |
| 1181 | */ |
| 1182 | #define __DRI_IMAGE "DRI_IMAGE" |
Nicolai Hähnle | f12e1c5 | 2017-10-10 13:58:46 +0200 | [diff] [blame] | 1183 | #define __DRI_IMAGE_VERSION 17 |
Kristian Høgsberg | 79cbcb6 | 2010-02-11 17:45:24 -0500 | [diff] [blame] | 1184 | |
| 1185 | /** |
| 1186 | * These formats correspond to the similarly named MESA_FORMAT_* |
| 1187 | * tokens, except in the native endian of the CPU. For example, on |
| 1188 | * little endian __DRI_IMAGE_FORMAT_XRGB8888 corresponds to |
| 1189 | * MESA_FORMAT_XRGB8888, but MESA_FORMAT_XRGB8888_REV on big endian. |
Kristian Høgsberg | c029834 | 2012-07-04 22:56:09 -0400 | [diff] [blame] | 1190 | * |
| 1191 | * __DRI_IMAGE_FORMAT_NONE is for images that aren't directly usable |
| 1192 | * by the driver (YUV planar formats) but serve as a base image for |
| 1193 | * creating sub-images for the different planes within the image. |
Jakob Bornecrantz | 6a7dea9 | 2012-08-31 19:48:26 +0200 | [diff] [blame] | 1194 | * |
Gwan-gyeong Mun | c875945 | 2017-08-11 01:18:57 +0900 | [diff] [blame] | 1195 | * R8, GR88 and NONE should not be used with createImageFromName or |
Jakob Bornecrantz | 6a7dea9 | 2012-08-31 19:48:26 +0200 | [diff] [blame] | 1196 | * createImage, and are returned by query from sub images created with |
| 1197 | * createImageFromNames (NONE, see above) and fromPlane (R8 & GR88). |
Kristian Høgsberg | 79cbcb6 | 2010-02-11 17:45:24 -0500 | [diff] [blame] | 1198 | */ |
| 1199 | #define __DRI_IMAGE_FORMAT_RGB565 0x1001 |
| 1200 | #define __DRI_IMAGE_FORMAT_XRGB8888 0x1002 |
| 1201 | #define __DRI_IMAGE_FORMAT_ARGB8888 0x1003 |
Chia-I Wu | e3cf7b6 | 2011-08-21 21:22:41 +0800 | [diff] [blame] | 1202 | #define __DRI_IMAGE_FORMAT_ABGR8888 0x1004 |
Sean V Kelley | 81f95ce | 2012-04-24 07:49:09 -0700 | [diff] [blame] | 1203 | #define __DRI_IMAGE_FORMAT_XBGR8888 0x1005 |
Kristian Høgsberg | c029834 | 2012-07-04 22:56:09 -0400 | [diff] [blame] | 1204 | #define __DRI_IMAGE_FORMAT_R8 0x1006 /* Since version 5 */ |
| 1205 | #define __DRI_IMAGE_FORMAT_GR88 0x1007 |
| 1206 | #define __DRI_IMAGE_FORMAT_NONE 0x1008 |
Kristian Høgsberg | 3160ec3 | 2013-09-14 23:31:08 -0700 | [diff] [blame] | 1207 | #define __DRI_IMAGE_FORMAT_XRGB2101010 0x1009 |
| 1208 | #define __DRI_IMAGE_FORMAT_ARGB2101010 0x100a |
Keith Packard | aba6b84 | 2013-11-04 17:27:43 -0800 | [diff] [blame] | 1209 | #define __DRI_IMAGE_FORMAT_SARGB8 0x100b |
Chad Versace | 9aa6ab0 | 2016-12-22 14:44:47 -0800 | [diff] [blame] | 1210 | #define __DRI_IMAGE_FORMAT_ARGB1555 0x100c |
Rainer Hochecker | 09b140a | 2017-01-05 16:58:56 +0100 | [diff] [blame] | 1211 | #define __DRI_IMAGE_FORMAT_R16 0x100d |
| 1212 | #define __DRI_IMAGE_FORMAT_GR1616 0x100e |
Kristian Høgsberg | 79cbcb6 | 2010-02-11 17:45:24 -0500 | [diff] [blame] | 1213 | |
Kristian Høgsberg | 5aaa53e | 2010-06-03 21:36:40 -0400 | [diff] [blame] | 1214 | #define __DRI_IMAGE_USE_SHARE 0x0001 |
| 1215 | #define __DRI_IMAGE_USE_SCANOUT 0x0002 |
Eric Engestrom | 39f3e25 | 2017-08-17 10:09:21 +0100 | [diff] [blame] | 1216 | #define __DRI_IMAGE_USE_CURSOR 0x0004 /* Deprecated */ |
Axel Davy | e8f9195 | 2013-08-15 12:47:58 +0200 | [diff] [blame] | 1217 | #define __DRI_IMAGE_USE_LINEAR 0x0008 |
Axel Davy | d943ac4 | 2015-10-21 12:28:00 +0200 | [diff] [blame] | 1218 | /* The buffer will only be read by an external process after SwapBuffers, |
| 1219 | * in contrary to gbm buffers, front buffers and fake front buffers, which |
| 1220 | * could be read after a flush." |
| 1221 | */ |
| 1222 | #define __DRI_IMAGE_USE_BACKBUFFER 0x0010 |
Kristian Høgsberg | 5aaa53e | 2010-06-03 21:36:40 -0400 | [diff] [blame] | 1223 | |
Jakob Bornecrantz | 6a7dea9 | 2012-08-31 19:48:26 +0200 | [diff] [blame] | 1224 | |
Rob Herring | a0f06f1 | 2016-05-03 21:02:43 -0500 | [diff] [blame] | 1225 | #define __DRI_IMAGE_TRANSFER_READ 0x1 |
| 1226 | #define __DRI_IMAGE_TRANSFER_WRITE 0x2 |
| 1227 | #define __DRI_IMAGE_TRANSFER_READ_WRITE \ |
| 1228 | (__DRI_IMAGE_TRANSFER_READ | __DRI_IMAGE_TRANSFER_WRITE) |
| 1229 | |
Jakob Bornecrantz | 6a7dea9 | 2012-08-31 19:48:26 +0200 | [diff] [blame] | 1230 | /** |
Chad Versace | 56f1f47 | 2015-06-23 15:48:40 -0700 | [diff] [blame] | 1231 | * Four CC formats that matches with WL_DRM_FORMAT_* from wayland_drm.h, |
| 1232 | * GBM_FORMAT_* from gbm.h, and DRM_FORMAT_* from drm_fourcc.h. Used with |
| 1233 | * createImageFromNames. |
Jakob Bornecrantz | 6a7dea9 | 2012-08-31 19:48:26 +0200 | [diff] [blame] | 1234 | * |
| 1235 | * \since 5 |
| 1236 | */ |
| 1237 | |
Chad Versace | 56f1f47 | 2015-06-23 15:48:40 -0700 | [diff] [blame] | 1238 | #define __DRI_IMAGE_FOURCC_R8 0x20203852 |
| 1239 | #define __DRI_IMAGE_FOURCC_GR88 0x38385247 |
Chad Versace | 9aa6ab0 | 2016-12-22 14:44:47 -0800 | [diff] [blame] | 1240 | #define __DRI_IMAGE_FOURCC_ARGB1555 0x35315241 |
Rainer Hochecker | 09b140a | 2017-01-05 16:58:56 +0100 | [diff] [blame] | 1241 | #define __DRI_IMAGE_FOURCC_R16 0x20363152 |
| 1242 | #define __DRI_IMAGE_FOURCC_GR1616 0x32335247 |
Jakob Bornecrantz | 6a7dea9 | 2012-08-31 19:48:26 +0200 | [diff] [blame] | 1243 | #define __DRI_IMAGE_FOURCC_RGB565 0x36314752 |
| 1244 | #define __DRI_IMAGE_FOURCC_ARGB8888 0x34325241 |
| 1245 | #define __DRI_IMAGE_FOURCC_XRGB8888 0x34325258 |
| 1246 | #define __DRI_IMAGE_FOURCC_ABGR8888 0x34324241 |
| 1247 | #define __DRI_IMAGE_FOURCC_XBGR8888 0x34324258 |
Keith Packard | aea4757 | 2013-11-21 20:08:35 -0800 | [diff] [blame] | 1248 | #define __DRI_IMAGE_FOURCC_SARGB8888 0x83324258 |
Jakob Bornecrantz | 6a7dea9 | 2012-08-31 19:48:26 +0200 | [diff] [blame] | 1249 | #define __DRI_IMAGE_FOURCC_YUV410 0x39565559 |
| 1250 | #define __DRI_IMAGE_FOURCC_YUV411 0x31315559 |
| 1251 | #define __DRI_IMAGE_FOURCC_YUV420 0x32315559 |
| 1252 | #define __DRI_IMAGE_FOURCC_YUV422 0x36315559 |
| 1253 | #define __DRI_IMAGE_FOURCC_YUV444 0x34325559 |
| 1254 | #define __DRI_IMAGE_FOURCC_NV12 0x3231564e |
| 1255 | #define __DRI_IMAGE_FOURCC_NV16 0x3631564e |
| 1256 | #define __DRI_IMAGE_FOURCC_YUYV 0x56595559 |
Johnson Lin | 194205c | 2017-06-16 13:34:02 +0800 | [diff] [blame] | 1257 | #define __DRI_IMAGE_FOURCC_UYVY 0x59565955 |
Jakob Bornecrantz | 6a7dea9 | 2012-08-31 19:48:26 +0200 | [diff] [blame] | 1258 | |
Kristian Høgsberg Kristensen | 2bb935b | 2016-04-27 15:00:54 -0700 | [diff] [blame] | 1259 | #define __DRI_IMAGE_FOURCC_YVU410 0x39555659 |
| 1260 | #define __DRI_IMAGE_FOURCC_YVU411 0x31315659 |
| 1261 | #define __DRI_IMAGE_FOURCC_YVU420 0x32315659 |
| 1262 | #define __DRI_IMAGE_FOURCC_YVU422 0x36315659 |
| 1263 | #define __DRI_IMAGE_FOURCC_YVU444 0x34325659 |
Jakob Bornecrantz | 6a7dea9 | 2012-08-31 19:48:26 +0200 | [diff] [blame] | 1264 | |
| 1265 | /** |
| 1266 | * Queryable on images created by createImageFromNames. |
| 1267 | * |
| 1268 | * RGB and RGBA are may be usable directly as images but its still |
| 1269 | * recommended to call fromPlanar with plane == 0. |
| 1270 | * |
Johnson Lin | 194205c | 2017-06-16 13:34:02 +0800 | [diff] [blame] | 1271 | * Y_U_V, Y_UV,Y_XUXV and Y_UXVX all requires call to fromPlanar to create |
Jakob Bornecrantz | 6a7dea9 | 2012-08-31 19:48:26 +0200 | [diff] [blame] | 1272 | * usable sub-images, sampling from images return raw YUV data and |
| 1273 | * color conversion needs to be done in the shader. |
| 1274 | * |
| 1275 | * \since 5 |
| 1276 | */ |
| 1277 | |
| 1278 | #define __DRI_IMAGE_COMPONENTS_RGB 0x3001 |
| 1279 | #define __DRI_IMAGE_COMPONENTS_RGBA 0x3002 |
| 1280 | #define __DRI_IMAGE_COMPONENTS_Y_U_V 0x3003 |
| 1281 | #define __DRI_IMAGE_COMPONENTS_Y_UV 0x3004 |
| 1282 | #define __DRI_IMAGE_COMPONENTS_Y_XUXV 0x3005 |
Johnson Lin | 194205c | 2017-06-16 13:34:02 +0800 | [diff] [blame] | 1283 | #define __DRI_IMAGE_COMPONENTS_Y_UXVX 0x3008 |
Chad Versace | 56f1f47 | 2015-06-23 15:48:40 -0700 | [diff] [blame] | 1284 | #define __DRI_IMAGE_COMPONENTS_R 0x3006 |
| 1285 | #define __DRI_IMAGE_COMPONENTS_RG 0x3007 |
Jakob Bornecrantz | 6a7dea9 | 2012-08-31 19:48:26 +0200 | [diff] [blame] | 1286 | |
| 1287 | |
Kristian Høgsberg | 5aaa53e | 2010-06-03 21:36:40 -0400 | [diff] [blame] | 1288 | /** |
| 1289 | * queryImage attributes |
| 1290 | */ |
| 1291 | |
| 1292 | #define __DRI_IMAGE_ATTRIB_STRIDE 0x2000 |
| 1293 | #define __DRI_IMAGE_ATTRIB_HANDLE 0x2001 |
| 1294 | #define __DRI_IMAGE_ATTRIB_NAME 0x2002 |
Jesse Barnes | 8de5c35 | 2012-02-21 12:53:09 -0800 | [diff] [blame] | 1295 | #define __DRI_IMAGE_ATTRIB_FORMAT 0x2003 /* available in versions 3+ */ |
Jakob Bornecrantz | 93ebec8 | 2012-08-21 18:01:55 +0200 | [diff] [blame] | 1296 | #define __DRI_IMAGE_ATTRIB_WIDTH 0x2004 /* available in versions 4+ */ |
Kristian Høgsberg | 44f066b | 2012-07-13 11:19:24 -0400 | [diff] [blame] | 1297 | #define __DRI_IMAGE_ATTRIB_HEIGHT 0x2005 |
Jakob Bornecrantz | 6a7dea9 | 2012-08-31 19:48:26 +0200 | [diff] [blame] | 1298 | #define __DRI_IMAGE_ATTRIB_COMPONENTS 0x2006 /* available in versions 5+ */ |
Kristian Høgsberg | 2356e28 | 2013-02-02 08:38:07 -0500 | [diff] [blame] | 1299 | #define __DRI_IMAGE_ATTRIB_FD 0x2007 /* available in versions |
| 1300 | * 7+. Each query will return a |
| 1301 | * new fd. */ |
Dave Airlie | 8f7338f | 2014-03-03 13:57:16 +1000 | [diff] [blame] | 1302 | #define __DRI_IMAGE_ATTRIB_FOURCC 0x2008 /* available in versions 11 */ |
| 1303 | #define __DRI_IMAGE_ATTRIB_NUM_PLANES 0x2009 /* available in versions 11 */ |
Kristian Høgsberg | 5aaa53e | 2010-06-03 21:36:40 -0400 | [diff] [blame] | 1304 | |
Chuanbo Weng | 1ceb775 | 2016-09-14 01:07:02 +0800 | [diff] [blame] | 1305 | #define __DRI_IMAGE_ATTRIB_OFFSET 0x200A /* available in versions 13 */ |
Ben Widawsky | d075cce | 2016-11-04 11:31:15 -0700 | [diff] [blame] | 1306 | #define __DRI_IMAGE_ATTRIB_MODIFIER_LOWER 0x200B /* available in versions 14 */ |
| 1307 | #define __DRI_IMAGE_ATTRIB_MODIFIER_UPPER 0x200C /* available in versions 14 */ |
Chuanbo Weng | 1ceb775 | 2016-09-14 01:07:02 +0800 | [diff] [blame] | 1308 | |
Topi Pohjolainen | 674dedc | 2013-03-26 15:14:20 +0200 | [diff] [blame] | 1309 | enum __DRIYUVColorSpace { |
| 1310 | __DRI_YUV_COLOR_SPACE_UNDEFINED = 0, |
| 1311 | __DRI_YUV_COLOR_SPACE_ITU_REC601 = 0x327F, |
| 1312 | __DRI_YUV_COLOR_SPACE_ITU_REC709 = 0x3280, |
| 1313 | __DRI_YUV_COLOR_SPACE_ITU_REC2020 = 0x3281 |
| 1314 | }; |
| 1315 | |
| 1316 | enum __DRISampleRange { |
| 1317 | __DRI_YUV_RANGE_UNDEFINED = 0, |
| 1318 | __DRI_YUV_FULL_RANGE = 0x3282, |
| 1319 | __DRI_YUV_NARROW_RANGE = 0x3283 |
| 1320 | }; |
| 1321 | |
| 1322 | enum __DRIChromaSiting { |
| 1323 | __DRI_YUV_CHROMA_SITING_UNDEFINED = 0, |
| 1324 | __DRI_YUV_CHROMA_SITING_0 = 0x3284, |
| 1325 | __DRI_YUV_CHROMA_SITING_0_5 = 0x3285 |
| 1326 | }; |
| 1327 | |
Abdiel Janulgue | 7b7af48 | 2012-11-27 15:19:54 +0200 | [diff] [blame] | 1328 | /** |
Frank Binns | cfc3200 | 2015-07-31 09:11:46 +0100 | [diff] [blame] | 1329 | * \name Reasons that __DRIimageExtensionRec::createImageFromTexture or |
| 1330 | * __DRIimageExtensionRec::createImageFromDmaBufs might fail |
Abdiel Janulgue | 7b7af48 | 2012-11-27 15:19:54 +0200 | [diff] [blame] | 1331 | */ |
| 1332 | /*@{*/ |
| 1333 | /** Success! */ |
| 1334 | #define __DRI_IMAGE_ERROR_SUCCESS 0 |
| 1335 | |
| 1336 | /** Memory allocation failure */ |
| 1337 | #define __DRI_IMAGE_ERROR_BAD_ALLOC 1 |
| 1338 | |
Frank Binns | cfc3200 | 2015-07-31 09:11:46 +0100 | [diff] [blame] | 1339 | /** Client requested an invalid attribute */ |
Abdiel Janulgue | 7b7af48 | 2012-11-27 15:19:54 +0200 | [diff] [blame] | 1340 | #define __DRI_IMAGE_ERROR_BAD_MATCH 2 |
| 1341 | |
| 1342 | /** Client requested an invalid texture object */ |
| 1343 | #define __DRI_IMAGE_ERROR_BAD_PARAMETER 3 |
Frank Binns | cfc3200 | 2015-07-31 09:11:46 +0100 | [diff] [blame] | 1344 | |
| 1345 | /** Client requested an invalid pitch and/or offset */ |
| 1346 | #define __DRI_IMAGE_ERROR_BAD_ACCESS 4 |
Abdiel Janulgue | 7b7af48 | 2012-11-27 15:19:54 +0200 | [diff] [blame] | 1347 | /*@}*/ |
| 1348 | |
Axel Davy | 8a66a5d | 2014-06-18 23:27:35 -0400 | [diff] [blame] | 1349 | /** |
Giovanni Campagna | e57ad3d | 2014-07-23 19:28:52 +0100 | [diff] [blame] | 1350 | * \name Capabilities that might be returned by __DRIimageExtensionRec::getCapabilities |
| 1351 | */ |
| 1352 | /*@{*/ |
| 1353 | #define __DRI_IMAGE_CAP_GLOBAL_NAMES 1 |
| 1354 | /*@}*/ |
| 1355 | |
| 1356 | /** |
Axel Davy | 8a66a5d | 2014-06-18 23:27:35 -0400 | [diff] [blame] | 1357 | * blitImage flags |
| 1358 | */ |
| 1359 | |
| 1360 | #define __BLIT_FLAG_FLUSH 0x0001 |
| 1361 | #define __BLIT_FLAG_FINISH 0x0002 |
| 1362 | |
Jason Ekstrand | 0a25a417 | 2017-08-16 11:53:38 -0700 | [diff] [blame] | 1363 | /** |
| 1364 | * queryDmaBufFormatModifierAttribs attributes |
| 1365 | */ |
| 1366 | |
| 1367 | /* Available in version 16 */ |
| 1368 | #define __DRI_IMAGE_FORMAT_MODIFIER_ATTRIB_PLANE_COUNT 0x0001 |
| 1369 | |
Kristian Høgsberg | 79cbcb6 | 2010-02-11 17:45:24 -0500 | [diff] [blame] | 1370 | typedef struct __DRIimageRec __DRIimage; |
| 1371 | typedef struct __DRIimageExtensionRec __DRIimageExtension; |
| 1372 | struct __DRIimageExtensionRec { |
| 1373 | __DRIextension base; |
| 1374 | |
Kristian Høgsberg | 9ec0b2a | 2010-09-22 15:07:15 -0400 | [diff] [blame] | 1375 | __DRIimage *(*createImageFromName)(__DRIscreen *screen, |
Kristian Høgsberg | 79cbcb6 | 2010-02-11 17:45:24 -0500 | [diff] [blame] | 1376 | int width, int height, int format, |
| 1377 | int name, int pitch, |
| 1378 | void *loaderPrivate); |
| 1379 | |
Nicolai Hähnle | f12e1c5 | 2017-10-10 13:58:46 +0200 | [diff] [blame] | 1380 | /* Deprecated since version 17; see createImageFromRenderbuffer2 */ |
Kristian Høgsberg | 79cbcb6 | 2010-02-11 17:45:24 -0500 | [diff] [blame] | 1381 | __DRIimage *(*createImageFromRenderbuffer)(__DRIcontext *context, |
| 1382 | int renderbuffer, |
| 1383 | void *loaderPrivate); |
| 1384 | |
| 1385 | void (*destroyImage)(__DRIimage *image); |
Kristian Høgsberg | 5aaa53e | 2010-06-03 21:36:40 -0400 | [diff] [blame] | 1386 | |
| 1387 | __DRIimage *(*createImage)(__DRIscreen *screen, |
| 1388 | int width, int height, int format, |
| 1389 | unsigned int use, |
| 1390 | void *loaderPrivate); |
| 1391 | |
| 1392 | GLboolean (*queryImage)(__DRIimage *image, int attrib, int *value); |
Benjamin Franzke | 5fbbd4c | 2011-03-09 20:47:42 +0100 | [diff] [blame] | 1393 | |
| 1394 | /** |
| 1395 | * The new __DRIimage will share the content with the old one, see dup(2). |
| 1396 | */ |
| 1397 | __DRIimage *(*dupImage)(__DRIimage *image, void *loaderPrivate); |
Kristian Høgsberg | 221c678 | 2012-01-18 15:32:35 -0500 | [diff] [blame] | 1398 | |
| 1399 | /** |
| 1400 | * Validate that a __DRIimage can be used a certain way. |
| 1401 | * |
| 1402 | * \since 2 |
| 1403 | */ |
| 1404 | GLboolean (*validateUsage)(__DRIimage *image, unsigned int use); |
Kristian Høgsberg | 4fddb2b | 2012-05-02 15:30:13 -0400 | [diff] [blame] | 1405 | |
| 1406 | /** |
Jakob Bornecrantz | 6a7dea9 | 2012-08-31 19:48:26 +0200 | [diff] [blame] | 1407 | * Unlike createImageFromName __DRI_IMAGE_FORMAT is not but instead |
| 1408 | * __DRI_IMAGE_FOURCC and strides are in bytes not pixels. Stride is |
| 1409 | * also per block and not per pixel (for non-RGB, see gallium blocks). |
| 1410 | * |
| 1411 | * \since 5 |
| 1412 | */ |
| 1413 | __DRIimage *(*createImageFromNames)(__DRIscreen *screen, |
| 1414 | int width, int height, int fourcc, |
| 1415 | int *names, int num_names, |
| 1416 | int *strides, int *offsets, |
| 1417 | void *loaderPrivate); |
| 1418 | |
| 1419 | /** |
Kristian Høgsberg | c029834 | 2012-07-04 22:56:09 -0400 | [diff] [blame] | 1420 | * Create an image out of a sub-region of a parent image. This |
| 1421 | * entry point lets us create individual __DRIimages for different |
| 1422 | * planes in a planar buffer (typically yuv), for example. While a |
| 1423 | * sub-image shares the underlying buffer object with the parent |
| 1424 | * image and other sibling sub-images, the life times of parent and |
| 1425 | * sub-images are not dependent. Destroying the parent or a |
| 1426 | * sub-image doesn't affect other images. The underlying buffer |
| 1427 | * object is free when no __DRIimage remains that references it. |
| 1428 | * |
| 1429 | * Sub-images may overlap, but rendering to overlapping sub-images |
| 1430 | * is undefined. |
| 1431 | * |
| 1432 | * \since 5 |
| 1433 | */ |
Jakob Bornecrantz | 6a7dea9 | 2012-08-31 19:48:26 +0200 | [diff] [blame] | 1434 | __DRIimage *(*fromPlanar)(__DRIimage *image, int plane, |
| 1435 | void *loaderPrivate); |
Abdiel Janulgue | 7b7af48 | 2012-11-27 15:19:54 +0200 | [diff] [blame] | 1436 | |
| 1437 | /** |
| 1438 | * Create image from texture. |
| 1439 | * |
| 1440 | * \since 6 |
| 1441 | */ |
| 1442 | __DRIimage *(*createImageFromTexture)(__DRIcontext *context, |
| 1443 | int target, |
| 1444 | unsigned texture, |
| 1445 | int depth, |
| 1446 | int level, |
| 1447 | unsigned *error, |
| 1448 | void *loaderPrivate); |
Kristian Høgsberg | 2356e28 | 2013-02-02 08:38:07 -0500 | [diff] [blame] | 1449 | /** |
| 1450 | * Like createImageFromNames, but takes a prime fd instead. |
| 1451 | * |
| 1452 | * \since 7 |
| 1453 | */ |
| 1454 | __DRIimage *(*createImageFromFds)(__DRIscreen *screen, |
| 1455 | int width, int height, int fourcc, |
| 1456 | int *fds, int num_fds, |
| 1457 | int *strides, int *offsets, |
| 1458 | void *loaderPrivate); |
Topi Pohjolainen | 674dedc | 2013-03-26 15:14:20 +0200 | [diff] [blame] | 1459 | |
| 1460 | /** |
| 1461 | * Like createImageFromFds, but takes additional attributes. |
| 1462 | * |
| 1463 | * For EGL_EXT_image_dma_buf_import. |
| 1464 | * |
| 1465 | * \since 8 |
| 1466 | */ |
| 1467 | __DRIimage *(*createImageFromDmaBufs)(__DRIscreen *screen, |
| 1468 | int width, int height, int fourcc, |
| 1469 | int *fds, int num_fds, |
| 1470 | int *strides, int *offsets, |
| 1471 | enum __DRIYUVColorSpace color_space, |
| 1472 | enum __DRISampleRange sample_range, |
| 1473 | enum __DRIChromaSiting horiz_siting, |
| 1474 | enum __DRIChromaSiting vert_siting, |
| 1475 | unsigned *error, |
| 1476 | void *loaderPrivate); |
Axel Davy | 8a66a5d | 2014-06-18 23:27:35 -0400 | [diff] [blame] | 1477 | |
| 1478 | /** |
| 1479 | * Blit a part of a __DRIimage to another and flushes |
| 1480 | * |
| 1481 | * flush_flag: |
| 1482 | * 0: no flush |
| 1483 | * __BLIT_FLAG_FLUSH: flush after the blit operation |
| 1484 | * __BLIT_FLAG_FINISH: flush and wait the blit finished |
| 1485 | * |
| 1486 | * \since 9 |
| 1487 | */ |
| 1488 | void (*blitImage)(__DRIcontext *context, __DRIimage *dst, __DRIimage *src, |
| 1489 | int dstx0, int dsty0, int dstwidth, int dstheight, |
| 1490 | int srcx0, int srcy0, int srcwidth, int srcheight, |
| 1491 | int flush_flag); |
Giovanni Campagna | e57ad3d | 2014-07-23 19:28:52 +0100 | [diff] [blame] | 1492 | |
| 1493 | /** |
| 1494 | * Query for general capabilities of the driver that concern |
| 1495 | * buffer sharing and image importing. |
| 1496 | * |
| 1497 | * \since 10 |
| 1498 | */ |
| 1499 | int (*getCapabilities)(__DRIscreen *screen); |
Rob Herring | a0f06f1 | 2016-05-03 21:02:43 -0500 | [diff] [blame] | 1500 | |
| 1501 | /** |
| 1502 | * Returns a map of the specified region of a __DRIimage for the specified usage. |
| 1503 | * |
| 1504 | * flags may include __DRI_IMAGE_TRANSFER_READ, which will populate the |
| 1505 | * mapping with the current buffer content. If __DRI_IMAGE_TRANSFER_READ |
| 1506 | * is not included in the flags, the buffer content at map time is |
| 1507 | * undefined. Users wanting to modify the mapping must include |
| 1508 | * __DRI_IMAGE_TRANSFER_WRITE; if __DRI_IMAGE_TRANSFER_WRITE is not |
| 1509 | * included, behaviour when writing the mapping is undefined. |
| 1510 | * |
| 1511 | * Returns the byte stride in *stride, and an opaque pointer to data |
| 1512 | * tracking the mapping in **data, which must be passed to unmapImage(). |
| 1513 | * |
| 1514 | * \since 12 |
| 1515 | */ |
| 1516 | void *(*mapImage)(__DRIcontext *context, __DRIimage *image, |
| 1517 | int x0, int y0, int width, int height, |
| 1518 | unsigned int flags, int *stride, void **data); |
| 1519 | |
| 1520 | /** |
| 1521 | * Unmap a previously mapped __DRIimage |
| 1522 | * |
| 1523 | * \since 12 |
| 1524 | */ |
| 1525 | void (*unmapImage)(__DRIcontext *context, __DRIimage *image, void *data); |
| 1526 | |
Ben Widawsky | d075cce | 2016-11-04 11:31:15 -0700 | [diff] [blame] | 1527 | |
| 1528 | /** |
| 1529 | * Creates an image with implementation's favorite modifiers. |
| 1530 | * |
| 1531 | * This acts like createImage except there is a list of modifiers passed in |
| 1532 | * which the implementation may selectively use to create the DRIimage. The |
| 1533 | * result should be the implementation selects one modifier (perhaps it would |
| 1534 | * hold on to a few and later pick). |
| 1535 | * |
| 1536 | * The created image should be destroyed with destroyImage(). |
| 1537 | * |
| 1538 | * Returns the new DRIimage. The chosen modifier can be obtained later on |
| 1539 | * and passed back to things like the kernel's AddFB2 interface. |
| 1540 | * |
| 1541 | * \sa __DRIimageRec::createImage |
| 1542 | * |
| 1543 | * \since 14 |
| 1544 | */ |
| 1545 | __DRIimage *(*createImageWithModifiers)(__DRIscreen *screen, |
| 1546 | int width, int height, int format, |
| 1547 | const uint64_t *modifiers, |
| 1548 | const unsigned int modifier_count, |
| 1549 | void *loaderPrivate); |
Varad Gautam | c592963 | 2017-05-30 17:23:36 +0530 | [diff] [blame] | 1550 | |
| 1551 | /* |
| 1552 | * Like createImageFromDmaBufs, but takes also format modifiers. |
| 1553 | * |
| 1554 | * For EGL_EXT_image_dma_buf_import_modifiers. |
| 1555 | * |
| 1556 | * \since 15 |
| 1557 | */ |
| 1558 | __DRIimage *(*createImageFromDmaBufs2)(__DRIscreen *screen, |
| 1559 | int width, int height, int fourcc, |
| 1560 | uint64_t modifier, |
| 1561 | int *fds, int num_fds, |
| 1562 | int *strides, int *offsets, |
| 1563 | enum __DRIYUVColorSpace color_space, |
| 1564 | enum __DRISampleRange sample_range, |
| 1565 | enum __DRIChromaSiting horiz_siting, |
| 1566 | enum __DRIChromaSiting vert_siting, |
| 1567 | unsigned *error, |
| 1568 | void *loaderPrivate); |
| 1569 | |
| 1570 | /* |
| 1571 | * dmabuf format query to support EGL_EXT_image_dma_buf_import_modifiers. |
| 1572 | * |
| 1573 | * \param max Maximum number of formats that can be accomodated into |
| 1574 | * \param formats. If zero, no formats are returned - |
| 1575 | * instead, the driver returns the total number of |
| 1576 | * supported dmabuf formats in \param count. |
| 1577 | * \param formats Buffer to fill formats into. |
| 1578 | * \param count Count of formats returned, or, total number of |
| 1579 | * supported formats in case \param max is zero. |
| 1580 | * |
| 1581 | * Returns true on success. |
| 1582 | * |
| 1583 | * \since 15 |
| 1584 | */ |
| 1585 | GLboolean (*queryDmaBufFormats)(__DRIscreen *screen, int max, |
| 1586 | int *formats, int *count); |
| 1587 | |
| 1588 | /* |
| 1589 | * dmabuf format modifier query for a given format to support |
| 1590 | * EGL_EXT_image_dma_buf_import_modifiers. |
| 1591 | * |
| 1592 | * \param fourcc The format to query modifiers for. If this format |
| 1593 | * is not supported by the driver, return false. |
| 1594 | * \param max Maximum number of modifiers that can be accomodated in |
| 1595 | * \param modifiers. If zero, no modifiers are returned - |
| 1596 | * instead, the driver returns the total number of |
| 1597 | * modifiers for \param format in \param count. |
| 1598 | * \param modifiers Buffer to fill modifiers into. |
| 1599 | * \param count Count of the modifiers returned, or, total number of |
| 1600 | * supported modifiers for \param fourcc in case |
| 1601 | * \param max is zero. |
| 1602 | * |
| 1603 | * Returns true upon success. |
| 1604 | * |
| 1605 | * \since 15 |
| 1606 | */ |
| 1607 | GLboolean (*queryDmaBufModifiers)(__DRIscreen *screen, int fourcc, |
| 1608 | int max, uint64_t *modifiers, |
| 1609 | unsigned int *external_only, |
| 1610 | int *count); |
Jason Ekstrand | 0a25a417 | 2017-08-16 11:53:38 -0700 | [diff] [blame] | 1611 | |
| 1612 | /** |
| 1613 | * dmabuf format modifier attribute query for a given format and modifier. |
| 1614 | * |
| 1615 | * \param fourcc The format to query. If this format is not supported by |
| 1616 | * the driver, return false. |
| 1617 | * \param modifier The modifier to query. If this format+modifier is not |
| 1618 | * supported by the driver, return false. |
| 1619 | * \param attrib The __DRI_IMAGE_FORMAT_MODIFIER_ATTRIB to query. |
| 1620 | * \param value A pointer to where to store the result of the query. |
| 1621 | * |
| 1622 | * Returns true upon success. |
| 1623 | * |
| 1624 | * \since 16 |
| 1625 | */ |
| 1626 | GLboolean (*queryDmaBufFormatModifierAttribs)(__DRIscreen *screen, |
| 1627 | uint32_t fourcc, uint64_t modifier, |
| 1628 | int attrib, uint64_t *value); |
Nicolai Hähnle | f12e1c5 | 2017-10-10 13:58:46 +0200 | [diff] [blame] | 1629 | |
| 1630 | /** |
| 1631 | * Create a DRI image from the given renderbuffer. |
| 1632 | * |
| 1633 | * \param context the current DRI context |
| 1634 | * \param renderbuffer the GL name of the renderbuffer |
| 1635 | * \param loaderPrivate for callbacks into the loader related to the image |
| 1636 | * \param error will be set to one of __DRI_IMAGE_ERROR_xxx |
| 1637 | * \return the newly created image on success, or NULL otherwise |
| 1638 | * |
| 1639 | * \since 17 |
| 1640 | */ |
| 1641 | __DRIimage *(*createImageFromRenderbuffer2)(__DRIcontext *context, |
| 1642 | int renderbuffer, |
| 1643 | void *loaderPrivate, |
| 1644 | unsigned *error); |
Kristian Høgsberg | 79cbcb6 | 2010-02-11 17:45:24 -0500 | [diff] [blame] | 1645 | }; |
| 1646 | |
Kristian Høgsberg | 5aaa53e | 2010-06-03 21:36:40 -0400 | [diff] [blame] | 1647 | |
Kristian Høgsberg | 79cbcb6 | 2010-02-11 17:45:24 -0500 | [diff] [blame] | 1648 | /** |
| 1649 | * This extension must be implemented by the loader and passed to the |
| 1650 | * driver at screen creation time. The EGLImage entry points in the |
| 1651 | * various client APIs take opaque EGLImage handles and use this |
| 1652 | * extension to map them to a __DRIimage. At version 1, this |
| 1653 | * extensions allows mapping EGLImage pointers to __DRIimage pointers, |
| 1654 | * but future versions could support other EGLImage-like, opaque types |
| 1655 | * with new lookup functions. |
| 1656 | */ |
| 1657 | #define __DRI_IMAGE_LOOKUP "DRI_IMAGE_LOOKUP" |
| 1658 | #define __DRI_IMAGE_LOOKUP_VERSION 1 |
| 1659 | |
| 1660 | typedef struct __DRIimageLookupExtensionRec __DRIimageLookupExtension; |
| 1661 | struct __DRIimageLookupExtensionRec { |
| 1662 | __DRIextension base; |
| 1663 | |
Kristian Høgsberg | 17eace5 | 2010-09-22 22:01:17 -0400 | [diff] [blame] | 1664 | __DRIimage *(*lookupEGLImage)(__DRIscreen *screen, void *image, |
Kristian Høgsberg | 79cbcb6 | 2010-02-11 17:45:24 -0500 | [diff] [blame] | 1665 | void *loaderPrivate); |
| 1666 | }; |
| 1667 | |
Jesse Barnes | 234286c | 2010-04-22 12:47:41 -0700 | [diff] [blame] | 1668 | /** |
| 1669 | * This extension allows for common DRI2 options |
| 1670 | */ |
| 1671 | #define __DRI2_CONFIG_QUERY "DRI_CONFIG_QUERY" |
| 1672 | #define __DRI2_CONFIG_QUERY_VERSION 1 |
| 1673 | |
| 1674 | typedef struct __DRI2configQueryExtensionRec __DRI2configQueryExtension; |
| 1675 | struct __DRI2configQueryExtensionRec { |
| 1676 | __DRIextension base; |
| 1677 | |
Dave Airlie | 8392179 | 2014-07-02 08:24:05 +1000 | [diff] [blame] | 1678 | int (*configQueryb)(__DRIscreen *screen, const char *var, unsigned char *val); |
Dave Airlie | 29800e6 | 2014-06-27 13:23:24 +1000 | [diff] [blame] | 1679 | int (*configQueryi)(__DRIscreen *screen, const char *var, int *val); |
| 1680 | int (*configQueryf)(__DRIscreen *screen, const char *var, float *val); |
Jesse Barnes | 234286c | 2010-04-22 12:47:41 -0700 | [diff] [blame] | 1681 | }; |
Ian Romanick | a8724d8 | 2012-07-03 11:32:59 -0700 | [diff] [blame] | 1682 | |
| 1683 | /** |
| 1684 | * Robust context driver extension. |
| 1685 | * |
| 1686 | * Existence of this extension means the driver can accept the |
| 1687 | * \c __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS flag and the |
| 1688 | * \c __DRI_CTX_ATTRIB_RESET_STRATEGY attribute in |
| 1689 | * \c __DRIdri2ExtensionRec::createContextAttribs. |
| 1690 | */ |
| 1691 | #define __DRI2_ROBUSTNESS "DRI_Robustness" |
| 1692 | #define __DRI2_ROBUSTNESS_VERSION 1 |
| 1693 | |
| 1694 | typedef struct __DRIrobustnessExtensionRec __DRIrobustnessExtension; |
| 1695 | struct __DRIrobustnessExtensionRec { |
| 1696 | __DRIextension base; |
| 1697 | }; |
| 1698 | |
Eric Anholt | cf5d8fc | 2013-06-26 15:15:57 -0700 | [diff] [blame] | 1699 | /** |
Grigori Goronzy | 7299e82 | 2017-06-29 03:24:15 +0200 | [diff] [blame] | 1700 | * No-error context driver extension. |
| 1701 | * |
| 1702 | * Existence of this extension means the driver can accept the |
| 1703 | * __DRI_CTX_FLAG_NO_ERROR flag. |
| 1704 | */ |
| 1705 | #define __DRI2_NO_ERROR "DRI_NoError" |
| 1706 | #define __DRI2_NO_ERROR_VERSION 1 |
| 1707 | |
| 1708 | typedef struct __DRInoErrorExtensionRec { |
| 1709 | __DRIextension base; |
| 1710 | } __DRInoErrorExtension; |
| 1711 | |
| 1712 | /** |
Eric Anholt | cf5d8fc | 2013-06-26 15:15:57 -0700 | [diff] [blame] | 1713 | * DRI config options extension. |
| 1714 | * |
| 1715 | * This extension provides the XML string containing driver options for use by |
| 1716 | * the loader in supporting the driconf application. |
Nicolai Hähnle | 9435b9c | 2017-06-30 10:52:48 +0200 | [diff] [blame] | 1717 | * |
| 1718 | * v2: |
| 1719 | * - Add the getXml getter function which allows the driver more flexibility in |
| 1720 | * how the XML is provided. |
| 1721 | * - Deprecate the direct xml pointer. It is only provided as a fallback for |
| 1722 | * older versions of libGL and must not be used by clients that are aware of |
| 1723 | * the newer version. Future driver versions may set it to NULL. |
Eric Anholt | cf5d8fc | 2013-06-26 15:15:57 -0700 | [diff] [blame] | 1724 | */ |
| 1725 | #define __DRI_CONFIG_OPTIONS "DRI_ConfigOptions" |
Nicolai Hähnle | 9435b9c | 2017-06-30 10:52:48 +0200 | [diff] [blame] | 1726 | #define __DRI_CONFIG_OPTIONS_VERSION 2 |
Eric Anholt | cf5d8fc | 2013-06-26 15:15:57 -0700 | [diff] [blame] | 1727 | |
| 1728 | typedef struct __DRIconfigOptionsExtensionRec { |
| 1729 | __DRIextension base; |
Nicolai Hähnle | 9435b9c | 2017-06-30 10:52:48 +0200 | [diff] [blame] | 1730 | const char *xml; /**< deprecated since v2, use getXml instead */ |
| 1731 | |
| 1732 | /** |
| 1733 | * Get an XML string that describes available driver options for use by a |
| 1734 | * config application. |
| 1735 | * |
| 1736 | * The returned string must be heap-allocated. The caller is responsible for |
| 1737 | * freeing it. |
| 1738 | */ |
| 1739 | char *(*getXml)(const char *driver_name); |
Eric Anholt | cf5d8fc | 2013-06-26 15:15:57 -0700 | [diff] [blame] | 1740 | } __DRIconfigOptionsExtension; |
| 1741 | |
Eric Anholt | 4e54751 | 2013-09-26 10:51:29 -0700 | [diff] [blame] | 1742 | /** |
| 1743 | * This extension provides a driver vtable to a set of common driver helper |
| 1744 | * functions (driCoreExtension, driDRI2Extension) within the driver |
| 1745 | * implementation, as opposed to having to pass them through a global |
| 1746 | * variable. |
| 1747 | * |
| 1748 | * It is not intended to be public API to the actual loader, and the vtable |
| 1749 | * layout may change at any time. |
| 1750 | */ |
| 1751 | #define __DRI_DRIVER_VTABLE "DRI_DriverVtable" |
| 1752 | #define __DRI_DRIVER_VTABLE_VERSION 1 |
| 1753 | |
| 1754 | typedef struct __DRIDriverVtableExtensionRec { |
| 1755 | __DRIextension base; |
| 1756 | const struct __DriverAPIRec *vtable; |
| 1757 | } __DRIDriverVtableExtension; |
| 1758 | |
Ian Romanick | 64bb1e8 | 2013-02-14 15:51:52 -0800 | [diff] [blame] | 1759 | /** |
| 1760 | * Query renderer driver extension |
| 1761 | * |
| 1762 | * This allows the window system layer (either EGL or GLX) to query aspects of |
| 1763 | * hardware and driver support without creating a context. |
| 1764 | */ |
| 1765 | #define __DRI2_RENDERER_QUERY "DRI_RENDERER_QUERY" |
| 1766 | #define __DRI2_RENDERER_QUERY_VERSION 1 |
| 1767 | |
| 1768 | #define __DRI2_RENDERER_VENDOR_ID 0x0000 |
| 1769 | #define __DRI2_RENDERER_DEVICE_ID 0x0001 |
| 1770 | #define __DRI2_RENDERER_VERSION 0x0002 |
| 1771 | #define __DRI2_RENDERER_ACCELERATED 0x0003 |
| 1772 | #define __DRI2_RENDERER_VIDEO_MEMORY 0x0004 |
| 1773 | #define __DRI2_RENDERER_UNIFIED_MEMORY_ARCHITECTURE 0x0005 |
| 1774 | #define __DRI2_RENDERER_PREFERRED_PROFILE 0x0006 |
| 1775 | #define __DRI2_RENDERER_OPENGL_CORE_PROFILE_VERSION 0x0007 |
| 1776 | #define __DRI2_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION 0x0008 |
| 1777 | #define __DRI2_RENDERER_OPENGL_ES_PROFILE_VERSION 0x0009 |
| 1778 | #define __DRI2_RENDERER_OPENGL_ES2_PROFILE_VERSION 0x000a |
Marek Olšák | 4f57ccd | 2015-06-10 14:45:58 +0200 | [diff] [blame] | 1779 | #define __DRI2_RENDERER_HAS_TEXTURE_3D 0x000b |
| 1780 | /* Whether there is an sRGB format support for every supported 32-bit UNORM |
| 1781 | * color format. |
| 1782 | */ |
| 1783 | #define __DRI2_RENDERER_HAS_FRAMEBUFFER_SRGB 0x000c |
Ian Romanick | 64bb1e8 | 2013-02-14 15:51:52 -0800 | [diff] [blame] | 1784 | |
Chris Wilson | 95ecf3d | 2016-10-27 19:34:46 +0100 | [diff] [blame^] | 1785 | /* Bitmaks of supported/available context priorities - must match |
| 1786 | * __EGL_CONTEXT_PRIORITY_LOW_BIT et al |
| 1787 | */ |
| 1788 | #define __DRI2_RENDERER_HAS_CONTEXT_PRIORITY 0x000d |
| 1789 | #define __DRI2_RENDERER_HAS_CONTEXT_PRIORITY_LOW (1 << 0) |
| 1790 | #define __DRI2_RENDERER_HAS_CONTEXT_PRIORITY_MEDIUM (1 << 1) |
| 1791 | #define __DRI2_RENDERER_HAS_CONTEXT_PRIORITY_HIGH (1 << 2) |
| 1792 | |
Ian Romanick | 64bb1e8 | 2013-02-14 15:51:52 -0800 | [diff] [blame] | 1793 | typedef struct __DRI2rendererQueryExtensionRec __DRI2rendererQueryExtension; |
| 1794 | struct __DRI2rendererQueryExtensionRec { |
| 1795 | __DRIextension base; |
| 1796 | |
| 1797 | int (*queryInteger)(__DRIscreen *screen, int attribute, unsigned int *val); |
| 1798 | int (*queryString)(__DRIscreen *screen, int attribute, const char **val); |
| 1799 | }; |
| 1800 | |
Keith Packard | 4424420 | 2013-11-04 18:09:51 -0800 | [diff] [blame] | 1801 | /** |
| 1802 | * Image Loader extension. Drivers use this to allocate color buffers |
| 1803 | */ |
| 1804 | |
| 1805 | enum __DRIimageBufferMask { |
| 1806 | __DRI_IMAGE_BUFFER_BACK = (1 << 0), |
| 1807 | __DRI_IMAGE_BUFFER_FRONT = (1 << 1) |
| 1808 | }; |
| 1809 | |
| 1810 | struct __DRIimageList { |
| 1811 | uint32_t image_mask; |
| 1812 | __DRIimage *back; |
| 1813 | __DRIimage *front; |
| 1814 | }; |
| 1815 | |
| 1816 | #define __DRI_IMAGE_LOADER "DRI_IMAGE_LOADER" |
Thomas Hellstrom | ae93d53 | 2017-06-20 18:24:34 +0200 | [diff] [blame] | 1817 | #define __DRI_IMAGE_LOADER_VERSION 3 |
Keith Packard | 4424420 | 2013-11-04 18:09:51 -0800 | [diff] [blame] | 1818 | |
| 1819 | struct __DRIimageLoaderExtensionRec { |
| 1820 | __DRIextension base; |
| 1821 | |
| 1822 | /** |
| 1823 | * Allocate color buffers. |
| 1824 | * |
| 1825 | * \param driDrawable |
| 1826 | * \param width Width of allocated buffers |
| 1827 | * \param height Height of allocated buffers |
| 1828 | * \param format one of __DRI_IMAGE_FORMAT_* |
| 1829 | * \param stamp Address of variable to be updated when |
| 1830 | * getBuffers must be called again |
| 1831 | * \param loaderPrivate The loaderPrivate for driDrawable |
| 1832 | * \param buffer_mask Set of buffers to allocate |
| 1833 | * \param buffers Returned buffers |
| 1834 | */ |
| 1835 | int (*getBuffers)(__DRIdrawable *driDrawable, |
| 1836 | unsigned int format, |
| 1837 | uint32_t *stamp, |
| 1838 | void *loaderPrivate, |
| 1839 | uint32_t buffer_mask, |
| 1840 | struct __DRIimageList *buffers); |
| 1841 | |
| 1842 | /** |
| 1843 | * Flush pending front-buffer rendering |
| 1844 | * |
| 1845 | * Any rendering that has been performed to the |
| 1846 | * fake front will be flushed to the front |
| 1847 | * |
| 1848 | * \param driDrawable Drawable whose front-buffer is to be flushed |
| 1849 | * \param loaderPrivate Loader's private data that was previously passed |
| 1850 | * into __DRIdri2ExtensionRec::createNewDrawable |
| 1851 | */ |
| 1852 | void (*flushFrontBuffer)(__DRIdrawable *driDrawable, void *loaderPrivate); |
Marek Olšák | 1bf703e | 2017-07-28 17:30:34 +0200 | [diff] [blame] | 1853 | |
| 1854 | /** |
| 1855 | * Return a loader capability value. If the loader doesn't know the enum, |
| 1856 | * it will return 0. |
| 1857 | * |
| 1858 | * \since 2 |
| 1859 | */ |
| 1860 | unsigned (*getCapability)(void *loaderPrivate, enum dri_loader_cap cap); |
Thomas Hellstrom | ae93d53 | 2017-06-20 18:24:34 +0200 | [diff] [blame] | 1861 | |
| 1862 | /** |
| 1863 | * Flush swap buffers |
| 1864 | * |
| 1865 | * Make sure any outstanding swap buffers have been submitted to the |
| 1866 | * device. |
| 1867 | * |
| 1868 | * \param driDrawable Drawable whose swaps need to be flushed |
| 1869 | * \param loaderPrivate Loader's private data that was previously passed |
| 1870 | * into __DRIdri2ExtensionRec::createNewDrawable |
| 1871 | * |
| 1872 | * \since 3 |
| 1873 | */ |
| 1874 | void (*flushSwapBuffers)(__DRIdrawable *driDrawable, void *loaderPrivate); |
Keith Packard | 4424420 | 2013-11-04 18:09:51 -0800 | [diff] [blame] | 1875 | }; |
| 1876 | |
| 1877 | /** |
| 1878 | * DRI extension. |
| 1879 | */ |
| 1880 | |
| 1881 | #define __DRI_IMAGE_DRIVER "DRI_IMAGE_DRIVER" |
| 1882 | #define __DRI_IMAGE_DRIVER_VERSION 1 |
| 1883 | |
| 1884 | struct __DRIimageDriverExtensionRec { |
| 1885 | __DRIextension base; |
| 1886 | |
| 1887 | /* Common DRI functions, shared with DRI2 */ |
| 1888 | __DRIcreateNewScreen2Func createNewScreen2; |
| 1889 | __DRIcreateNewDrawableFunc createNewDrawable; |
Keith Packard | 4424420 | 2013-11-04 18:09:51 -0800 | [diff] [blame] | 1890 | __DRIcreateContextAttribsFunc createContextAttribs; |
| 1891 | __DRIgetAPIMaskFunc getAPIMask; |
| 1892 | }; |
| 1893 | |
Paul Berry | e043b2a | 2012-11-14 11:13:02 -0800 | [diff] [blame] | 1894 | /** |
| 1895 | * Background callable loader extension. |
| 1896 | * |
| 1897 | * Loaders expose this extension to indicate to drivers that they are capable |
| 1898 | * of handling callbacks from the driver's background drawing threads. |
| 1899 | */ |
| 1900 | #define __DRI_BACKGROUND_CALLABLE "DRI_BackgroundCallable" |
| 1901 | #define __DRI_BACKGROUND_CALLABLE_VERSION 1 |
| 1902 | |
| 1903 | typedef struct __DRIbackgroundCallableExtensionRec __DRIbackgroundCallableExtension; |
| 1904 | struct __DRIbackgroundCallableExtensionRec { |
| 1905 | __DRIextension base; |
| 1906 | |
| 1907 | /** |
| 1908 | * Indicate that this thread is being used by the driver as a background |
| 1909 | * drawing thread which may make callbacks to the loader. |
| 1910 | * |
| 1911 | * \param loaderPrivate is the value that was passed to to the driver when |
| 1912 | * the context was created. This can be used by the loader to identify |
| 1913 | * which context any callbacks are associated with. |
| 1914 | * |
| 1915 | * If this function is called more than once from any given thread, each |
| 1916 | * subsequent call overrides the loaderPrivate data that was passed in the |
| 1917 | * previous call. The driver can take advantage of this to re-use a |
| 1918 | * background thread to perform drawing on behalf of multiple contexts. |
| 1919 | * |
| 1920 | * It is permissible for the driver to call this function from a |
| 1921 | * non-background thread (i.e. a thread that has already been bound to a |
| 1922 | * context using __DRIcoreExtensionRec::bindContext()); when this happens, |
| 1923 | * the \c loaderPrivate pointer must be equal to the pointer that was |
| 1924 | * passed to the driver when the currently bound context was created. |
| 1925 | * |
| 1926 | * This call should execute quickly enough that the driver can call it with |
| 1927 | * impunity whenever a background thread starts performing drawing |
| 1928 | * operations (e.g. it should just set a thread-local variable). |
| 1929 | */ |
| 1930 | void (*setBackgroundContext)(void *loaderPrivate); |
Gregory Hainaut | fa84f62 | 2017-05-29 13:18:25 +0200 | [diff] [blame] | 1931 | |
| 1932 | /** |
| 1933 | * Indicate that it is multithread safe to use glthread. For GLX/EGL |
| 1934 | * platforms using Xlib, that involves calling XInitThreads, before |
| 1935 | * opening an X display. |
| 1936 | * |
| 1937 | * Note: only supported if extension version is at least 2. |
| 1938 | * |
| 1939 | * \param loaderPrivate is the value that was passed to to the driver when |
| 1940 | * the context was created. This can be used by the loader to identify |
| 1941 | * which context any callbacks are associated with. |
| 1942 | */ |
| 1943 | GLboolean (*isThreadSafe)(void *loaderPrivate); |
Paul Berry | e043b2a | 2012-11-14 11:13:02 -0800 | [diff] [blame] | 1944 | }; |
| 1945 | |
Keith Whitwell | 74d563c | 2004-04-29 12:23:39 +0000 | [diff] [blame] | 1946 | #endif |