aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Herring <[email protected]>2016-05-03 21:02:43 -0500
committerEmil Velikov <[email protected]>2016-05-23 12:07:46 +0100
commita0f06f168fd951d5b50b892786f041b58e9554ae (patch)
tree0f98c10b3f415ac6fdd023ad53bcfccb0777bf48
parentbdfa635f726d77457db9ab6298c7910138befbcd (diff)
DRI: Add DRIimage map and unmap functions
Add mapImage and unmapImage functions to DRIimage extension for mapping and unmapping DRIimages for CPU access. The caller provides the region of the image to map and is returned a pointer to the beginning of the region and the stride (which could be different from the original). Signed-off-by: Rob Herring <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
-rw-r--r--include/GL/internal/dri_interface.h34
1 files changed, 33 insertions, 1 deletions
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 84731a06ef2..5cf34a4356f 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1094,7 +1094,7 @@ struct __DRIdri2ExtensionRec {
* extensions.
*/
#define __DRI_IMAGE "DRI_IMAGE"
-#define __DRI_IMAGE_VERSION 11
+#define __DRI_IMAGE_VERSION 12
/**
* These formats correspond to the similarly named MESA_FORMAT_*
@@ -1133,6 +1133,11 @@ struct __DRIdri2ExtensionRec {
#define __DRI_IMAGE_USE_BACKBUFFER 0x0010
+#define __DRI_IMAGE_TRANSFER_READ 0x1
+#define __DRI_IMAGE_TRANSFER_WRITE 0x2
+#define __DRI_IMAGE_TRANSFER_READ_WRITE \
+ (__DRI_IMAGE_TRANSFER_READ | __DRI_IMAGE_TRANSFER_WRITE)
+
/**
* Four CC formats that matches with WL_DRM_FORMAT_* from wayland_drm.h,
* GBM_FORMAT_* from gbm.h, and DRM_FORMAT_* from drm_fourcc.h. Used with
@@ -1381,6 +1386,33 @@ struct __DRIimageExtensionRec {
* \since 10
*/
int (*getCapabilities)(__DRIscreen *screen);
+
+ /**
+ * Returns a map of the specified region of a __DRIimage for the specified usage.
+ *
+ * flags may include __DRI_IMAGE_TRANSFER_READ, which will populate the
+ * mapping with the current buffer content. If __DRI_IMAGE_TRANSFER_READ
+ * is not included in the flags, the buffer content at map time is
+ * undefined. Users wanting to modify the mapping must include
+ * __DRI_IMAGE_TRANSFER_WRITE; if __DRI_IMAGE_TRANSFER_WRITE is not
+ * included, behaviour when writing the mapping is undefined.
+ *
+ * Returns the byte stride in *stride, and an opaque pointer to data
+ * tracking the mapping in **data, which must be passed to unmapImage().
+ *
+ * \since 12
+ */
+ void *(*mapImage)(__DRIcontext *context, __DRIimage *image,
+ int x0, int y0, int width, int height,
+ unsigned int flags, int *stride, void **data);
+
+ /**
+ * Unmap a previously mapped __DRIimage
+ *
+ * \since 12
+ */
+ void (*unmapImage)(__DRIcontext *context, __DRIimage *image, void *data);
+
};