dri2proto: Branch 'master' - 11 commits

Jesse Barnes jbarnes at kemper.freedesktop.org
Tue Dec 8 16:09:15 PST 2009


 dri2proto.h   |  112 ++++++++++++++++++++++
 dri2proto.txt |  284 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 dri2tokens.h  |    5 +
 3 files changed, 390 insertions(+), 11 deletions(-)

New commits:
commit bd6f2584d3d55746bb56bf923b35e85adfd0dc3b
Merge: 84eac7f... 9c1a8f1...
Author: Jesse Barnes <jbarnes at virtuousgeek.org>
Date:   Tue Dec 8 16:03:11 2009 -0800

    Merge branch 'dri2-swapbuffers'

diff --cc dri2proto.txt
index d10e372,35bad41..de58289
--- a/dri2proto.txt
+++ b/dri2proto.txt
@@@ -125,11 -148,17 +148,18 @@@ No errrors defined by the DRI2 extensio
  
  			     âš™ âš™ âš™  âš™ âš™ âš™
  
+ 5. Events
+ 
+ The only event provided by DRI2 is DRI2_BufferSwapComplete.
+ 
+ 
+ 			     âš™ âš™ âš™  âš™ âš™ âš™
+ 
  
- 5. Protocol Types
+ 6. Protocol Types
  
 -DRI2DRIVER { DRI2DriverDRI }
 +DRI2DRIVER { DRI2DriverDRI
 +	     DRI2DriverVDPAU }
  
  	These values describe the type of driver the client will want
  	to load.  The server sends back the name of the driver to use
diff --cc dri2tokens.h
index d560271,a20462a..7804e4d
--- a/dri2tokens.h
+++ b/dri2tokens.h
@@@ -45,6 -45,10 +45,11 @@@
  #define DRI2BufferDepthStencil		9
  
  #define DRI2DriverDRI			0
 +#define DRI2DriverVDPAU			1
  
+ /* Event sub-types for the swap complete event */
+ #define DRI2_EXCHANGE_COMPLETE		0x1
+ #define DRI2_BLIT_COMPLETE		0x2
+ #define DRI2_FLIP_COMPLETE		0x3
+ 
  #endif
commit 9c1a8f1d074bd7b87c4edf8b689c13c93fba9aaa
Author: Jesse Barnes <jbarnes at jbarnes-desktop.localdomain>
Date:   Thu Nov 12 17:23:03 2009 +0000

    Fix cut & paste error: Extension Requests -> Extension Events

diff --git a/dri2proto.txt b/dri2proto.txt
index 0b382ff..35bad41 100644
--- a/dri2proto.txt
+++ b/dri2proto.txt
@@ -440,7 +440,7 @@ The name of this extension is "DRI2".
 
 			     âš™ âš™ âš™  âš™ âš™ âš™
 
-9. Extension Requests
+9. Extension Events
 
 ┌───
     DRI2BufferSwapComplete
commit 7c7e9bbf4ab6177e9623f3c4d667ed83789167b4
Author: Jesse Barnes <jbarnes at jbarnes-desktop.localdomain>
Date:   Thu Nov 12 15:26:40 2009 +0000

    Add DRI2 event support for DRI2BufferSwapComplete

diff --git a/dri2proto.h b/dri2proto.h
index 377bdb9..43152c2 100644
--- a/dri2proto.h
+++ b/dri2proto.h
@@ -38,8 +38,8 @@
 #define DRI2_MINOR			2
 
 #define DRI2NumberErrors		0
-#define DRI2NumberEvents		0
-#define DRI2NumberRequests		8
+#define DRI2NumberEvents		1
+#define DRI2NumberRequests		13
 
 #define X_DRI2QueryVersion		0
 #define X_DRI2Connect			1
@@ -55,6 +55,11 @@
 #define X_DRI2WaitSBC			11
 #define X_DRI2SwapInterval		12
 
+/*
+ * Events
+ */
+#define DRI2_BufferSwapComplete	0
+
 typedef struct {
     CARD32  attachment B32;
     CARD32  name B32;
@@ -279,4 +284,19 @@ typedef struct {
 } xDRI2SwapIntervalReq;
 #define sz_xDRI2SwapIntervalReq 12
 
+typedef struct {
+    CARD8 type;
+    CARD8 pad;
+    CARD16 sequenceNumber B16;
+    CARD16 event_type B16;
+    CARD32 drawable B32;
+    CARD32 ust_hi B32;
+    CARD32 ust_lo B32;
+    CARD32 msc_hi B32;
+    CARD32 msc_lo B32;
+    CARD32 sbc_hi B32;
+    CARD32 sbc_lo B32;
+} xDRI2BufferSwapComplete;
+#define sz_xDRI2BufferSwapComplete 32
+
 #endif
diff --git a/dri2proto.txt b/dri2proto.txt
index 71fc0ca..0b382ff 100644
--- a/dri2proto.txt
+++ b/dri2proto.txt
@@ -123,6 +123,12 @@ DRI2SwapBuffers, clients can limit their frame rate by specifying a swap
 interval using the swap interval call (currently only available through GLX)
 or by using the OML swap buffers routine.
 
+2.7 Events
+
+DRI2 provides a single event to indicate when a DRI2SwapBuffers request has
+been completed.  This can be used to throttle drawing on the client side and
+tie into application main loops.
+
 			     âš™ âš™ âš™  âš™ âš™ âš™
 
 
@@ -142,8 +148,15 @@ No errrors defined by the DRI2 extension.
 
 			     âš™ âš™ âš™  âš™ âš™ âš™
 
+5. Events
+
+The only event provided by DRI2 is DRI2_BufferSwapComplete.
+
+
+			     âš™ âš™ âš™  âš™ âš™ âš™
+
 
-5. Protocol Types
+6. Protocol Types
 
 DRI2DRIVER { DRI2DriverDRI }
 
@@ -187,7 +200,7 @@ DRI2ATTACH_FORMAT { attachment: CARD32
 			     âš™ âš™ âš™  âš™ âš™ âš™
 
 
-6. Extension Initialization
+7. Extension Initialization
 
 The name of this extension is "DRI2".
 
@@ -218,7 +231,7 @@ The name of this extension is "DRI2".
 			     âš™ âš™ âš™  âš™ âš™ âš™
 
 
-7. Extension Requests
+8. Extension Requests
 
 ┌───
     DRI2Connect
@@ -427,8 +440,27 @@ The name of this extension is "DRI2".
 
 			     âš™ âš™ âš™  âš™ âš™ âš™
 
+9. Extension Requests
+
+┌───
+    DRI2BufferSwapComplete
+      â–¶
+      	event_type: CARD16
+	drawable: CARD32
+	ust: CARD64
+	msc: CARD64
+	sbc: CARD64
+└───
+
+	This event reports the status of the last DRI2SwapBuffers event to
+	the client.  The event type should be one of DRI2_EXCHANGE_COMPLETE,
+	indicating a successful buffer exchange, DRI2_BLIT_COMPLETE, indicating
+	the swap was performed with a blit, and DRI2_FLIP_COMPLETE, indicating
+	a full page flip was completed.
 
-8. Extension Versioning
+			     âš™ âš™ âš™  âš™ âš™ âš™
+
+10. Extension Versioning
 
 The DRI2 extension has undergone a number of revisions before
 
@@ -452,30 +484,36 @@ The DRI2 extension has undergone a number of revisions before
 
 	2.0: Awesomeness!
 
+	2.1: True excellence.  Added DRI2GetBuffersWithFormat to allow
+             more flexible object creation.
+
+	2.2: Approaching perfection.  Added requests for swapbuffers,
+             MSC and SBC related requests, and events.
+
 Compatibility up to 2.0 is not preserved, but was also never released.
 
 
 			     âš™ âš™ âš™  âš™ âš™ âš™
 
 
-10. Relationship with other extensions
+11. Relationship with other extensions
 
 As an extension designed to support other extensions, there is
 naturally some interactions with other extensions.
 
 
-10.1 GLX
+11.1 GLX
 
 The GL auxilary buffers map directly to the DRI2 buffers... eh
 
 
-10.2 DBE
+11.2 DBE
 
 The DBE back buffer must correspond to the DRI2_BUFFER_FRONT_LEFT
 DRI2 buffer for servers that support both DBE and DRI2.
 
 
-10.3 XvMC / Xv
+11.3 XvMC / Xv
 
 We might add a DRI2_BUFFER_YUV to do vsynced colorspace conversion
 blits.  Maybe... not really sure.
diff --git a/dri2tokens.h b/dri2tokens.h
index d56e4fb..a20462a 100644
--- a/dri2tokens.h
+++ b/dri2tokens.h
@@ -46,4 +46,9 @@
 
 #define DRI2DriverDRI			0
 
+/* Event sub-types for the swap complete event */
+#define DRI2_EXCHANGE_COMPLETE		0x1
+#define DRI2_BLIT_COMPLETE		0x2
+#define DRI2_FLIP_COMPLETE		0x3
+
 #endif
commit f9e6b17debd2f69821bd8d412cccf02dd9ba17af
Author: Jesse Barnes <jbarnes at jbarnes-desktop.localdomain>
Date:   Wed Nov 11 15:26:40 2009 -0800

    Pad out DRI2 swap buffers reply

diff --git a/dri2proto.h b/dri2proto.h
index 31bcdb3..377bdb9 100644
--- a/dri2proto.h
+++ b/dri2proto.h
@@ -217,8 +217,12 @@ typedef struct {
     CARD32  length B32;
     CARD32  swap_hi B32;
     CARD32  swap_lo B32;
+    CARD32  pad2 B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+    CARD32  pad5 B32;
 } xDRI2SwapBuffersReply;
-#define sz_xDRI2SwapBuffersReply 16
+#define sz_xDRI2SwapBuffersReply 32
 
 typedef struct {
     CARD8   reqType;
commit 516a1ff1f8ceca9ddefce21303e65d873aeeba14
Author: Jesse Barnes <jbarnes at jbarnes-desktop.localdomain>
Date:   Tue Nov 10 12:12:07 2009 -0800

    Add DRI2SwapInterval protocol
    
    Needed to handle swap interval in the direct rendered case.

diff --git a/dri2proto.h b/dri2proto.h
index 85b9dbf..31bcdb3 100644
--- a/dri2proto.h
+++ b/dri2proto.h
@@ -53,6 +53,7 @@
 #define X_DRI2GetMSC			9
 #define X_DRI2WaitMSC			10
 #define X_DRI2WaitSBC			11
+#define X_DRI2SwapInterval		12
 
 typedef struct {
     CARD32  attachment B32;
@@ -265,4 +266,13 @@ typedef struct {
 } xDRI2MSCReply;
 #define sz_xDRI2MSCReply 32
 
+typedef struct {
+    CARD8   reqType;
+    CARD8   dri2ReqType;
+    CARD16  length B16;
+    CARD32  drawable B32;
+    CARD32  interval B32;
+} xDRI2SwapIntervalReq;
+#define sz_xDRI2SwapIntervalReq 12
+
 #endif
diff --git a/dri2proto.txt b/dri2proto.txt
index 6430b2a..71fc0ca 100644
--- a/dri2proto.txt
+++ b/dri2proto.txt
@@ -33,6 +33,7 @@ Keith Whitwell <keith at tungstengraphics.com>
 Jerome Glisse <glisse at freedesktop.org>
 Ian Romanick <ian.d.romanick at intel.com>
 Michel Dänzer <michel at tungstengraphics.com>
+Jesse Barnes <jbarnes at virtuousgeek.org>
 
 
 			     âš™ âš™ âš™  âš™ âš™ âš™
@@ -412,6 +413,18 @@ The name of this extension is "DRI2".
 	This request is only available with protocol version 1.2 or
 	later.
 
+┌───
+    DRI2SwapInterval
+	drawable: DRAWABLE
+	interval: CARD32
+      â–¶
+└───
+	Errors: Window
+
+	Sets the swap interval for DRAWABLE.  This will throttle
+	DRI2SwapBuffers requests to swap at most once per interval frames,
+	which is useful useful for limiting the frame rate.
+
 			     âš™ âš™ âš™  âš™ âš™ âš™
 
 
@@ -744,6 +757,16 @@ A.2 Protocol Requests
 	4	CARD32			sbc_lo
 └───
 
+┌───
+    DRI2SwapInterval
+	1	CARD8			major opcode
+	1	7			DRI2 opcode
+	2	8			length
+	4	DRAWABLE		drawable
+ 	4	CARD32			interval
+     â–¶
+└───
+
 A.3 Protocol Events
 
 The DRI2 extension specifies no events.
commit 5e059038a95b5bad7f41a2019beaad913ed29502
Author: Jesse Barnes <jbarnes at virtuousgeek.org>
Date:   Thu Oct 29 12:45:48 2009 -0700

    Bump package version to 2.2

diff --git a/configure.ac b/configure.ac
index 2d8fdc8..003f7ac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ([2.57])
-AC_INIT([DRI2Proto], [2.1], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
+AC_INIT([DRI2Proto], [2.2], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 
 # Require xorg-macros: XORG_CHANGELOG
commit 1102a9199db8aa08e891f808f8921a5d312e3197
Author: Jesse Barnes <jbarnes at virtuousgeek.org>
Date:   Fri Oct 2 22:23:09 2009 -0700

    Fix DRI2SwapBuffers reply length
    
    Length should be a CARD32 and match the endianness annotation.
    
    Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>

diff --git a/dri2proto.h b/dri2proto.h
index cee8a3c..85b9dbf 100644
--- a/dri2proto.h
+++ b/dri2proto.h
@@ -213,7 +213,7 @@ typedef struct {
     BYTE    type;   /* X_Reply */
     BYTE    pad1;
     CARD16  sequenceNumber B16;
-    CARD16  length B32;
+    CARD32  length B32;
     CARD32  swap_hi B32;
     CARD32  swap_lo B32;
 } xDRI2SwapBuffersReply;
commit 29c7fcbf10508ec822ad528928b72702e4c9af01
Author: Jesse Barnes <jbarnes at virtuousgeek.org>
Date:   Thu Oct 1 22:13:34 2009 -0700

    Add swap interval and synchronization support
    
    Based on SGI_video_sync, SGI_swap_control and OML_sync_control, add swap
    interval and synchronization support to DRI2.  Useful for throttling rendering
    and basic performance metrics.
    
    Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>

diff --git a/dri2proto.h b/dri2proto.h
index 37873c4..cee8a3c 100644
--- a/dri2proto.h
+++ b/dri2proto.h
@@ -50,6 +50,9 @@
 #define X_DRI2CopyRegion		6
 #define X_DRI2GetBuffersWithFormat	7
 #define X_DRI2SwapBuffers		8
+#define X_DRI2GetMSC			9
+#define X_DRI2WaitMSC			10
+#define X_DRI2WaitSBC			11
 
 typedef struct {
     CARD32  attachment B32;
@@ -197,7 +200,69 @@ typedef struct {
     CARD8   dri2ReqType;
     CARD16  length B16;
     CARD32  drawable B32;
+    CARD32  target_msc_hi B32;
+    CARD32  target_msc_lo B32;
+    CARD32  divisor_hi B32;
+    CARD32  divisor_lo B32;
+    CARD32  remainder_hi B32;
+    CARD32  remainder_lo B32;
 } xDRI2SwapBuffersReq;
-#define sz_xDRI2SwapBuffersReq   8
+#define sz_xDRI2SwapBuffersReq  32
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    BYTE    pad1;
+    CARD16  sequenceNumber B16;
+    CARD16  length B32;
+    CARD32  swap_hi B32;
+    CARD32  swap_lo B32;
+} xDRI2SwapBuffersReply;
+#define sz_xDRI2SwapBuffersReply 16
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   dri2ReqType;
+    CARD16  length B16;
+    CARD32  drawable B32;
+} xDRI2GetMSCReq;
+#define sz_xDRI2GetMSCReq 8
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   dri2ReqType;
+    CARD16  length B16;
+    CARD32  drawable B32;
+    CARD32  target_msc_hi B32;
+    CARD32  target_msc_lo B32;
+    CARD32  divisor_hi B32;
+    CARD32  divisor_lo B32;
+    CARD32  remainder_hi B32;
+    CARD32  remainder_lo B32;
+} xDRI2WaitMSCReq;
+#define sz_xDRI2WaitMSCReq 32
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   dri2ReqType;
+    CARD16  length B16;
+    CARD32  drawable B32;
+    CARD32  target_sbc_hi B32;
+    CARD32  target_sbc_lo B32;
+} xDRI2WaitSBCReq;
+#define sz_xDRI2WaitSBCReq 16
+
+typedef struct {
+    CARD8   type;
+    CARD8   pad1;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  ust_hi B32;
+    CARD32  ust_lo B32;
+    CARD32  msc_hi B32;
+    CARD32  msc_lo B32;
+    CARD32  sbc_hi B32;
+    CARD32  sbc_lo B32;
+} xDRI2MSCReply;
+#define sz_xDRI2MSCReply 32
 
 #endif
diff --git a/dri2proto.txt b/dri2proto.txt
index 1bad3b9..6430b2a 100644
--- a/dri2proto.txt
+++ b/dri2proto.txt
@@ -110,6 +110,17 @@ of the front and back buffers.  If the display server supports it, this
 operation may be preferred, since it may be easier and/or more performant
 for the server to perform a simple buffer swap rather than a blit.
 
+2.6 Synchronizing rendering
+
+DRI2 provides several methods for synchronizing drawing with various events.
+The protocol for these methods is based on the SGI_video_sync and
+OML_sync_control GLX extensions.  Using the DRI2WaitMSC request, a client
+can wait for a specific frame count or divisor/remainder before continuing
+its processing.  With the DRI2WaitSBC request, clients can block until a given
+swap count is reached (as incremented by DRI2SwapBuffers).  Finally, using
+DRI2SwapBuffers, clients can limit their frame rate by specifying a swap
+interval using the swap interval call (currently only available through GLX)
+or by using the OML swap buffers routine.
 
 			     âš™ âš™ âš™  âš™ âš™ âš™
 
@@ -297,17 +308,22 @@ The name of this extension is "DRI2".
     DRI2SwapBuffers
 	drawable: DRAWABLE
       â–¶	
-	buffers: LISTofDRI2BUFFER
+	count: two CARD32s
 └───
 	Errors: Window
 
 	Schedule a swap of the front and back buffers with the display
 	server.
 
-	This request has no reply.  The server is expected to either perform
-	a buffer exchange or queue one before returning.  The client should
-	invalidate its render buffers after sending this request, causing
-	a subsequent GetBuffers request to get updated buffer info.
+	Returns the swap count value when the swap will actually occur (e.g.
+	the last queued swap count + (pending swap count * swap interval)).
+
+	The client should invalidate its render buffers after sending this
+	request, causing a subsequent GetBuffers request to get updated buffer
+	info.
+
+	This request is only available with protocol version 1.2 or
+	later.
 
 ┌───
     DRI2GetBuffersWithFormat
@@ -334,6 +350,68 @@ The name of this extension is "DRI2".
 	This request is only available with protocol version 1.1 or
 	later.
 
+┌───
+    DRI2GetMSC
+	drawable: DRAWABLE
+      â–¶
+	ust, msc, sbc: CARD64
+└───
+	Errors: Window
+
+	Get the current media stamp counter (MSC) and swap buffer count (SBC)
+	along with the unadjusted system time (UST) when the MSC was last
+	incremented.
+
+	This request is only available with protocol version 1.2 or
+	later.
+
+┌───
+    DRI2WaitMSC
+	drawable: DRAWABLE
+	target_msc: two CARD32s
+	divisor: two CARD32s
+	remainder: two CARD32s
+      â–¶
+	ust, msc, sbc: CARD64
+└───
+	Errors: Window
+
+	Blocks the client until either the frame count reaches target_msc or,
+	if the frame count is already greater than target_msc when the request
+	is received, until the frame count % divisor = remainder.  If divisor
+	is 0, the client will be unblocked if the frame count is greater than
+	or equal to the target_msc.
+
+	Returns the current media stamp counter (MSC) and swap buffer count
+	(SBC) along with the unadjusted system time (UST) when the MSC was last
+	incremented.
+
+	This request is only available with protocol version 1.2 or
+	later.
+
+┌───
+    DRI2WaitSBC
+	drawable: DRAWABLE
+	target_sbc: two CARD32s
+      â–¶
+	ust, msc, sbc: CARD64
+└───
+	Errors: Window
+
+	Blocks the client until the swap buffer count reaches target_sbc.  If
+	the swap buffer count is already greater than or equal to target_sbc
+	when the request is recieved, this request will return immediately.
+
+	If target_sbc is 0, this request will block the client until all
+	previous DRI2SwapBuffers requests have completed.
+
+	Returns the current media stamp counter (MSC) and swap buffer count
+	(SBC) along with the unadjusted system time (UST) when the MSC was last
+	incremented.
+
+	This request is only available with protocol version 1.2 or
+	later.
+
 			     âš™ âš™ âš™  âš™ âš™ âš™
 
 
@@ -558,10 +636,6 @@ A.2 Protocol Requests
 	5n	LISTofDRI2BUFFER	buffers
 └───
 
-A.3 Protocol Events
-
-The DRI2 extension specifies no events.
-
 ┌───
     DRI2SwapBuffers
 	1	CARD8			major opcode
@@ -583,6 +657,96 @@ The DRI2 extension specifies no events.
 	5n	LISTofDRI2BUFFER	buffers
 └───
 
+┌───
+    DRI2SwapBuffers
+	1	CARD8			major opcode
+	1	7			DRI2 opcode
+	2	8			length
+	4	DRAWABLE		drawable
+	4	CARD32			target_msc_hi
+	4	CARD32			target_msc_lo
+	4	CARD32			divisor_hi
+	4	CARD32			divisor_lo
+	4	CARD32			remainder_hi
+	4	CARD32			remainder_lo
+      â–¶	
+	1	1			Reply
+        1				unused
+	2	CARD16			sequence number
+	4	0			reply length
+	4	CARD32			swap_hi
+	4	CARD32			swap_lo
+	5n	LISTofDRI2BUFFER	buffers
+└───
+
+┌───
+    DRI2GetMSC
+	1	CARD8			major opcode
+	1	7			DRI2 opcode
+	2	8			length
+	4	DRAWABLE		drawable
+      â–¶
+	1	1			Reply
+        1				unused
+	2	CARD16			sequence number
+	4	0			reply length
+	4	CARD32			ust_hi
+	4	CARD32			ust_lo
+	4	CARD32			msc_hi
+	4	CARD32			msc_lo
+	4	CARD32			sbc_hi
+	4	CARD32			sbc_lo
+└───
+
+┌───
+    DRI2WaitMSC
+	1	CARD8			major opcode
+	1	7			DRI2 opcode
+	2	8			length
+	4	DRAWABLE		drawable
+	4	CARD32			target_msc_hi
+	4	CARD32			target_msc_lo
+	4	CARD32			divisor_hi
+	4	CARD32			divisor_lo
+	4	CARD32			remainder_hi
+	4	CARD32			remainder_lo
+      â–¶
+	1	1			Reply
+        1				unused
+	2	CARD16			sequence number
+	4	0			reply length
+	4	CARD32			ust_hi
+	4	CARD32			ust_lo
+	4	CARD32			msc_hi
+	4	CARD32			msc_lo
+	4	CARD32			sbc_hi
+	4	CARD32			sbc_lo
+└───
+
+┌───
+    DRI2WaitSBC
+	1	CARD8			major opcode
+	1	7			DRI2 opcode
+	2	8			length
+	4	DRAWABLE		drawable
+ 	4	CARD32			swap_hi
+	4	CARD32			swap_lo
+     â–¶
+	1	1			Reply
+        1				unused
+	2	CARD16			sequence number
+	4	0			reply length
+	4	CARD32			ust_hi
+	4	CARD32			ust_lo
+	4	CARD32			msc_hi
+	4	CARD32			msc_lo
+	4	CARD32			sbc_hi
+	4	CARD32			sbc_lo
+└───
+
+A.3 Protocol Events
+
+The DRI2 extension specifies no events.
 
 A.4 Protocol Errors
 
commit 00c15f92c1f294d762f2052f1d775c393ebd2432
Author: Jesse Barnes <jbarnes at jbarnes-x200.(none)>
Date:   Mon Jun 8 16:12:50 2009 -0700

    Update protocol description for swapbuffers

diff --git a/dri2proto.txt b/dri2proto.txt
index bad9567..1bad3b9 100644
--- a/dri2proto.txt
+++ b/dri2proto.txt
@@ -304,10 +304,10 @@ The name of this extension is "DRI2".
 	Schedule a swap of the front and back buffers with the display
 	server.
 
-	In reply, the display server is expected to provide new front
-	and back buffers to the client following this request.  The
-	display server should process this request asynchronously
-	if possible, to prevent the client from blocking.
+	This request has no reply.  The server is expected to either perform
+	a buffer exchange or queue one before returning.  The client should
+	invalidate its render buffers after sending this request, causing
+	a subsequent GetBuffers request to get updated buffer info.
 
 ┌───
     DRI2GetBuffersWithFormat
commit aaee5f8af4f0fe63498cd8ae507f8d33edba280c
Author: Kristian Høgsberg <krh at redhat.com>
Date:   Wed Jun 3 17:36:43 2009 -0400

    Make swapbuffers an async request
    
    The protocol now require a DRI2GetBuffersWithFormat request to follow the
    swapbuffer request so.

diff --git a/dri2proto.h b/dri2proto.h
index 441155e..37873c4 100644
--- a/dri2proto.h
+++ b/dri2proto.h
@@ -200,18 +200,4 @@ typedef struct {
 } xDRI2SwapBuffersReq;
 #define sz_xDRI2SwapBuffersReq   8
 
-typedef struct {
-    BYTE    type;   /* X_Reply */
-    BYTE    pad1;
-    CARD16  sequenceNumber B16;
-    CARD32  length B32;
-    CARD32  count B32;
-    CARD32  pad3 B32;
-    CARD32  pad4 B32;
-    CARD32  pad5 B32;
-    CARD32  pad6 B32;
-    CARD32  pad7 B32;
-} xDRI2SwapBuffersReply;
-#define sz_xDRI2SwapBuffersReply	32
-
 #endif
commit 9b5ef83c0b9ef0239ac82adfa9a816f195074dcb
Author: Jesse Barnes <jbarnes at virtuousgeek.org>
Date:   Fri May 1 14:41:55 2009 -0700

    Add SwapBuffers request
    
    Add a SwapBuffers request for requesting a front<->back swap.  Returns a
    whole new set of buffers to the client to allow for triple buffering
    etc.

diff --git a/dri2proto.h b/dri2proto.h
index 8d76079..441155e 100644
--- a/dri2proto.h
+++ b/dri2proto.h
@@ -35,7 +35,7 @@
 
 #define DRI2_NAME			"DRI2"
 #define DRI2_MAJOR			1
-#define DRI2_MINOR			1
+#define DRI2_MINOR			2
 
 #define DRI2NumberErrors		0
 #define DRI2NumberEvents		0
@@ -49,6 +49,7 @@
 #define X_DRI2GetBuffers		5
 #define X_DRI2CopyRegion		6
 #define X_DRI2GetBuffersWithFormat	7
+#define X_DRI2SwapBuffers		8
 
 typedef struct {
     CARD32  attachment B32;
@@ -191,4 +192,26 @@ typedef struct {
 } xDRI2CopyRegionReply;
 #define sz_xDRI2CopyRegionReply	32
 
+typedef struct {
+    CARD8   reqType;
+    CARD8   dri2ReqType;
+    CARD16  length B16;
+    CARD32  drawable B32;
+} xDRI2SwapBuffersReq;
+#define sz_xDRI2SwapBuffersReq   8
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    BYTE    pad1;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  count B32;
+    CARD32  pad3 B32;
+    CARD32  pad4 B32;
+    CARD32  pad5 B32;
+    CARD32  pad6 B32;
+    CARD32  pad7 B32;
+} xDRI2SwapBuffersReply;
+#define sz_xDRI2SwapBuffersReply	32
+
 #endif
diff --git a/dri2proto.txt b/dri2proto.txt
index e931bfb..bad9567 100644
--- a/dri2proto.txt
+++ b/dri2proto.txt
@@ -105,6 +105,11 @@ DRI2 implementation of direct rendering GLX, should use these enty
 points to copy contents back and forth to as necessary to ensure
 consistent rendering.
 
+The client may also use the DRI2SwapBuffers function to request a swap
+of the front and back buffers.  If the display server supports it, this
+operation may be preferred, since it may be easier and/or more performant
+for the server to perform a simple buffer swap rather than a blit.
+
 
 			     âš™ âš™ âš™  âš™ âš™ âš™
 
@@ -288,6 +293,21 @@ The name of this extension is "DRI2".
 	the server has seen the request before proceeding with
 	rendering the next frame.
 
+┌───
+    DRI2SwapBuffers
+	drawable: DRAWABLE
+      â–¶	
+	buffers: LISTofDRI2BUFFER
+└───
+	Errors: Window
+
+	Schedule a swap of the front and back buffers with the display
+	server.
+
+	In reply, the display server is expected to provide new front
+	and back buffers to the client following this request.  The
+	display server should process this request asynchronously
+	if possible, to prevent the client from blocking.
 
 ┌───
     DRI2GetBuffersWithFormat
@@ -542,6 +562,27 @@ A.3 Protocol Events
 
 The DRI2 extension specifies no events.
 
+┌───
+    DRI2SwapBuffers
+	1	CARD8			major opcode
+	1	7			DRI2 opcode
+	2	8			length
+	4	DRAWABLE		drawable
+      â–¶	
+	1	1			Reply
+        1				unused
+	2	CARD16			sequence number
+	4	0			reply length
+	4	CARD32			buffer count
+	4	CARD32			unused
+	4	CARD32			unused
+	4	CARD32			unused
+	4	CARD32			unused
+	4	CARD32			unused
+	4	CARD32			unused
+	5n	LISTofDRI2BUFFER	buffers
+└───
+
 
 A.4 Protocol Errors
 


More information about the xorg-commit mailing list