typedef struct drm_clip_rect drm_clip_rect_t;
#endif
+#include <stdint.h>
+
/**
* \name DRI interface structures
*
#define __DRI2_FENCE "DRI2_Fence"
#define __DRI2_FENCE_VERSION 2
-#define __DRI2_FENCE_TIMEOUT_INFINITE 0xffffffffffffffffllu
+#define __DRI2_FENCE_TIMEOUT_INFINITE 0xffffffffffffffffull
#define __DRI2_FENCE_FLAG_FLUSH_COMMANDS (1 << 0)
#define __DRI_ATTRIB_TEXTURE_2D_BIT 0x02
#define __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT 0x04
+/* __DRI_ATTRIB_SWAP_METHOD */
+/* Note that with the exception of __DRI_ATTRIB_SWAP_NONE, we need to define
+ * the same tokens as GLX. This is because old and current X servers will
+ * transmit the driconf value grabbed from the AIGLX driver untranslated as
+ * the GLX fbconfig value. __DRI_ATTRIB_SWAP_NONE is only used by dri drivers
+ * to signal to the dri core that the driconfig is single-buffer.
+ */
+#define __DRI_ATTRIB_SWAP_NONE 0x0000
+#define __DRI_ATTRIB_SWAP_EXCHANGE 0x8061
+#define __DRI_ATTRIB_SWAP_COPY 0x8062
+#define __DRI_ATTRIB_SWAP_UNDEFINED 0x8063
+
/**
* This extension defines the core DRI functionality.
+ *
+ * Version >= 2 indicates that getConfigAttrib with __DRI_ATTRIB_SWAP_METHOD
+ * returns a reliable value.
*/
#define __DRI_CORE "DRI_Core"
-#define __DRI_CORE_VERSION 1
+#define __DRI_CORE_VERSION 2
struct __DRIcoreExtensionRec {
__DRIextension base;
};
#define __DRI_DRI2_LOADER "DRI_DRI2Loader"
-#define __DRI_DRI2_LOADER_VERSION 3
+#define __DRI_DRI2_LOADER_VERSION 4
+
+enum dri_loader_cap {
+ /* Whether the loader handles RGBA channel ordering correctly. If not,
+ * only BGRA ordering can be exposed.
+ */
+ DRI_LOADER_CAP_RGBA_ORDERING,
+};
+
struct __DRIdri2LoaderExtensionRec {
__DRIextension base;
int *width, int *height,
unsigned int *attachments, int count,
int *out_count, void *loaderPrivate);
+
+ /**
+ * Return a loader capability value. If the loader doesn't know the enum,
+ * it will return 0.
+ *
+ * \param loaderPrivate The last parameter of createNewScreen or
+ * createNewScreen2.
+ * \param cap See the enum.
+ *
+ * \since 4
+ */
+ unsigned (*getCapability)(void *loaderPrivate, enum dri_loader_cap cap);
};
/**
*/
#define __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS 0x00000004
+/**
+ * \requires __DRI2_NO_ERROR.
+ *
+ */
+#define __DRI_CTX_FLAG_NO_ERROR 0x00000008
+
/**
* \name Context reset strategies.
*/
* extensions.
*/
#define __DRI_IMAGE "DRI_IMAGE"
-#define __DRI_IMAGE_VERSION 14
+#define __DRI_IMAGE_VERSION 17
/**
* These formats correspond to the similarly named MESA_FORMAT_*
* by the driver (YUV planar formats) but serve as a base image for
* creating sub-images for the different planes within the image.
*
- * R8, GR88 and NONE should not be used with createImageFormName or
+ * R8, GR88 and NONE should not be used with createImageFromName or
* createImage, and are returned by query from sub images created with
* createImageFromNames (NONE, see above) and fromPlane (R8 & GR88).
*/
#define __DRI_IMAGE_USE_SHARE 0x0001
#define __DRI_IMAGE_USE_SCANOUT 0x0002
-#define __DRI_IMAGE_USE_CURSOR 0x0004 /* Depricated */
+#define __DRI_IMAGE_USE_CURSOR 0x0004 /* Deprecated */
#define __DRI_IMAGE_USE_LINEAR 0x0008
/* The buffer will only be read by an external process after SwapBuffers,
* in contrary to gbm buffers, front buffers and fake front buffers, which
#define __DRI_IMAGE_FOURCC_NV12 0x3231564e
#define __DRI_IMAGE_FOURCC_NV16 0x3631564e
#define __DRI_IMAGE_FOURCC_YUYV 0x56595559
+#define __DRI_IMAGE_FOURCC_UYVY 0x59565955
#define __DRI_IMAGE_FOURCC_YVU410 0x39555659
#define __DRI_IMAGE_FOURCC_YVU411 0x31315659
* RGB and RGBA are may be usable directly as images but its still
* recommended to call fromPlanar with plane == 0.
*
- * Y_U_V, Y_UV and Y_XUXV all requires call to fromPlanar to create
+ * Y_U_V, Y_UV,Y_XUXV and Y_UXVX all requires call to fromPlanar to create
* usable sub-images, sampling from images return raw YUV data and
* color conversion needs to be done in the shader.
*
#define __DRI_IMAGE_COMPONENTS_Y_U_V 0x3003
#define __DRI_IMAGE_COMPONENTS_Y_UV 0x3004
#define __DRI_IMAGE_COMPONENTS_Y_XUXV 0x3005
+#define __DRI_IMAGE_COMPONENTS_Y_UXVX 0x3008
#define __DRI_IMAGE_COMPONENTS_R 0x3006
#define __DRI_IMAGE_COMPONENTS_RG 0x3007
#define __BLIT_FLAG_FLUSH 0x0001
#define __BLIT_FLAG_FINISH 0x0002
+/**
+ * queryDmaBufFormatModifierAttribs attributes
+ */
+
+/* Available in version 16 */
+#define __DRI_IMAGE_FORMAT_MODIFIER_ATTRIB_PLANE_COUNT 0x0001
+
typedef struct __DRIimageRec __DRIimage;
typedef struct __DRIimageExtensionRec __DRIimageExtension;
struct __DRIimageExtensionRec {
int name, int pitch,
void *loaderPrivate);
+ /* Deprecated since version 17; see createImageFromRenderbuffer2 */
__DRIimage *(*createImageFromRenderbuffer)(__DRIcontext *context,
int renderbuffer,
void *loaderPrivate);
const uint64_t *modifiers,
const unsigned int modifier_count,
void *loaderPrivate);
+
+ /*
+ * Like createImageFromDmaBufs, but takes also format modifiers.
+ *
+ * For EGL_EXT_image_dma_buf_import_modifiers.
+ *
+ * \since 15
+ */
+ __DRIimage *(*createImageFromDmaBufs2)(__DRIscreen *screen,
+ int width, int height, int fourcc,
+ uint64_t modifier,
+ int *fds, int num_fds,
+ int *strides, int *offsets,
+ enum __DRIYUVColorSpace color_space,
+ enum __DRISampleRange sample_range,
+ enum __DRIChromaSiting horiz_siting,
+ enum __DRIChromaSiting vert_siting,
+ unsigned *error,
+ void *loaderPrivate);
+
+ /*
+ * dmabuf format query to support EGL_EXT_image_dma_buf_import_modifiers.
+ *
+ * \param max Maximum number of formats that can be accomodated into
+ * \param formats. If zero, no formats are returned -
+ * instead, the driver returns the total number of
+ * supported dmabuf formats in \param count.
+ * \param formats Buffer to fill formats into.
+ * \param count Count of formats returned, or, total number of
+ * supported formats in case \param max is zero.
+ *
+ * Returns true on success.
+ *
+ * \since 15
+ */
+ GLboolean (*queryDmaBufFormats)(__DRIscreen *screen, int max,
+ int *formats, int *count);
+
+ /*
+ * dmabuf format modifier query for a given format to support
+ * EGL_EXT_image_dma_buf_import_modifiers.
+ *
+ * \param fourcc The format to query modifiers for. If this format
+ * is not supported by the driver, return false.
+ * \param max Maximum number of modifiers that can be accomodated in
+ * \param modifiers. If zero, no modifiers are returned -
+ * instead, the driver returns the total number of
+ * modifiers for \param format in \param count.
+ * \param modifiers Buffer to fill modifiers into.
+ * \param count Count of the modifiers returned, or, total number of
+ * supported modifiers for \param fourcc in case
+ * \param max is zero.
+ *
+ * Returns true upon success.
+ *
+ * \since 15
+ */
+ GLboolean (*queryDmaBufModifiers)(__DRIscreen *screen, int fourcc,
+ int max, uint64_t *modifiers,
+ unsigned int *external_only,
+ int *count);
+
+ /**
+ * dmabuf format modifier attribute query for a given format and modifier.
+ *
+ * \param fourcc The format to query. If this format is not supported by
+ * the driver, return false.
+ * \param modifier The modifier to query. If this format+modifier is not
+ * supported by the driver, return false.
+ * \param attrib The __DRI_IMAGE_FORMAT_MODIFIER_ATTRIB to query.
+ * \param value A pointer to where to store the result of the query.
+ *
+ * Returns true upon success.
+ *
+ * \since 16
+ */
+ GLboolean (*queryDmaBufFormatModifierAttribs)(__DRIscreen *screen,
+ uint32_t fourcc, uint64_t modifier,
+ int attrib, uint64_t *value);
+
+ /**
+ * Create a DRI image from the given renderbuffer.
+ *
+ * \param context the current DRI context
+ * \param renderbuffer the GL name of the renderbuffer
+ * \param loaderPrivate for callbacks into the loader related to the image
+ * \param error will be set to one of __DRI_IMAGE_ERROR_xxx
+ * \return the newly created image on success, or NULL otherwise
+ *
+ * \since 17
+ */
+ __DRIimage *(*createImageFromRenderbuffer2)(__DRIcontext *context,
+ int renderbuffer,
+ void *loaderPrivate,
+ unsigned *error);
};
__DRIextension base;
};
+/**
+ * No-error context driver extension.
+ *
+ * Existence of this extension means the driver can accept the
+ * __DRI_CTX_FLAG_NO_ERROR flag.
+ */
+#define __DRI2_NO_ERROR "DRI_NoError"
+#define __DRI2_NO_ERROR_VERSION 1
+
+typedef struct __DRInoErrorExtensionRec {
+ __DRIextension base;
+} __DRInoErrorExtension;
+
/**
* DRI config options extension.
*
* This extension provides the XML string containing driver options for use by
* the loader in supporting the driconf application.
+ *
+ * v2:
+ * - Add the getXml getter function which allows the driver more flexibility in
+ * how the XML is provided.
+ * - Deprecate the direct xml pointer. It is only provided as a fallback for
+ * older versions of libGL and must not be used by clients that are aware of
+ * the newer version. Future driver versions may set it to NULL.
*/
#define __DRI_CONFIG_OPTIONS "DRI_ConfigOptions"
-#define __DRI_CONFIG_OPTIONS_VERSION 1
+#define __DRI_CONFIG_OPTIONS_VERSION 2
typedef struct __DRIconfigOptionsExtensionRec {
__DRIextension base;
- const char *xml;
+ const char *xml; /**< deprecated since v2, use getXml instead */
+
+ /**
+ * Get an XML string that describes available driver options for use by a
+ * config application.
+ *
+ * The returned string must be heap-allocated. The caller is responsible for
+ * freeing it.
+ */
+ char *(*getXml)(const char *driver_name);
} __DRIconfigOptionsExtension;
/**
};
#define __DRI_IMAGE_LOADER "DRI_IMAGE_LOADER"
-#define __DRI_IMAGE_LOADER_VERSION 1
+#define __DRI_IMAGE_LOADER_VERSION 3
struct __DRIimageLoaderExtensionRec {
__DRIextension base;
* into __DRIdri2ExtensionRec::createNewDrawable
*/
void (*flushFrontBuffer)(__DRIdrawable *driDrawable, void *loaderPrivate);
+
+ /**
+ * Return a loader capability value. If the loader doesn't know the enum,
+ * it will return 0.
+ *
+ * \since 2
+ */
+ unsigned (*getCapability)(void *loaderPrivate, enum dri_loader_cap cap);
+
+ /**
+ * Flush swap buffers
+ *
+ * Make sure any outstanding swap buffers have been submitted to the
+ * device.
+ *
+ * \param driDrawable Drawable whose swaps need to be flushed
+ * \param loaderPrivate Loader's private data that was previously passed
+ * into __DRIdri2ExtensionRec::createNewDrawable
+ *
+ * \since 3
+ */
+ void (*flushSwapBuffers)(__DRIdrawable *driDrawable, void *loaderPrivate);
};
/**
* operations (e.g. it should just set a thread-local variable).
*/
void (*setBackgroundContext)(void *loaderPrivate);
+
+ /**
+ * Indicate that it is multithread safe to use glthread. For GLX/EGL
+ * platforms using Xlib, that involves calling XInitThreads, before
+ * opening an X display.
+ *
+ * Note: only supported if extension version is at least 2.
+ *
+ * \param loaderPrivate is the value that was passed to to the driver when
+ * the context was created. This can be used by the loader to identify
+ * which context any callbacks are associated with.
+ */
+ GLboolean (*isThreadSafe)(void *loaderPrivate);
};
#endif