+/**
+ * Extension for EGL_ANDROID_blob_cache
+ */
+
+#define __DRI2_BLOB "DRI2_Blob"
+#define __DRI2_BLOB_VERSION 1
+
+typedef void
+(*__DRIblobCacheSet) (const void *key, signed long keySize,
+ const void *value, signed long valueSize);
+
+typedef signed long
+(*__DRIblobCacheGet) (const void *key, signed long keySize,
+ void *value, signed long valueSize);
+
+struct __DRI2blobExtensionRec {
+ __DRIextension base;
+
+ /**
+ * Set cache functions for setting and getting cache entries.
+ */
+ void (*set_cache_funcs) (__DRIscreen *screen,
+ __DRIblobCacheSet set, __DRIblobCacheGet get);
+};
+
+/**
+ * Extension for fences / synchronization objects.
+ */
+
+#define __DRI2_FENCE "DRI2_Fence"
+#define __DRI2_FENCE_VERSION 2
+
+#define __DRI2_FENCE_TIMEOUT_INFINITE 0xffffffffffffffffull
+
+#define __DRI2_FENCE_FLAG_FLUSH_COMMANDS (1 << 0)
+
+/**
+ * \name Capabilities that might be returned by __DRI2fenceExtensionRec::get_capabilities
+ */
+/*@{*/
+#define __DRI_FENCE_CAP_NATIVE_FD 1
+/*@}*/
+
+struct __DRI2fenceExtensionRec {
+ __DRIextension base;
+
+ /**
+ * Create and insert a fence into the command stream of the context.
+ */
+ void *(*create_fence)(__DRIcontext *ctx);
+
+ /**
+ * Get a fence associated with the OpenCL event object.
+ * This can be NULL, meaning that OpenCL interoperability is not supported.
+ */
+ void *(*get_fence_from_cl_event)(__DRIscreen *screen, intptr_t cl_event);
+
+ /**
+ * Destroy a fence.
+ */
+ void (*destroy_fence)(__DRIscreen *screen, void *fence);
+
+ /**
+ * This function waits and doesn't return until the fence is signalled
+ * or the timeout expires. It returns true if the fence has been signaled.
+ *
+ * \param ctx the context where commands are flushed
+ * \param fence the fence
+ * \param flags a combination of __DRI2_FENCE_FLAG_xxx flags
+ * \param timeout the timeout in ns or __DRI2_FENCE_TIMEOUT_INFINITE
+ */
+ GLboolean (*client_wait_sync)(__DRIcontext *ctx, void *fence,
+ unsigned flags, uint64_t timeout);
+
+ /**
+ * This function enqueues a wait command into the command stream of
+ * the context and then returns. When the execution reaches the wait
+ * command, no further execution will be done in the context until
+ * the fence is signaled. This is a no-op if the device doesn't support
+ * parallel execution of contexts.
+ *
+ * \param ctx the context where the waiting is done
+ * \param fence the fence
+ * \param flags a combination of __DRI2_FENCE_FLAG_xxx flags that make
+ * sense with this function (right now there are none)
+ */
+ void (*server_wait_sync)(__DRIcontext *ctx, void *fence, unsigned flags);
+
+ /**
+ * Query for general capabilities of the driver that concern fences.
+ * Returns a bitmask of __DRI_FENCE_CAP_x
+ *
+ * \since 2
+ */
+ unsigned (*get_capabilities)(__DRIscreen *screen);
+
+ /**
+ * Create an fd (file descriptor) associated fence. If the fence fd
+ * is -1, this behaves similarly to create_fence() except that when
+ * rendering is flushed the driver creates a fence fd. Otherwise,
+ * the driver wraps an existing fence fd.
+ *
+ * This is used to implement the EGL_ANDROID_native_fence_sync extension.
+ *
+ * \since 2
+ *
+ * \param ctx the context associated with the fence
+ * \param fd the fence fd or -1
+ */
+ void *(*create_fence_fd)(__DRIcontext *ctx, int fd);
+
+ /**
+ * For fences created with create_fence_fd(), after rendering is flushed,
+ * this retrieves the native fence fd. Caller takes ownership of the
+ * fd and will close() it when it is no longer needed.
+ *
+ * \since 2
+ *
+ * \param screen the screen associated with the fence
+ * \param fence the fence
+ */
+ int (*get_fence_fd)(__DRIscreen *screen, void *fence);
+};
+
+
+/**
+ * Extension for API interop.
+ * See GL/mesa_glinterop.h.
+ */
+
+#define __DRI2_INTEROP "DRI2_Interop"
+#define __DRI2_INTEROP_VERSION 1
+
+struct mesa_glinterop_device_info;
+struct mesa_glinterop_export_in;
+struct mesa_glinterop_export_out;
+
+struct __DRI2interopExtensionRec {
+ __DRIextension base;
+
+ /** Same as MesaGLInterop*QueryDeviceInfo. */
+ int (*query_device_info)(__DRIcontext *ctx,
+ struct mesa_glinterop_device_info *out);
+
+ /** Same as MesaGLInterop*ExportObject. */
+ int (*export_object)(__DRIcontext *ctx,
+ struct mesa_glinterop_export_in *in,
+ struct mesa_glinterop_export_out *out);
+};
+
+
+/**
+ * Extension for limiting window system back buffer rendering to user-defined
+ * scissor region.
+ */
+
+#define __DRI2_BUFFER_DAMAGE "DRI2_BufferDamage"
+#define __DRI2_BUFFER_DAMAGE_VERSION 1
+
+struct __DRI2bufferDamageExtensionRec {
+ __DRIextension base;
+
+ /**
+ * Provides an array of rectangles representing an overriding scissor region
+ * for rendering operations performed to the specified drawable. These
+ * rectangles do not replace client API scissor regions or draw
+ * co-ordinates, but instead inform the driver of the overall bounds of all
+ * operations which will be issued before the next flush.
+ *
+ * Any rendering operations writing pixels outside this region to the
+ * drawable will have an undefined effect on the entire drawable.
+ *
+ * This entrypoint may only be called after the drawable has either been
+ * newly created or flushed, and before any rendering operations which write
+ * pixels to the drawable. Calling this entrypoint at any other time will
+ * have an undefined effect on the entire drawable.
+ *
+ * Calling this entrypoint with @nrects 0 and @rects NULL will reset the
+ * region to the buffer's full size. This entrypoint may be called once to
+ * reset the region, followed by a second call with a populated region,
+ * before a rendering call is made.
+ *
+ * Used to implement EGL_KHR_partial_update.
+ *
+ * \param drawable affected drawable
+ * \param nrects number of rectangles provided
+ * \param rects the array of rectangles, lower-left origin
+ */
+ void (*set_damage_region)(__DRIdrawable *drawable, unsigned int nrects,
+ int *rects);
+};
+