dri3proto.txt revision 452262e1
117ca54c3Smrg			  The DRI3 Extension
2452262e1Smrg			     Version 1.3
3452262e1Smrg			      2021-11-30
417ca54c3Smrg
517ca54c3Smrg			    Keith Packard
617ca54c3Smrg			  keithp@keithp.com
717ca54c3Smrg			  Intel Corporation
817ca54c3Smrg
917ca54c3Smrg			    Daniel Stone
1017ca54c3Smrg		       daniels@collabora.com
1117ca54c3Smrg			     Collabora
1217ca54c3Smrg
1317ca54c3Smrg
1417ca54c3Smrg1. Introduction
1517ca54c3Smrg
1617ca54c3SmrgThe DRI3 extension provides mechanisms to translate between direct
1717ca54c3Smrgrendered buffers and X pixmaps. When combined with the Present extension,
1817ca54c3Smrga complete direct rendering solution for hardware-accelerated devices
1917ca54c3Smrgsuch as GPUs is provided.
2017ca54c3Smrg
2117ca54c3SmrgThe direct rendered buffers are passed across the protocol via
2217ca54c3Smrgstandard POSIX file descriptor passing mechanisms. On Linux, these
2317ca54c3Smrgbuffers are DMA-BUF objects.
2417ca54c3Smrg
2517ca54c3SmrgDRI3 also includes a mechanism to translate between Linux Futexes
2617ca54c3Smrgand X Sync extension Fences. This provides a synchronization mechanism
2717ca54c3Smrgwhich can be used to serialize access to shared render buffers.
2817ca54c3Smrg
2917ca54c3Smrg1.1. Acknowledgments
3017ca54c3Smrg
3117ca54c3SmrgEric Anholt <eric@anholt.net>
3217ca54c3SmrgDave Airlie <airlied@redhat.com>
3317ca54c3SmrgKristian Høgsberg <krh@bitplanet.net>
3417ca54c3SmrgJames Jones <jajones@nvidia.com>
3517ca54c3SmrgArthur Huillet <arthur.huillet@free.fr>
3617ca54c3SmrgLouis-Francis Ratté-Boulianne <lfrb@collabora.com>
37452262e1SmrgAustin Shafer <ashafer@nvidia.com>
3817ca54c3Smrg
3917ca54c3Smrg			     ❄ ❄ ❄  ❄  ❄ ❄ ❄ 
4017ca54c3Smrg
4117ca54c3Smrg2. Data Types
4217ca54c3Smrg
4317ca54c3SmrgThe DRI3 extension uses the RandR extension Provider data type to
4417ca54c3Smrgselect among multiple GPUs on a single screen and the Sync extension
4517ca54c3Smrgfence object to provide graphics object synchronization.
4617ca54c3Smrg
4717ca54c3Smrg			     ❄ ❄ ❄  ❄  ❄ ❄ ❄ 
4817ca54c3Smrg
4917ca54c3Smrg4. Errors
5017ca54c3Smrg
5117ca54c3SmrgDRI3 defines no errors.
5217ca54c3Smrg
5317ca54c3Smrg			     ❄ ❄ ❄  ❄  ❄ ❄ ❄ 
5417ca54c3Smrg
5517ca54c3Smrg5. Events
5617ca54c3Smrg
5717ca54c3SmrgDRI3 defines no events.
5817ca54c3Smrg
5917ca54c3Smrg			     ❄ ❄ ❄  ❄  ❄ ❄ ❄ 
6017ca54c3Smrg
6117ca54c3Smrg6. Protocol Types
6217ca54c3Smrg
6317ca54c3SmrgDRI3 defines no new protocol types.
6417ca54c3Smrg
6517ca54c3Smrg			     ❄ ❄ ❄  ❄  ❄ ❄ ❄ 
6617ca54c3Smrg
6717ca54c3Smrg7. Extension Initialization
6817ca54c3Smrg
6917ca54c3SmrgThe name of this extension is "DRI3"
7017ca54c3Smrg
7117ca54c3Smrg┌───
7217ca54c3Smrg    DRI3QueryVersion
7317ca54c3Smrg	client-major-version:	CARD32
7417ca54c3Smrg	client-minor-version:	CARD32
7517ca54c3Smrg7617ca54c3Smrg	major-version:		CARD32
7717ca54c3Smrg	minor-version:		CARD32
7817ca54c3Smrg└───
7917ca54c3Smrg
8017ca54c3Smrg	The client sends the highest supported version to the server
8117ca54c3Smrg	and the server sends the highest version it supports, but no
8217ca54c3Smrg	higher than the requested version. Major versions changes can
8317ca54c3Smrg	introduce incompatibilities in existing functionality, minor
8417ca54c3Smrg	version changes introduce only backward compatible changes.
8517ca54c3Smrg	It is the clients responsibility to ensure that the server
8617ca54c3Smrg	supports a version which is compatible with its expectations.
8717ca54c3Smrg
8817ca54c3Smrg	Backwards compatible changes included addition of new
8917ca54c3Smrg	requests.
9017ca54c3Smrg
9117ca54c3Smrg
9217ca54c3Smrg			     ❄ ❄ ❄  ❄  ❄ ❄ ❄ 
9317ca54c3Smrg
9417ca54c3Smrg8. Extension Requests
9517ca54c3Smrg
9617ca54c3Smrg┌───
9717ca54c3Smrg    DRI3Open
9817ca54c3Smrg	drawable: DRAWABLE
9917ca54c3Smrg	provider: PROVIDER
10017ca54c3Smrg10117ca54c3Smrg	nfd: CARD8
10217ca54c3Smrg	device: FD
10317ca54c3Smrg└───
10417ca54c3Smrg	Errors: Drawable, Value, Match
10517ca54c3Smrg
10617ca54c3Smrg	This requests that the X server open the direct rendering
10717ca54c3Smrg	device associated with drawable and RandR provider. The
10817ca54c3Smrg	provider must support SourceOutput or SourceOffload.
10917ca54c3Smrg
11017ca54c3Smrg	The file descriptor for the device is returned in
11117ca54c3Smrg	'device'. 'nfd' will be set to one (this is strictly a
11217ca54c3Smrg	convenience for XCB which otherwise would need
11317ca54c3Smrg	request-specific information about how many file descriptors
11417ca54c3Smrg	were associated with this reply).
11517ca54c3Smrg
11617ca54c3Smrg┌───
11717ca54c3Smrg    DRI3PixmapFromBuffer
11817ca54c3Smrg	pixmap: PIXMAP
11917ca54c3Smrg	drawable: DRAWABLE
12017ca54c3Smrg	size: CARD32
12117ca54c3Smrg	width, height, stride: CARD16
12217ca54c3Smrg	depth, bpp: CARD8
12317ca54c3Smrg	buffer: FD
12417ca54c3Smrg└───
12517ca54c3Smrg	Errors: Alloc, Drawable, IDChoice, Value, Match
12617ca54c3Smrg
12717ca54c3Smrg	Creates a pixmap for the direct rendering object associated
12817ca54c3Smrg	with 'buffer' and the screen associated with 'drawable'.
12917ca54c3Smrg	Changes to pixmap will be visible in that direct rendered
13017ca54c3Smrg	object and changes to the direct rendered object will be
13117ca54c3Smrg	visible in the pixmap.
13217ca54c3Smrg
13317ca54c3Smrg	'size' specifies the total size of the buffer bytes. 'width',
13417ca54c3Smrg	'height' describe the geometry (in pixels) of the underlying
13517ca54c3Smrg	buffer. 'stride' specifies the number of bytes per scanline in
13617ca54c3Smrg	the buffer. The pixels within the buffer are not required to
13717ca54c3Smrg	be arranged in a simple linear fashion, but 'size' will be at
13817ca54c3Smrg	least 'height' * 'stride'.
13917ca54c3Smrg
14017ca54c3Smrg	Precisely how any additional information about the buffer is
14117ca54c3Smrg	shared is outside the scope of this extension.
14217ca54c3Smrg
14317ca54c3Smrg	If buffer cannot be used with the screen associated with
14417ca54c3Smrg	drawable, a Match error is returned.
14517ca54c3Smrg
14617ca54c3Smrg	If depth or bpp are not supported by the screen, a Value error
14717ca54c3Smrg	is returned.
14817ca54c3Smrg
14917ca54c3Smrg	For information on synchronization of buffer access between
15017ca54c3Smrg	the client and the X server, please see section 12.
15117ca54c3Smrg
15217ca54c3Smrg┌───
15317ca54c3Smrg    DRI3BufferFromPixmap
15417ca54c3Smrg	pixmap: PIXMAP
15517ca54c3Smrg15617ca54c3Smrg	nfd: CARD8
15717ca54c3Smrg	size: CARD32
15817ca54c3Smrg	width, height, stride: CARD16
15917ca54c3Smrg	depth, bpp: CARD8
16017ca54c3Smrg	buffer: FD
16117ca54c3Smrg└───
16217ca54c3Smrg	Errors: Pixmap, Match
16317ca54c3Smrg
16417ca54c3Smrg	Pass back a direct rendering object associated with
16517ca54c3Smrg	pixmap. Changes to pixmap will be visible in that
16617ca54c3Smrg	direct rendered object and changes to the direct rendered
16717ca54c3Smrg	object will be visible in the pixmap.
16817ca54c3Smrg
16917ca54c3Smrg	'size' specifies the total size of the buffer bytes. 'width',
17017ca54c3Smrg	'height' describe the geometry (in pixels) of the underlying
17117ca54c3Smrg	buffer. 'stride' specifies the number of bytes per scanline in
17217ca54c3Smrg	the buffer. The pixels within the buffer are not required to
17317ca54c3Smrg	be arranged in a simple linear fashion, but 'size' will be at
17417ca54c3Smrg	least 'height' * 'stride'.
17517ca54c3Smrg
17617ca54c3Smrg	Precisely how any additional information about the buffer is
17717ca54c3Smrg	shared is outside the scope of this extension.
17817ca54c3Smrg
17917ca54c3Smrg	If buffer cannot be used with the screen associated with
18017ca54c3Smrg	drawable, a Match error is returned.
18117ca54c3Smrg
18217ca54c3Smrg	For information on synchronization of buffer access between
18317ca54c3Smrg	the client and the X server, please see section 12.
18417ca54c3Smrg
18517ca54c3Smrg┌───
18617ca54c3Smrg    DRI3FenceFromFD
18717ca54c3Smrg	drawable: DRAWABLE
18817ca54c3Smrg	fence: FENCE
18917ca54c3Smrg	initially-triggered: BOOL
19017ca54c3Smrg	fd: FD
19117ca54c3Smrg└───
19217ca54c3Smrg	Errors: IDchoice, Drawable
19317ca54c3Smrg
19417ca54c3Smrg	Creates a Sync extension Fence that provides the regular Sync
19517ca54c3Smrg	extension semantics along with a file descriptor that provides
19617ca54c3Smrg	a device-specific mechanism to manipulate the fence directly.
19717ca54c3Smrg	Details about the mechanism used with this file descriptor are
19817ca54c3Smrg	outside the scope of the DRI3 extension.
19917ca54c3Smrg
20017ca54c3Smrg	For information on synchronization of buffer access between
20117ca54c3Smrg	the client and the X server, please see section 12.
20217ca54c3Smrg
20317ca54c3Smrg┌───
20417ca54c3Smrg    DRI3FDFromFence
20517ca54c3Smrg	drawable: DRAWABLE
20617ca54c3Smrg	fence: FENCE
20717ca54c3Smrg20817ca54c3Smrg	fd: FD
20917ca54c3Smrg└───
21017ca54c3Smrg	Errors: IDchoice, Drawable, Match
21117ca54c3Smrg
21217ca54c3Smrg	Given a Sync extension Fence that provides the regular Sync
21317ca54c3Smrg	extension semantics, returns a file descriptor that provides a
21417ca54c3Smrg	device-specific mechanism to manipulate the fence directly.
21517ca54c3Smrg	Details about the mechanism used with this file descriptor are
21617ca54c3Smrg	outside the scope of the DRI3 extension. 'drawable' must be
21717ca54c3Smrg	associated with a direct rendering device that 'fence' can
21817ca54c3Smrg	work with, otherwise a Match error results.
21917ca54c3Smrg
22017ca54c3Smrg	For information on synchronization of buffer access between
22117ca54c3Smrg	the client and the X server, please see section 12.
22217ca54c3Smrg
22317ca54c3Smrg┌───
22417ca54c3Smrg    DRI3GetSupportedModifiers
22517ca54c3Smrg	window: WINDOW
22617ca54c3Smrg	depth: CARD8
22717ca54c3Smrg	bpp: CARD8
22817ca54c3Smrg22917ca54c3Smrg	num_window_modifiers: CARD32
23017ca54c3Smrg	num_screen_modifiers: CARD32
23117ca54c3Smrg	window_modifiers: ListOfCARD64
23217ca54c3Smrg	screen_modifiers: ListOfCARD64
23317ca54c3Smrg└───
23417ca54c3Smrg	Errors: Window, Match
23517ca54c3Smrg
23617ca54c3Smrg	Return supported DRM FourCC modifiers for the specified
23717ca54c3Smrg	'window'.
23817ca54c3Smrg
23917ca54c3Smrg	The first list of 'window_modifiers' contains a set of
24017ca54c3Smrg	modifiers which the server considers optimal for the window's
24117ca54c3Smrg	current configuration. Using these modifiers to allocate, even
24217ca54c3Smrg	if locally suboptimal to the client driver, may result in a
24317ca54c3Smrg	more optimal display pipeline, e.g. by avoiding composition.
24417ca54c3Smrg
24517ca54c3Smrg	The second list of 'screen_modifiers', is the total set of
24617ca54c3Smrg	modifiers which are acceptable for use on the Screen associated
24717ca54c3Smrg	with 'window'. This set of modifiers will not change over the
24817ca54c3Smrg	lifetime of the client. Using this set of modifiers to allocate
24917ca54c3Smrg	may not result in a globally optimal pipeline, if separate
25017ca54c3Smrg	'window_modifiers' are available.
25117ca54c3Smrg
25217ca54c3Smrg	It is expected that a client calling this request will obtain
25317ca54c3Smrg	the modifiers for a particular window, allocate buffers using
25417ca54c3Smrg	the preferred modifier set as described above, create a Pixmap
25517ca54c3Smrg	referring to the storage of those buffers using the
25617ca54c3Smrg	DRI3BuffersFromPixmap request, then make the content visible
25717ca54c3Smrg	in the storage of those buffers visible with a request such as
25817ca54c3Smrg	the Present extension's PresentPixmap.
25917ca54c3Smrg
26017ca54c3Smrg	The meaning of any modifier is canonically defined in
26117ca54c3Smrg	drm_fourcc.h.
26217ca54c3Smrg
26317ca54c3Smrg┌───
26417ca54c3Smrg    DRI3PixmapFromBuffers
26517ca54c3Smrg	pixmap: PIXMAP
26617ca54c3Smrg	window: WINDOW
26717ca54c3Smrg	num_buffers: CARD8
26817ca54c3Smrg	width, height: CARD16
26917ca54c3Smrg	stride0, offset0: CARD32
27017ca54c3Smrg	stride1, offset1: CARD32
27117ca54c3Smrg	stride2, offset2: CARD32
27217ca54c3Smrg	stride3, offset3: CARD32
27317ca54c3Smrg	depth, bpp: CARD8
27417ca54c3Smrg	modifier: CARD64
27517ca54c3Smrg	buffers: ListOfFD
27617ca54c3Smrg└───
27717ca54c3Smrg	Errors: Alloc, Window, IDChoice, Value, Match
27817ca54c3Smrg
27917ca54c3Smrg	Creates a pixmap for the direct rendering object associated
28017ca54c3Smrg	with 'buffers' and the screen associated with 'window'.
28117ca54c3Smrg	Changes to pixmap will be visible in that direct rendered
28217ca54c3Smrg	object and changes to the direct rendered object will be
28317ca54c3Smrg	visible in the pixmap. The pixmap will be available for
28417ca54c3Smrg	presentation to the window.
28517ca54c3Smrg
28617ca54c3Smrg	In contrast to PixmapFromBuffer, multiple buffers may be
28717ca54c3Smrg	combined to specify a single logical source for pixel
28817ca54c3Smrg	sampling: 'num_buffers' may be set from 1 (single buffer,
28917ca54c3Smrg	akin to PixmapFromBuffer) to 4. This is the number of file
29017ca54c3Smrg	descriptors which will be sent with this request; one per
29117ca54c3Smrg	buffer.
29217ca54c3Smrg
29317ca54c3Smrg	Modifiers allow explicit specification of non-linear sources,
29417ca54c3Smrg	such as tiled or compressed buffers. The combination of bpp,
29517ca54c3Smrg	depth, and modifier allows unambiguous declaration of the
29617ca54c3Smrg	buffer layout in a manner defined by the DRM tokens.
29717ca54c3Smrg
29817ca54c3Smrg	If 'modifier' is DRM_FORMAT_MOD_INVALID, the client does
29917ca54c3Smrg	not have information on the buffer layout. In this case, the
30017ca54c3Smrg	buffer may only have a single plane. The driver may make its
30117ca54c3Smrg	own inference through unspecified means to determine the exact
30217ca54c3Smrg	buffer layout, however this is neither required nor defined
30317ca54c3Smrg	by the specification, and is considered an implementation
30417ca54c3Smrg	detail of the particular driver.
30517ca54c3Smrg
30617ca54c3Smrg	'width' and 'height' describe the geometry (in pixels) of the
30717ca54c3Smrg	logical pixel-sample source.
30817ca54c3Smrg
30917ca54c3Smrg	'strideN' and 'offsetN' define the number of bytes per logical
31017ca54c3Smrg	scanline, and the distance in bytes from the beginning of the
31117ca54c3Smrg	buffer passed for that plane until the start of the sample
31217ca54c3Smrg	source for that plane, respectively for plane N. If the plane
31317ca54c3Smrg	is not used according to the format and modifier specification,
31417ca54c3Smrg	both values for that plane must be zero.
31517ca54c3Smrg
31617ca54c3Smrg	Precisely how any additional information about the buffer (such
31717ca54c3Smrg	as memory placement) is shared is outside the scope of this
31817ca54c3Smrg	extension.
31917ca54c3Smrg
32017ca54c3Smrg	If the buffer(s) cannot be used with the screen associated with
32117ca54c3Smrg	'window', a Match error is returned.
32217ca54c3Smrg
32317ca54c3Smrg	If the bpp, depth, and modifier combination is not supported by
32417ca54c3Smrg	the screen, a Value error is returned.
32517ca54c3Smrg
32617ca54c3Smrg	For information on synchronization of buffer access between
32717ca54c3Smrg	the client and the X server, please see section 12.
32817ca54c3Smrg
32917ca54c3Smrg┌───
33017ca54c3Smrg    DRI3BuffersFromPixmap
33117ca54c3Smrg	pixmap: PIXMAP
33217ca54c3Smrg33317ca54c3Smrg	nfd: CARD8
33417ca54c3Smrg	width, height: CARD16
33517ca54c3Smrg	depth, bpp: CARD8
33617ca54c3Smrg	modifier: CARD64
33717ca54c3Smrg	strides: ListOfCARD32
33817ca54c3Smrg	offsets: ListOfCARD32
33917ca54c3Smrg	buffers: ListOfFD
34017ca54c3Smrg└───
34117ca54c3Smrg	Errors: Pixmap, Match
34217ca54c3Smrg
34317ca54c3Smrg	Returns direct rendering objects associated with 'pixmap'.
34417ca54c3Smrg	Changes to 'pixmap' will be visible in the direct rendered
34517ca54c3Smrg	objects and changes to the direct rendered objects will be
34617ca54c3Smrg	visible in 'pixmap' after flushing and synchronization.
34717ca54c3Smrg
34817ca54c3Smrg	'width' and 'height' describe the geometry (in pixels) of the
34917ca54c3Smrg	logical pixel-sample source from combining the direct rendering
35017ca54c3Smrg	objects.
35117ca54c3Smrg
35217ca54c3Smrg	See PixmapFromBuffers for more details on DRM modifiers usage.
35317ca54c3Smrg
35417ca54c3Smrg	'nfd' describes the number of buffers returned for the pixmap,
35517ca54c3Smrg	which must be combined together according to 'depth', 'bpp', and
35617ca54c3Smrg	'modifier'.
35717ca54c3Smrg
35817ca54c3Smrg	For each buffer, there is an entry in the 'strides',
35917ca54c3Smrg	'offsets', and 'buffers' list. 'buffer' contains a single file
36017ca54c3Smrg	descriptor referring to the buffer. 'stride' specifies the
36117ca54c3Smrg	number of bytes per logical scanline for this plane, and
36217ca54c3Smrg	'offset' specifies the distance in bytes from the beginning
36317ca54c3Smrg	of 'buffer' until the start of the sample source for that
36417ca54c3Smrg	plane.
36517ca54c3Smrg
36617ca54c3Smrg	Precisely how any additional information about the buffer is
36717ca54c3Smrg	shared is outside the scope of this extension.
36817ca54c3Smrg
36917ca54c3Smrg	If buffers cannot be exported from the the screen associated
37017ca54c3Smrg	with 'pixmap', a Match error is returned.
37117ca54c3Smrg
37217ca54c3Smrg	For information on synchronization of buffer access between
37317ca54c3Smrg	the client and the X server, please see section 12.
37417ca54c3Smrg
375452262e1Smrg┌───
376452262e1Smrg    DRI3SetDRMDeviceInUse
377452262e1Smrg	window: WINDOW
378452262e1Smrg	drmMajor: CARD32
379452262e1Smrg	drmMinor: CARD32
380452262e1Smrg└───
381452262e1Smrg	Errors: Window
382452262e1Smrg
383452262e1Smrg	This request provides a hint to the server about the device
384452262e1Smrg	in use by this window. This is used to provide
385452262e1Smrg	DRI3GetSupportedModifiers with a hint of what device to
386452262e1Smrg	return modifiers for in the window_modifiers return value.
387452262e1Smrg	Using this hint allows for device-specific modifiers to
388452262e1Smrg	be returned by DRI3GetSupportedModifiers, for example
389452262e1Smrg	when an application is renderoffloaded and eligible for
390452262e1Smrg	direct scanout.
391452262e1Smrg
392452262e1Smrg	This is only a hint, and may or may not be reflected in
393452262e1Smrg	the modifier list returned.
394452262e1Smrg
395452262e1Smrg	If the window specified was not found, a Window error will
396452262e1Smrg	be returned.
39717ca54c3Smrg
39817ca54c3Smrg			     ❄ ❄ ❄  ❄  ❄ ❄ ❄
39917ca54c3Smrg
40017ca54c3Smrg9. Extension Events
40117ca54c3Smrg
40217ca54c3SmrgDRI3 defines no events.
40317ca54c3Smrg
40417ca54c3Smrg			     ❄ ❄ ❄  ❄  ❄ ❄ ❄
40517ca54c3Smrg
40617ca54c3Smrg10. Extension Versioning
40717ca54c3Smrg
40817ca54c3SmrgThe DRI3 extension is adapted from the DRI2 extension.
40917ca54c3Smrg
41017ca54c3Smrg	1.0: First published version
41117ca54c3Smrg
41217ca54c3Smrg	1.1: Cosmetic changes
41317ca54c3Smrg
41417ca54c3Smrg	1.2: Add GetSupportedModifiers,
41517ca54c3Smrg	     PixmapFromBuffers, and BuffersFromPixmap requests.
41617ca54c3Smrg
417452262e1Smrg	1.3: Add SetDRMDeviceInUse
418452262e1Smrg
41917ca54c3Smrg			     ❄ ❄ ❄  ❄  ❄ ❄ ❄
42017ca54c3Smrg
42117ca54c3Smrg
42217ca54c3Smrg11. Relationship with other extensions
42317ca54c3Smrg
42417ca54c3SmrgAs an extension designed to support other extensions, there is
42517ca54c3Smrgnaturally some interactions with other extensions.
42617ca54c3Smrg
42717ca54c3Smrg11.1 GLX
42817ca54c3Smrg
42917ca54c3SmrgGLX is both an application interface and an X extension. OpenGL
43017ca54c3Smrgapplications using the GLX API will use the GLX extension, DRI3 and
43117ca54c3SmrgPresent when doing direct rendering.
43217ca54c3Smrg
43317ca54c3Smrg11.2 Present
43417ca54c3Smrg
43517ca54c3SmrgThe Present extension provides a way to synchronize the display of pixmap
43617ca54c3Smrgcontents to the screen. When used in conjunction with DRI3, they
43717ca54c3Smrgprovide a complete direct rendering solution for OpenGL or other APIs.
43817ca54c3Smrg
43917ca54c3Smrg11.3 DRI2
44017ca54c3Smrg
44117ca54c3SmrgDRI3 provides similar functionality to the DRI2Connect and
44217ca54c3SmrgDRI2GetBuffersWithFormat requests, however DRI3 uses file descriptors
44317ca54c3Smrgto refer to the direct rendering device and buffers.
44417ca54c3Smrg
44517ca54c3SmrgPresent and DRI3 are designed in conjunction to replace DRI2
44617ca54c3Smrg
44717ca54c3Smrg11.2 XvMC / Xv
44817ca54c3Smrg
44917ca54c3SmrgIt might be nice to be able to reference YUV formatted direct rendered
45017ca54c3Smrgobjects from the X server.
45117ca54c3Smrg
45217ca54c3Smrg			     ❄ ❄ ❄  ❄  ❄ ❄ ❄
45317ca54c3Smrg
45417ca54c3Smrg12. Synchronization
45517ca54c3Smrg
45617ca54c3SmrgSynchronization of access to buffers shared between processes is not
45717ca54c3Smrgcurrently explicitly controlled by this protocol.
45817ca54c3Smrg
45917ca54c3SmrgWithout the use of additional extensions not defined by the DRI3
46017ca54c3Smrgprotocol as of version 1.2, synchronization between multiple
46117ca54c3Smrgprocesses and contexts is considered to follow the implicit model.
46217ca54c3Smrg
46317ca54c3SmrgIn this model, the driver is required to have a global view of
46417ca54c3Smrgaccess requests issued by all processes with a reference to the
46517ca54c3Smrgbuffer, and control scheduling of all operations on that buffer,
46617ca54c3Smrgwhether performed by the CPU or auxiliary hardware.
46717ca54c3Smrg
46817ca54c3SmrgThe driver is responsible for enforcing a strict ordering to protect
46917ca54c3Smrgagainst write-after-read or read-after-write hazards, such that any
47017ca54c3Smrgreads requested by one process or context, are fulfilled before any
47117ca54c3Smrgwrites requested by another process or context, as long as that read
47217ca54c3Smrgwas definitively submitted before the write.
47317ca54c3Smrg
47417ca54c3SmrgA similar dependency exists for reads submitted after writes: the
47517ca54c3Smrgdriver must ensure that the write is fully visible and coherent to
47617ca54c3Smrgthe read request.
47717ca54c3Smrg
47817ca54c3SmrgAs a purely illustrative example, if two processes share a buffer,
47917ca54c3Smrgwhere one process reads from a buffer using an OpenGL texture
48017ca54c3Smrgsampler and submits this work by calling 'glFlush', and the other
48117ca54c3Smrgprocess submits work to the driver to write to that buffer, the
48217ca54c3Smrgdriver is responsible for ensuring that the results of the latter
48317ca54c3Smrgwrite are not visible to the texture sampler.
48417ca54c3Smrg
48517ca54c3SmrgThe Sync fences provided by DRI3 control only this submission of
48617ca54c3Smrgwork and ensuing global visibility of the requests, rather than the
48717ca54c3Smrgcompletion of the work within any hardware. To further the example
48817ca54c3Smrgabove, a fence used to prevent any writes to the buffer before the
48917ca54c3Smrgsampler had completed access, the fence would be signaled when
49017ca54c3Smrg'glFlush' had been called, at which point the request has become
49117ca54c3Smrgglobally visible to the driver's request-scheduling and
49217ca54c3Smrgsynchronization mechanisms. The logical ordering of requests made
49317ca54c3Smrgby software has been preserved, and the driver then takes care
49417ca54c3Smrgto ensure that these requests are scheduled such they do not
49517ca54c3Smrgobserve effects from requests made later in time.
49617ca54c3Smrg
49717ca54c3SmrgThis presents a fully coherent in-order FIFO-like model across
49817ca54c3Smrgprocesses, where synchronzation is handled externally to the DRI3
49917ca54c3Smrgclient with no explicit intervention.
50017ca54c3Smrg
50117ca54c3SmrgThis restriction also applies for cross-device usage.
50217ca54c3Smrg
50317ca54c3Smrg			     ❄ ❄ ❄  ❄  ❄ ❄ ❄
50417ca54c3Smrg
50517ca54c3SmrgAppendix A. Protocol Encoding
50617ca54c3Smrg
50717ca54c3SmrgSyntactic Conventions
50817ca54c3Smrg
50917ca54c3SmrgThis document uses the same syntactic conventions as the core X
51017ca54c3Smrgprotocol encoding document.
51117ca54c3Smrg
51217ca54c3Smrg
51317ca54c3SmrgA.1 Common Types
51417ca54c3Smrg
51517ca54c3SmrgNone.
51617ca54c3Smrg
51717ca54c3SmrgA.2 Protocol Requests
51817ca54c3Smrg
51917ca54c3Smrg┌───
52017ca54c3Smrg    DRI3QueryVersion
52117ca54c3Smrg	1	CARD8			major opcode
52217ca54c3Smrg	1	0			DRI3 opcode
52317ca54c3Smrg	2	3			length
52417ca54c3Smrg	4	CARD32			major version
52517ca54c3Smrg	4	CARD32			minor version
52617ca54c3Smrg52717ca54c3Smrg	1	1			Reply
52817ca54c3Smrg        1				unused
52917ca54c3Smrg	2	CARD16			sequence number
53017ca54c3Smrg	4	0			reply length
53117ca54c3Smrg	4	CARD32			major version
53217ca54c3Smrg        4	CARD32			minor version
53317ca54c3Smrg	16				unused	
53417ca54c3Smrg└───
53517ca54c3Smrg
53617ca54c3Smrg
53717ca54c3Smrg┌───
53817ca54c3Smrg    DRI3Open
53917ca54c3Smrg	1	CARD8			major opcode
54017ca54c3Smrg	1	1			DRI3 opcode
54117ca54c3Smrg	2	4			length
54217ca54c3Smrg	4	DRAWABLE		drawable
54317ca54c3Smrg	4	PROVIDER		provider
54417ca54c3Smrg54517ca54c3Smrg	1	1			Reply
54617ca54c3Smrg        1	1			nfd
54717ca54c3Smrg	2	CARD16			sequence number
54817ca54c3Smrg	4	0			reply length
54917ca54c3Smrg	24				unused
55017ca54c3Smrg
55117ca54c3Smrg	0	FD			device
55217ca54c3Smrg└───
55317ca54c3Smrg
55417ca54c3Smrg┌───
55517ca54c3Smrg    DRI3PixmapFromBuffer
55617ca54c3Smrg	1	CARD8			major opcode
55717ca54c3Smrg	1	2			DRI3 opcode
55817ca54c3Smrg	2	6			length
55917ca54c3Smrg	4	Pixmap			pixmap
56017ca54c3Smrg	4	Drawable		drawable
56117ca54c3Smrg	4	CARD32			size
56217ca54c3Smrg	2	CARD16			width
56317ca54c3Smrg	2	CARD16			height
56417ca54c3Smrg	2	CARD16			stride
56517ca54c3Smrg	1	CARD8			depth
56617ca54c3Smrg	1	CARD8			bpp
56717ca54c3Smrg
56817ca54c3Smrg	0	FD			buffer
56917ca54c3Smrg└───
57017ca54c3Smrg
57117ca54c3Smrg┌───
57217ca54c3Smrg    DRI3BufferFromPixmap
57317ca54c3Smrg	1	CARD8			major opcode
57417ca54c3Smrg	1	3			DRI3 opcode
57517ca54c3Smrg	2	2			length
57617ca54c3Smrg	4	Pixmap			pixmap
57717ca54c3Smrg57817ca54c3Smrg	1	1			Reply
57917ca54c3Smrg        1	1			nfd
58017ca54c3Smrg	2	CARD16			sequence number
58117ca54c3Smrg	4	0			reply length
58217ca54c3Smrg	4	CARD32			size
58317ca54c3Smrg	2	CARD16			width
58417ca54c3Smrg	2	CARD16			height
58517ca54c3Smrg	2	CARD16			stride
58617ca54c3Smrg	1	CARD8			depth
58717ca54c3Smrg	1	CARD8			bpp
58817ca54c3Smrg	12				unused
58917ca54c3Smrg
59017ca54c3Smrg	0	FD			buffer
59117ca54c3Smrg└───
59217ca54c3Smrg
59317ca54c3Smrg┌───
59417ca54c3Smrg    DRI3FenceFromFD
59517ca54c3Smrg	1	CARD8			major opcode
59617ca54c3Smrg	1	4			DRI3 opcode
59717ca54c3Smrg	2	4			length
59817ca54c3Smrg	4	Drawable		drawable
59917ca54c3Smrg	4	Fence			fence
60017ca54c3Smrg	1	BOOL			initially triggered
60117ca54c3Smrg	3				unused
60217ca54c3Smrg
60317ca54c3Smrg	0	FD			fence fd
60417ca54c3Smrg└───
60517ca54c3Smrg
60617ca54c3Smrg┌───
60717ca54c3Smrg    DRI3FDFromFence
60817ca54c3Smrg	1	CARD8			major opcode
60917ca54c3Smrg	1	5			DRI3 opcode
61017ca54c3Smrg	2	3			length
61117ca54c3Smrg	4	Drawable		drawable
61217ca54c3Smrg	4	Fence			fence
61317ca54c3Smrg61417ca54c3Smrg	1	1			Reply
61517ca54c3Smrg        1	1			nfd
61617ca54c3Smrg	2	CARD16			sequence number
61717ca54c3Smrg	4	0			reply length
61817ca54c3Smrg	24				unused
61917ca54c3Smrg
62017ca54c3Smrg	0	FD			fence fd
62117ca54c3Smrg└───
62217ca54c3Smrg
62317ca54c3Smrg┌───
62417ca54c3Smrg    DRI3GetSupportedModifiers
62517ca54c3Smrg	1	CARD8			major opcode
62617ca54c3Smrg	1	7			DRI3 opcode
62717ca54c3Smrg	2	3			length
62817ca54c3Smrg	4	Window			window
62917ca54c3Smrg	1	CARD8			depth
63017ca54c3Smrg	1	CARD8			bpp
63117ca54c3Smrg	2				unused
63217ca54c3Smrg63317ca54c3Smrg	1	1			Reply
63417ca54c3Smrg        1	0			unused
63517ca54c3Smrg	2	CARD16			sequence number
63617ca54c3Smrg	4	CARD32			reply length
63717ca54c3Smrg	4	CARD32			num_window_modifiers
63817ca54c3Smrg	4	CARD32			num_screen_modifiers
63917ca54c3Smrg	16				unused
64017ca54c3Smrg
64117ca54c3Smrg	4	ListOfCARD64		window_modifiers[num_window_modifiers]
64217ca54c3Smrg	4	ListOfCARD64		screen_modifiers[num_screen_modifiers]
64317ca54c3Smrg└───
64417ca54c3Smrg
64517ca54c3Smrg┌───
64617ca54c3Smrg    DRI3PixmapFromBuffers
64717ca54c3Smrg	1	CARD8			major opcode
64817ca54c3Smrg	1	8			DRI3 opcode
64917ca54c3Smrg	2	8			length
65017ca54c3Smrg	4	Pixmap			pixmap
65117ca54c3Smrg	4	Window			window
65217ca54c3Smrg	1	CARD8			num_buffers
65317ca54c3Smrg	3				unused
65417ca54c3Smrg	2	CARD16			width
65517ca54c3Smrg	2	CARD16			height
65617ca54c3Smrg	4	CARD32			stride0
65717ca54c3Smrg	4	CARD32			offset0
65817ca54c3Smrg	4	CARD32			stride1
65917ca54c3Smrg	4	CARD32			offset1
66017ca54c3Smrg	4	CARD32			stride2
66117ca54c3Smrg	4	CARD32			offset2
66217ca54c3Smrg	4	CARD32			stride3
66317ca54c3Smrg	4	CARD32			offset3
66417ca54c3Smrg	1	CARD8			depth
66517ca54c3Smrg	1	CARD8			bpp
66617ca54c3Smrg	2				unused
66717ca54c3Smrg	8	CARD64			modifier
66817ca54c3Smrg
66917ca54c3Smrg	0	ListOfFD		buffers[num_buffers]
67017ca54c3Smrg└───
67117ca54c3Smrg
67217ca54c3Smrg┌───
67317ca54c3Smrg    DRI3BuffersFromPixmap
67417ca54c3Smrg	1	CARD8			major opcode
67517ca54c3Smrg	1	9			DRI3 opcode
67617ca54c3Smrg	2	2			length
67717ca54c3Smrg	4	Pixmap			pixmap
67817ca54c3Smrg67917ca54c3Smrg	1	1			Reply
68017ca54c3Smrg        1	CARD8			nfd
68117ca54c3Smrg	2	CARD16			sequence number
68217ca54c3Smrg	4	CARD32			reply length
68317ca54c3Smrg	2	CARD16			width
68417ca54c3Smrg	2	CARD16			height
68517ca54c3Smrg	4	CARD8			unused
68617ca54c3Smrg	8	CARD64			modifier
68717ca54c3Smrg	1	CARD8			depth
68817ca54c3Smrg	1	CARD8			bpp
68917ca54c3Smrg	6				unused
69017ca54c3Smrg
69117ca54c3Smrg	0	ListOfFD		buffer[nfd]
69217ca54c3Smrg	4	ListOfCARD32		strides[nfd]
69317ca54c3Smrg	4	ListOfCARD32		offsets[nfd]
69417ca54c3Smrg└───
69517ca54c3Smrg
696452262e1Smrg┌───
697452262e1Smrg    DRI3SetDRMDeviceInUse
698452262e1Smrg	1	CARD8			major opcode
699452262e1Smrg	1	10			DRI3 opcode
700452262e1Smrg	2	4			length
701452262e1Smrg	4	Window			window
702452262e1Smrg	4	CARD32			drmMajor
703452262e1Smrg	4	CARD32			drmMinor
704452262e1Smrg└───
705452262e1Smrg
70617ca54c3SmrgA.3 Protocol Events
70717ca54c3Smrg
70817ca54c3SmrgThe DRI3 extension defines no events.
70917ca54c3Smrg
71017ca54c3SmrgA.4 Protocol Errors
71117ca54c3Smrg
71217ca54c3SmrgThe DRI3 extension defines no errors.
71317ca54c3Smrg
71417ca54c3Smrg			     ❄ ❄ ❄  ❄  ❄ ❄ ❄
715