dri: Implement a DRI vtable extension to replace the global driDriverAPI.
[mesa.git] / include / GL / internal / dri_interface.h
1 /*
2 * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
3 * Copyright 2007-2008 Red Hat, Inc.
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>
37 * \author Kristian Høgsberg <krh@redhat.com>
38 */
39
40 #ifndef DRI_INTERFACE_H
41 #define DRI_INTERFACE_H
42
43 /* For archs with no drm.h */
44 #if defined(__APPLE__) || defined(__CYGWIN__) || defined(__GNU__)
45 #ifndef __NOT_HAVE_DRM_H
46 #define __NOT_HAVE_DRM_H
47 #endif
48 #endif
49
50 #ifndef __NOT_HAVE_DRM_H
51 #include <drm.h>
52 #else
53 typedef unsigned int drm_context_t;
54 typedef unsigned int drm_drawable_t;
55 typedef struct drm_clip_rect drm_clip_rect_t;
56 #endif
57
58 /**
59 * \name DRI interface structures
60 *
61 * The following structures define the interface between the GLX client
62 * side library and the DRI (direct rendering infrastructure).
63 */
64 /*@{*/
65 typedef struct __DRIdisplayRec __DRIdisplay;
66 typedef struct __DRIscreenRec __DRIscreen;
67 typedef struct __DRIcontextRec __DRIcontext;
68 typedef struct __DRIdrawableRec __DRIdrawable;
69 typedef struct __DRIconfigRec __DRIconfig;
70 typedef struct __DRIframebufferRec __DRIframebuffer;
71 typedef struct __DRIversionRec __DRIversion;
72
73 typedef struct __DRIcoreExtensionRec __DRIcoreExtension;
74 typedef struct __DRIextensionRec __DRIextension;
75 typedef struct __DRIcopySubBufferExtensionRec __DRIcopySubBufferExtension;
76 typedef struct __DRIswapControlExtensionRec __DRIswapControlExtension;
77 typedef struct __DRIframeTrackingExtensionRec __DRIframeTrackingExtension;
78 typedef struct __DRImediaStreamCounterExtensionRec __DRImediaStreamCounterExtension;
79 typedef struct __DRItexOffsetExtensionRec __DRItexOffsetExtension;
80 typedef struct __DRItexBufferExtensionRec __DRItexBufferExtension;
81 typedef struct __DRIlegacyExtensionRec __DRIlegacyExtension;
82 typedef struct __DRIswrastExtensionRec __DRIswrastExtension;
83 typedef struct __DRIbufferRec __DRIbuffer;
84 typedef struct __DRIdri2ExtensionRec __DRIdri2Extension;
85 typedef struct __DRIdri2LoaderExtensionRec __DRIdri2LoaderExtension;
86 typedef struct __DRI2flushExtensionRec __DRI2flushExtension;
87 typedef struct __DRI2throttleExtensionRec __DRI2throttleExtension;
88
89 /*@}*/
90
91
92 /**
93 * Extension struct. Drivers 'inherit' from this struct by embedding
94 * it as the first element in the extension struct.
95 *
96 * We never break API in for a DRI extension. If we need to change
97 * the way things work in a non-backwards compatible manner, we
98 * introduce a new extension. During a transition period, we can
99 * leave both the old and the new extension in the driver, which
100 * allows us to move to the new interface without having to update the
101 * loader(s) in lock step.
102 *
103 * However, we can add entry points to an extension over time as long
104 * as we don't break the old ones. As we add entry points to an
105 * extension, we increase the version number. The corresponding
106 * #define can be used to guard code that accesses the new entry
107 * points at compile time and the version field in the extension
108 * struct can be used at run-time to determine how to use the
109 * extension.
110 */
111 struct __DRIextensionRec {
112 const char *name;
113 int version;
114 };
115
116 /**
117 * The first set of extension are the screen extensions, returned by
118 * __DRIcore::getExtensions(). This entry point will return a list of
119 * extensions and the loader can use the ones it knows about by
120 * casting them to more specific extensions and advertising any GLX
121 * extensions the DRI extensions enables.
122 */
123
124 /**
125 * Used by drivers to indicate support for setting the read drawable.
126 */
127 #define __DRI_READ_DRAWABLE "DRI_ReadDrawable"
128 #define __DRI_READ_DRAWABLE_VERSION 1
129
130 /**
131 * Used by drivers that implement the GLX_MESA_copy_sub_buffer extension.
132 */
133 #define __DRI_COPY_SUB_BUFFER "DRI_CopySubBuffer"
134 #define __DRI_COPY_SUB_BUFFER_VERSION 1
135 struct __DRIcopySubBufferExtensionRec {
136 __DRIextension base;
137 void (*copySubBuffer)(__DRIdrawable *drawable, int x, int y, int w, int h);
138 };
139
140 /**
141 * Used by drivers that implement the GLX_SGI_swap_control or
142 * GLX_MESA_swap_control extension.
143 */
144 #define __DRI_SWAP_CONTROL "DRI_SwapControl"
145 #define __DRI_SWAP_CONTROL_VERSION 1
146 struct __DRIswapControlExtensionRec {
147 __DRIextension base;
148 void (*setSwapInterval)(__DRIdrawable *drawable, unsigned int inteval);
149 unsigned int (*getSwapInterval)(__DRIdrawable *drawable);
150 };
151
152 /**
153 * Used by drivers that implement the GLX_MESA_swap_frame_usage extension.
154 */
155 #define __DRI_FRAME_TRACKING "DRI_FrameTracking"
156 #define __DRI_FRAME_TRACKING_VERSION 1
157 struct __DRIframeTrackingExtensionRec {
158 __DRIextension base;
159
160 /**
161 * Enable or disable frame usage tracking.
162 *
163 * \since Internal API version 20030317.
164 */
165 int (*frameTracking)(__DRIdrawable *drawable, GLboolean enable);
166
167 /**
168 * Retrieve frame usage information.
169 *
170 * \since Internal API version 20030317.
171 */
172 int (*queryFrameTracking)(__DRIdrawable *drawable,
173 int64_t * sbc, int64_t * missedFrames,
174 float * lastMissedUsage, float * usage);
175 };
176
177
178 /**
179 * Used by drivers that implement the GLX_SGI_video_sync extension.
180 */
181 #define __DRI_MEDIA_STREAM_COUNTER "DRI_MediaStreamCounter"
182 #define __DRI_MEDIA_STREAM_COUNTER_VERSION 1
183 struct __DRImediaStreamCounterExtensionRec {
184 __DRIextension base;
185
186 /**
187 * Wait for the MSC to equal target_msc, or, if that has already passed,
188 * the next time (MSC % divisor) is equal to remainder. If divisor is
189 * zero, the function will return as soon as MSC is greater than or equal
190 * to target_msc.
191 */
192 int (*waitForMSC)(__DRIdrawable *drawable,
193 int64_t target_msc, int64_t divisor, int64_t remainder,
194 int64_t * msc, int64_t * sbc);
195
196 /**
197 * Get the number of vertical refreshes since some point in time before
198 * this function was first called (i.e., system start up).
199 */
200 int (*getDrawableMSC)(__DRIscreen *screen, __DRIdrawable *drawable,
201 int64_t *msc);
202 };
203
204
205 #define __DRI_TEX_OFFSET "DRI_TexOffset"
206 #define __DRI_TEX_OFFSET_VERSION 1
207 struct __DRItexOffsetExtensionRec {
208 __DRIextension base;
209
210 /**
211 * Method to override base texture image with a driver specific 'offset'.
212 * The depth passed in allows e.g. to ignore the alpha channel of texture
213 * images where the non-alpha components don't occupy a whole texel.
214 *
215 * For GLX_EXT_texture_from_pixmap with AIGLX.
216 */
217 void (*setTexOffset)(__DRIcontext *pDRICtx, GLint texname,
218 unsigned long long offset, GLint depth, GLuint pitch);
219 };
220
221
222 /* Valid values for format in the setTexBuffer2 function below. These
223 * values match the GLX tokens for compatibility reasons, but we
224 * define them here since the DRI interface can't depend on GLX. */
225 #define __DRI_TEXTURE_FORMAT_NONE 0x20D8
226 #define __DRI_TEXTURE_FORMAT_RGB 0x20D9
227 #define __DRI_TEXTURE_FORMAT_RGBA 0x20DA
228
229 #define __DRI_TEX_BUFFER "DRI_TexBuffer"
230 #define __DRI_TEX_BUFFER_VERSION 2
231 struct __DRItexBufferExtensionRec {
232 __DRIextension base;
233
234 /**
235 * Method to override base texture image with the contents of a
236 * __DRIdrawable.
237 *
238 * For GLX_EXT_texture_from_pixmap with AIGLX. Deprecated in favor of
239 * setTexBuffer2 in version 2 of this interface
240 */
241 void (*setTexBuffer)(__DRIcontext *pDRICtx,
242 GLint target,
243 __DRIdrawable *pDraw);
244
245 /**
246 * Method to override base texture image with the contents of a
247 * __DRIdrawable, including the required texture format attribute.
248 *
249 * For GLX_EXT_texture_from_pixmap with AIGLX.
250 */
251 void (*setTexBuffer2)(__DRIcontext *pDRICtx,
252 GLint target,
253 GLint format,
254 __DRIdrawable *pDraw);
255 /**
256 * Method to release texture buffer in case some special platform
257 * need this.
258 *
259 * For GLX_EXT_texture_from_pixmap with AIGLX.
260 */
261 void (*releaseTexBuffer)(__DRIcontext *pDRICtx,
262 GLint target,
263 __DRIdrawable *pDraw);
264 };
265
266 /**
267 * Used by drivers that implement DRI2
268 */
269 #define __DRI2_FLUSH "DRI2_Flush"
270 #define __DRI2_FLUSH_VERSION 4
271
272 #define __DRI2_FLUSH_DRAWABLE (1 << 0) /* the drawable should be flushed. */
273 #define __DRI2_FLUSH_CONTEXT (1 << 1) /* glFlush should be called */
274
275 enum __DRI2throttleReason {
276 __DRI2_THROTTLE_SWAPBUFFER,
277 __DRI2_THROTTLE_COPYSUBBUFFER,
278 __DRI2_THROTTLE_FLUSHFRONT
279 };
280
281 struct __DRI2flushExtensionRec {
282 __DRIextension base;
283 void (*flush)(__DRIdrawable *drawable);
284
285 /**
286 * Ask the driver to call getBuffers/getBuffersWithFormat before
287 * it starts rendering again.
288 *
289 * \param drawable the drawable to invalidate
290 *
291 * \since 3
292 */
293 void (*invalidate)(__DRIdrawable *drawable);
294
295 /**
296 * This function reduces the number of flushes in the driver by combining
297 * several operations into one call.
298 *
299 * It can:
300 * - throttle
301 * - flush a drawable
302 * - flush a context
303 *
304 * \param context the context
305 * \param drawable the drawable to flush
306 * \param flags a combination of _DRI2_FLUSH_xxx flags
307 * \param throttle_reason the reason for throttling, 0 = no throttling
308 *
309 * \since 4
310 */
311 void (*flush_with_flags)(__DRIcontext *ctx,
312 __DRIdrawable *drawable,
313 unsigned flags,
314 enum __DRI2throttleReason throttle_reason);
315 };
316
317
318 /**
319 * Extension that the driver uses to request
320 * throttle callbacks.
321 */
322
323 #define __DRI2_THROTTLE "DRI2_Throttle"
324 #define __DRI2_THROTTLE_VERSION 1
325
326 struct __DRI2throttleExtensionRec {
327 __DRIextension base;
328 void (*throttle)(__DRIcontext *ctx,
329 __DRIdrawable *drawable,
330 enum __DRI2throttleReason reason);
331 };
332
333 /*@}*/
334
335 /**
336 * The following extensions describe loader features that the DRI
337 * driver can make use of. Some of these are mandatory, such as the
338 * getDrawableInfo extension for DRI and the DRI Loader extensions for
339 * DRI2, while others are optional, and if present allow the driver to
340 * expose certain features. The loader pass in a NULL terminated
341 * array of these extensions to the driver in the createNewScreen
342 * constructor.
343 */
344
345 typedef struct __DRIgetDrawableInfoExtensionRec __DRIgetDrawableInfoExtension;
346 typedef struct __DRIsystemTimeExtensionRec __DRIsystemTimeExtension;
347 typedef struct __DRIdamageExtensionRec __DRIdamageExtension;
348 typedef struct __DRIloaderExtensionRec __DRIloaderExtension;
349 typedef struct __DRIswrastLoaderExtensionRec __DRIswrastLoaderExtension;
350
351
352 /**
353 * Callback to getDrawableInfo protocol
354 */
355 #define __DRI_GET_DRAWABLE_INFO "DRI_GetDrawableInfo"
356 #define __DRI_GET_DRAWABLE_INFO_VERSION 1
357 struct __DRIgetDrawableInfoExtensionRec {
358 __DRIextension base;
359
360 /**
361 * This function is used to get information about the position, size, and
362 * clip rects of a drawable.
363 */
364 GLboolean (* getDrawableInfo) ( __DRIdrawable *drawable,
365 unsigned int * index, unsigned int * stamp,
366 int * x, int * y, int * width, int * height,
367 int * numClipRects, drm_clip_rect_t ** pClipRects,
368 int * backX, int * backY,
369 int * numBackClipRects, drm_clip_rect_t ** pBackClipRects,
370 void *loaderPrivate);
371 };
372
373 /**
374 * Callback to get system time for media stream counter extensions.
375 */
376 #define __DRI_SYSTEM_TIME "DRI_SystemTime"
377 #define __DRI_SYSTEM_TIME_VERSION 1
378 struct __DRIsystemTimeExtensionRec {
379 __DRIextension base;
380
381 /**
382 * Get the 64-bit unadjusted system time (UST).
383 */
384 int (*getUST)(int64_t * ust);
385
386 /**
387 * Get the media stream counter (MSC) rate.
388 *
389 * Matching the definition in GLX_OML_sync_control, this function returns
390 * the rate of the "media stream counter". In practical terms, this is
391 * the frame refresh rate of the display.
392 */
393 GLboolean (*getMSCRate)(__DRIdrawable *draw,
394 int32_t * numerator, int32_t * denominator,
395 void *loaderPrivate);
396 };
397
398 /**
399 * Damage reporting
400 */
401 #define __DRI_DAMAGE "DRI_Damage"
402 #define __DRI_DAMAGE_VERSION 1
403 struct __DRIdamageExtensionRec {
404 __DRIextension base;
405
406 /**
407 * Reports areas of the given drawable which have been modified by the
408 * driver.
409 *
410 * \param drawable which the drawing was done to.
411 * \param rects rectangles affected, with the drawable origin as the
412 * origin.
413 * \param x X offset of the drawable within the screen (used in the
414 * front_buffer case)
415 * \param y Y offset of the drawable within the screen.
416 * \param front_buffer boolean flag for whether the drawing to the
417 * drawable was actually done directly to the front buffer (instead
418 * of backing storage, for example)
419 * \param loaderPrivate the data passed in at createNewDrawable time
420 */
421 void (*reportDamage)(__DRIdrawable *draw,
422 int x, int y,
423 drm_clip_rect_t *rects, int num_rects,
424 GLboolean front_buffer,
425 void *loaderPrivate);
426 };
427
428 #define __DRI_SWRAST_IMAGE_OP_DRAW 1
429 #define __DRI_SWRAST_IMAGE_OP_CLEAR 2
430 #define __DRI_SWRAST_IMAGE_OP_SWAP 3
431
432 /**
433 * SWRast Loader extension.
434 */
435 #define __DRI_SWRAST_LOADER "DRI_SWRastLoader"
436 #define __DRI_SWRAST_LOADER_VERSION 1
437 struct __DRIswrastLoaderExtensionRec {
438 __DRIextension base;
439
440 /*
441 * Drawable position and size
442 */
443 void (*getDrawableInfo)(__DRIdrawable *drawable,
444 int *x, int *y, int *width, int *height,
445 void *loaderPrivate);
446
447 /**
448 * Put image to drawable
449 */
450 void (*putImage)(__DRIdrawable *drawable, int op,
451 int x, int y, int width, int height,
452 char *data, void *loaderPrivate);
453
454 /**
455 * Get image from readable
456 */
457 void (*getImage)(__DRIdrawable *readable,
458 int x, int y, int width, int height,
459 char *data, void *loaderPrivate);
460 };
461
462 /**
463 * Invalidate loader extension. The presence of this extension
464 * indicates to the DRI driver that the loader will call invalidate in
465 * the __DRI2_FLUSH extension, whenever the needs to query for new
466 * buffers. This means that the DRI driver can drop the polling in
467 * glViewport().
468 *
469 * The extension doesn't provide any functionality, it's only use to
470 * indicate to the driver that it can use the new semantics. A DRI
471 * driver can use this to switch between the different semantics or
472 * just refuse to initialize if this extension isn't present.
473 */
474 #define __DRI_USE_INVALIDATE "DRI_UseInvalidate"
475 #define __DRI_USE_INVALIDATE_VERSION 1
476
477 typedef struct __DRIuseInvalidateExtensionRec __DRIuseInvalidateExtension;
478 struct __DRIuseInvalidateExtensionRec {
479 __DRIextension base;
480 };
481
482 /**
483 * The remaining extensions describe driver extensions, immediately
484 * available interfaces provided by the driver. To start using the
485 * driver, dlsym() for the __DRI_DRIVER_EXTENSIONS symbol and look for
486 * the extension you need in the array.
487 */
488 #define __DRI_DRIVER_EXTENSIONS "__driDriverExtensions"
489
490 /**
491 * This symbol replaces the __DRI_DRIVER_EXTENSIONS symbol, and will be
492 * suffixed by "_drivername", allowing multiple drivers to be built into one
493 * library, and also giving the driver the chance to return a variable driver
494 * extensions struct depending on the driver name being loaded or any other
495 * system state.
496 *
497 * The function prototype is:
498 *
499 * const __DRIextension **__driDriverGetExtensions_drivername(void);
500 */
501 #define __DRI_DRIVER_GET_EXTENSIONS "__driDriverGetExtensions"
502
503 /**
504 * Tokens for __DRIconfig attribs. A number of attributes defined by
505 * GLX or EGL standards are not in the table, as they must be provided
506 * by the loader. For example, FBConfig ID or visual ID, drawable type.
507 */
508
509 #define __DRI_ATTRIB_BUFFER_SIZE 1
510 #define __DRI_ATTRIB_LEVEL 2
511 #define __DRI_ATTRIB_RED_SIZE 3
512 #define __DRI_ATTRIB_GREEN_SIZE 4
513 #define __DRI_ATTRIB_BLUE_SIZE 5
514 #define __DRI_ATTRIB_LUMINANCE_SIZE 6
515 #define __DRI_ATTRIB_ALPHA_SIZE 7
516 #define __DRI_ATTRIB_ALPHA_MASK_SIZE 8
517 #define __DRI_ATTRIB_DEPTH_SIZE 9
518 #define __DRI_ATTRIB_STENCIL_SIZE 10
519 #define __DRI_ATTRIB_ACCUM_RED_SIZE 11
520 #define __DRI_ATTRIB_ACCUM_GREEN_SIZE 12
521 #define __DRI_ATTRIB_ACCUM_BLUE_SIZE 13
522 #define __DRI_ATTRIB_ACCUM_ALPHA_SIZE 14
523 #define __DRI_ATTRIB_SAMPLE_BUFFERS 15
524 #define __DRI_ATTRIB_SAMPLES 16
525 #define __DRI_ATTRIB_RENDER_TYPE 17
526 #define __DRI_ATTRIB_CONFIG_CAVEAT 18
527 #define __DRI_ATTRIB_CONFORMANT 19
528 #define __DRI_ATTRIB_DOUBLE_BUFFER 20
529 #define __DRI_ATTRIB_STEREO 21
530 #define __DRI_ATTRIB_AUX_BUFFERS 22
531 #define __DRI_ATTRIB_TRANSPARENT_TYPE 23
532 #define __DRI_ATTRIB_TRANSPARENT_INDEX_VALUE 24
533 #define __DRI_ATTRIB_TRANSPARENT_RED_VALUE 25
534 #define __DRI_ATTRIB_TRANSPARENT_GREEN_VALUE 26
535 #define __DRI_ATTRIB_TRANSPARENT_BLUE_VALUE 27
536 #define __DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE 28
537 #define __DRI_ATTRIB_FLOAT_MODE 29
538 #define __DRI_ATTRIB_RED_MASK 30
539 #define __DRI_ATTRIB_GREEN_MASK 31
540 #define __DRI_ATTRIB_BLUE_MASK 32
541 #define __DRI_ATTRIB_ALPHA_MASK 33
542 #define __DRI_ATTRIB_MAX_PBUFFER_WIDTH 34
543 #define __DRI_ATTRIB_MAX_PBUFFER_HEIGHT 35
544 #define __DRI_ATTRIB_MAX_PBUFFER_PIXELS 36
545 #define __DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH 37
546 #define __DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT 38
547 #define __DRI_ATTRIB_VISUAL_SELECT_GROUP 39
548 #define __DRI_ATTRIB_SWAP_METHOD 40
549 #define __DRI_ATTRIB_MAX_SWAP_INTERVAL 41
550 #define __DRI_ATTRIB_MIN_SWAP_INTERVAL 42
551 #define __DRI_ATTRIB_BIND_TO_TEXTURE_RGB 43
552 #define __DRI_ATTRIB_BIND_TO_TEXTURE_RGBA 44
553 #define __DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE 45
554 #define __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS 46
555 #define __DRI_ATTRIB_YINVERTED 47
556 #define __DRI_ATTRIB_FRAMEBUFFER_SRGB_CAPABLE 48
557
558 /* __DRI_ATTRIB_RENDER_TYPE */
559 #define __DRI_ATTRIB_RGBA_BIT 0x01
560 #define __DRI_ATTRIB_COLOR_INDEX_BIT 0x02
561 #define __DRI_ATTRIB_LUMINANCE_BIT 0x04
562 #define __DRI_ATTRIB_FLOAT_BIT 0x08
563 #define __DRI_ATTRIB_UNSIGNED_FLOAT_BIT 0x10
564
565 /* __DRI_ATTRIB_CONFIG_CAVEAT */
566 #define __DRI_ATTRIB_SLOW_BIT 0x01
567 #define __DRI_ATTRIB_NON_CONFORMANT_CONFIG 0x02
568
569 /* __DRI_ATTRIB_TRANSPARENT_TYPE */
570 #define __DRI_ATTRIB_TRANSPARENT_RGB 0x00
571 #define __DRI_ATTRIB_TRANSPARENT_INDEX 0x01
572
573 /* __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS */
574 #define __DRI_ATTRIB_TEXTURE_1D_BIT 0x01
575 #define __DRI_ATTRIB_TEXTURE_2D_BIT 0x02
576 #define __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT 0x04
577
578 /**
579 * This extension defines the core DRI functionality.
580 */
581 #define __DRI_CORE "DRI_Core"
582 #define __DRI_CORE_VERSION 1
583
584 struct __DRIcoreExtensionRec {
585 __DRIextension base;
586
587 __DRIscreen *(*createNewScreen)(int screen, int fd,
588 unsigned int sarea_handle,
589 const __DRIextension **extensions,
590 const __DRIconfig ***driverConfigs,
591 void *loaderPrivate);
592
593 void (*destroyScreen)(__DRIscreen *screen);
594
595 const __DRIextension **(*getExtensions)(__DRIscreen *screen);
596
597 int (*getConfigAttrib)(const __DRIconfig *config,
598 unsigned int attrib,
599 unsigned int *value);
600
601 int (*indexConfigAttrib)(const __DRIconfig *config, int index,
602 unsigned int *attrib, unsigned int *value);
603
604 __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
605 const __DRIconfig *config,
606 unsigned int drawable_id,
607 unsigned int head,
608 void *loaderPrivate);
609
610 void (*destroyDrawable)(__DRIdrawable *drawable);
611
612 void (*swapBuffers)(__DRIdrawable *drawable);
613
614 __DRIcontext *(*createNewContext)(__DRIscreen *screen,
615 const __DRIconfig *config,
616 __DRIcontext *shared,
617 void *loaderPrivate);
618
619 int (*copyContext)(__DRIcontext *dest,
620 __DRIcontext *src,
621 unsigned long mask);
622
623 void (*destroyContext)(__DRIcontext *context);
624
625 int (*bindContext)(__DRIcontext *ctx,
626 __DRIdrawable *pdraw,
627 __DRIdrawable *pread);
628
629 int (*unbindContext)(__DRIcontext *ctx);
630 };
631
632 /**
633 * Stored version of some component (i.e., server-side DRI module, kernel-side
634 * DRM, etc.).
635 *
636 * \todo
637 * There are several data structures that explicitly store a major version,
638 * minor version, and patch level. These structures should be modified to
639 * have a \c __DRIversionRec instead.
640 */
641 struct __DRIversionRec {
642 int major; /**< Major version number. */
643 int minor; /**< Minor version number. */
644 int patch; /**< Patch-level. */
645 };
646
647 /**
648 * Framebuffer information record. Used by libGL to communicate information
649 * about the framebuffer to the driver's \c __driCreateNewScreen function.
650 *
651 * In XFree86, most of this information is derrived from data returned by
652 * calling \c XF86DRIGetDeviceInfo.
653 *
654 * \sa XF86DRIGetDeviceInfo __DRIdisplayRec::createNewScreen
655 * __driUtilCreateNewScreen CallCreateNewScreen
656 *
657 * \bug This structure could be better named.
658 */
659 struct __DRIframebufferRec {
660 unsigned char *base; /**< Framebuffer base address in the CPU's
661 * address space. This value is calculated by
662 * calling \c drmMap on the framebuffer handle
663 * returned by \c XF86DRIGetDeviceInfo (or a
664 * similar function).
665 */
666 int size; /**< Framebuffer size, in bytes. */
667 int stride; /**< Number of bytes from one line to the next. */
668 int width; /**< Pixel width of the framebuffer. */
669 int height; /**< Pixel height of the framebuffer. */
670 int dev_priv_size; /**< Size of the driver's dev-priv structure. */
671 void *dev_priv; /**< Pointer to the driver's dev-priv structure. */
672 };
673
674
675 /**
676 * This extension provides alternative screen, drawable and context
677 * constructors for legacy DRI functionality. This is used in
678 * conjunction with the core extension.
679 */
680 #define __DRI_LEGACY "DRI_Legacy"
681 #define __DRI_LEGACY_VERSION 1
682
683 struct __DRIlegacyExtensionRec {
684 __DRIextension base;
685
686 __DRIscreen *(*createNewScreen)(int screen,
687 const __DRIversion *ddx_version,
688 const __DRIversion *dri_version,
689 const __DRIversion *drm_version,
690 const __DRIframebuffer *frame_buffer,
691 void *pSAREA, int fd,
692 const __DRIextension **extensions,
693 const __DRIconfig ***driver_configs,
694 void *loaderPrivate);
695
696 __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
697 const __DRIconfig *config,
698 drm_drawable_t hwDrawable,
699 int renderType, const int *attrs,
700 void *loaderPrivate);
701
702 __DRIcontext *(*createNewContext)(__DRIscreen *screen,
703 const __DRIconfig *config,
704 int render_type,
705 __DRIcontext *shared,
706 drm_context_t hwContext,
707 void *loaderPrivate);
708 };
709
710 /**
711 * This extension provides alternative screen, drawable and context
712 * constructors for swrast DRI functionality. This is used in
713 * conjunction with the core extension.
714 */
715 #define __DRI_SWRAST "DRI_SWRast"
716 #define __DRI_SWRAST_VERSION 4
717
718 struct __DRIswrastExtensionRec {
719 __DRIextension base;
720
721 __DRIscreen *(*createNewScreen)(int screen,
722 const __DRIextension **extensions,
723 const __DRIconfig ***driver_configs,
724 void *loaderPrivate);
725
726 __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
727 const __DRIconfig *config,
728 void *loaderPrivate);
729
730 /* Since version 2 */
731 __DRIcontext *(*createNewContextForAPI)(__DRIscreen *screen,
732 int api,
733 const __DRIconfig *config,
734 __DRIcontext *shared,
735 void *data);
736
737 /**
738 * Create a context for a particular API with a set of attributes
739 *
740 * \since version 3
741 *
742 * \sa __DRIdri2ExtensionRec::createContextAttribs
743 */
744 __DRIcontext *(*createContextAttribs)(__DRIscreen *screen,
745 int api,
746 const __DRIconfig *config,
747 __DRIcontext *shared,
748 unsigned num_attribs,
749 const uint32_t *attribs,
750 unsigned *error,
751 void *loaderPrivate);
752
753 /**
754 * createNewScreen() with the driver extensions passed in.
755 *
756 * \since version 4
757 */
758 __DRIscreen *(*createNewScreen2)(int screen,
759 const __DRIextension **loader_extensions,
760 const __DRIextension **driver_extensions,
761 const __DRIconfig ***driver_configs,
762 void *loaderPrivate);
763
764 };
765
766 /**
767 * DRI2 Loader extension.
768 */
769 #define __DRI_BUFFER_FRONT_LEFT 0
770 #define __DRI_BUFFER_BACK_LEFT 1
771 #define __DRI_BUFFER_FRONT_RIGHT 2
772 #define __DRI_BUFFER_BACK_RIGHT 3
773 #define __DRI_BUFFER_DEPTH 4
774 #define __DRI_BUFFER_STENCIL 5
775 #define __DRI_BUFFER_ACCUM 6
776 #define __DRI_BUFFER_FAKE_FRONT_LEFT 7
777 #define __DRI_BUFFER_FAKE_FRONT_RIGHT 8
778 #define __DRI_BUFFER_DEPTH_STENCIL 9 /**< Only available with DRI2 1.1 */
779 #define __DRI_BUFFER_HIZ 10
780
781 /* Inofficial and for internal use. Increase when adding a new buffer token. */
782 #define __DRI_BUFFER_COUNT 11
783
784 struct __DRIbufferRec {
785 unsigned int attachment;
786 unsigned int name;
787 unsigned int pitch;
788 unsigned int cpp;
789 unsigned int flags;
790 };
791
792 #define __DRI_DRI2_LOADER "DRI_DRI2Loader"
793 #define __DRI_DRI2_LOADER_VERSION 3
794 struct __DRIdri2LoaderExtensionRec {
795 __DRIextension base;
796
797 __DRIbuffer *(*getBuffers)(__DRIdrawable *driDrawable,
798 int *width, int *height,
799 unsigned int *attachments, int count,
800 int *out_count, void *loaderPrivate);
801
802 /**
803 * Flush pending front-buffer rendering
804 *
805 * Any rendering that has been performed to the
806 * \c __DRI_BUFFER_FAKE_FRONT_LEFT will be flushed to the
807 * \c __DRI_BUFFER_FRONT_LEFT.
808 *
809 * \param driDrawable Drawable whose front-buffer is to be flushed
810 * \param loaderPrivate Loader's private data that was previously passed
811 * into __DRIdri2ExtensionRec::createNewDrawable
812 */
813 void (*flushFrontBuffer)(__DRIdrawable *driDrawable, void *loaderPrivate);
814
815
816 /**
817 * Get list of buffers from the server
818 *
819 * Gets a list of buffer for the specified set of attachments. Unlike
820 * \c ::getBuffers, this function takes a list of attachments paired with
821 * opaque \c unsigned \c int value describing the format of the buffer.
822 * It is the responsibility of the caller to know what the service that
823 * allocates the buffers will expect to receive for the format.
824 *
825 * \param driDrawable Drawable whose buffers are being queried.
826 * \param width Output where the width of the buffers is stored.
827 * \param height Output where the height of the buffers is stored.
828 * \param attachments List of pairs of attachment ID and opaque format
829 * requested for the drawable.
830 * \param count Number of attachment / format pairs stored in
831 * \c attachments.
832 * \param loaderPrivate Loader's private data that was previously passed
833 * into __DRIdri2ExtensionRec::createNewDrawable.
834 */
835 __DRIbuffer *(*getBuffersWithFormat)(__DRIdrawable *driDrawable,
836 int *width, int *height,
837 unsigned int *attachments, int count,
838 int *out_count, void *loaderPrivate);
839 };
840
841 /**
842 * This extension provides alternative screen, drawable and context
843 * constructors for DRI2.
844 */
845 #define __DRI_DRI2 "DRI_DRI2"
846 #define __DRI_DRI2_VERSION 4
847
848 #define __DRI_API_OPENGL 0 /**< OpenGL compatibility profile */
849 #define __DRI_API_GLES 1 /**< OpenGL ES 1.x */
850 #define __DRI_API_GLES2 2 /**< OpenGL ES 2.x */
851 #define __DRI_API_OPENGL_CORE 3 /**< OpenGL 3.2+ core profile */
852 #define __DRI_API_GLES3 4 /**< OpenGL ES 3.x */
853
854 #define __DRI_CTX_ATTRIB_MAJOR_VERSION 0
855 #define __DRI_CTX_ATTRIB_MINOR_VERSION 1
856 #define __DRI_CTX_ATTRIB_FLAGS 2
857
858 /**
859 * \requires __DRI2_ROBUSTNESS.
860 */
861 #define __DRI_CTX_ATTRIB_RESET_STRATEGY 3
862
863 #define __DRI_CTX_FLAG_DEBUG 0x00000001
864 #define __DRI_CTX_FLAG_FORWARD_COMPATIBLE 0x00000002
865
866 /**
867 * \requires __DRI2_ROBUSTNESS.
868 */
869 #define __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS 0x00000004
870
871 /**
872 * \name Context reset strategies.
873 */
874 /*@{*/
875 #define __DRI_CTX_RESET_NO_NOTIFICATION 0
876 #define __DRI_CTX_RESET_LOSE_CONTEXT 1
877 /*@}*/
878
879 /**
880 * \name Reasons that __DRIdri2Extension::createContextAttribs might fail
881 */
882 /*@{*/
883 /** Success! */
884 #define __DRI_CTX_ERROR_SUCCESS 0
885
886 /** Memory allocation failure */
887 #define __DRI_CTX_ERROR_NO_MEMORY 1
888
889 /** Client requested an API (e.g., OpenGL ES 2.0) that the driver can't do. */
890 #define __DRI_CTX_ERROR_BAD_API 2
891
892 /** Client requested an API version that the driver can't do. */
893 #define __DRI_CTX_ERROR_BAD_VERSION 3
894
895 /** Client requested a flag or combination of flags the driver can't do. */
896 #define __DRI_CTX_ERROR_BAD_FLAG 4
897
898 /** Client requested an attribute the driver doesn't understand. */
899 #define __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE 5
900
901 /** Client requested a flag the driver doesn't understand. */
902 #define __DRI_CTX_ERROR_UNKNOWN_FLAG 6
903 /*@}*/
904
905 struct __DRIdri2ExtensionRec {
906 __DRIextension base;
907
908 __DRIscreen *(*createNewScreen)(int screen, int fd,
909 const __DRIextension **extensions,
910 const __DRIconfig ***driver_configs,
911 void *loaderPrivate);
912
913 __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
914 const __DRIconfig *config,
915 void *loaderPrivate);
916
917 __DRIcontext *(*createNewContext)(__DRIscreen *screen,
918 const __DRIconfig *config,
919 __DRIcontext *shared,
920 void *loaderPrivate);
921
922 /* Since version 2 */
923 unsigned int (*getAPIMask)(__DRIscreen *screen);
924
925 __DRIcontext *(*createNewContextForAPI)(__DRIscreen *screen,
926 int api,
927 const __DRIconfig *config,
928 __DRIcontext *shared,
929 void *data);
930
931 __DRIbuffer *(*allocateBuffer)(__DRIscreen *screen,
932 unsigned int attachment,
933 unsigned int format,
934 int width,
935 int height);
936 void (*releaseBuffer)(__DRIscreen *screen,
937 __DRIbuffer *buffer);
938
939 /**
940 * Create a context for a particular API with a set of attributes
941 *
942 * \since version 3
943 *
944 * \sa __DRIswrastExtensionRec::createContextAttribs
945 */
946 __DRIcontext *(*createContextAttribs)(__DRIscreen *screen,
947 int api,
948 const __DRIconfig *config,
949 __DRIcontext *shared,
950 unsigned num_attribs,
951 const uint32_t *attribs,
952 unsigned *error,
953 void *loaderPrivate);
954
955 /**
956 * createNewScreen with the driver's extension list passed in.
957 *
958 * \since version 4
959 */
960 __DRIscreen *(*createNewScreen2)(int screen, int fd,
961 const __DRIextension **loader_extensions,
962 const __DRIextension **driver_extensions,
963 const __DRIconfig ***driver_configs,
964 void *loaderPrivate);
965 };
966
967
968 /**
969 * This extension provides functionality to enable various EGLImage
970 * extensions.
971 */
972 #define __DRI_IMAGE "DRI_IMAGE"
973 #define __DRI_IMAGE_VERSION 8
974
975 /**
976 * These formats correspond to the similarly named MESA_FORMAT_*
977 * tokens, except in the native endian of the CPU. For example, on
978 * little endian __DRI_IMAGE_FORMAT_XRGB8888 corresponds to
979 * MESA_FORMAT_XRGB8888, but MESA_FORMAT_XRGB8888_REV on big endian.
980 *
981 * __DRI_IMAGE_FORMAT_NONE is for images that aren't directly usable
982 * by the driver (YUV planar formats) but serve as a base image for
983 * creating sub-images for the different planes within the image.
984 *
985 * R8, GR88 and NONE should not be used with createImageFormName or
986 * createImage, and are returned by query from sub images created with
987 * createImageFromNames (NONE, see above) and fromPlane (R8 & GR88).
988 */
989 #define __DRI_IMAGE_FORMAT_RGB565 0x1001
990 #define __DRI_IMAGE_FORMAT_XRGB8888 0x1002
991 #define __DRI_IMAGE_FORMAT_ARGB8888 0x1003
992 #define __DRI_IMAGE_FORMAT_ABGR8888 0x1004
993 #define __DRI_IMAGE_FORMAT_XBGR8888 0x1005
994 #define __DRI_IMAGE_FORMAT_R8 0x1006 /* Since version 5 */
995 #define __DRI_IMAGE_FORMAT_GR88 0x1007
996 #define __DRI_IMAGE_FORMAT_NONE 0x1008
997 #define __DRI_IMAGE_FORMAT_XRGB2101010 0x1009
998 #define __DRI_IMAGE_FORMAT_ARGB2101010 0x100a
999
1000 #define __DRI_IMAGE_USE_SHARE 0x0001
1001 #define __DRI_IMAGE_USE_SCANOUT 0x0002
1002 #define __DRI_IMAGE_USE_CURSOR 0x0004 /* Depricated */
1003 #define __DRI_IMAGE_USE_LINEAR 0x0008
1004
1005
1006 /**
1007 * Four CC formats that matches with WL_DRM_FORMAT_* from wayland_drm.h
1008 * and GBM_FORMAT_* from gbm.h, used with createImageFromNames.
1009 *
1010 * \since 5
1011 */
1012
1013 #define __DRI_IMAGE_FOURCC_RGB565 0x36314752
1014 #define __DRI_IMAGE_FOURCC_ARGB8888 0x34325241
1015 #define __DRI_IMAGE_FOURCC_XRGB8888 0x34325258
1016 #define __DRI_IMAGE_FOURCC_ABGR8888 0x34324241
1017 #define __DRI_IMAGE_FOURCC_XBGR8888 0x34324258
1018 #define __DRI_IMAGE_FOURCC_YUV410 0x39565559
1019 #define __DRI_IMAGE_FOURCC_YUV411 0x31315559
1020 #define __DRI_IMAGE_FOURCC_YUV420 0x32315559
1021 #define __DRI_IMAGE_FOURCC_YUV422 0x36315559
1022 #define __DRI_IMAGE_FOURCC_YUV444 0x34325559
1023 #define __DRI_IMAGE_FOURCC_NV12 0x3231564e
1024 #define __DRI_IMAGE_FOURCC_NV16 0x3631564e
1025 #define __DRI_IMAGE_FOURCC_YUYV 0x56595559
1026
1027
1028 /**
1029 * Queryable on images created by createImageFromNames.
1030 *
1031 * RGB and RGBA are may be usable directly as images but its still
1032 * recommended to call fromPlanar with plane == 0.
1033 *
1034 * Y_U_V, Y_UV and Y_XUXV all requires call to fromPlanar to create
1035 * usable sub-images, sampling from images return raw YUV data and
1036 * color conversion needs to be done in the shader.
1037 *
1038 * \since 5
1039 */
1040
1041 #define __DRI_IMAGE_COMPONENTS_RGB 0x3001
1042 #define __DRI_IMAGE_COMPONENTS_RGBA 0x3002
1043 #define __DRI_IMAGE_COMPONENTS_Y_U_V 0x3003
1044 #define __DRI_IMAGE_COMPONENTS_Y_UV 0x3004
1045 #define __DRI_IMAGE_COMPONENTS_Y_XUXV 0x3005
1046
1047
1048 /**
1049 * queryImage attributes
1050 */
1051
1052 #define __DRI_IMAGE_ATTRIB_STRIDE 0x2000
1053 #define __DRI_IMAGE_ATTRIB_HANDLE 0x2001
1054 #define __DRI_IMAGE_ATTRIB_NAME 0x2002
1055 #define __DRI_IMAGE_ATTRIB_FORMAT 0x2003 /* available in versions 3+ */
1056 #define __DRI_IMAGE_ATTRIB_WIDTH 0x2004 /* available in versions 4+ */
1057 #define __DRI_IMAGE_ATTRIB_HEIGHT 0x2005
1058 #define __DRI_IMAGE_ATTRIB_COMPONENTS 0x2006 /* available in versions 5+ */
1059 #define __DRI_IMAGE_ATTRIB_FD 0x2007 /* available in versions
1060 * 7+. Each query will return a
1061 * new fd. */
1062
1063 enum __DRIYUVColorSpace {
1064 __DRI_YUV_COLOR_SPACE_UNDEFINED = 0,
1065 __DRI_YUV_COLOR_SPACE_ITU_REC601 = 0x327F,
1066 __DRI_YUV_COLOR_SPACE_ITU_REC709 = 0x3280,
1067 __DRI_YUV_COLOR_SPACE_ITU_REC2020 = 0x3281
1068 };
1069
1070 enum __DRISampleRange {
1071 __DRI_YUV_RANGE_UNDEFINED = 0,
1072 __DRI_YUV_FULL_RANGE = 0x3282,
1073 __DRI_YUV_NARROW_RANGE = 0x3283
1074 };
1075
1076 enum __DRIChromaSiting {
1077 __DRI_YUV_CHROMA_SITING_UNDEFINED = 0,
1078 __DRI_YUV_CHROMA_SITING_0 = 0x3284,
1079 __DRI_YUV_CHROMA_SITING_0_5 = 0x3285
1080 };
1081
1082 /**
1083 * \name Reasons that __DRIimageExtensionRec::createImageFromTexture might fail
1084 */
1085 /*@{*/
1086 /** Success! */
1087 #define __DRI_IMAGE_ERROR_SUCCESS 0
1088
1089 /** Memory allocation failure */
1090 #define __DRI_IMAGE_ERROR_BAD_ALLOC 1
1091
1092 /** Client requested an invalid attribute for a texture object */
1093 #define __DRI_IMAGE_ERROR_BAD_MATCH 2
1094
1095 /** Client requested an invalid texture object */
1096 #define __DRI_IMAGE_ERROR_BAD_PARAMETER 3
1097 /*@}*/
1098
1099 typedef struct __DRIimageRec __DRIimage;
1100 typedef struct __DRIimageExtensionRec __DRIimageExtension;
1101 struct __DRIimageExtensionRec {
1102 __DRIextension base;
1103
1104 __DRIimage *(*createImageFromName)(__DRIscreen *screen,
1105 int width, int height, int format,
1106 int name, int pitch,
1107 void *loaderPrivate);
1108
1109 __DRIimage *(*createImageFromRenderbuffer)(__DRIcontext *context,
1110 int renderbuffer,
1111 void *loaderPrivate);
1112
1113 void (*destroyImage)(__DRIimage *image);
1114
1115 __DRIimage *(*createImage)(__DRIscreen *screen,
1116 int width, int height, int format,
1117 unsigned int use,
1118 void *loaderPrivate);
1119
1120 GLboolean (*queryImage)(__DRIimage *image, int attrib, int *value);
1121
1122 /**
1123 * The new __DRIimage will share the content with the old one, see dup(2).
1124 */
1125 __DRIimage *(*dupImage)(__DRIimage *image, void *loaderPrivate);
1126
1127 /**
1128 * Validate that a __DRIimage can be used a certain way.
1129 *
1130 * \since 2
1131 */
1132 GLboolean (*validateUsage)(__DRIimage *image, unsigned int use);
1133
1134 /**
1135 * Unlike createImageFromName __DRI_IMAGE_FORMAT is not but instead
1136 * __DRI_IMAGE_FOURCC and strides are in bytes not pixels. Stride is
1137 * also per block and not per pixel (for non-RGB, see gallium blocks).
1138 *
1139 * \since 5
1140 */
1141 __DRIimage *(*createImageFromNames)(__DRIscreen *screen,
1142 int width, int height, int fourcc,
1143 int *names, int num_names,
1144 int *strides, int *offsets,
1145 void *loaderPrivate);
1146
1147 /**
1148 * Create an image out of a sub-region of a parent image. This
1149 * entry point lets us create individual __DRIimages for different
1150 * planes in a planar buffer (typically yuv), for example. While a
1151 * sub-image shares the underlying buffer object with the parent
1152 * image and other sibling sub-images, the life times of parent and
1153 * sub-images are not dependent. Destroying the parent or a
1154 * sub-image doesn't affect other images. The underlying buffer
1155 * object is free when no __DRIimage remains that references it.
1156 *
1157 * Sub-images may overlap, but rendering to overlapping sub-images
1158 * is undefined.
1159 *
1160 * \since 5
1161 */
1162 __DRIimage *(*fromPlanar)(__DRIimage *image, int plane,
1163 void *loaderPrivate);
1164
1165 /**
1166 * Create image from texture.
1167 *
1168 * \since 6
1169 */
1170 __DRIimage *(*createImageFromTexture)(__DRIcontext *context,
1171 int target,
1172 unsigned texture,
1173 int depth,
1174 int level,
1175 unsigned *error,
1176 void *loaderPrivate);
1177 /**
1178 * Like createImageFromNames, but takes a prime fd instead.
1179 *
1180 * \since 7
1181 */
1182 __DRIimage *(*createImageFromFds)(__DRIscreen *screen,
1183 int width, int height, int fourcc,
1184 int *fds, int num_fds,
1185 int *strides, int *offsets,
1186 void *loaderPrivate);
1187
1188 /**
1189 * Like createImageFromFds, but takes additional attributes.
1190 *
1191 * For EGL_EXT_image_dma_buf_import.
1192 *
1193 * \since 8
1194 */
1195 __DRIimage *(*createImageFromDmaBufs)(__DRIscreen *screen,
1196 int width, int height, int fourcc,
1197 int *fds, int num_fds,
1198 int *strides, int *offsets,
1199 enum __DRIYUVColorSpace color_space,
1200 enum __DRISampleRange sample_range,
1201 enum __DRIChromaSiting horiz_siting,
1202 enum __DRIChromaSiting vert_siting,
1203 unsigned *error,
1204 void *loaderPrivate);
1205 };
1206
1207
1208 /**
1209 * This extension must be implemented by the loader and passed to the
1210 * driver at screen creation time. The EGLImage entry points in the
1211 * various client APIs take opaque EGLImage handles and use this
1212 * extension to map them to a __DRIimage. At version 1, this
1213 * extensions allows mapping EGLImage pointers to __DRIimage pointers,
1214 * but future versions could support other EGLImage-like, opaque types
1215 * with new lookup functions.
1216 */
1217 #define __DRI_IMAGE_LOOKUP "DRI_IMAGE_LOOKUP"
1218 #define __DRI_IMAGE_LOOKUP_VERSION 1
1219
1220 typedef struct __DRIimageLookupExtensionRec __DRIimageLookupExtension;
1221 struct __DRIimageLookupExtensionRec {
1222 __DRIextension base;
1223
1224 __DRIimage *(*lookupEGLImage)(__DRIscreen *screen, void *image,
1225 void *loaderPrivate);
1226 };
1227
1228 /**
1229 * This extension allows for common DRI2 options
1230 */
1231 #define __DRI2_CONFIG_QUERY "DRI_CONFIG_QUERY"
1232 #define __DRI2_CONFIG_QUERY_VERSION 1
1233
1234 typedef struct __DRI2configQueryExtensionRec __DRI2configQueryExtension;
1235 struct __DRI2configQueryExtensionRec {
1236 __DRIextension base;
1237
1238 int (*configQueryb)(__DRIscreen *screen, const char *var, GLboolean *val);
1239 int (*configQueryi)(__DRIscreen *screen, const char *var, GLint *val);
1240 int (*configQueryf)(__DRIscreen *screen, const char *var, GLfloat *val);
1241 };
1242
1243 /**
1244 * Robust context driver extension.
1245 *
1246 * Existence of this extension means the driver can accept the
1247 * \c __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS flag and the
1248 * \c __DRI_CTX_ATTRIB_RESET_STRATEGY attribute in
1249 * \c __DRIdri2ExtensionRec::createContextAttribs.
1250 */
1251 #define __DRI2_ROBUSTNESS "DRI_Robustness"
1252 #define __DRI2_ROBUSTNESS_VERSION 1
1253
1254 typedef struct __DRIrobustnessExtensionRec __DRIrobustnessExtension;
1255 struct __DRIrobustnessExtensionRec {
1256 __DRIextension base;
1257 };
1258
1259 /**
1260 * DRI config options extension.
1261 *
1262 * This extension provides the XML string containing driver options for use by
1263 * the loader in supporting the driconf application.
1264 */
1265 #define __DRI_CONFIG_OPTIONS "DRI_ConfigOptions"
1266 #define __DRI_CONFIG_OPTIONS_VERSION 1
1267
1268 typedef struct __DRIconfigOptionsExtensionRec {
1269 __DRIextension base;
1270 const char *xml;
1271 } __DRIconfigOptionsExtension;
1272
1273 /**
1274 * This extension provides a driver vtable to a set of common driver helper
1275 * functions (driCoreExtension, driDRI2Extension) within the driver
1276 * implementation, as opposed to having to pass them through a global
1277 * variable.
1278 *
1279 * It is not intended to be public API to the actual loader, and the vtable
1280 * layout may change at any time.
1281 */
1282 #define __DRI_DRIVER_VTABLE "DRI_DriverVtable"
1283 #define __DRI_DRIVER_VTABLE_VERSION 1
1284
1285 typedef struct __DRIDriverVtableExtensionRec {
1286 __DRIextension base;
1287 const struct __DriverAPIRec *vtable;
1288 } __DRIDriverVtableExtension;
1289
1290 #endif