2 * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
3 * Copyright 2007-2008 Red Hat, Inc.
4 * (C) Copyright IBM Corporation 2004
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:
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
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.
28 * \file dri_interface.h
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.
35 * \author Kevin E. Martin <kevin@precisioninsight.com>
36 * \author Ian Romanick <idr@us.ibm.com>
37 * \author Kristian Høgsberg <krh@redhat.com>
40 #ifndef DRI_INTERFACE_H
41 #define DRI_INTERFACE_H
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
50 #ifndef __NOT_HAVE_DRM_H
53 typedef unsigned int drm_context_t
;
54 typedef unsigned int drm_drawable_t
;
55 typedef struct drm_clip_rect drm_clip_rect_t
;
59 * \name DRI interface structures
61 * The following structures define the interface between the GLX client
62 * side library and the DRI (direct rendering infrastructure).
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
;
73 typedef struct __DRIcoreExtensionRec __DRIcoreExtension
;
74 typedef struct __DRIextensionRec __DRIextension
;
75 typedef struct __DRIcopySubBufferExtensionRec __DRIcopySubBufferExtension
;
76 typedef struct __DRIswapControlExtensionRec __DRIswapControlExtension
;
77 typedef struct __DRIallocateExtensionRec __DRIallocateExtension
;
78 typedef struct __DRIframeTrackingExtensionRec __DRIframeTrackingExtension
;
79 typedef struct __DRImediaStreamCounterExtensionRec __DRImediaStreamCounterExtension
;
80 typedef struct __DRItexOffsetExtensionRec __DRItexOffsetExtension
;
81 typedef struct __DRItexBufferExtensionRec __DRItexBufferExtension
;
82 typedef struct __DRIlegacyExtensionRec __DRIlegacyExtension
;
83 typedef struct __DRIswrastExtensionRec __DRIswrastExtension
;
84 typedef struct __DRIbufferRec __DRIbuffer
;
85 typedef struct __DRIdri2ExtensionRec __DRIdri2Extension
;
86 typedef struct __DRIdri2LoaderExtensionRec __DRIdri2LoaderExtension
;
87 typedef struct __DRI2flushExtensionRec __DRI2flushExtension
;
93 * Extension struct. Drivers 'inherit' from this struct by embedding
94 * it as the first element in the extension struct.
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.
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
111 struct __DRIextensionRec
{
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.
125 * Used by drivers to indicate support for setting the read drawable.
127 #define __DRI_READ_DRAWABLE "DRI_ReadDrawable"
128 #define __DRI_READ_DRAWABLE_VERSION 1
131 * Used by drivers that implement the GLX_MESA_copy_sub_buffer extension.
133 #define __DRI_COPY_SUB_BUFFER "DRI_CopySubBuffer"
134 #define __DRI_COPY_SUB_BUFFER_VERSION 1
135 struct __DRIcopySubBufferExtensionRec
{
137 void (*copySubBuffer
)(__DRIdrawable
*drawable
, int x
, int y
, int w
, int h
);
141 * Used by drivers that implement the GLX_SGI_swap_control or
142 * GLX_MESA_swap_control extension.
144 #define __DRI_SWAP_CONTROL "DRI_SwapControl"
145 #define __DRI_SWAP_CONTROL_VERSION 1
146 struct __DRIswapControlExtensionRec
{
148 void (*setSwapInterval
)(__DRIdrawable
*drawable
, unsigned int inteval
);
149 unsigned int (*getSwapInterval
)(__DRIdrawable
*drawable
);
153 * Used by drivers that implement the GLX_MESA_allocate_memory.
155 #define __DRI_ALLOCATE "DRI_Allocate"
156 #define __DRI_ALLOCATE_VERSION 1
157 struct __DRIallocateExtensionRec
{
160 void *(*allocateMemory
)(__DRIscreen
*screen
, GLsizei size
,
161 GLfloat readfreq
, GLfloat writefreq
,
164 void (*freeMemory
)(__DRIscreen
*screen
, GLvoid
*pointer
);
166 GLuint (*memoryOffset
)(__DRIscreen
*screen
, const GLvoid
*pointer
);
170 * Used by drivers that implement the GLX_MESA_swap_frame_usage extension.
172 #define __DRI_FRAME_TRACKING "DRI_FrameTracking"
173 #define __DRI_FRAME_TRACKING_VERSION 1
174 struct __DRIframeTrackingExtensionRec
{
178 * Enable or disable frame usage tracking.
180 * \since Internal API version 20030317.
182 int (*frameTracking
)(__DRIdrawable
*drawable
, GLboolean enable
);
185 * Retrieve frame usage information.
187 * \since Internal API version 20030317.
189 int (*queryFrameTracking
)(__DRIdrawable
*drawable
,
190 int64_t * sbc
, int64_t * missedFrames
,
191 float * lastMissedUsage
, float * usage
);
196 * Used by drivers that implement the GLX_SGI_video_sync extension.
198 #define __DRI_MEDIA_STREAM_COUNTER "DRI_MediaStreamCounter"
199 #define __DRI_MEDIA_STREAM_COUNTER_VERSION 1
200 struct __DRImediaStreamCounterExtensionRec
{
204 * Wait for the MSC to equal target_msc, or, if that has already passed,
205 * the next time (MSC % divisor) is equal to remainder. If divisor is
206 * zero, the function will return as soon as MSC is greater than or equal
209 int (*waitForMSC
)(__DRIdrawable
*drawable
,
210 int64_t target_msc
, int64_t divisor
, int64_t remainder
,
211 int64_t * msc
, int64_t * sbc
);
214 * Get the number of vertical refreshes since some point in time before
215 * this function was first called (i.e., system start up).
217 int (*getDrawableMSC
)(__DRIscreen
*screen
, __DRIdrawable
*drawable
,
222 #define __DRI_TEX_OFFSET "DRI_TexOffset"
223 #define __DRI_TEX_OFFSET_VERSION 1
224 struct __DRItexOffsetExtensionRec
{
228 * Method to override base texture image with a driver specific 'offset'.
229 * The depth passed in allows e.g. to ignore the alpha channel of texture
230 * images where the non-alpha components don't occupy a whole texel.
232 * For GLX_EXT_texture_from_pixmap with AIGLX.
234 void (*setTexOffset
)(__DRIcontext
*pDRICtx
, GLint texname
,
235 unsigned long long offset
, GLint depth
, GLuint pitch
);
239 /* Valid values for format in the setTexBuffer2 function below. These
240 * values match the GLX tokens for compatibility reasons, but we
241 * define them here since the DRI interface can't depend on GLX. */
242 #define __DRI_TEXTURE_FORMAT_NONE 0x20D8
243 #define __DRI_TEXTURE_FORMAT_RGB 0x20D9
244 #define __DRI_TEXTURE_FORMAT_RGBA 0x20DA
246 #define __DRI_TEX_BUFFER "DRI_TexBuffer"
247 #define __DRI_TEX_BUFFER_VERSION 2
248 struct __DRItexBufferExtensionRec
{
252 * Method to override base texture image with the contents of a
255 * For GLX_EXT_texture_from_pixmap with AIGLX. Deprecated in favor of
256 * setTexBuffer2 in version 2 of this interface
258 void (*setTexBuffer
)(__DRIcontext
*pDRICtx
,
260 __DRIdrawable
*pDraw
);
263 * Method to override base texture image with the contents of a
264 * __DRIdrawable, including the required texture format attribute.
266 * For GLX_EXT_texture_from_pixmap with AIGLX.
268 void (*setTexBuffer2
)(__DRIcontext
*pDRICtx
,
271 __DRIdrawable
*pDraw
);
275 * Used by drivers that implement DRI2
277 #define __DRI2_FLUSH "DRI2_Flush"
278 #define __DRI2_FLUSH_VERSION 3
279 struct __DRI2flushExtensionRec
{
281 void (*flush
)(__DRIdrawable
*drawable
);
284 * Ask the driver to call getBuffers/getBuffersWithFormat before
285 * it starts rendering again.
287 * \param drawable the drawable to invalidate
291 void (*invalidate
)(__DRIdrawable
*drawable
);
296 * XML document describing the configuration options supported by the
299 extern const char __driConfigOptions
[];
304 * The following extensions describe loader features that the DRI
305 * driver can make use of. Some of these are mandatory, such as the
306 * getDrawableInfo extension for DRI and the DRI Loader extensions for
307 * DRI2, while others are optional, and if present allow the driver to
308 * expose certain features. The loader pass in a NULL terminated
309 * array of these extensions to the driver in the createNewScreen
313 typedef struct __DRIgetDrawableInfoExtensionRec __DRIgetDrawableInfoExtension
;
314 typedef struct __DRIsystemTimeExtensionRec __DRIsystemTimeExtension
;
315 typedef struct __DRIdamageExtensionRec __DRIdamageExtension
;
316 typedef struct __DRIloaderExtensionRec __DRIloaderExtension
;
317 typedef struct __DRIswrastLoaderExtensionRec __DRIswrastLoaderExtension
;
321 * Callback to getDrawableInfo protocol
323 #define __DRI_GET_DRAWABLE_INFO "DRI_GetDrawableInfo"
324 #define __DRI_GET_DRAWABLE_INFO_VERSION 1
325 struct __DRIgetDrawableInfoExtensionRec
{
329 * This function is used to get information about the position, size, and
330 * clip rects of a drawable.
332 GLboolean (* getDrawableInfo
) ( __DRIdrawable
*drawable
,
333 unsigned int * index
, unsigned int * stamp
,
334 int * x
, int * y
, int * width
, int * height
,
335 int * numClipRects
, drm_clip_rect_t
** pClipRects
,
336 int * backX
, int * backY
,
337 int * numBackClipRects
, drm_clip_rect_t
** pBackClipRects
,
338 void *loaderPrivate
);
342 * Callback to get system time for media stream counter extensions.
344 #define __DRI_SYSTEM_TIME "DRI_SystemTime"
345 #define __DRI_SYSTEM_TIME_VERSION 1
346 struct __DRIsystemTimeExtensionRec
{
350 * Get the 64-bit unadjusted system time (UST).
352 int (*getUST
)(int64_t * ust
);
355 * Get the media stream counter (MSC) rate.
357 * Matching the definition in GLX_OML_sync_control, this function returns
358 * the rate of the "media stream counter". In practical terms, this is
359 * the frame refresh rate of the display.
361 GLboolean (*getMSCRate
)(__DRIdrawable
*draw
,
362 int32_t * numerator
, int32_t * denominator
,
363 void *loaderPrivate
);
369 #define __DRI_DAMAGE "DRI_Damage"
370 #define __DRI_DAMAGE_VERSION 1
371 struct __DRIdamageExtensionRec
{
375 * Reports areas of the given drawable which have been modified by the
378 * \param drawable which the drawing was done to.
379 * \param rects rectangles affected, with the drawable origin as the
381 * \param x X offset of the drawable within the screen (used in the
383 * \param y Y offset of the drawable within the screen.
384 * \param front_buffer boolean flag for whether the drawing to the
385 * drawable was actually done directly to the front buffer (instead
386 * of backing storage, for example)
387 * \param loaderPrivate the data passed in at createNewDrawable time
389 void (*reportDamage
)(__DRIdrawable
*draw
,
391 drm_clip_rect_t
*rects
, int num_rects
,
392 GLboolean front_buffer
,
393 void *loaderPrivate
);
396 #define __DRI_SWRAST_IMAGE_OP_DRAW 1
397 #define __DRI_SWRAST_IMAGE_OP_CLEAR 2
398 #define __DRI_SWRAST_IMAGE_OP_SWAP 3
401 * SWRast Loader extension.
403 #define __DRI_SWRAST_LOADER "DRI_SWRastLoader"
404 #define __DRI_SWRAST_LOADER_VERSION 1
405 struct __DRIswrastLoaderExtensionRec
{
409 * Drawable position and size
411 void (*getDrawableInfo
)(__DRIdrawable
*drawable
,
412 int *x
, int *y
, int *width
, int *height
,
413 void *loaderPrivate
);
416 * Put image to drawable
418 void (*putImage
)(__DRIdrawable
*drawable
, int op
,
419 int x
, int y
, int width
, int height
,
420 char *data
, void *loaderPrivate
);
423 * Get image from readable
425 void (*getImage
)(__DRIdrawable
*readable
,
426 int x
, int y
, int width
, int height
,
427 char *data
, void *loaderPrivate
);
431 * The remaining extensions describe driver extensions, immediately
432 * available interfaces provided by the driver. To start using the
433 * driver, dlsym() for the __DRI_DRIVER_EXTENSIONS symbol and look for
434 * the extension you need in the array.
436 #define __DRI_DRIVER_EXTENSIONS "__driDriverExtensions"
439 * Tokens for __DRIconfig attribs. A number of attributes defined by
440 * GLX or EGL standards are not in the table, as they must be provided
441 * by the loader. For example, FBConfig ID or visual ID, drawable type.
444 #define __DRI_ATTRIB_BUFFER_SIZE 1
445 #define __DRI_ATTRIB_LEVEL 2
446 #define __DRI_ATTRIB_RED_SIZE 3
447 #define __DRI_ATTRIB_GREEN_SIZE 4
448 #define __DRI_ATTRIB_BLUE_SIZE 5
449 #define __DRI_ATTRIB_LUMINANCE_SIZE 6
450 #define __DRI_ATTRIB_ALPHA_SIZE 7
451 #define __DRI_ATTRIB_ALPHA_MASK_SIZE 8
452 #define __DRI_ATTRIB_DEPTH_SIZE 9
453 #define __DRI_ATTRIB_STENCIL_SIZE 10
454 #define __DRI_ATTRIB_ACCUM_RED_SIZE 11
455 #define __DRI_ATTRIB_ACCUM_GREEN_SIZE 12
456 #define __DRI_ATTRIB_ACCUM_BLUE_SIZE 13
457 #define __DRI_ATTRIB_ACCUM_ALPHA_SIZE 14
458 #define __DRI_ATTRIB_SAMPLE_BUFFERS 15
459 #define __DRI_ATTRIB_SAMPLES 16
460 #define __DRI_ATTRIB_RENDER_TYPE 17
461 #define __DRI_ATTRIB_CONFIG_CAVEAT 18
462 #define __DRI_ATTRIB_CONFORMANT 19
463 #define __DRI_ATTRIB_DOUBLE_BUFFER 20
464 #define __DRI_ATTRIB_STEREO 21
465 #define __DRI_ATTRIB_AUX_BUFFERS 22
466 #define __DRI_ATTRIB_TRANSPARENT_TYPE 23
467 #define __DRI_ATTRIB_TRANSPARENT_INDEX_VALUE 24
468 #define __DRI_ATTRIB_TRANSPARENT_RED_VALUE 25
469 #define __DRI_ATTRIB_TRANSPARENT_GREEN_VALUE 26
470 #define __DRI_ATTRIB_TRANSPARENT_BLUE_VALUE 27
471 #define __DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE 28
472 #define __DRI_ATTRIB_FLOAT_MODE 29
473 #define __DRI_ATTRIB_RED_MASK 30
474 #define __DRI_ATTRIB_GREEN_MASK 31
475 #define __DRI_ATTRIB_BLUE_MASK 32
476 #define __DRI_ATTRIB_ALPHA_MASK 33
477 #define __DRI_ATTRIB_MAX_PBUFFER_WIDTH 34
478 #define __DRI_ATTRIB_MAX_PBUFFER_HEIGHT 35
479 #define __DRI_ATTRIB_MAX_PBUFFER_PIXELS 36
480 #define __DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH 37
481 #define __DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT 38
482 #define __DRI_ATTRIB_VISUAL_SELECT_GROUP 39
483 #define __DRI_ATTRIB_SWAP_METHOD 40
484 #define __DRI_ATTRIB_MAX_SWAP_INTERVAL 41
485 #define __DRI_ATTRIB_MIN_SWAP_INTERVAL 42
486 #define __DRI_ATTRIB_BIND_TO_TEXTURE_RGB 43
487 #define __DRI_ATTRIB_BIND_TO_TEXTURE_RGBA 44
488 #define __DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE 45
489 #define __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS 46
490 #define __DRI_ATTRIB_YINVERTED 47
492 /* __DRI_ATTRIB_RENDER_TYPE */
493 #define __DRI_ATTRIB_RGBA_BIT 0x01
494 #define __DRI_ATTRIB_COLOR_INDEX_BIT 0x02
495 #define __DRI_ATTRIB_LUMINANCE_BIT 0x04
497 /* __DRI_ATTRIB_CONFIG_CAVEAT */
498 #define __DRI_ATTRIB_SLOW_BIT 0x01
499 #define __DRI_ATTRIB_NON_CONFORMANT_CONFIG 0x02
501 /* __DRI_ATTRIB_TRANSPARENT_TYPE */
502 #define __DRI_ATTRIB_TRANSPARENT_RGB 0x00
503 #define __DRI_ATTRIB_TRANSPARENT_INDEX 0x01
505 /* __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS */
506 #define __DRI_ATTRIB_TEXTURE_1D_BIT 0x01
507 #define __DRI_ATTRIB_TEXTURE_2D_BIT 0x02
508 #define __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT 0x04
511 * This extension defines the core DRI functionality.
513 #define __DRI_CORE "DRI_Core"
514 #define __DRI_CORE_VERSION 1
516 struct __DRIcoreExtensionRec
{
519 __DRIscreen
*(*createNewScreen
)(int screen
, int fd
,
520 unsigned int sarea_handle
,
521 const __DRIextension
**extensions
,
522 const __DRIconfig
***driverConfigs
,
523 void *loaderPrivate
);
525 void (*destroyScreen
)(__DRIscreen
*screen
);
527 const __DRIextension
**(*getExtensions
)(__DRIscreen
*screen
);
529 int (*getConfigAttrib
)(const __DRIconfig
*config
,
531 unsigned int *value
);
533 int (*indexConfigAttrib
)(const __DRIconfig
*config
, int index
,
534 unsigned int *attrib
, unsigned int *value
);
536 __DRIdrawable
*(*createNewDrawable
)(__DRIscreen
*screen
,
537 const __DRIconfig
*config
,
538 unsigned int drawable_id
,
540 void *loaderPrivate
);
542 void (*destroyDrawable
)(__DRIdrawable
*drawable
);
544 void (*swapBuffers
)(__DRIdrawable
*drawable
);
546 __DRIcontext
*(*createNewContext
)(__DRIscreen
*screen
,
547 const __DRIconfig
*config
,
548 __DRIcontext
*shared
,
549 void *loaderPrivate
);
551 int (*copyContext
)(__DRIcontext
*dest
,
555 void (*destroyContext
)(__DRIcontext
*context
);
557 int (*bindContext
)(__DRIcontext
*ctx
,
558 __DRIdrawable
*pdraw
,
559 __DRIdrawable
*pread
);
561 int (*unbindContext
)(__DRIcontext
*ctx
);
565 * Stored version of some component (i.e., server-side DRI module, kernel-side
569 * There are several data structures that explicitly store a major version,
570 * minor version, and patch level. These structures should be modified to
571 * have a \c __DRIversionRec instead.
573 struct __DRIversionRec
{
574 int major
; /**< Major version number. */
575 int minor
; /**< Minor version number. */
576 int patch
; /**< Patch-level. */
580 * Framebuffer information record. Used by libGL to communicate information
581 * about the framebuffer to the driver's \c __driCreateNewScreen function.
583 * In XFree86, most of this information is derrived from data returned by
584 * calling \c XF86DRIGetDeviceInfo.
586 * \sa XF86DRIGetDeviceInfo __DRIdisplayRec::createNewScreen
587 * __driUtilCreateNewScreen CallCreateNewScreen
589 * \bug This structure could be better named.
591 struct __DRIframebufferRec
{
592 unsigned char *base
; /**< Framebuffer base address in the CPU's
593 * address space. This value is calculated by
594 * calling \c drmMap on the framebuffer handle
595 * returned by \c XF86DRIGetDeviceInfo (or a
598 int size
; /**< Framebuffer size, in bytes. */
599 int stride
; /**< Number of bytes from one line to the next. */
600 int width
; /**< Pixel width of the framebuffer. */
601 int height
; /**< Pixel height of the framebuffer. */
602 int dev_priv_size
; /**< Size of the driver's dev-priv structure. */
603 void *dev_priv
; /**< Pointer to the driver's dev-priv structure. */
608 * This extension provides alternative screen, drawable and context
609 * constructors for legacy DRI functionality. This is used in
610 * conjunction with the core extension.
612 #define __DRI_LEGACY "DRI_Legacy"
613 #define __DRI_LEGACY_VERSION 1
615 struct __DRIlegacyExtensionRec
{
618 __DRIscreen
*(*createNewScreen
)(int screen
,
619 const __DRIversion
*ddx_version
,
620 const __DRIversion
*dri_version
,
621 const __DRIversion
*drm_version
,
622 const __DRIframebuffer
*frame_buffer
,
623 void *pSAREA
, int fd
,
624 const __DRIextension
**extensions
,
625 const __DRIconfig
***driver_configs
,
626 void *loaderPrivate
);
628 __DRIdrawable
*(*createNewDrawable
)(__DRIscreen
*screen
,
629 const __DRIconfig
*config
,
630 drm_drawable_t hwDrawable
,
631 int renderType
, const int *attrs
,
632 void *loaderPrivate
);
634 __DRIcontext
*(*createNewContext
)(__DRIscreen
*screen
,
635 const __DRIconfig
*config
,
637 __DRIcontext
*shared
,
638 drm_context_t hwContext
,
639 void *loaderPrivate
);
643 * This extension provides alternative screen, drawable and context
644 * constructors for swrast DRI functionality. This is used in
645 * conjunction with the core extension.
647 #define __DRI_SWRAST "DRI_SWRast"
648 #define __DRI_SWRAST_VERSION 1
650 struct __DRIswrastExtensionRec
{
653 __DRIscreen
*(*createNewScreen
)(int screen
,
654 const __DRIextension
**extensions
,
655 const __DRIconfig
***driver_configs
,
656 void *loaderPrivate
);
658 __DRIdrawable
*(*createNewDrawable
)(__DRIscreen
*screen
,
659 const __DRIconfig
*config
,
660 void *loaderPrivate
);
664 * DRI2 Loader extension.
666 #define __DRI_BUFFER_FRONT_LEFT 0
667 #define __DRI_BUFFER_BACK_LEFT 1
668 #define __DRI_BUFFER_FRONT_RIGHT 2
669 #define __DRI_BUFFER_BACK_RIGHT 3
670 #define __DRI_BUFFER_DEPTH 4
671 #define __DRI_BUFFER_STENCIL 5
672 #define __DRI_BUFFER_ACCUM 6
673 #define __DRI_BUFFER_FAKE_FRONT_LEFT 7
674 #define __DRI_BUFFER_FAKE_FRONT_RIGHT 8
675 #define __DRI_BUFFER_DEPTH_STENCIL 9 /**< Only available with DRI2 1.1 */
677 struct __DRIbufferRec
{
678 unsigned int attachment
;
685 #define __DRI_DRI2_LOADER "DRI_DRI2Loader"
686 #define __DRI_DRI2_LOADER_VERSION 3
687 struct __DRIdri2LoaderExtensionRec
{
690 __DRIbuffer
*(*getBuffers
)(__DRIdrawable
*driDrawable
,
691 int *width
, int *height
,
692 unsigned int *attachments
, int count
,
693 int *out_count
, void *loaderPrivate
);
696 * Flush pending front-buffer rendering
698 * Any rendering that has been performed to the
699 * \c __DRI_BUFFER_FAKE_FRONT_LEFT will be flushed to the
700 * \c __DRI_BUFFER_FRONT_LEFT.
702 * \param driDrawable Drawable whose front-buffer is to be flushed
703 * \param loaderPrivate Loader's private data that was previously passed
704 * into __DRIdri2ExtensionRec::createNewDrawable
706 void (*flushFrontBuffer
)(__DRIdrawable
*driDrawable
, void *loaderPrivate
);
710 * Get list of buffers from the server
712 * Gets a list of buffer for the specified set of attachments. Unlike
713 * \c ::getBuffers, this function takes a list of attachments paired with
714 * opaque \c unsigned \c int value describing the format of the buffer.
715 * It is the responsibility of the caller to know what the service that
716 * allocates the buffers will expect to receive for the format.
718 * \param driDrawable Drawable whose buffers are being queried.
719 * \param width Output where the width of the buffers is stored.
720 * \param height Output where the height of the buffers is stored.
721 * \param attachments List of pairs of attachment ID and opaque format
722 * requested for the drawable.
723 * \param count Number of attachment / format pairs stored in
725 * \param loaderPrivate Loader's private data that was previously passed
726 * into __DRIdri2ExtensionRec::createNewDrawable.
728 __DRIbuffer
*(*getBuffersWithFormat
)(__DRIdrawable
*driDrawable
,
729 int *width
, int *height
,
730 unsigned int *attachments
, int count
,
731 int *out_count
, void *loaderPrivate
);
735 * This extension provides alternative screen, drawable and context
736 * constructors for DRI2.
738 #define __DRI_DRI2 "DRI_DRI2"
739 #define __DRI_DRI2_VERSION 1
741 struct __DRIdri2ExtensionRec
{
744 __DRIscreen
*(*createNewScreen
)(int screen
, int fd
,
745 const __DRIextension
**extensions
,
746 const __DRIconfig
***driver_configs
,
747 void *loaderPrivate
);
749 __DRIdrawable
*(*createNewDrawable
)(__DRIscreen
*screen
,
750 const __DRIconfig
*config
,
751 void *loaderPrivate
);
753 __DRIcontext
*(*createNewContext
)(__DRIscreen
*screen
,
754 const __DRIconfig
*config
,
755 __DRIcontext
*shared
,
756 void *loaderPrivate
);
762 * This extension provides functionality to enable various EGLImage
765 #define __DRI_IMAGE "DRI_IMAGE"
766 #define __DRI_IMAGE_VERSION 1
769 * These formats correspond to the similarly named MESA_FORMAT_*
770 * tokens, except in the native endian of the CPU. For example, on
771 * little endian __DRI_IMAGE_FORMAT_XRGB8888 corresponds to
772 * MESA_FORMAT_XRGB8888, but MESA_FORMAT_XRGB8888_REV on big endian.
774 #define __DRI_IMAGE_FORMAT_RGB565 0x1001
775 #define __DRI_IMAGE_FORMAT_XRGB8888 0x1002
776 #define __DRI_IMAGE_FORMAT_ARGB8888 0x1003
778 typedef struct __DRIimageRec __DRIimage
;
779 typedef struct __DRIimageExtensionRec __DRIimageExtension
;
780 struct __DRIimageExtensionRec
{
783 __DRIimage
*(*createImageFromName
)(__DRIcontext
*context
,
784 int width
, int height
, int format
,
786 void *loaderPrivate
);
788 __DRIimage
*(*createImageFromRenderbuffer
)(__DRIcontext
*context
,
790 void *loaderPrivate
);
792 void (*destroyImage
)(__DRIimage
*image
);
796 * This extension must be implemented by the loader and passed to the
797 * driver at screen creation time. The EGLImage entry points in the
798 * various client APIs take opaque EGLImage handles and use this
799 * extension to map them to a __DRIimage. At version 1, this
800 * extensions allows mapping EGLImage pointers to __DRIimage pointers,
801 * but future versions could support other EGLImage-like, opaque types
802 * with new lookup functions.
804 #define __DRI_IMAGE_LOOKUP "DRI_IMAGE_LOOKUP"
805 #define __DRI_IMAGE_LOOKUP_VERSION 1
807 typedef struct __DRIimageLookupExtensionRec __DRIimageLookupExtension
;
808 struct __DRIimageLookupExtensionRec
{
811 __DRIimage
*(*lookupEGLImage
)(__DRIcontext
*context
, void *image
,
812 void *loaderPrivate
);