[Mesa-dev] [PATCH 1/6] dri_interface: add an error-returning version of createImageFromRenderbuffer

Nicolai Hähnle nhaehnle at gmail.com
Fri Oct 6 20:16:03 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

We ought to be able to distinguish between allocation errors and bad
parameters (non-existent renderbuffer object).

Bumps the version of the DRI Image extension to 17.
---
 include/GL/internal/dri_interface.h | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 783ff1c70d5..aefba92c024 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1173,21 +1173,21 @@ struct __DRIdri2ExtensionRec {
     */
    __DRIcreateNewScreen2Func            createNewScreen2;
 };
 
 
 /**
  * This extension provides functionality to enable various EGLImage
  * extensions.
  */
 #define __DRI_IMAGE "DRI_IMAGE"
-#define __DRI_IMAGE_VERSION 16
+#define __DRI_IMAGE_VERSION 17
 
 /**
  * These formats correspond to the similarly named MESA_FORMAT_*
  * tokens, except in the native endian of the CPU.  For example, on
  * little endian __DRI_IMAGE_FORMAT_XRGB8888 corresponds to
  * MESA_FORMAT_XRGB8888, but MESA_FORMAT_XRGB8888_REV on big endian.
  *
  * __DRI_IMAGE_FORMAT_NONE is for images that aren't directly usable
  * by the driver (YUV planar formats) but serve as a base image for
  * creating sub-images for the different planes within the image.
@@ -1370,20 +1370,21 @@ enum __DRIChromaSiting {
 typedef struct __DRIimageRec          __DRIimage;
 typedef struct __DRIimageExtensionRec __DRIimageExtension;
 struct __DRIimageExtensionRec {
     __DRIextension base;
 
     __DRIimage *(*createImageFromName)(__DRIscreen *screen,
 				       int width, int height, int format,
 				       int name, int pitch,
 				       void *loaderPrivate);
 
+    /* Deprecated since version 17; see createImageFromRenderbuffer2 */
     __DRIimage *(*createImageFromRenderbuffer)(__DRIcontext *context,
 					       int renderbuffer,
 					       void *loaderPrivate);
 
     void (*destroyImage)(__DRIimage *image);
 
     __DRIimage *(*createImage)(__DRIscreen *screen,
 			       int width, int height, int format,
 			       unsigned int use,
 			       void *loaderPrivate);
@@ -1618,20 +1619,36 @@ struct __DRIimageExtensionRec {
     * \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);
 };
 
 
 /**
  * This extension must be implemented by the loader and passed to the
  * driver at screen creation time.  The EGLImage entry points in the
  * various client APIs take opaque EGLImage handles and use this
  * extension to map them to a __DRIimage.  At version 1, this
  * extensions allows mapping EGLImage pointers to __DRIimage pointers,
  * but future versions could support other EGLImage-like, opaque types
-- 
2.11.0



More information about the mesa-dev mailing list