[PATCH 01/02] dri2proto: Add DRI2GetParam request

Chad Versace chad.versace at linux.intel.com
Thu May 10 00:04:36 PDT 2012


Bump protocol version to 1.4.
Bump package version to 2.7.

This new protocol request effectively allows clients to perform feature
detection on the DDX. 

If I had DRI2GetParam in June 2011, when I was implementing support in the
Intel DDX and Mesa for new hardware that required a new DRI2 attachment
format, then I could have avoided a week of pain caused by the necessity
of writing a horrid feature detection hack [1] in Mesa. In the future, when
the work begins to add MSAA support to the Intel DDX, having a clean way
to do feature detection will allow us to avoid revisiting and expanding
that hack

[1] mesa, commit aea2236a, function intel_verify_dri2_has_hiz

CC: Keith Packard <keithp at keithp.com>
CC: Kristian Høgsberg <krh at bitplanet.net>
CC: Ian Romanick <idr at freedesktop.org>
CC: Eric Anholt <eric at anholt.net>
CC: Ville Syrjälä <syrjala at sci.fi>
CC: Michel Dänzer <daenzer at vmware.com>
CC: Chris Wilson <chris at chris-wilson.co.uk>
CC: Jesse Barnes <jbarnes at virtuousgeek.org>
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
 configure.ac  |    2 +-
 dri2proto.h   |   33 +++++++++++++++++++++++++++++--
 dri2proto.txt |   60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 dri2tokens.h  |    4 ++++
 4 files changed, 96 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index d671f5a..aeb86a9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ([2.60])
-AC_INIT([DRI2Proto], [2.6], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
+AC_INIT([DRI2Proto], [2.7], [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 cd82afb..8098568 100644
--- a/dri2proto.h
+++ b/dri2proto.h
@@ -35,11 +35,11 @@
 
 #define DRI2_NAME			"DRI2"
 #define DRI2_MAJOR			1
-#define DRI2_MINOR			3
+#define DRI2_MINOR			4
 
 #define DRI2NumberErrors		0
 #define DRI2NumberEvents		2
-#define DRI2NumberRequests		13
+#define DRI2NumberRequests		14
 
 #define X_DRI2QueryVersion		0
 #define X_DRI2Connect			1
@@ -54,6 +54,7 @@
 #define X_DRI2WaitMSC			10
 #define X_DRI2WaitSBC			11
 #define X_DRI2SwapInterval		12
+#define X_DRI2GetParam			13
 
 /*
  * Events
@@ -330,4 +331,32 @@ typedef struct {
 } xDRI2InvalidateBuffers;
 #define sz_xDRI2InvalidateBuffers 32
 
+typedef struct {
+    CARD8   reqType;
+    CARD8   dri2ReqType;
+    CARD16  length B16;
+    CARD32  drawable B32;
+    CARD32  namespace_ B32;
+    CARD32  param_hi B32;
+    CARD32  param_lo B32;
+} xDRI2GetParamReq;
+#define sz_xDRI2GetParamReq 20
+
+typedef struct {
+    BYTE    type; /*X_Reply*/
+    BYTE    pad1;
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    BOOL    is_param_recognized;
+    BYTE    pad2;
+    BYTE    pad3;
+    BYTE    pad4;
+    CARD32  value_hi B32;
+    CARD32  value_lo B32;
+    CARD32  pad5 B32;
+    CARD32  pad6 B32;
+    CARD32  pad7 B32;
+} xDRI2GetParamReply;
+#define sz_xDRI2GetParamReply 32
+
 #endif
diff --git a/dri2proto.txt b/dri2proto.txt
index 7bde067..df3758c 100644
--- a/dri2proto.txt
+++ b/dri2proto.txt
@@ -203,6 +203,14 @@ DRI2ATTACH_FORMAT { attachment: CARD32
 	format.  'attachment' describes the attachment point for the buffer,
 	'format' describes an opaque, device-dependent format for the buffer.
 
+DRI2PARAM_NAMESPACE { DRI2ParamNamespaceServer
+	              DRI2ParamNamespaceDriver }
+
+	These values describe the target namespace of a DRI2GetParam request.
+        Parameter names in the server namespace are invariant with respect to
+        the loaded driver. Parameter names in the driver namespace are
+	specific to the loaded driver.
+
 			     ⚙ ⚙ ⚙  ⚙ ⚙ ⚙
 
 
@@ -440,6 +448,28 @@ The name of this extension is "DRI2".
 	DRI2SwapBuffers requests to swap at most once per interval frames,
 	which is useful useful for limiting the frame rate.
 
+┌───
+    DRI2GetParam
+	drawable: DRAWABLE
+	namespace: DRI2PARAM_NAMESPACE
+	param: CARD64
+      ▶
+	is_param_recognized: BOOL
+	unused: 3 bytes
+	value: CARD64
+└───
+	Errors: Drawable, Value
+
+        Get the value of a parameter. The parameter's value is looked up in
+	the 'namespace' on the screen associated with the 'drawable'.
+
+        Possible values of 'param_is_recognized' are true (1) and
+	false(0).  If false, then 'value' is undefined.
+
+	If 'namespace' has a bad value, the a Value error is emitted.
+
+	This request is only available with protocol version 1.4 or later.
+
 			     ⚙ ⚙ ⚙  ⚙ ⚙ ⚙
 
 9. Extension Events
@@ -512,6 +542,8 @@ The DRI2 extension has undergone a number of revisions before
 
 	2.6: Enlightenment attained.  Added the DRI2BufferHiz attachment.
 
+	2.7: Added the DRI2GetParam request.
+
 Compatibility up to 2.0 is not preserved, but was also never released.
 
 
@@ -599,6 +631,14 @@ A.1 Common Types
 	This data type is only available with protocol version 1.1 or
 	later.
 
+┌───
+    DRI2PARAM_NAMESPACE
+	0x0	DRI2ParamNamespaceServer
+	0x1	DRI2ParamNamespaceDriver
+└───
+	Indicates the target namespace of a DRI2GetParam request. This data
+	type is only available with protocol version 1.4 or later.
+
 A.2 Protocol Requests
 
 ┌───
@@ -830,6 +870,26 @@ A.2 Protocol Requests
      ▶
 └───
 
+┌───
+    DRI2GetParam
+	1	CARD8			major opcode
+	1	13			DRI2 opcode
+	2	8			length
+	4	CARD32			namespace
+	4	CARD32			param_hi
+	4	CARD32			param_lo
+     ▶
+	1	1			Reply
+	1				unused
+	2	CARD16			sequence number
+	4	0			reply length
+	1	BOOL			is_param_recognized
+	3				unused
+	4	CARD32			value_hi
+	4	CARD32			value_lo
+	12				unused
+└───
+
 A.3 Protocol Events
 
 The DRI2 extension specifies DRI2_BufferSwapComplete and
diff --git a/dri2tokens.h b/dri2tokens.h
index 16c9008..2bd10eb 100644
--- a/dri2tokens.h
+++ b/dri2tokens.h
@@ -53,4 +53,8 @@
 #define DRI2_BLIT_COMPLETE		0x2
 #define DRI2_FLIP_COMPLETE		0x3
 
+/* Target namespaces for the DRI2GetParam request. */
+#define DRI2ParamNamespaceServer	0
+#define DRI2ParamNamespaceDriver	1
+
 #endif
-- 
1.7.10.1



More information about the xorg-devel mailing list