[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

x11proto-dri2: Changes to 'upstream-unstable'



 .gitignore    |   78 ++++++++++++++-
 Makefile.am   |    9 +
 README        |   30 ++++++
 configure.ac  |   13 +-
 dri2proto.h   |  114 ++++++++++++++++++++++
 dri2proto.txt |  288 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 dri2tokens.h  |    6 +
 7 files changed, 508 insertions(+), 30 deletions(-)

New commits:
commit 84eac7f37646d36c2644b8f6880c10c249068450
Author: Gaetan Nadon <memsize@videotron.ca>
Date:   Sun Nov 22 19:24:47 2009 -0500

    Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES
    
    Now that the INSTALL file is generated.
    Allows running make maintainer-clean.

diff --git a/Makefile.am b/Makefile.am
index 2b252f2..153b422 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,6 +6,8 @@ pkgconfig_DATA = dri2proto.pc
 
 EXTRA_DIST = dri2proto.pc.in dri2proto.txt
 
+MAINTAINERCLEANFILES = ChangeLog INSTALL
+
 .PHONY: ChangeLog INSTALL
 
 INSTALL:

commit 499241b74322b984bbbee0803513e32b6f83bb31
Author: Aaron Plattner <aplattner@nvidia.com>
Date:   Mon Oct 12 13:11:47 2009 -0700

    Add a DRI2DriverVDPAU driver type.
    
    Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
    Acked-by: Kristian Høgsberg <krh@bitplanet.net>

diff --git a/configure.ac b/configure.ac
index d8f6bc8..fc96197 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])
 AM_MAINTAINER_MODE
 
diff --git a/dri2proto.h b/dri2proto.h
index 8d76079..ba10eb4 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
diff --git a/dri2proto.txt b/dri2proto.txt
index e931bfb..d10e372 100644
--- a/dri2proto.txt
+++ b/dri2proto.txt
@@ -128,7 +128,8 @@ No errrors defined by the DRI2 extension.
 
 5. 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
@@ -386,6 +387,7 @@ A.1 Common Types
 ┌───
     DRI2DRIVER
 	0x0	DRI2DriverDRI
+	0x1	DRI2DriverVDPAU
 └───
 
 ┌───
diff --git a/dri2tokens.h b/dri2tokens.h
index d56e4fb..d560271 100644
--- a/dri2tokens.h
+++ b/dri2tokens.h
@@ -45,5 +45,6 @@
 #define DRI2BufferDepthStencil		9
 
 #define DRI2DriverDRI			0
+#define DRI2DriverVDPAU			1
 
 #endif

commit 0a5e388ae9c1306bb253c161071424e0282ea8f5
Author: Gaetan Nadon <memsize@videotron.ca>
Date:   Mon Nov 16 11:13:29 2009 -0500

    README: file created or updated #24206
    
    Contains a set of URLs to freedesktop.org.

diff --git a/README b/README
new file mode 100644
index 0000000..1115e51
--- /dev/null
+++ b/README
@@ -0,0 +1,30 @@
+			Direct Rendering Infrastructure 2 Extension
+
+This extension defines a protocol to securely allow user applications to access
+the video hardware without requiring data to be passed through the X server.
+
+Extension name: DRI2
+
+All questions regarding this software should be directed at the
+Xorg mailing list:
+
+        http://lists.freedesktop.org/mailman/listinfo/xorg
+
+Please submit bug reports to the Xorg bugzilla:
+
+        https://bugs.freedesktop.org/enter_bug.cgi?product=xorg
+
+The master development code repository can be found at:
+
+        git://anongit.freedesktop.org/git/xorg/proto/dri2proto
+
+        http://cgit.freedesktop.org/xorg/proto/dri2proto
+
+For patch submission instructions, see:
+
+	http://www.x.org/wiki/Development/Documentation/SubmittingPatches
+
+For more information on the git code manager, see:
+
+        http://wiki.x.org/wiki/GitPage
+

commit 1b648b29caea1540abcb0ea7c35c45f749e160b4
Author: Gaetan Nadon <memsize@videotron.ca>
Date:   Sun Nov 15 19:45:26 2009 -0500

    Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432
    
    ChangeLog filename is known to Automake and requires no further
    coding in the makefile.

diff --git a/Makefile.am b/Makefile.am
index 731ccc5..2b252f2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,10 +6,6 @@ pkgconfig_DATA = dri2proto.pc
 
 EXTRA_DIST = dri2proto.pc.in dri2proto.txt
 
-EXTRA_DIST += ChangeLog
-
-MAINTAINERCLEANFILES = ChangeLog
-
 .PHONY: ChangeLog INSTALL
 
 INSTALL:

commit 77eefcd20b38392a75e7c71a7e182dcfcaf3e7c3
Author: Gaetan Nadon <memsize@videotron.ca>
Date:   Sun Nov 15 18:31:28 2009 -0500

    Makefile.am: INSTALL file is missing or incorrect #24206
    
    The standard GNU file on building/installing  tarball is copied
    using the XORG_INSTALL macro contained in XORG_DEFAULT_OPTIONS
    Add INSTALL target

diff --git a/Makefile.am b/Makefile.am
index d26a4a5..731ccc5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -10,9 +10,12 @@ EXTRA_DIST += ChangeLog
 
 MAINTAINERCLEANFILES = ChangeLog
 
-.PHONY: ChangeLog
+.PHONY: ChangeLog INSTALL
+
+INSTALL:
+	$(INSTALL_CMD)
 
 ChangeLog:
 	$(CHANGELOG_CMD)
 
-dist-hook: ChangeLog
+dist-hook: ChangeLog INSTALL

commit 2ddb34caa23048083232e592300cfee7b8c2f04f
Author: Gaetan Nadon <memsize@videotron.ca>
Date:   Sun Nov 15 18:11:36 2009 -0500

    configure.ac: deploy the new XORG_DEFAULT_OPTIONS #24242
    
    This macro aggregate a number of existing macros that sets commmon
    X.Org components configuration options. It shields the configuration file from
    future changes.

diff --git a/configure.ac b/configure.ac
index afc8170..d8f6bc8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,11 +3,11 @@ AC_INIT([DRI2Proto], [2.1], [https://bugs.freedesktop.org/enter_bug.cgi?product=
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
 
-# Require xorg-macros: XORG_CHANGELOG
-m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.2 or later before running autoconf/autogen])])
-XORG_MACROS_VERSION(1.2)
-XORG_RELEASE_VERSION
-XORG_CHANGELOG
+# Require xorg-macros: XORG_DEFAULT_OPTIONS
+m4_ifndef([XORG_MACROS_VERSION],
+          [m4_fatal([must install xorg-macros 1.3 or later before running autoconf/autogen])])
+XORG_MACROS_VERSION(1.3)
+XORG_DEFAULT_OPTIONS
 
 AC_OUTPUT([Makefile
            dri2proto.pc])

commit 363595cd28af5ff820e0790525108685bebf7275
Author: Gaetan Nadon <memsize@videotron.ca>
Date:   Sun Nov 15 13:55:25 2009 -0500

    configure.ac: AM_MAINTAINER_MODE missing #24238
    
    This turns off maintainer mode build rules in tarballs.
    Works in conjunction with autogen.sh --enable-maintainer-mode

diff --git a/configure.ac b/configure.ac
index 2d8fdc8..afc8170 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,7 @@
 AC_PREREQ([2.57])
 AC_INIT([DRI2Proto], [2.1], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
+AM_MAINTAINER_MODE
 
 # Require xorg-macros: XORG_CHANGELOG
 m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.2 or later before running autoconf/autogen])])

commit 9e8c94f5a55b0ba97cc1f8b34c1d58e50ea2c7f8
Author: Gaetan Nadon <memsize@videotron.ca>
Date:   Sat Nov 14 18:26:46 2009 -0500

    .gitignore: use common defaults with custom section # 24239
    
    Using common defaults will reduce errors and maintenance.
    Only the very small or inexistent custom section need periodic maintenance
    when the structure of the component changes. Do not edit defaults.

diff --git a/.gitignore b/.gitignore
index 12c40fc..507f5dd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,14 +1,78 @@
-Makefile
-Makefile.in
+#
+#		X.Org module default exclusion patterns
+#		The next section if for module specific patterns
+#
+#	Do not edit the following section
+# 	GNU Build System (Autotools)
 aclocal.m4
-dri2proto.pc
-autom4te.cache
+autom4te.cache/
+autoscan.log
+ChangeLog
+compile
+config.guess
+config.h
+config.h.in
 config.log
+config-ml.in
+config.py
 config.status
+config.status.lineno
+config.sub
 configure
+configure.scan
+depcomp
+.deps/
+INSTALL
 install-sh
+.libs/
+libtool
+libtool.m4
+ltmain.sh
+lt~obsolete.m4
+ltoptions.m4
+ltsugar.m4
+ltversion.m4
+Makefile
+Makefile.in
+mdate-sh
 missing
+mkinstalldirs
+*.pc
+py-compile
+stamp-h?
+symlink-tree
+texinfo.tex
+ylwrap
+
+#	Do not edit the following section
+# 	Edit Compile Debug Document Distribute
 *~
-dri2proto-*.tar.*
-ChangeLog
-tags
+*.[0-9]
+*.[0-9]x
+*.bak
+*.bin
+core
+*.dll
+*.exe
+*-ISO*.bdf
+*-JIS*.bdf
+*-KOI8*.bdf
+*.kld
+*.ko
+*.ko.cmd
+*.lai
+*.l[oa]
+*.[oa]
+*.obj
+*.patch
+*.so
+*.pcf.gz
+*.pdb
+*.tar.bz2
+*.tar.gz
+#
+#		Add & Override patterns for dri2proto 
+#
+#		Edit the following section as needed
+# For example, !report.pc overrides *.pc. See 'man gitignore'
+# 

commit 9c1a8f1d074bd7b87c4edf8b689c13c93fba9aaa
Author: Jesse Barnes <jbarnes@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@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@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@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@tungstengraphics.com>
 Jerome Glisse <glisse@freedesktop.org>
 Ian Romanick <ian.d.romanick@intel.com>
 Michel Dänzer <michel@tungstengraphics.com>
+Jesse Barnes <jbarnes@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@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@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@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@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@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
+      ▶


Reply to: