[RFC] dri2: Expose API for drivers to set drawable swap limit.

Pauli Nieminen ext-pauli.nieminen at nokia.com
Wed Jul 14 06:20:40 PDT 2010


This allows ddx to set swap_limit if there is variable number of
buffers for drawable.

This allows ddx driver to select triple buffering to avoid problems if
frame rate is close to VSYNC rate. While driver may want to keep
composite swaps double buffered to save memory.

Signed-off-by: Pauli Nieminen <ext-pauli.nieminen at nokia.com>
---

This patch is for 1.10. 

This is minimal patch that is requried to implement ddx controlled multi
buffering.

Do we need DRI2 request to set the number of buffers?
Client and DDX driver could communicate number of buffers using format field 
in getbuffers.

 hw/xfree86/dri2/dri2.c |   12 ++++++++++++
 hw/xfree86/dri2/dri2.h |    1 +
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 42b2db4..424fbd0 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -175,6 +175,18 @@ DRI2AllocateDrawable(DrawablePtr pDraw)
     return pPriv;
 }
 
+Bool
+DRI2SwapLimit(DrawablePtr pDraw, int swap_limit)
+{
+    DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw);
+    if (!pPriv)
+	return FALSE;
+
+    pPriv->swap_limit = swap_limit;
+
+    return TRUE;
+}
+
 typedef struct DRI2DrawableRefRec {
     XID		  id;
     XID		  dri2_id;
diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h
index fe0bf6c..0e0bea4 100644
--- a/hw/xfree86/dri2/dri2.h
+++ b/hw/xfree86/dri2/dri2.h
@@ -251,6 +251,7 @@ extern _X_EXPORT DRI2BufferPtr *DRI2GetBuffersWithFormat(DrawablePtr pDraw,
 	int *out_count);
 
 extern _X_EXPORT void DRI2SwapInterval(DrawablePtr pDrawable, int interval);
+extern _X_EXPORT Bool DRI2SwapLimit(DrawablePtr pDraw, int swap_limit);
 extern _X_EXPORT int DRI2SwapBuffers(ClientPtr client, DrawablePtr pDrawable,
 				     CARD64 target_msc, CARD64 divisor,
 				     CARD64 remainder, CARD64 *swap_target,
-- 
1.6.3.3



More information about the xorg-devel mailing list