diff options
author | Keith Packard <keithp@keithp.com> | 2017-12-13 15:12:25 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2017-12-13 15:12:25 -0800 |
commit | d27cc19b84dd8db6f6b2e25227faef1ba3b6724f (patch) | |
tree | 717bde1cd0792b5e8d078fd387e398048889f7f2 | |
parent | 59dd66484784ac7ec69950c7a0ac10c40321660a (diff) | |
parent | 3937f72040b79c7245b261da880364177cc40a6e (diff) |
Merge dri3proto
-rw-r--r-- | .gitignore | 78 | ||||
-rw-r--r-- | COPYING | 19 | ||||
-rw-r--r-- | Makefile.am | 19 | ||||
-rw-r--r-- | README | 31 | ||||
-rwxr-xr-x | autogen.sh | 17 | ||||
-rw-r--r-- | configure.ac | 13 | ||||
-rw-r--r-- | dri3proto.h | 167 | ||||
-rw-r--r-- | dri3proto.pc.in | 9 | ||||
-rw-r--r-- | dri3proto.txt | 378 |
9 files changed, 731 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2f471ac --- /dev/null +++ b/.gitignore @@ -0,0 +1,78 @@ +# +# 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 +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 +*~ +*.[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 dri3proto +# +# Edit the following section as needed +# For example, !report.pc overrides *.pc. See 'man gitignore' +# @@ -0,0 +1,19 @@ +Copyright © 2013 Keith Packard + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that copyright +notice and this permission notice appear in supporting documentation, and +that the name of the copyright holders not be used in advertising or +publicity pertaining to distribution of the software without specific, +written prior permission. The copyright holders make no representations +about the suitability of this software for any purpose. It is provided "as +is" without express or implied warranty. + +THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +OF THIS SOFTWARE. diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..7a85bf1 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,19 @@ +dri3dir = $(includedir)/X11/extensions +dri3_HEADERS = dri3proto.h + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = dri3proto.pc + +dist_doc_DATA = dri3proto.txt + +MAINTAINERCLEANFILES = ChangeLog INSTALL + +.PHONY: ChangeLog INSTALL + +INSTALL: + $(INSTALL_CMD) + +ChangeLog: + $(CHANGELOG_CMD) + +dist-hook: ChangeLog INSTALL @@ -0,0 +1,31 @@ + Direct Rendering Infrastructure 3 Extension + +The DRI3 extension provides mechanisms to translate between direct +rendered buffers and X pixmaps. When combined with the Present extension, +a complete direct rendering solution for OpenGL is provided. + +Extension name: DRI3 + +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/dri3proto + + http://cgit.freedesktop.org/xorg/proto/dri3proto + +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 + diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..7abdaac --- /dev/null +++ b/autogen.sh @@ -0,0 +1,17 @@ +#! /bin/sh + +srcdir=`dirname "$0"` +test -z "$srcdir" && srcdir=. + +ORIGDIR=`pwd` +cd "$srcdir" + +autoreconf -v --install || exit 1 +cd "$ORIGDIR" || exit $? + +git config --local --get format.subjectPrefix >/dev/null 2>&1 || + git config --local format.subjectPrefix "PATCH dri3proto" + +if test -z "$NOCONFIGURE"; then + exec "$srcdir"/configure "$@" +fi diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..d7abd0a --- /dev/null +++ b/configure.ac @@ -0,0 +1,13 @@ +AC_PREREQ([2.60]) +AC_INIT([DRI3Proto], [1.0], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg]) +AM_INIT_AUTOMAKE([foreign dist-bzip2]) + +# 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_CONFIG_FILES([Makefile + dri3proto.pc]) +AC_OUTPUT diff --git a/dri3proto.h b/dri3proto.h new file mode 100644 index 0000000..ceddee8 --- /dev/null +++ b/dri3proto.h @@ -0,0 +1,167 @@ +/* + * Copyright © 2013 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#ifndef _DRI3_PROTO_H_ +#define _DRI3_PROTO_H_ + +#define DRI3_NAME "DRI3" +#define DRI3_MAJOR 1 +#define DRI3_MINOR 0 + +#define DRI3NumberErrors 0 +#define DRI3NumberEvents 0 + +#define X_DRI3QueryVersion 0 +#define X_DRI3Open 1 +#define X_DRI3PixmapFromBuffer 2 +#define X_DRI3BufferFromPixmap 3 +#define X_DRI3FenceFromFD 4 +#define X_DRI3FDFromFence 5 + +#define DRI3NumberRequests 6 + +typedef struct { + CARD8 reqType; + CARD8 dri3ReqType; + CARD16 length B16; + CARD32 majorVersion B32; + CARD32 minorVersion B32; +} xDRI3QueryVersionReq; +#define sz_xDRI3QueryVersionReq 12 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE pad1; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 majorVersion B32; + CARD32 minorVersion B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; +} xDRI3QueryVersionReply; +#define sz_xDRI3QueryVersionReply 32 + +typedef struct { + CARD8 reqType; + CARD8 dri3ReqType; + CARD16 length B16; + CARD32 drawable B32; + CARD32 provider B32; +} xDRI3OpenReq; +#define sz_xDRI3OpenReq 12 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 nfd; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; + CARD32 pad7 B32; +} xDRI3OpenReply; +#define sz_xDRI3OpenReply 32 + +typedef struct { + CARD8 reqType; + CARD8 dri3ReqType; + CARD16 length B16; + CARD32 pixmap B32; + CARD32 drawable B32; + CARD32 size B32; + CARD16 width B16; + CARD16 height B16; + CARD16 stride B16; + CARD8 depth; + CARD8 bpp; +} xDRI3PixmapFromBufferReq; + +#define sz_xDRI3PixmapFromBufferReq 24 + +typedef struct { + CARD8 reqType; + CARD8 dri3ReqType; + CARD16 length B16; + CARD32 pixmap B32; +} xDRI3BufferFromPixmapReq; +#define sz_xDRI3BufferFromPixmapReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 nfd; /* Number of file descriptors returned (1) */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 size B32; + CARD16 width B16; + CARD16 height B16; + CARD16 stride B16; + CARD8 depth; + CARD8 bpp; + CARD32 pad20 B32; + CARD32 pad24 B32; + CARD32 pad28 B32; +} xDRI3BufferFromPixmapReply; +#define sz_xDRI3BufferFromPixmapReply 32 + +typedef struct { + CARD8 reqType; + CARD8 dri3ReqType; + CARD16 length B16; + CARD32 drawable B32; + CARD32 fence B32; + BOOL initially_triggered; + CARD8 pad13; + CARD16 pad14 B16; +} xDRI3FenceFromFDReq; + +#define sz_xDRI3FenceFromFDReq 16 + +typedef struct { + CARD8 reqType; + CARD8 dri3ReqType; + CARD16 length B16; + CARD32 drawable B32; + CARD32 fence B32; +} xDRI3FDFromFenceReq; + +#define sz_xDRI3FDFromFenceReq 12 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 nfd; /* Number of file descriptors returned (1) */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 pad08 B32; + CARD32 pad12 B32; + CARD32 pad16 B32; + CARD32 pad20 B32; + CARD32 pad24 B32; + CARD32 pad28 B32; +} xDRI3FDFromFenceReply; + +#define sz_xDRI3FDFromFenceReply 32 + +#endif diff --git a/dri3proto.pc.in b/dri3proto.pc.in new file mode 100644 index 0000000..be8c7c6 --- /dev/null +++ b/dri3proto.pc.in @@ -0,0 +1,9 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: DRI3Proto +Description: DRI3 extension headers +Version: @PACKAGE_VERSION@ +Cflags: -I${includedir} diff --git a/dri3proto.txt b/dri3proto.txt new file mode 100644 index 0000000..dac11d3 --- /dev/null +++ b/dri3proto.txt @@ -0,0 +1,378 @@ + The DRI3 Extension + Version 1.0 + 2013-6-4 + + Keith Packard + keithp@keithp.com + Intel Corporation + +1. Introduction + +The DRI3 extension provides mechanisms to translate between direct +rendered buffers and X pixmaps. When combined with the Present extension, +a complete direct rendering solution for OpenGL is provided. + +The direct rendered buffers are passed across the protocol via +standard POSIX file descriptor passing mechanisms. On Linux, these +buffers are DMA-BUF objects. + +DRI3 also includes a mechanism to translate between Linux Futexes +and X Sync extension Fences. This provides a synchronization mechanism +which can be used to serialize access to shared render buffers. + +1.1. Acknowledgments + +Eric Anholt <eric@anholt.net> +Dave Airlie <airlied@redhat.com> +Kristian Høgsberg <krh@bitplanet.net> +James Jones <janomes@nvidia.com> +Arthur Huillet <arthur.huillet@free.fr> + + ❄ ❄ ❄ ❄ ❄ ❄ ❄ + +2. Data Types + +The DRI3 extension uses the RandR extension Provider data type to +select among multiple GPUs on a single screen and the Sync extension +fence object to provide graphics object synchronization. + + ❄ ❄ ❄ ❄ ❄ ❄ ❄ + +4. Errors + +DRI3 defines no errors. + + ❄ ❄ ❄ ❄ ❄ ❄ ❄ + +5. Events + +DRI3 defines no events. + + ❄ ❄ ❄ ❄ ❄ ❄ ❄ + +6. Protocol Types + +DRI3 defines no new protocol types. + + ❄ ❄ ❄ ❄ ❄ ❄ ❄ + +7. Extension Initialization + +The name of this extension is "DRI3" + +┌─── + DRI3QueryVersion + client-major-version: CARD32 + client-minor-version: CARD32 + ▶ + major-version: CARD32 + minor-version: CARD32 +└─── + + The client sends the highest supported version to the server + and the server sends the highest version it supports, but no + higher than the requested version. Major versions changes can + introduce incompatibilities in existing functionality, minor + version changes introduce only backward compatible changes. + It is the clients responsibility to ensure that the server + supports a version which is compatible with its expectations. + + Backwards compatible changes included addition of new + requests. + + + ❄ ❄ ❄ ❄ ❄ ❄ ❄ + +8. Extension Requests + +┌─── + DRI3Open + drawable: DRAWABLE + provider: PROVIDER + ▶ + nfd: CARD8 + device: FD +└─── + Errors: Drawable, Value, Match + + This requests that the X server open the direct rendering + device associated with drawable and RandR provider. The + provider must support SourceOutput or SourceOffload. + + The file descriptor for the device is returned in + 'device'. 'nfd' will be set to one (this is strictly a + convenience for XCB which otherwise would need + request-specific information about how many file descriptors + were associated with this reply). + +┌─── + DRI3PixmapFromBuffer + pixmap: PIXMAP + drawable: DRAWABLE + size: CARD32 + width, height, stride: CARD16 + depth, bpp: CARD8 + buffer: FD +└─── + Errors: Alloc, Drawable, IDChoice, Value, Match + + Creates a pixmap for the direct rendering object associated + with 'buffer'. Changes to pixmap will be visible in that + direct rendered object and changes to the direct rendered + object will be visible in the pixmap. + + 'size' specifies the total size of the buffer bytes. 'width', + 'height' describe the geometry (in pixels) of the underlying + buffer. 'stride' specifies the number of bytes per scanline in + the buffer. The pixels within the buffer are not required to + be arranged in a simple linear fashion, but 'size' will be at + least 'height' * 'stride'. + + Precisely how any additional information about the buffer is + shared is outside the scope of this extension. + + If buffer cannot be used with the screen associated with + drawable, a Match error is returned. + + If depth or bpp are not supported by the screen, a Value error + is returned. + +┌─── + DRI3BufferFromPixmap + pixmap: PIXMAP + ▶ + nfd: CARD8 + size: CARD32 + width, height, stride: CARD16 + depth, bpp: CARD8 + buffer: FD +└─── + Errors: Pixmap, Match + + Pass back a direct rendering object associated with + pixmap. Changes to pixmap will be visible in that + direct rendered object and changes to the direct rendered + object will be visible in the pixmap. + + 'size' specifies the total size of the buffer bytes. 'width', + 'height' describe the geometry (in pixels) of the underlying + buffer. 'stride' specifies the number of bytes per scanline in + the buffer. The pixels within the buffer are not required to + be arranged in a simple linear fashion, but 'size' will be at + least 'height' * 'stride'. + + Precisely how any additional information about the buffer is + shared is outside the scope of this extension. + + If buffer cannot be used with the screen associated with + drawable, a Match error is returned. + +┌─── + DRI3FenceFromFD + drawable: DRAWABLE + fence: FENCE + initially-triggered: BOOL + fd: FD +└─── + Errors: IDchoice, Drawable + + Creates a Sync extension Fence that provides the regular Sync + extension semantics along with a file descriptor that provides + a device-specific mechanism to manipulate the fence directly. + Details about the mechanism used with this file descriptor are + outside the scope of the DRI3 extension. + +┌─── + DRI3FDFromFence + drawable: DRAWABLE + fence: FENCE + ▶ + fd: FD +└─── + Errors: IDchoice, Drawable, Match + + Given a Sync extension Fence that provides the regular Sync + extension semantics, returns a file descriptor that provides a + device-specific mechanism to manipulate the fence directly. + Details about the mechanism used with this file descriptor are + outside the scope of the DRI3 extension. 'drawable' must be + associated with a direct rendering device that 'fence' can + work with, otherwise a Match error results. + + + ❄ ❄ ❄ ❄ ❄ ❄ ❄ + +9. Extension Events + +DRI3 defines no events. + + ❄ ❄ ❄ ❄ ❄ ❄ ❄ + +10. Extension Versioning + +The DRI3 extension is adapted from the DRI2 extension. + + 1.0: First published version + + ❄ ❄ ❄ ❄ ❄ ❄ ❄ + + +11. Relationship with other extensions + +As an extension designed to support other extensions, there is +naturally some interactions with other extensions. + +11.1 GLX + +GLX is both an application interface and an X extension. OpenGL +applications using the GLX API will use the GLX extension, DRI3 and +Present when doing direct rendering. + +11.2 Present + +The Present extension provides a way to synchronize the display of pixmap +contents to the screen. When used in conjunction with DRI3, they +provide a complete direct rendering solution for OpenGL or other APIs. + +11.3 DRI2 + +DRI3 provides similar functionality to the DRI2Connect and +DRI2GetBuffersWithFormat requests, however DRI3 uses file descriptors +to refer to the direct rendering device and buffers. + +Present and DRI3 are designed in conjunction to replace DRI2 + +11.2 XvMC / Xv + +It might be nice to be able to reference YUV formatted direct rendered +objects from the X server. + + ❄ ❄ ❄ ❄ ❄ ❄ ❄ + +Appendix A. Protocol Encoding + +Syntactic Conventions + +This document uses the same syntactic conventions as the core X +protocol encoding document. + + +A.1 Common Types + +None. + +A.2 Protocol Requests + +┌─── + DRI3QueryVersion + 1 CARD8 major opcode + 1 0 DRI3 opcode + 2 3 length + 4 CARD32 major version + 4 CARD32 minor version + ▶ + 1 1 Reply + 1 unused + 2 CARD16 sequence number + 4 0 reply length + 4 CARD32 major version + 4 CARD32 minor version + 16 unused +└─── + + +┌─── + DRI3Open + 1 CARD8 major opcode + 1 1 DRI3 opcode + 2 4 length + 4 DRAWABLE drawable + 4 PROVIDER provider + ▶ + 1 1 Reply + 1 1 nfd + 2 CARD16 sequence number + 4 0 reply length + 24 unused + + 0 FD device +└─── + +┌─── + DRI3PixmapFromBuffer + 1 CARD8 major opcode + 1 2 DRI3 opcode + 2 6 length + 4 Pixmap pixmap + 4 Drawable drawable + 4 CARD32 size + 2 CARD16 width + 2 CARD16 height + 2 CARD16 stride + 1 CARD8 depth + 1 CARD8 bpp + + 0 FD buffer +└─── + +┌─── + DRI3BufferFromPixmap + 1 CARD8 major opcode + 1 3 DRI3 opcode + 2 2 length + 4 Pixmap pixmap + ▶ + 1 1 Reply + 1 1 nfd + 2 CARD16 sequence number + 4 0 reply length + 4 CARD32 size + 2 CARD16 width + 2 CARD16 height + 2 CARD16 stride + 1 CARD8 depth + 1 CARD8 bpp + 12 unused + + 0 FD buffer +└─── + +┌─── + DRI3FenceFromFD + 1 CARD8 major opcode + 1 4 DRI3 opcode + 2 4 length + 4 Drawable drawable + 4 Fence fence + 1 BOOL initially triggered + 3 unused + + 0 FD fence fd +└─── + +┌─── + DRI3FDFromFence + 1 CARD8 major opcode + 1 5 DRI3 opcode + 2 3 length + 4 Drawable drawable + 4 Fence fence + ▶ + 1 1 Reply + 1 1 nfd + 2 CARD16 sequence number + 4 0 reply length + 24 unused + + 0 FD fence fd +└─── + +A.3 Protocol Events + +The DRI3 extension defines no events. + +A.4 Protocol Errors + +The DRI3 extension defines no errors. + + ❄ ❄ ❄ ❄ ❄ ❄ ❄ |