Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  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.  * XML document describing the configuration options supported by the
  335.  * driver.
  336.  */
  337. extern const char __driConfigOptions[];
  338.  
  339. /*@}*/
  340.  
  341. /**
  342.  * The following extensions describe loader features that the DRI
  343.  * driver can make use of.  Some of these are mandatory, such as the
  344.  * getDrawableInfo extension for DRI and the DRI Loader extensions for
  345.  * DRI2, while others are optional, and if present allow the driver to
  346.  * expose certain features.  The loader pass in a NULL terminated
  347.  * array of these extensions to the driver in the createNewScreen
  348.  * constructor.
  349.  */
  350.  
  351. typedef struct __DRIgetDrawableInfoExtensionRec __DRIgetDrawableInfoExtension;
  352. typedef struct __DRIsystemTimeExtensionRec __DRIsystemTimeExtension;
  353. typedef struct __DRIdamageExtensionRec __DRIdamageExtension;
  354. typedef struct __DRIloaderExtensionRec __DRIloaderExtension;
  355. typedef struct __DRIswrastLoaderExtensionRec __DRIswrastLoaderExtension;
  356.  
  357.  
  358. /**
  359.  * Callback to getDrawableInfo protocol
  360.  */
  361. #define __DRI_GET_DRAWABLE_INFO "DRI_GetDrawableInfo"
  362. #define __DRI_GET_DRAWABLE_INFO_VERSION 1
  363. struct __DRIgetDrawableInfoExtensionRec {
  364.     __DRIextension base;
  365.  
  366.     /**
  367.      * This function is used to get information about the position, size, and
  368.      * clip rects of a drawable.
  369.      */
  370.     GLboolean (* getDrawableInfo) ( __DRIdrawable *drawable,
  371.         unsigned int * index, unsigned int * stamp,
  372.         int * x, int * y, int * width, int * height,
  373.         int * numClipRects, drm_clip_rect_t ** pClipRects,
  374.         int * backX, int * backY,
  375.         int * numBackClipRects, drm_clip_rect_t ** pBackClipRects,
  376.         void *loaderPrivate);
  377. };
  378.  
  379. /**
  380.  * Callback to get system time for media stream counter extensions.
  381.  */
  382. #define __DRI_SYSTEM_TIME "DRI_SystemTime"
  383. #define __DRI_SYSTEM_TIME_VERSION 1
  384. struct __DRIsystemTimeExtensionRec {
  385.     __DRIextension base;
  386.  
  387.     /**
  388.      * Get the 64-bit unadjusted system time (UST).
  389.      */
  390.     int (*getUST)(int64_t * ust);
  391.  
  392.     /**
  393.      * Get the media stream counter (MSC) rate.
  394.      *
  395.      * Matching the definition in GLX_OML_sync_control, this function returns
  396.      * the rate of the "media stream counter".  In practical terms, this is
  397.      * the frame refresh rate of the display.
  398.      */
  399.     GLboolean (*getMSCRate)(__DRIdrawable *draw,
  400.                             int32_t * numerator, int32_t * denominator,
  401.                             void *loaderPrivate);
  402. };
  403.  
  404. /**
  405.  * Damage reporting
  406.  */
  407. #define __DRI_DAMAGE "DRI_Damage"
  408. #define __DRI_DAMAGE_VERSION 1
  409. struct __DRIdamageExtensionRec {
  410.     __DRIextension base;
  411.  
  412.     /**
  413.      * Reports areas of the given drawable which have been modified by the
  414.      * driver.
  415.      *
  416.      * \param drawable which the drawing was done to.
  417.      * \param rects rectangles affected, with the drawable origin as the
  418.      *        origin.
  419.      * \param x X offset of the drawable within the screen (used in the
  420.      *        front_buffer case)
  421.      * \param y Y offset of the drawable within the screen.
  422.      * \param front_buffer boolean flag for whether the drawing to the
  423.      *        drawable was actually done directly to the front buffer (instead
  424.      *        of backing storage, for example)
  425.      * \param loaderPrivate the data passed in at createNewDrawable time
  426.      */
  427.     void (*reportDamage)(__DRIdrawable *draw,
  428.                          int x, int y,
  429.                          drm_clip_rect_t *rects, int num_rects,
  430.                          GLboolean front_buffer,
  431.                          void *loaderPrivate);
  432. };
  433.  
  434. #define __DRI_SWRAST_IMAGE_OP_DRAW      1
  435. #define __DRI_SWRAST_IMAGE_OP_CLEAR     2
  436. #define __DRI_SWRAST_IMAGE_OP_SWAP      3
  437.  
  438. /**
  439.  * SWRast Loader extension.
  440.  */
  441. #define __DRI_SWRAST_LOADER "DRI_SWRastLoader"
  442. #define __DRI_SWRAST_LOADER_VERSION 1
  443. struct __DRIswrastLoaderExtensionRec {
  444.     __DRIextension base;
  445.  
  446.     /*
  447.      * Drawable position and size
  448.      */
  449.     void (*getDrawableInfo)(__DRIdrawable *drawable,
  450.                             int *x, int *y, int *width, int *height,
  451.                             void *loaderPrivate);
  452.  
  453.     /**
  454.      * Put image to drawable
  455.      */
  456.     void (*putImage)(__DRIdrawable *drawable, int op,
  457.                      int x, int y, int width, int height,
  458.                      char *data, void *loaderPrivate);
  459.  
  460.     /**
  461.      * Get image from readable
  462.      */
  463.     void (*getImage)(__DRIdrawable *readable,
  464.                      int x, int y, int width, int height,
  465.                      char *data, void *loaderPrivate);
  466. };
  467.  
  468. /**
  469.  * Invalidate loader extension.  The presence of this extension
  470.  * indicates to the DRI driver that the loader will call invalidate in
  471.  * the __DRI2_FLUSH extension, whenever the needs to query for new
  472.  * buffers.  This means that the DRI driver can drop the polling in
  473.  * glViewport().
  474.  *
  475.  * The extension doesn't provide any functionality, it's only use to
  476.  * indicate to the driver that it can use the new semantics.  A DRI
  477.  * driver can use this to switch between the different semantics or
  478.  * just refuse to initialize if this extension isn't present.
  479.  */
  480. #define __DRI_USE_INVALIDATE "DRI_UseInvalidate"
  481. #define __DRI_USE_INVALIDATE_VERSION 1
  482.  
  483. typedef struct __DRIuseInvalidateExtensionRec __DRIuseInvalidateExtension;
  484. struct __DRIuseInvalidateExtensionRec {
  485.    __DRIextension base;
  486. };
  487.  
  488. /**
  489.  * The remaining extensions describe driver extensions, immediately
  490.  * available interfaces provided by the driver.  To start using the
  491.  * driver, dlsym() for the __DRI_DRIVER_EXTENSIONS symbol and look for
  492.  * the extension you need in the array.
  493.  */
  494. #define __DRI_DRIVER_EXTENSIONS "__driDriverExtensions"
  495.  
  496. /**
  497.  * Tokens for __DRIconfig attribs.  A number of attributes defined by
  498.  * GLX or EGL standards are not in the table, as they must be provided
  499.  * by the loader.  For example, FBConfig ID or visual ID, drawable type.
  500.  */
  501.  
  502. #define __DRI_ATTRIB_BUFFER_SIZE                 1
  503. #define __DRI_ATTRIB_LEVEL                       2
  504. #define __DRI_ATTRIB_RED_SIZE                    3
  505. #define __DRI_ATTRIB_GREEN_SIZE                  4
  506. #define __DRI_ATTRIB_BLUE_SIZE                   5
  507. #define __DRI_ATTRIB_LUMINANCE_SIZE              6
  508. #define __DRI_ATTRIB_ALPHA_SIZE                  7
  509. #define __DRI_ATTRIB_ALPHA_MASK_SIZE             8
  510. #define __DRI_ATTRIB_DEPTH_SIZE                  9
  511. #define __DRI_ATTRIB_STENCIL_SIZE               10
  512. #define __DRI_ATTRIB_ACCUM_RED_SIZE             11
  513. #define __DRI_ATTRIB_ACCUM_GREEN_SIZE           12
  514. #define __DRI_ATTRIB_ACCUM_BLUE_SIZE            13
  515. #define __DRI_ATTRIB_ACCUM_ALPHA_SIZE           14
  516. #define __DRI_ATTRIB_SAMPLE_BUFFERS             15
  517. #define __DRI_ATTRIB_SAMPLES                    16
  518. #define __DRI_ATTRIB_RENDER_TYPE                17
  519. #define __DRI_ATTRIB_CONFIG_CAVEAT              18
  520. #define __DRI_ATTRIB_CONFORMANT                 19
  521. #define __DRI_ATTRIB_DOUBLE_BUFFER              20
  522. #define __DRI_ATTRIB_STEREO                     21
  523. #define __DRI_ATTRIB_AUX_BUFFERS                22
  524. #define __DRI_ATTRIB_TRANSPARENT_TYPE           23
  525. #define __DRI_ATTRIB_TRANSPARENT_INDEX_VALUE    24
  526. #define __DRI_ATTRIB_TRANSPARENT_RED_VALUE      25
  527. #define __DRI_ATTRIB_TRANSPARENT_GREEN_VALUE    26
  528. #define __DRI_ATTRIB_TRANSPARENT_BLUE_VALUE     27
  529. #define __DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE    28
  530. #define __DRI_ATTRIB_FLOAT_MODE                 29
  531. #define __DRI_ATTRIB_RED_MASK                   30
  532. #define __DRI_ATTRIB_GREEN_MASK                 31
  533. #define __DRI_ATTRIB_BLUE_MASK                  32
  534. #define __DRI_ATTRIB_ALPHA_MASK                 33
  535. #define __DRI_ATTRIB_MAX_PBUFFER_WIDTH          34
  536. #define __DRI_ATTRIB_MAX_PBUFFER_HEIGHT         35
  537. #define __DRI_ATTRIB_MAX_PBUFFER_PIXELS         36
  538. #define __DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH      37
  539. #define __DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT     38
  540. #define __DRI_ATTRIB_VISUAL_SELECT_GROUP        39
  541. #define __DRI_ATTRIB_SWAP_METHOD                40
  542. #define __DRI_ATTRIB_MAX_SWAP_INTERVAL          41
  543. #define __DRI_ATTRIB_MIN_SWAP_INTERVAL          42
  544. #define __DRI_ATTRIB_BIND_TO_TEXTURE_RGB        43
  545. #define __DRI_ATTRIB_BIND_TO_TEXTURE_RGBA       44
  546. #define __DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE     45
  547. #define __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS    46
  548. #define __DRI_ATTRIB_YINVERTED                  47
  549. #define __DRI_ATTRIB_FRAMEBUFFER_SRGB_CAPABLE   48
  550.  
  551. /* __DRI_ATTRIB_RENDER_TYPE */
  552. #define __DRI_ATTRIB_RGBA_BIT                   0x01
  553. #define __DRI_ATTRIB_COLOR_INDEX_BIT            0x02
  554. #define __DRI_ATTRIB_LUMINANCE_BIT              0x04
  555. #define __DRI_ATTRIB_FLOAT_BIT                  0x08
  556. #define __DRI_ATTRIB_UNSIGNED_FLOAT_BIT         0x10
  557.  
  558. /* __DRI_ATTRIB_CONFIG_CAVEAT */
  559. #define __DRI_ATTRIB_SLOW_BIT                   0x01
  560. #define __DRI_ATTRIB_NON_CONFORMANT_CONFIG      0x02
  561.  
  562. /* __DRI_ATTRIB_TRANSPARENT_TYPE */
  563. #define __DRI_ATTRIB_TRANSPARENT_RGB            0x00
  564. #define __DRI_ATTRIB_TRANSPARENT_INDEX          0x01
  565.  
  566. /* __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS  */
  567. #define __DRI_ATTRIB_TEXTURE_1D_BIT             0x01
  568. #define __DRI_ATTRIB_TEXTURE_2D_BIT             0x02
  569. #define __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT      0x04
  570.  
  571. /**
  572.  * This extension defines the core DRI functionality.
  573.  */
  574. #define __DRI_CORE "DRI_Core"
  575. #define __DRI_CORE_VERSION 1
  576.  
  577. struct __DRIcoreExtensionRec {
  578.     __DRIextension base;
  579.  
  580.     __DRIscreen *(*createNewScreen)(int screen, int fd,
  581.                                     unsigned int sarea_handle,
  582.                                     const __DRIextension **extensions,
  583.                                     const __DRIconfig ***driverConfigs,
  584.                                     void *loaderPrivate);
  585.  
  586.     void (*destroyScreen)(__DRIscreen *screen);
  587.  
  588.     const __DRIextension **(*getExtensions)(__DRIscreen *screen);
  589.  
  590.     int (*getConfigAttrib)(const __DRIconfig *config,
  591.                            unsigned int attrib,
  592.                            unsigned int *value);
  593.  
  594.     int (*indexConfigAttrib)(const __DRIconfig *config, int index,
  595.                              unsigned int *attrib, unsigned int *value);
  596.  
  597.     __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
  598.                                         const __DRIconfig *config,
  599.                                         unsigned int drawable_id,
  600.                                         unsigned int head,
  601.                                         void *loaderPrivate);
  602.  
  603.     void (*destroyDrawable)(__DRIdrawable *drawable);
  604.  
  605.     void (*swapBuffers)(__DRIdrawable *drawable);
  606.  
  607.     __DRIcontext *(*createNewContext)(__DRIscreen *screen,
  608.                                       const __DRIconfig *config,
  609.                                       __DRIcontext *shared,
  610.                                       void *loaderPrivate);
  611.  
  612.     int (*copyContext)(__DRIcontext *dest,
  613.                        __DRIcontext *src,
  614.                        unsigned long mask);
  615.  
  616.     void (*destroyContext)(__DRIcontext *context);
  617.  
  618.     int (*bindContext)(__DRIcontext *ctx,
  619.                        __DRIdrawable *pdraw,
  620.                        __DRIdrawable *pread);
  621.  
  622.     int (*unbindContext)(__DRIcontext *ctx);
  623. };
  624.  
  625. /**
  626.  * Stored version of some component (i.e., server-side DRI module, kernel-side
  627.  * DRM, etc.).
  628.  *
  629.  * \todo
  630.  * There are several data structures that explicitly store a major version,
  631.  * minor version, and patch level.  These structures should be modified to
  632.  * have a \c __DRIversionRec instead.
  633.  */
  634. struct __DRIversionRec {
  635.     int    major;        /**< Major version number. */
  636.     int    minor;        /**< Minor version number. */
  637.     int    patch;        /**< Patch-level. */
  638. };
  639.  
  640. /**
  641.  * Framebuffer information record.  Used by libGL to communicate information
  642.  * about the framebuffer to the driver's \c __driCreateNewScreen function.
  643.  *
  644.  * In XFree86, most of this information is derrived from data returned by
  645.  * calling \c XF86DRIGetDeviceInfo.
  646.  *
  647.  * \sa XF86DRIGetDeviceInfo __DRIdisplayRec::createNewScreen
  648.  *     __driUtilCreateNewScreen CallCreateNewScreen
  649.  *
  650.  * \bug This structure could be better named.
  651.  */
  652. struct __DRIframebufferRec {
  653.     unsigned char *base;    /**< Framebuffer base address in the CPU's
  654.                              * address space.  This value is calculated by
  655.                              * calling \c drmMap on the framebuffer handle
  656.                              * returned by \c XF86DRIGetDeviceInfo (or a
  657.                              * similar function).
  658.                              */
  659.     int size;               /**< Framebuffer size, in bytes. */
  660.     int stride;             /**< Number of bytes from one line to the next. */
  661.     int width;              /**< Pixel width of the framebuffer. */
  662.     int height;             /**< Pixel height of the framebuffer. */
  663.     int dev_priv_size;      /**< Size of the driver's dev-priv structure. */
  664.     void *dev_priv;         /**< Pointer to the driver's dev-priv structure. */
  665. };
  666.  
  667.  
  668. /**
  669.  * This extension provides alternative screen, drawable and context
  670.  * constructors for legacy DRI functionality.  This is used in
  671.  * conjunction with the core extension.
  672.  */
  673. #define __DRI_LEGACY "DRI_Legacy"
  674. #define __DRI_LEGACY_VERSION 1
  675.  
  676. struct __DRIlegacyExtensionRec {
  677.     __DRIextension base;
  678.  
  679.     __DRIscreen *(*createNewScreen)(int screen,
  680.                                     const __DRIversion *ddx_version,
  681.                                     const __DRIversion *dri_version,
  682.                                     const __DRIversion *drm_version,
  683.                                     const __DRIframebuffer *frame_buffer,
  684.                                     void *pSAREA, int fd,
  685.                                     const __DRIextension **extensions,
  686.                                     const __DRIconfig ***driver_configs,
  687.                                     void *loaderPrivate);
  688.  
  689.     __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
  690.                                         const __DRIconfig *config,
  691.                                         drm_drawable_t hwDrawable,
  692.                                         int renderType, const int *attrs,
  693.                                         void *loaderPrivate);
  694.  
  695.     __DRIcontext *(*createNewContext)(__DRIscreen *screen,
  696.                                       const __DRIconfig *config,
  697.                                       int render_type,
  698.                                       __DRIcontext *shared,
  699.                                       drm_context_t hwContext,
  700.                                       void *loaderPrivate);
  701. };
  702.  
  703. /**
  704.  * This extension provides alternative screen, drawable and context
  705.  * constructors for swrast DRI functionality.  This is used in
  706.  * conjunction with the core extension.
  707.  */
  708. #define __DRI_SWRAST "DRI_SWRast"
  709. #define __DRI_SWRAST_VERSION 3
  710.  
  711. struct __DRIswrastExtensionRec {
  712.     __DRIextension base;
  713.  
  714.     __DRIscreen *(*createNewScreen)(int screen,
  715.                                     const __DRIextension **extensions,
  716.                                     const __DRIconfig ***driver_configs,
  717.                                     void *loaderPrivate);
  718.  
  719.     __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
  720.                                         const __DRIconfig *config,
  721.                                         void *loaderPrivate);
  722.  
  723.    /* Since version 2 */
  724.    __DRIcontext *(*createNewContextForAPI)(__DRIscreen *screen,
  725.                                            int api,
  726.                                            const __DRIconfig *config,
  727.                                            __DRIcontext *shared,
  728.                                            void *data);
  729.  
  730.    /**
  731.     * Create a context for a particular API with a set of attributes
  732.     *
  733.     * \since version 3
  734.     *
  735.     * \sa __DRIdri2ExtensionRec::createContextAttribs
  736.     */
  737.    __DRIcontext *(*createContextAttribs)(__DRIscreen *screen,
  738.                                          int api,
  739.                                          const __DRIconfig *config,
  740.                                          __DRIcontext *shared,
  741.                                          unsigned num_attribs,
  742.                                          const uint32_t *attribs,
  743.                                          unsigned *error,
  744.                                          void *loaderPrivate);
  745. };
  746.  
  747. /**
  748.  * DRI2 Loader extension.
  749.  */
  750. #define __DRI_BUFFER_FRONT_LEFT         0
  751. #define __DRI_BUFFER_BACK_LEFT          1
  752. #define __DRI_BUFFER_FRONT_RIGHT        2
  753. #define __DRI_BUFFER_BACK_RIGHT         3
  754. #define __DRI_BUFFER_DEPTH              4
  755. #define __DRI_BUFFER_STENCIL            5
  756. #define __DRI_BUFFER_ACCUM              6
  757. #define __DRI_BUFFER_FAKE_FRONT_LEFT    7
  758. #define __DRI_BUFFER_FAKE_FRONT_RIGHT   8
  759. #define __DRI_BUFFER_DEPTH_STENCIL      9  /**< Only available with DRI2 1.1 */
  760. #define __DRI_BUFFER_HIZ                10
  761.  
  762. /* Inofficial and for internal use. Increase when adding a new buffer token. */
  763. #define __DRI_BUFFER_COUNT              11
  764.  
  765. struct __DRIbufferRec {
  766.     unsigned int attachment;
  767.     unsigned int name;
  768.     unsigned int pitch;
  769.     unsigned int cpp;
  770.     unsigned int flags;
  771. };
  772.  
  773. #define __DRI_DRI2_LOADER "DRI_DRI2Loader"
  774. #define __DRI_DRI2_LOADER_VERSION 3
  775. struct __DRIdri2LoaderExtensionRec {
  776.     __DRIextension base;
  777.  
  778.     __DRIbuffer *(*getBuffers)(__DRIdrawable *driDrawable,
  779.                                int *width, int *height,
  780.                                unsigned int *attachments, int count,
  781.                                int *out_count, void *loaderPrivate);
  782.  
  783.     /**
  784.      * Flush pending front-buffer rendering
  785.      *
  786.      * Any rendering that has been performed to the
  787.      * \c __DRI_BUFFER_FAKE_FRONT_LEFT will be flushed to the
  788.      * \c __DRI_BUFFER_FRONT_LEFT.
  789.      *
  790.      * \param driDrawable    Drawable whose front-buffer is to be flushed
  791.      * \param loaderPrivate  Loader's private data that was previously passed
  792.      *                       into __DRIdri2ExtensionRec::createNewDrawable
  793.      */
  794.     void (*flushFrontBuffer)(__DRIdrawable *driDrawable, void *loaderPrivate);
  795.  
  796.  
  797.     /**
  798.      * Get list of buffers from the server
  799.      *
  800.      * Gets a list of buffer for the specified set of attachments.  Unlike
  801.      * \c ::getBuffers, this function takes a list of attachments paired with
  802.      * opaque \c unsigned \c int value describing the format of the buffer.
  803.      * It is the responsibility of the caller to know what the service that
  804.      * allocates the buffers will expect to receive for the format.
  805.      *
  806.      * \param driDrawable    Drawable whose buffers are being queried.
  807.      * \param width          Output where the width of the buffers is stored.
  808.      * \param height         Output where the height of the buffers is stored.
  809.      * \param attachments    List of pairs of attachment ID and opaque format
  810.      *                       requested for the drawable.
  811.      * \param count          Number of attachment / format pairs stored in
  812.      *                       \c attachments.
  813.      * \param loaderPrivate  Loader's private data that was previously passed
  814.      *                       into __DRIdri2ExtensionRec::createNewDrawable.
  815.      */
  816.     __DRIbuffer *(*getBuffersWithFormat)(__DRIdrawable *driDrawable,
  817.                                          int *width, int *height,
  818.                                          unsigned int *attachments, int count,
  819.                                          int *out_count, void *loaderPrivate);
  820. };
  821.  
  822. /**
  823.  * This extension provides alternative screen, drawable and context
  824.  * constructors for DRI2.
  825.  */
  826. #define __DRI_DRI2 "DRI_DRI2"
  827. #define __DRI_DRI2_VERSION 3
  828.  
  829. #define __DRI_API_OPENGL        0       /**< OpenGL compatibility profile */
  830. #define __DRI_API_GLES          1       /**< OpenGL ES 1.x */
  831. #define __DRI_API_GLES2         2       /**< OpenGL ES 2.x */
  832. #define __DRI_API_OPENGL_CORE   3       /**< OpenGL 3.2+ core profile */
  833. #define __DRI_API_GLES3         4       /**< OpenGL ES 3.x */
  834.  
  835. #define __DRI_CTX_ATTRIB_MAJOR_VERSION          0
  836. #define __DRI_CTX_ATTRIB_MINOR_VERSION          1
  837. #define __DRI_CTX_ATTRIB_FLAGS                  2
  838.  
  839. /**
  840.  * \requires __DRI2_ROBUSTNESS.
  841.  */
  842. #define __DRI_CTX_ATTRIB_RESET_STRATEGY         3
  843.  
  844. #define __DRI_CTX_FLAG_DEBUG                    0x00000001
  845. #define __DRI_CTX_FLAG_FORWARD_COMPATIBLE       0x00000002
  846.  
  847. /**
  848.  * \requires __DRI2_ROBUSTNESS.
  849.  */
  850. #define __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS     0x00000004
  851.  
  852. /**
  853.  * \name Context reset strategies.
  854.  */
  855. /*@{*/
  856. #define __DRI_CTX_RESET_NO_NOTIFICATION         0
  857. #define __DRI_CTX_RESET_LOSE_CONTEXT            1
  858. /*@}*/
  859.  
  860. /**
  861.  * \name Reasons that __DRIdri2Extension::createContextAttribs might fail
  862.  */
  863. /*@{*/
  864. /** Success! */
  865. #define __DRI_CTX_ERROR_SUCCESS                 0
  866.  
  867. /** Memory allocation failure */
  868. #define __DRI_CTX_ERROR_NO_MEMORY               1
  869.  
  870. /** Client requested an API (e.g., OpenGL ES 2.0) that the driver can't do. */
  871. #define __DRI_CTX_ERROR_BAD_API                 2
  872.  
  873. /** Client requested an API version that the driver can't do. */
  874. #define __DRI_CTX_ERROR_BAD_VERSION             3
  875.  
  876. /** Client requested a flag or combination of flags the driver can't do. */
  877. #define __DRI_CTX_ERROR_BAD_FLAG                4
  878.  
  879. /** Client requested an attribute the driver doesn't understand. */
  880. #define __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE       5
  881.  
  882. /** Client requested a flag the driver doesn't understand. */
  883. #define __DRI_CTX_ERROR_UNKNOWN_FLAG            6
  884. /*@}*/
  885.  
  886. struct __DRIdri2ExtensionRec {
  887.     __DRIextension base;
  888.  
  889.     __DRIscreen *(*createNewScreen)(int screen, int fd,
  890.                                     const __DRIextension **extensions,
  891.                                     const __DRIconfig ***driver_configs,
  892.                                     void *loaderPrivate);
  893.  
  894.     __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
  895.                                         const __DRIconfig *config,
  896.                                         void *loaderPrivate);
  897.  
  898.     __DRIcontext *(*createNewContext)(__DRIscreen *screen,
  899.                                       const __DRIconfig *config,
  900.                                       __DRIcontext *shared,
  901.                                       void *loaderPrivate);
  902.  
  903.    /* Since version 2 */
  904.    unsigned int (*getAPIMask)(__DRIscreen *screen);
  905.  
  906.    __DRIcontext *(*createNewContextForAPI)(__DRIscreen *screen,
  907.                                            int api,
  908.                                            const __DRIconfig *config,
  909.                                            __DRIcontext *shared,
  910.                                            void *data);
  911.  
  912.    __DRIbuffer *(*allocateBuffer)(__DRIscreen *screen,
  913.                                   unsigned int attachment,
  914.                                   unsigned int format,
  915.                                   int width,
  916.                                   int height);
  917.    void (*releaseBuffer)(__DRIscreen *screen,
  918.                          __DRIbuffer *buffer);
  919.  
  920.    /**
  921.     * Create a context for a particular API with a set of attributes
  922.     *
  923.     * \since version 3
  924.     *
  925.     * \sa __DRIswrastExtensionRec::createContextAttribs
  926.     */
  927.    __DRIcontext *(*createContextAttribs)(__DRIscreen *screen,
  928.                                          int api,
  929.                                          const __DRIconfig *config,
  930.                                          __DRIcontext *shared,
  931.                                          unsigned num_attribs,
  932.                                          const uint32_t *attribs,
  933.                                          unsigned *error,
  934.                                          void *loaderPrivate);
  935. };
  936.  
  937.  
  938. /**
  939.  * This extension provides functionality to enable various EGLImage
  940.  * extensions.
  941.  */
  942. #define __DRI_IMAGE "DRI_IMAGE"
  943. #define __DRI_IMAGE_VERSION 7
  944.  
  945. /**
  946.  * These formats correspond to the similarly named MESA_FORMAT_*
  947.  * tokens, except in the native endian of the CPU.  For example, on
  948.  * little endian __DRI_IMAGE_FORMAT_XRGB8888 corresponds to
  949.  * MESA_FORMAT_XRGB8888, but MESA_FORMAT_XRGB8888_REV on big endian.
  950.  *
  951.  * __DRI_IMAGE_FORMAT_NONE is for images that aren't directly usable
  952.  * by the driver (YUV planar formats) but serve as a base image for
  953.  * creating sub-images for the different planes within the image.
  954.  *
  955.  * R8, GR88 and NONE should not be used with createImageFormName or
  956.  * createImage, and are returned by query from sub images created with
  957.  * createImageFromNames (NONE, see above) and fromPlane (R8 & GR88).
  958.  */
  959. #define __DRI_IMAGE_FORMAT_RGB565       0x1001
  960. #define __DRI_IMAGE_FORMAT_XRGB8888     0x1002
  961. #define __DRI_IMAGE_FORMAT_ARGB8888     0x1003
  962. #define __DRI_IMAGE_FORMAT_ABGR8888     0x1004
  963. #define __DRI_IMAGE_FORMAT_XBGR8888     0x1005
  964. #define __DRI_IMAGE_FORMAT_R8           0x1006 /* Since version 5 */
  965. #define __DRI_IMAGE_FORMAT_GR88         0x1007
  966. #define __DRI_IMAGE_FORMAT_NONE         0x1008
  967.  
  968. #define __DRI_IMAGE_USE_SHARE           0x0001
  969. #define __DRI_IMAGE_USE_SCANOUT         0x0002
  970. #define __DRI_IMAGE_USE_CURSOR          0x0004 /* Depricated */
  971.  
  972.  
  973. /**
  974.  * Four CC formats that matches with WL_DRM_FORMAT_* from wayland_drm.h
  975.  * and GBM_FORMAT_* from gbm.h, used with createImageFromNames.
  976.  *
  977.  * \since 5
  978.  */
  979.  
  980. #define __DRI_IMAGE_FOURCC_RGB565       0x36314752
  981. #define __DRI_IMAGE_FOURCC_ARGB8888     0x34325241
  982. #define __DRI_IMAGE_FOURCC_XRGB8888     0x34325258
  983. #define __DRI_IMAGE_FOURCC_ABGR8888     0x34324241
  984. #define __DRI_IMAGE_FOURCC_XBGR8888     0x34324258
  985. #define __DRI_IMAGE_FOURCC_YUV410       0x39565559
  986. #define __DRI_IMAGE_FOURCC_YUV411       0x31315559
  987. #define __DRI_IMAGE_FOURCC_YUV420       0x32315559
  988. #define __DRI_IMAGE_FOURCC_YUV422       0x36315559
  989. #define __DRI_IMAGE_FOURCC_YUV444       0x34325559
  990. #define __DRI_IMAGE_FOURCC_NV12         0x3231564e
  991. #define __DRI_IMAGE_FOURCC_NV16         0x3631564e
  992. #define __DRI_IMAGE_FOURCC_YUYV         0x56595559
  993.  
  994.  
  995. /**
  996.  * Queryable on images created by createImageFromNames.
  997.  *
  998.  * RGB and RGBA are may be usable directly as images but its still
  999.  * recommended to call fromPlanar with plane == 0.
  1000.  *
  1001.  * Y_U_V, Y_UV and Y_XUXV all requires call to fromPlanar to create
  1002.  * usable sub-images, sampling from images return raw YUV data and
  1003.  * color conversion needs to be done in the shader.
  1004.  *
  1005.  * \since 5
  1006.  */
  1007.  
  1008. #define __DRI_IMAGE_COMPONENTS_RGB      0x3001
  1009. #define __DRI_IMAGE_COMPONENTS_RGBA     0x3002
  1010. #define __DRI_IMAGE_COMPONENTS_Y_U_V    0x3003
  1011. #define __DRI_IMAGE_COMPONENTS_Y_UV     0x3004
  1012. #define __DRI_IMAGE_COMPONENTS_Y_XUXV   0x3005
  1013.  
  1014.  
  1015. /**
  1016.  * queryImage attributes
  1017.  */
  1018.  
  1019. #define __DRI_IMAGE_ATTRIB_STRIDE       0x2000
  1020. #define __DRI_IMAGE_ATTRIB_HANDLE       0x2001
  1021. #define __DRI_IMAGE_ATTRIB_NAME         0x2002
  1022. #define __DRI_IMAGE_ATTRIB_FORMAT       0x2003 /* available in versions 3+ */
  1023. #define __DRI_IMAGE_ATTRIB_WIDTH        0x2004 /* available in versions 4+ */
  1024. #define __DRI_IMAGE_ATTRIB_HEIGHT       0x2005
  1025. #define __DRI_IMAGE_ATTRIB_COMPONENTS   0x2006 /* available in versions 5+ */
  1026. #define __DRI_IMAGE_ATTRIB_FD           0x2007 /* available in versions
  1027.                                                 * 7+. Each query will return a
  1028.                                                 * new fd. */
  1029.  
  1030. /**
  1031.  * \name Reasons that __DRIimageExtensionRec::createImageFromTexture might fail
  1032.  */
  1033. /*@{*/
  1034. /** Success! */
  1035. #define __DRI_IMAGE_ERROR_SUCCESS       0
  1036.  
  1037. /** Memory allocation failure */
  1038. #define __DRI_IMAGE_ERROR_BAD_ALLOC     1
  1039.  
  1040. /** Client requested an invalid attribute for a texture object  */
  1041. #define __DRI_IMAGE_ERROR_BAD_MATCH     2
  1042.  
  1043. /** Client requested an invalid texture object */
  1044. #define __DRI_IMAGE_ERROR_BAD_PARAMETER 3
  1045. /*@}*/
  1046.  
  1047. typedef struct __DRIimageRec          __DRIimage;
  1048. typedef struct __DRIimageExtensionRec __DRIimageExtension;
  1049. struct __DRIimageExtensionRec {
  1050.     __DRIextension base;
  1051.  
  1052.     __DRIimage *(*createImageFromName)(__DRIscreen *screen,
  1053.                                        int width, int height, int format,
  1054.                                        int name, int pitch,
  1055.                                        void *loaderPrivate);
  1056.  
  1057.     __DRIimage *(*createImageFromRenderbuffer)(__DRIcontext *context,
  1058.                                                int renderbuffer,
  1059.                                                void *loaderPrivate);
  1060.  
  1061.     void (*destroyImage)(__DRIimage *image);
  1062.  
  1063.     __DRIimage *(*createImage)(__DRIscreen *screen,
  1064.                                int width, int height, int format,
  1065.                                unsigned int use,
  1066.                                void *loaderPrivate);
  1067.  
  1068.    GLboolean (*queryImage)(__DRIimage *image, int attrib, int *value);
  1069.  
  1070.    /**
  1071.     * The new __DRIimage will share the content with the old one, see dup(2).
  1072.     */
  1073.    __DRIimage *(*dupImage)(__DRIimage *image, void *loaderPrivate);
  1074.  
  1075.    /**
  1076.     * Validate that a __DRIimage can be used a certain way.
  1077.     *
  1078.     * \since 2
  1079.     */
  1080.    GLboolean (*validateUsage)(__DRIimage *image, unsigned int use);
  1081.  
  1082.    /**
  1083.     * Unlike createImageFromName __DRI_IMAGE_FORMAT is not but instead
  1084.     * __DRI_IMAGE_FOURCC and strides are in bytes not pixels. Stride is
  1085.     * also per block and not per pixel (for non-RGB, see gallium blocks).
  1086.     *
  1087.     * \since 5
  1088.     */
  1089.    __DRIimage *(*createImageFromNames)(__DRIscreen *screen,
  1090.                                        int width, int height, int fourcc,
  1091.                                        int *names, int num_names,
  1092.                                        int *strides, int *offsets,
  1093.                                        void *loaderPrivate);
  1094.  
  1095.    /**
  1096.     * Create an image out of a sub-region of a parent image.  This
  1097.     * entry point lets us create individual __DRIimages for different
  1098.     * planes in a planar buffer (typically yuv), for example.  While a
  1099.     * sub-image shares the underlying buffer object with the parent
  1100.     * image and other sibling sub-images, the life times of parent and
  1101.     * sub-images are not dependent.  Destroying the parent or a
  1102.     * sub-image doesn't affect other images.  The underlying buffer
  1103.     * object is free when no __DRIimage remains that references it.
  1104.     *
  1105.     * Sub-images may overlap, but rendering to overlapping sub-images
  1106.     * is undefined.
  1107.     *
  1108.     * \since 5
  1109.     */
  1110.     __DRIimage *(*fromPlanar)(__DRIimage *image, int plane,
  1111.                               void *loaderPrivate);
  1112.  
  1113.     /**
  1114.      * Create image from texture.
  1115.      *
  1116.      * \since 6
  1117.      */
  1118.    __DRIimage *(*createImageFromTexture)(__DRIcontext *context,
  1119.                                          int target,
  1120.                                          unsigned texture,
  1121.                                          int depth,
  1122.                                          int level,
  1123.                                          unsigned *error,
  1124.                                          void *loaderPrivate);
  1125.    /**
  1126.     * Like createImageFromNames, but takes a prime fd instead.
  1127.     *
  1128.     * \since 7
  1129.     */
  1130.    __DRIimage *(*createImageFromFds)(__DRIscreen *screen,
  1131.                                      int width, int height, int fourcc,
  1132.                                      int *fds, int num_fds,
  1133.                                      int *strides, int *offsets,
  1134.                                      void *loaderPrivate);
  1135. };
  1136.  
  1137.  
  1138. /**
  1139.  * This extension must be implemented by the loader and passed to the
  1140.  * driver at screen creation time.  The EGLImage entry points in the
  1141.  * various client APIs take opaque EGLImage handles and use this
  1142.  * extension to map them to a __DRIimage.  At version 1, this
  1143.  * extensions allows mapping EGLImage pointers to __DRIimage pointers,
  1144.  * but future versions could support other EGLImage-like, opaque types
  1145.  * with new lookup functions.
  1146.  */
  1147. #define __DRI_IMAGE_LOOKUP "DRI_IMAGE_LOOKUP"
  1148. #define __DRI_IMAGE_LOOKUP_VERSION 1
  1149.  
  1150. typedef struct __DRIimageLookupExtensionRec __DRIimageLookupExtension;
  1151. struct __DRIimageLookupExtensionRec {
  1152.     __DRIextension base;
  1153.  
  1154.     __DRIimage *(*lookupEGLImage)(__DRIscreen *screen, void *image,
  1155.                                   void *loaderPrivate);
  1156. };
  1157.  
  1158. /**
  1159.  * This extension allows for common DRI2 options
  1160.  */
  1161. #define __DRI2_CONFIG_QUERY "DRI_CONFIG_QUERY"
  1162. #define __DRI2_CONFIG_QUERY_VERSION 1
  1163.  
  1164. typedef struct __DRI2configQueryExtensionRec __DRI2configQueryExtension;
  1165. struct __DRI2configQueryExtensionRec {
  1166.    __DRIextension base;
  1167.  
  1168.    int (*configQueryb)(__DRIscreen *screen, const char *var, GLboolean *val);
  1169.    int (*configQueryi)(__DRIscreen *screen, const char *var, GLint *val);
  1170.    int (*configQueryf)(__DRIscreen *screen, const char *var, GLfloat *val);
  1171. };
  1172.  
  1173. /**
  1174.  * Robust context driver extension.
  1175.  *
  1176.  * Existence of this extension means the driver can accept the
  1177.  * \c __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS flag and the
  1178.  * \c __DRI_CTX_ATTRIB_RESET_STRATEGY attribute in
  1179.  * \c __DRIdri2ExtensionRec::createContextAttribs.
  1180.  */
  1181. #define __DRI2_ROBUSTNESS "DRI_Robustness"
  1182. #define __DRI2_ROBUSTNESS_VERSION 1
  1183.  
  1184. typedef struct __DRIrobustnessExtensionRec __DRIrobustnessExtension;
  1185. struct __DRIrobustnessExtensionRec {
  1186.    __DRIextension base;
  1187. };
  1188.  
  1189. #endif
  1190.