DRI2: Provide an interface for drivers to flush front-buffer rendering
authorIan Romanick <idr@freedesktop.org>
Mon, 6 Apr 2009 19:44:18 +0000 (12:44 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Thu, 9 Apr 2009 21:18:14 +0000 (14:18 -0700)
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@redhat.com>
include/GL/internal/dri_interface.h
src/glx/x11/dri2_glx.c

index a83602bfd87a20d9d6dbf7aabc2592934a1633c7..335bf62a801258040f7788b2fac3e7807aabe8a6 100644 (file)
@@ -659,7 +659,7 @@ struct __DRIbufferRec {
 };
 
 #define __DRI_DRI2_LOADER "DRI_DRI2Loader"
-#define __DRI_DRI2_LOADER_VERSION 1
+#define __DRI_DRI2_LOADER_VERSION 2
 struct __DRIdri2LoaderExtensionRec {
     __DRIextension base;
 
@@ -667,6 +667,19 @@ struct __DRIdri2LoaderExtensionRec {
                               int *width, int *height,
                               unsigned int *attachments, int count,
                               int *out_count, void *loaderPrivate);
+
+    /**
+     * Flush pending front-buffer rendering
+     *
+     * Any rendering that has been performed to the
+     * \c __DRI_BUFFER_FAKE_FRONT_LEFT will be flushed to the
+     * \c __DRI_BUFFER_FRONT_LEFT.
+     *
+     * \param driDrawable    Drawable whose front-buffer is to be flushed
+     * \param loaderPrivate  Loader's private data that was previously passed
+     *                       into __DRIdri2ExtensionRec::createNewDrawable
+     */
+    void (*flushFrontBuffer)(__DRIdrawable *driDrawable, void *loaderPrivate);
 };
 
 /**
index 9c8f1101b9ef11d3617d3ed39dcde9e67004c3fe..aa21a97023f9313e4bc3b71323e34c7de847c866 100644 (file)
@@ -273,6 +273,15 @@ static void dri2WaitGL(__GLXDRIdrawable *pdraw)
     XFixesDestroyRegion(pdraw->psc->dpy, region);
 }
 
+
+static void dri2FlushFrontBuffer(__DRIdrawable *driDrawable,
+                                void *loaderPrivate)
+{
+    (void) driDrawable;
+    dri2WaitGL((__GLXDRIdrawable *) loaderPrivate);
+}
+
+
 static void dri2DestroyScreen(__GLXscreenConfigs *psc)
 {
     /* Free the direct rendering per screen data */
@@ -327,6 +336,7 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
 static const __DRIdri2LoaderExtension dri2LoaderExtension = {
     { __DRI_DRI2_LOADER, __DRI_DRI2_LOADER_VERSION },
     dri2GetBuffers,
+    dri2FlushFrontBuffer
 };
 
 static const __DRIextension *loader_extensions[] = {