dri2proto.txt revision d63b911f
1			  The DRI2 Extension
2			      Version 2.0
3			      2008-09-04
4      
5			  Kristian Høgsberg
6			    krh@redhat.com
7			     Red Hat, Inc
8
9
101. Introduction
11
12The DRI2 extension is designed to associate and access auxiliary
13rendering buffers with an X drawable.
14
15DRI2 is a essentially a helper extension to support implementation of
16direct rendering drivers/libraries/technologies.
17
18The main consumer of this extension will be a direct rendering OpenGL
19driver, but the DRI2 extension is not designed to be OpenGL specific.
20Direct rendering implementations of OpenVG, Xv, cairo and other
21graphics APIs should find the functionality exposed by this extension
22helpful and hopefully sufficient.
23
24Relation to XF86DRI
25
26
271.1. Acknowledgements
28
29Kevin E. Martin <kem@redhat.com>
30Keith Packard <keithp@keithp.com>
31Eric Anholt <eric@anholt.net>
32Keith Whitwell <keith@tungstengraphics.com>
33Jerome Glisse <glisse@freedesktop.org>
34Ian Romanick <ian.d.romanick@intel.com>
35Michel Dänzer <michel@tungstengraphics.com>
36Jesse Barnes <jbarnes@virtuousgeek.org>
37
38
39			     ⚙ ⚙ ⚙  ⚙ ⚙ ⚙
40
41
422. DRI2 Concepts
43
44
452.1. Attachment points
46
47Stolen from OpenGL FBOs, I guess.
48
49
502.2. Kernel rendering manager
51
52This specification assumes a rendering architecture, where an
53underlying kernel rendering manager that can provide 32 bit integer
54handles to video memory buffers.  These handles can be passed between
55processes, which, through a direct rendering driver, submit rendering
56to the kernel rendering manager, targeting and/or sourcing from these
57buffers.  This extension provides a means to communicate about such
58buffers as associated with an X drawable.
59
60The details of how the direct rendering driver use the buffer names
61and submit the rendering requests is outside the scope of this
62specification.  However, Appendix B does discuss implementation of
63this specification on the Graphics Execution Manager (GEM).
64
65
662.3. Request ordering
67
68No ordering between swap buffers and X rendering.  X rendering to src
69buffers will block if they have a vblank pending.
70
71
722.4 Authentication model
73
74The purpose of the DRM authentication scheme is to grant access to the
75kernel rendering manager buffers created by the X server if, and only
76if, the client has access to the X server.  This is achieved in a
77three-step protocol:
78
79	1) The client gets a token from the kernel rendering manager
80	that uniquely identifies it.  The token is a 32 bit integer.
81
82	2) The client passes the token to the X server in the
83	DRI2Authenticate request.  This request is a round trip to
84	make sure the X server has received and processed the
85	authentication before the client starts accessing the DRM.
86
87	3) The X server authorizes the client by passing the token to
88	the kernel rendering manager.
89
90A kernel rendering manager can choose not to implement any
91authentication and just allow access to all buffers.
92
93
942.5 Rendering to the X front buffer
95
96OpenGL allows the client to render to the front buffer, either by
97using a single-buffered configuration or but explicitly setting the
98draw buffer to GL_FRONT_LEFT.  Not allowed!
99
100The client must ask for a fake front buffer, render to that and then
101use DRI2CopyRegion to copy contents back and forth between the fake
102front buffer and the real front buffer.  When X and direct rendering
103to a front buffer is interleaved, it is the responsibility of the
104application to synchronize access using glXWaitGL and glXWaitX.  A
105DRI2 implementation of direct rendering GLX, should use these entry
106points to copy contents back and forth to as necessary to ensure
107consistent rendering.
108
109The client may also use the DRI2SwapBuffers function to request a swap
110of the front and back buffers.  If the display server supports it, this
111operation may be preferred, since it may be easier and/or more performant
112for the server to perform a simple buffer swap rather than a blit.
113
1142.6 Synchronizing rendering
115
116DRI2 provides several methods for synchronizing drawing with various events.
117The protocol for these methods is based on the SGI_video_sync and
118OML_sync_control GLX extensions.  Using the DRI2WaitMSC request, a client
119can wait for a specific frame count or divisor/remainder before continuing
120its processing.  With the DRI2WaitSBC request, clients can block until a given
121swap count is reached (as incremented by DRI2SwapBuffers).  Finally, using
122DRI2SwapBuffers, clients can limit their frame rate by specifying a swap
123interval using the swap interval call (currently only available through GLX)
124or by using the OML swap buffers routine.
125
1262.7 Events
127
128DRI2 provides an event to indicate when a DRI2SwapBuffers request has
129been completed.  This can be used to throttle drawing on the client
130side and tie into application main loops.
131
132Another event is generated when the validity of the requested buffers
133changes.
134
135			     ⚙ ⚙ ⚙  ⚙ ⚙ ⚙
136
137
1383. Data Types
139
140The server side region support specified in the Xfixes extension
141version 2 is used in the CopyRegion request.
142
143
144			     ⚙ ⚙ ⚙  ⚙ ⚙ ⚙
145
146
1474. Errors
148
149No errors are defined by the DRI2 extension.
150
151
152			     ⚙ ⚙ ⚙  ⚙ ⚙ ⚙
153
1545. Events
155
156The only events provided by DRI2 are DRI2_BufferSwapComplete
157and DRI2InvalidateBuffers.
158
159
160			     ⚙ ⚙ ⚙  ⚙ ⚙ ⚙
161
162
1636. Protocol Types
164
165DRI2DRIVER { DRI2DriverDRI
166	     DRI2DriverVDPAU }
167
168	These values describe the type of driver the client will want
169	to load.  The server sends back the name of the driver to use
170	for the screen in question.
171
172DRI2ATTACHMENT { DRI2BufferFrontLeft
173	       	 DRI2BufferBackLeft
174	       	 DRI2BufferFrontRight
175	       	 DRI2BufferBackRight
176	       	 DRI2BufferDepth
177	       	 DRI2BufferStencil
178	       	 DRI2BufferAccum
179		 DRI2BufferFakeFrontLeft
180		 DRI2BufferFakeFrontRight
181		 DRI2BufferDepthStencil
182		 DRI2BufferHiz }
183
184	These values describe various attachment points for DRI2
185	buffers.
186
187DRI2BUFFER { attachment: CARD32
188    	     name: CARD32
189	     pitch: CARD32
190    	     cpp: CARD32
191	     flags: CARD32 }
192
193	The DRI2BUFFER describes an auxiliary rendering buffer
194	associated with an X drawable.  'attachment' describes the
195	attachment point for the buffer, 'name' is the name of the
196	underlying kernel buffer,
197
198
199DRI2ATTACH_FORMAT { attachment: CARD32
200		    format:     CARD32 }
201
202	The DRI2ATTACH_FORMAT describes an attachment and the associated
203	format.  'attachment' describes the attachment point for the buffer,
204	'format' describes an opaque, device-dependent format for the buffer.
205
206			     ⚙ ⚙ ⚙  ⚙ ⚙ ⚙
207
208
2097. Extension Initialization
210
211The name of this extension is "DRI2".
212
213┌───
214    DRI2QueryVersion
215	client-major-version:	CARD32
216	client-minor-version:	CARD32
217218	major-version:		CARD32
219	minor-version:		CARD32
220└───
221
222	The client sends the highest supported version to the server
223	and the server sends the highest version it supports, but no
224	higher than the requested version. Major versions changes can
225	introduce incompatibilities in existing functionality, minor
226	version changes introduce only backward compatible changes.
227	It is the clients responsibility to ensure that the server
228	supports a version which is compatible with its expectations.
229
230	Backwards compatible changes included addition of new
231	requests, but also new value types in the DRI2CopyRegion
232	request.  When new values are introduced, the minor version
233	will be increased so the client can know which values the X
234	server understands from the version number.
235
236
237			     ⚙ ⚙ ⚙  ⚙ ⚙ ⚙
238
239
2408. Extension Requests
241
242┌───
243    DRI2Connect
244	window: WINDOW
245	driverType: DRI2DRIVER
246247	driver: STRING
248	device: STRING
249└───
250
251	Returns the driver name and device file to use for the
252	specified driver type for the screen associated with 'window'.
253
254	'type' identifies the type of driver to query for.
255
256	'driver' is the name of the driver to load.  The client is
257	assumed to know where to look for the drivers and what to do
258	with it.
259
260	'device' is the filename of the DRM device file.
261
262	If the client is not local, or the request driver type is
263	unknown or not available, 'driver' and 'device' will be empty
264	strings.  We are not using an regular X
265	error here to indicate failure, which will allow the client
266	fall back to other options more easily.
267
268	ISSUE: We could add the list of supported attachments and the
269	supported DRI2CopyRegion values here (just the bitmask of all
270	supported values).
271	
272┌───
273    DRI2Authenticate
274	window: WINDOW
275	token: CARD32
276277        authenticated: CARD32
278└───
279	Errors: Window
280
281	Request that the X server authenticates 'token', allowing the
282	client to access the DRM buffers created by the X server on
283	the screen associated with 'window'.
284
285	Authentication shouldn't fail at this point, except if an
286	invalid token is passed, in which case authenticated is False.
287
288┌───
289    DRI2GetBuffers
290	drawable: DRAWABLE
291	attachments: LISTofDRI2ATTACHMENTS
292293	width, height: CARD32
294	buffers: LISTofDRI2BUFFER
295└───
296	Errors: Window
297
298	Get buffers for the provided attachment points for the given
299	drawable.
300
301	If the DDX driver does not support one or more of the
302	specified attachment points, a Value error is generated, with
303	the first unsupported attachment point as the error value.
304
305	'width' and 'height' describes the dimensions of the drawable.
306
307	'buffers' is a list of DRI2BUFFER for the given DRI2
308	attachment points.
309
310┌───
311    DRI2CopyRegion
312	drawable: DRAWABLE
313	region: REGION
314	source: DRI2ATTACHMENT
315	destination: DRI2ATTACHMENT
316317└───
318	Errors: Window, Value
319
320	Schedule a copy from one DRI2 buffer to another.
321
322	The DRICopyRegion request has a reply but it is empty.  The
323	reply is there to let the direct rendering client wait until
324	the server has seen the request before proceeding with
325	rendering the next frame.
326
327┌───
328    DRI2SwapBuffers
329	drawable: DRAWABLE
330	target_msc: two CARD32s
331	divisor: two CARD32s
332	remainder: two CARD32s
333334	swap: two CARD32s
335└───
336	Errors: Window
337
338	Schedule a swap of the front and back buffers with the display
339	server.
340
341	Returns the swap count value when the swap will actually occur (e.g.
342	the last queued swap count + (pending swap count * swap interval)).
343
344	This request is only available with protocol version 1.2 or
345	later.
346
347┌───
348    DRI2GetBuffersWithFormat
349	drawable: DRAWABLE
350	attachments: LISTofDRI2ATTACH_FORMAT
351352	width, height: CARD32
353	buffers: LISTofDRI2BUFFER
354└───
355	Errors: Window
356
357	Get buffers for the provided attachment points with the specified
358	formats for the given drawable.
359
360	If the DDX driver does not support one or more of the
361	specified attachment points or formats, a Value error is generated,
362	with the first unsupported attachment point as the error value.
363
364	'width' and 'height' describes the dimensions of the drawable.
365
366	'buffers' is a list of DRI2BUFFER for the given DRI2
367	attachment points.
368
369	This request is only available with protocol version 1.1 or
370	later.
371
372┌───
373    DRI2GetMSC
374	drawable: DRAWABLE
375376	ust, msc, sbc: CARD64
377└───
378	Errors: Window
379
380	Get the current media stamp counter (MSC) and swap buffer count (SBC)
381	along with the unadjusted system time (UST) when the MSC was last
382	incremented.
383
384	This request is only available with protocol version 1.2 or
385	later.
386
387┌───
388    DRI2WaitMSC
389	drawable: DRAWABLE
390	target_msc: two CARD32s
391	divisor: two CARD32s
392	remainder: two CARD32s
393394	ust, msc, sbc: CARD64
395└───
396	Errors: Window
397
398	Blocks the client until either the frame count reaches target_msc or,
399	if the frame count is already greater than target_msc when the request
400	is received, until the frame count % divisor = remainder.  If divisor
401	is 0, the client will be unblocked if the frame count is greater than
402	or equal to the target_msc.
403
404	Returns the current media stamp counter (MSC) and swap buffer count
405	(SBC) along with the unadjusted system time (UST) when the MSC was last
406	incremented.
407
408	This request is only available with protocol version 1.2 or
409	later.
410
411┌───
412    DRI2WaitSBC
413	drawable: DRAWABLE
414	target_sbc: two CARD32s
415416	ust, msc, sbc: CARD64
417└───
418	Errors: Window
419
420	Blocks the client until the swap buffer count reaches target_sbc.  If
421	the swap buffer count is already greater than or equal to target_sbc
422	when the request is received, this request will return immediately.
423
424	If target_sbc is 0, this request will block the client until all
425	previous DRI2SwapBuffers requests have completed.
426
427	Returns the current media stamp counter (MSC) and swap buffer count
428	(SBC) along with the unadjusted system time (UST) when the MSC was last
429	incremented.
430
431	This request is only available with protocol version 1.2 or
432	later.
433
434┌───
435    DRI2SwapInterval
436	drawable: DRAWABLE
437	interval: CARD32
438439└───
440	Errors: Window
441
442	Sets the swap interval for DRAWABLE.  This will throttle
443	DRI2SwapBuffers requests to swap at most once per interval frames,
444	which is useful useful for limiting the frame rate.
445
446┌───
447    DRI2GetParam
448	drawable: DRAWABLE
449	param: CARD32
450451	is_param_recognized: BOOL
452	value: CARD64
453└───
454	Errors: Drawable
455
456	Get the value of a parameter.  The parameter's value is looked up on
457	the screen associated with 'drawable'.
458
459	Parameter names in which the value of the most significant byte is
460	0 are reserved for the X server. Currently, no such parameter names
461	are defined. (When any such names are defined, they will be defined in
462	this extension specification and its associated headers).
463
464	Parameter names in which the byte's value is 1 are reserved for the
465	DDX. Such names are private to each driver and shall be defined in the
466	respective driver's headers.
467
468	Parameter names in which the byte's value is neither 0 nor 1 are
469	reserved for future use.
470
471	Possible values of 'is_param_recognized' are true (1) and false (0).
472	If false, then 'value' is undefined.
473
474	This request is only available with protocol version 1.4 or later.
475
476			     ⚙ ⚙ ⚙  ⚙ ⚙ ⚙
477
4789. Extension Events
479
480┌───
481    DRI2BufferSwapComplete
482483      	event_type: CARD16
484	drawable: CARD32
485	ust: CARD64
486	msc: CARD64
487	sbc: CARD64
488└───
489
490	This event reports the status of the last DRI2SwapBuffers event to
491	the client.  The event type should be one of DRI2_EXCHANGE_COMPLETE,
492	indicating a successful buffer exchange, DRI2_BLIT_COMPLETE, indicating
493	the swap was performed with a blit, and DRI2_FLIP_COMPLETE, indicating
494	a full page flip was completed.
495
496┌───
497    DRI2InvalidateBuffers
498499	drawable: CARD32
500└───
501
502	This event is generated when the buffers the client had
503	requested for 'drawable' (with DRI2GetBuffers or
504	DRI2GetBuffersWithFormat) become inappropriate because they
505	don't match the drawable dimensions anymore, or a buffer swap
506	has been performed.
507
508	Note that the server is only required to warn the client once
509	about this condition, until the client takes care of bringing
510	them back up-to-date with another GetBuffers request.
511
512			     ⚙ ⚙ ⚙  ⚙ ⚙ ⚙
513
51410. Extension Versioning
515
516The DRI2 extension has undergone a number of revisions before
517
518	1.0: Released, but never used.  Relied on a number of
519		constructs from the XF86DRI extension, such as a
520		shared memory area (SAREA) to communicate changes in
521		cliprects and window sizes, and
522
523	1.99.1: Move the swap buffer functionality into the X server,
524		introduce SwapBuffer request to copy back buffer
525		contents to the X drawable.
526
527	1.99.2: Rethink the SwapBuffer request as an asynchronous
528		request to copy a region between DRI2 buffers.  Drop
529		CreateDrawable and DestroyDrawable, update Connect to
530		support different driver types and to send the
531		authentication group.
532
533	1.99.3: Drop the bitmask argument intended to indicate
534		presence of optional arguments for CopyRegion.
535
536	2.0: Awesomeness!
537
538	2.1: True excellence.  Added DRI2GetBuffersWithFormat to allow
539             more flexible object creation.
540
541	2.2: Approaching perfection.  Added requests for swapbuffers,
542             MSC and SBC related requests, and events.
543
544	2.3: Added the DRI2InvalidateBuffers event.
545
546	2.6: Enlightenment attained.  Added the DRI2BufferHiz attachment.
547
548	2.7: Added the DRI2GetParam request.
549
550Compatibility up to 2.0 is not preserved, but was also never released.
551
552
553			     ⚙ ⚙ ⚙  ⚙ ⚙ ⚙
554
555
55611. Relationship with other extensions
557
558As an extension designed to support other extensions, there is
559naturally some interactions with other extensions.
560
561
56211.1 GLX
563
564The GL auxiliary buffers map directly to the DRI2 buffers... eh
565
566
56711.2 DBE
568
569The DBE back buffer must correspond to the DRI2_BUFFER_FRONT_LEFT
570DRI2 buffer for servers that support both DBE and DRI2.
571
572
57311.3 XvMC / Xv
574
575We might add a DRI2_BUFFER_YUV to do vsynced colorspace conversion
576blits.  Maybe... not really sure.
577
578
579			     ⚙ ⚙ ⚙  ⚙ ⚙ ⚙
580
581
582Appendix A. Protocol Encoding
583
584Syntactic Conventions
585
586This document uses the same syntactic conventions as the core X
587protocol encoding document.
588
589
590A.1 Common Types
591
592┌───
593    DRI2DRIVER
594	0x0	DRI2DriverDRI
595	0x1	DRI2DriverVDPAU
596└───
597
598┌───
599    DRI2ATTACHMENT
600	0x0	DRI2BufferFrontLeft
601	0x1	DRI2BufferBackLeft
602	0x2	DRI2BufferFrontRight
603	0x3	DRI2BufferBackRight
604	0x4	DRI2BufferDepth
605	0x5	DRI2BufferStencil
606	0x6	DRI2BufferAccum
607	0x7	DRI2BufferFakeFrontLeft
608	0x8	DRI2BufferFakeFrontRight
609	0x9	DRI2BufferDepthStencil
610	0xa	DRI2BufferHiz
611└───
612	Used to encode the possible attachment points.  The attachment
613	DRI2BufferDepthStencil is only available with protocol version 1.1 or
614	later.
615
616┌───
617    DRI2BUFFER
618	4	CARD32	attachment
619	4	CARD32	name
620	4	CARD32	pitch
621	4	CARD32	cpp
622	4	CARD32	flags
623└───
624	A DRI2 buffer specifies the attachment, the kernel memory
625	manager name, the pitch and chars per pixel for a buffer
626	attached to a given drawable.
627
628┌───
629    DRI2ATTACH_FORMAT
630	4	CARD32	attachment
631	4	CARD32	format
632└───
633	Used to describe the attachment and format requested from the server.
634	This data type is only available with protocol version 1.1 or
635	later.
636
637A.2 Protocol Requests
638
639┌───
640    DRI2QueryVersion
641	1	CARD8			major opcode
642	1	0			DRI2 opcode
643	2	3			length
644	4	CARD32			major version
645	4	CARD32			minor version
646647	1	1			Reply
648        1				unused
649	2	CARD16			sequence number
650	4	0			reply length
651	4	CARD32			major version
652        4	CARD32			minor version
653	16				unused	
654└───
655
656┌───
657    DRI2Connect
658	1	CARD8			major opcode
659	1	1			DRI2 opcode
660	2	3			length
661	4	WINDOW			window
662	4	CARD32			driver type
663664	1	1			Reply
665        1				unused
666	2	CARD16			sequence number
667	4	(n+m+p+q)/4		reply length
668	4	n			driver name length
669	4	m			device name length
670	16				unused
671	n	CARD8			driver name
672	p				unused, p=pad(n)
673	m	CARD8			device name
674	q				unused, q=pad(m)
675└───
676
677┌───
678    DRI2Authenticate
679	1	CARD8			major opcode
680	1	2			DRI2 opcode
681	2	3			length
682	4	WINDOW			window
683	4	CARD32			authentication token
684685	1	1			Reply
686        1				unused
687	2	CARD16			sequence number
688	4	0			reply length
689	4	CARD32			authenticated
690	20				unused	
691└───
692
693┌───
694    DRI2GetBuffers
695	1	CARD8			major opcode
696	1	5			DRI2 opcode
697	2	3			length
698	4	DRAWABLE		drawable
699	4	n			number of attachments
700	4n	LISTofDRI2ATTACHMENTS	attachments
701702	1	1			Reply
703        1				unused
704	2	CARD16			sequence number
705	4	0			reply length
706	4	CARD32			width of drawable
707	4	CARD32			height of drawable
708	4	CARD32			buffer count
709	12				unused	
710	5n	LISTofDRI2BUFFER	buffers
711└───
712
713┌───
714    DRI2CopyRegion
715	1	CARD8			major opcode
716	1	6			DRI2 opcode
717	2	3			length
718	4	DRAWABLE		drawable
719	4	REGION			region
720	4	DRI2ATTACHMENT		source
721	4	DRI2ATTACHMENT		destination
722723	1	1			Reply
724        1				unused
725	2	CARD16			sequence number
726	4	0			reply length
727	24				unused	
728└───
729
730┌───
731    DRI2GetBuffersWithFormat
732	1	CARD8			major opcode
733	1	7			DRI2 opcode
734	2	3			length
735	4	DRAWABLE		drawable
736	4	n			number of attachments
737	8n	LISTofDRI2ATTACH_FORMAT	attachments and formats
738739	1	1			Reply
740       1				unused
741	2	CARD16			sequence number
742	4	0			reply length
743	4	CARD32			width of drawable
744	4	CARD32			height of drawable
745	4	CARD32			buffer count
746	12				unused	
747	5n	LISTofDRI2BUFFER	buffers
748└───
749
750┌───
751    DRI2SwapBuffers
752	1	CARD8			major opcode
753	1	8			DRI2 opcode
754	2	8			length
755	4	DRAWABLE		drawable
756	4	CARD32			target_msc_hi
757	4	CARD32			target_msc_lo
758	4	CARD32			divisor_hi
759	4	CARD32			divisor_lo
760	4	CARD32			remainder_hi
761	4	CARD32			remainder_lo
762763	1	1			Reply
764        1				unused
765	2	CARD16			sequence number
766	4	0			reply length
767	4	CARD32			swap_hi
768	4	CARD32			swap_lo
769	20				unused
770└───
771
772┌───
773    DRI2GetMSC
774	1	CARD8			major opcode
775	1	9			DRI2 opcode
776	2	8			length
777	4	DRAWABLE		drawable
778779	1	1			Reply
780        1				unused
781	2	CARD16			sequence number
782	4	0			reply length
783	4	CARD32			ust_hi
784	4	CARD32			ust_lo
785	4	CARD32			msc_hi
786	4	CARD32			msc_lo
787	4	CARD32			sbc_hi
788	4	CARD32			sbc_lo
789└───
790
791┌───
792    DRI2WaitMSC
793	1	CARD8			major opcode
794	1	10			DRI2 opcode
795	2	8			length
796	4	DRAWABLE		drawable
797	4	CARD32			target_msc_hi
798	4	CARD32			target_msc_lo
799	4	CARD32			divisor_hi
800	4	CARD32			divisor_lo
801	4	CARD32			remainder_hi
802	4	CARD32			remainder_lo
803804	1	1			Reply
805        1				unused
806	2	CARD16			sequence number
807	4	0			reply length
808	4	CARD32			ust_hi
809	4	CARD32			ust_lo
810	4	CARD32			msc_hi
811	4	CARD32			msc_lo
812	4	CARD32			sbc_hi
813	4	CARD32			sbc_lo
814└───
815
816┌───
817    DRI2WaitSBC
818	1	CARD8			major opcode
819	1	11			DRI2 opcode
820	2	8			length
821	4	DRAWABLE		drawable
822 	4	CARD32			swap_hi
823	4	CARD32			swap_lo
824825	1	1			Reply
826        1				unused
827	2	CARD16			sequence number
828	4	0			reply length
829	4	CARD32			ust_hi
830	4	CARD32			ust_lo
831	4	CARD32			msc_hi
832	4	CARD32			msc_lo
833	4	CARD32			sbc_hi
834	4	CARD32			sbc_lo
835└───
836
837┌───
838    DRI2SwapInterval
839	1	CARD8			major opcode
840	1	12			DRI2 opcode
841	2	8			length
842	4	DRAWABLE		drawable
843 	4	CARD32			interval
844845└───
846
847┌───
848    DRI2GetParam
849	1	CARD8			major opcode
850	1	13			DRI2 opcode
851	2	8			length
852	4	DRAWABLE		drawable
853	4	CARD32			param
854855	1	1			Reply
856	1	BOOL			is_param_recognized
857	2	CARD16			sequence number
858	4	0			reply length
859	4	CARD32			value_hi
860	4	CARD32			value_lo
861	16				unused
862└───
863
864A.3 Protocol Events
865
866The DRI2 extension specifies DRI2_BufferSwapComplete and
867DRI2_InvalidateBuffers events.
868
869┌───
870    DRI2_BufferSwapComplete
871	1	CARD8			type
872	1	CARD8			extension
873	2	CARD16			sequenceNumber
874	2	CARD16			event_type
875	4	DRAWABLE		drawable
876	4	CARD32			ust_hi
877	4	CARD32			ust_lo
878	4	CARD32			msc_hi
879	4	CARD32			msc_lo
880	4	CARD32			sbc_hi
881	4	CARD32			sbc_lo
882└───
883
884
885┌───
886    DRI2_InvalidateBuffers
887	1	CARD8			type
888	1	CARD8			extension
889	2	CARD16			sequenceNumber
890	4	DRAWABLE		drawable
891	4	CARD32			unused
892	4	CARD32			unused
893	4	CARD32			unused
894	4	CARD32			unused
895	4	CARD32			unused
896	4	CARD32			unused
897└───
898
899A.4 Protocol Errors
900
901The DRI2 extension specifies no errors.
902
903
904			     ⚙ ⚙ ⚙  ⚙ ⚙ ⚙
905
906
907Appendix B. Implementation on GEM
908
909Where to begin...
910