diff options
author | Keith Packard <keithp@keithp.com> | 2013-11-04 18:09:51 -0800 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2013-11-07 19:08:09 -0800 |
commit | 442442026eb241f05f2b7c03da304e0be047a7da (patch) | |
tree | 004956fd32cda29d0d0c8cf7edb5581ef0a7681a /include/GL | |
parent | 1f085ba18fb11ca7d378bb2b4423702b1c823786 (diff) | |
download | external_mesa3d-442442026eb241f05f2b7c03da304e0be047a7da.zip external_mesa3d-442442026eb241f05f2b7c03da304e0be047a7da.tar.gz external_mesa3d-442442026eb241f05f2b7c03da304e0be047a7da.tar.bz2 |
dri: add __DRIimageLoaderExtension and __DRIimageDriverExtension
These provide an interface between the driver and the loader to allocate
color buffers through the DRIimage extension interface rather than through a
loader-specific extension (as is used by DRI2, for instance).
The driver uses the loader 'getBuffers' interface to allocate color buffers.
The loader uses the createNewScreen2, createNewDrawable, createNewContext,
getAPIMask and createContextAttribs APIS (mostly shared with DRI2).
This interface will work with the DRI3 loader, and should also work with GBM
and other loaders so that drivers need not be customized for each new loader
interface, as long as they provide this image interface.
v2: Fix build of i915 and i965 together (by anholt)
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'include/GL')
-rw-r--r-- | include/GL/internal/dri_interface.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index fdd7f94..ed43257 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -86,6 +86,10 @@ typedef struct __DRIdri2LoaderExtensionRec __DRIdri2LoaderExtension; typedef struct __DRI2flushExtensionRec __DRI2flushExtension; typedef struct __DRI2throttleExtensionRec __DRI2throttleExtension; + +typedef struct __DRIimageLoaderExtensionRec __DRIimageLoaderExtension; +typedef struct __DRIimageDriverExtensionRec __DRIimageDriverExtension; + /*@}*/ @@ -1334,4 +1338,76 @@ struct __DRI2rendererQueryExtensionRec { int (*queryString)(__DRIscreen *screen, int attribute, const char **val); }; +/** + * Image Loader extension. Drivers use this to allocate color buffers + */ + +enum __DRIimageBufferMask { + __DRI_IMAGE_BUFFER_BACK = (1 << 0), + __DRI_IMAGE_BUFFER_FRONT = (1 << 1) +}; + +struct __DRIimageList { + uint32_t image_mask; + __DRIimage *back; + __DRIimage *front; +}; + +#define __DRI_IMAGE_LOADER "DRI_IMAGE_LOADER" +#define __DRI_IMAGE_LOADER_VERSION 1 + +struct __DRIimageLoaderExtensionRec { + __DRIextension base; + + /** + * Allocate color buffers. + * + * \param driDrawable + * \param width Width of allocated buffers + * \param height Height of allocated buffers + * \param format one of __DRI_IMAGE_FORMAT_* + * \param stamp Address of variable to be updated when + * getBuffers must be called again + * \param loaderPrivate The loaderPrivate for driDrawable + * \param buffer_mask Set of buffers to allocate + * \param buffers Returned buffers + */ + int (*getBuffers)(__DRIdrawable *driDrawable, + unsigned int format, + uint32_t *stamp, + void *loaderPrivate, + uint32_t buffer_mask, + struct __DRIimageList *buffers); + + /** + * Flush pending front-buffer rendering + * + * Any rendering that has been performed to the + * fake front will be flushed to the front + * + * \param driDrawable Drawable whose front-buffer is to be flushed + * \param loaderPrivate Loader's private data that was previously passed + * into __DRIdri2ExtensionRec::createNewDrawable + */ + void (*flushFrontBuffer)(__DRIdrawable *driDrawable, void *loaderPrivate); +}; + +/** + * DRI extension. + */ + +#define __DRI_IMAGE_DRIVER "DRI_IMAGE_DRIVER" +#define __DRI_IMAGE_DRIVER_VERSION 1 + +struct __DRIimageDriverExtensionRec { + __DRIextension base; + + /* Common DRI functions, shared with DRI2 */ + __DRIcreateNewScreen2Func createNewScreen2; + __DRIcreateNewDrawableFunc createNewDrawable; + __DRIcreateNewContextFunc createNewContext; + __DRIcreateContextAttribsFunc createContextAttribs; + __DRIgetAPIMaskFunc getAPIMask; +}; + #endif |