[Mesa-dev] [PATCH 1/3] dri: Add another duplicateImage to DRIimageExtension which allows you to create a sRGB view of a DRI image

John Kåre Alsaker john.kare.alsaker at gmail.com
Sat Feb 23 07:53:22 PST 2013


duplicateImage will allow you to create a linear or sRGB view into a DRIimage you have access to.
This is useful because compositors may want a specific view which doesn't correspond to the one used by applications.
---
 include/GL/internal/dri_interface.h | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 42147e9..f4948a8 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -938,7 +938,7 @@ struct __DRIdri2ExtensionRec {
  * extensions.
  */
 #define __DRI_IMAGE "DRI_IMAGE"
-#define __DRI_IMAGE_VERSION 6
+#define __DRI_IMAGE_VERSION 7
 
 /**
  * These formats correspond to the similarly named MESA_FORMAT_*
@@ -1009,6 +1009,15 @@ struct __DRIdri2ExtensionRec {
 #define __DRI_IMAGE_COMPONENTS_Y_UV	0x3004
 #define __DRI_IMAGE_COMPONENTS_Y_XUXV	0x3005
 
+/**
+ * Flags for duplicateImage.
+ *
+ * \since 7
+ */
+
+#define __DRI_IMAGE_FLAG_SRGB_VIEW	0x0001
+#define __DRI_IMAGE_FLAG_LINEAR_VIEW	0x0002
+
 
 /**
  * queryImage attributes
@@ -1105,6 +1114,7 @@ struct __DRIimageExtensionRec {
     __DRIimage *(*fromPlanar)(__DRIimage *image, int plane,
                               void *loaderPrivate);
 
+
     /**
      * Create image from texture.
      *
@@ -1117,6 +1127,15 @@ struct __DRIimageExtensionRec {
                                          int level,
                                          unsigned *error,
                                          void *loaderPrivate);
+
+   /**
+    * The new __DRIimage will share the raw content with the old one,
+    * but it might have a different format.
+    *
+    * \since 7
+    */
+    __DRIimage *(*duplicateImage)(__DRIscreen *screen, __DRIimage *image,
+                              unsigned int flags, void *loaderPrivate);
 };
 
 
-- 
1.8.1.3



More information about the mesa-dev mailing list