Merge branch '7.8'
[mesa.git] / include / GL / internal / dri_interface.h
index 58540d60057f06f4177515b90057a4adfede6fe8..aa56eb45d798cfaa1b1cf0d9a247bc68e2320665 100644 (file)
 #define DRI_INTERFACE_H
 
 /* For archs with no drm.h */
-#if !defined(__APPLE__) && !defined(__CYGWIN__) && !defined(__GNU__)
+#if defined(__APPLE__) || defined(__CYGWIN__) || defined(__GNU__)
+#ifndef __NOT_HAVE_DRM_H
+#define __NOT_HAVE_DRM_H
+#endif
+#endif
+
+#ifndef __NOT_HAVE_DRM_H
 #include <drm.h>
 #else
 typedef unsigned int drm_context_t;
@@ -269,22 +275,20 @@ struct __DRItexBufferExtensionRec {
  * Used by drivers that implement DRI2
  */
 #define __DRI2_FLUSH "DRI2_Flush"
-#define __DRI2_FLUSH_VERSION 2
+#define __DRI2_FLUSH_VERSION 3
 struct __DRI2flushExtensionRec {
     __DRIextension base;
     void (*flush)(__DRIdrawable *drawable);
 
     /**
-     * Flush all rendering queue in the driver to the drm and
-     * invalidate all buffers.  The driver will call out to
-     * getBuffers/getBuffersWithFormat before it starts rendering
-     * again.
+     * Ask the driver to call getBuffers/getBuffersWithFormat before
+     * it starts rendering again.
      *
-     * \param drawable the drawable to flush and invalidate
+     * \param drawable the drawable to invalidate
      *
-     * \since 2
+     * \since 3
      */
-    void (*flushInvalidate)(__DRIdrawable *drawable);
+    void (*invalidate)(__DRIdrawable *drawable);
 };
 
 
@@ -753,4 +757,59 @@ struct __DRIdri2ExtensionRec {
 
 };
 
+
+/**
+ * This extension provides functionality to enable various EGLImage
+ * extensions.
+ */
+#define __DRI_IMAGE "DRI_IMAGE"
+#define __DRI_IMAGE_VERSION 1
+
+/**
+ * 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.
+ */
+#define __DRI_IMAGE_FORMAT_RGB565       0x1001
+#define __DRI_IMAGE_FORMAT_XRGB8888     0x1002
+#define __DRI_IMAGE_FORMAT_ARGB8888     0x1003
+
+typedef struct __DRIimageRec          __DRIimage;
+typedef struct __DRIimageExtensionRec __DRIimageExtension;
+struct __DRIimageExtensionRec {
+    __DRIextension base;
+
+    __DRIimage *(*createImageFromName)(__DRIcontext *context,
+                                      int width, int height, int format,
+                                      int name, int pitch,
+                                      void *loaderPrivate);
+
+    __DRIimage *(*createImageFromRenderbuffer)(__DRIcontext *context,
+                                              int renderbuffer,
+                                              void *loaderPrivate);
+
+    void (*destroyImage)(__DRIimage *image);
+};
+
+/**
+ * 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
+ * with new lookup functions.
+ */
+#define __DRI_IMAGE_LOOKUP "DRI_IMAGE_LOOKUP"
+#define __DRI_IMAGE_LOOKUP_VERSION 1
+
+typedef struct __DRIimageLookupExtensionRec __DRIimageLookupExtension;
+struct __DRIimageLookupExtensionRec {
+    __DRIextension base;
+
+    __DRIimage *(*lookupEGLImage)(__DRIcontext *context, void *image,
+                                 void *loaderPrivate);
+};
+
 #endif