3
MESA_image_dma_buf_export
7
EGL_MESA_image_dma_buf_export
15
Dave Airlie (airlied 'at' redhat 'dot' com)
23
Version 3, May 5, 2015
31
Requires EGL 1.4 or later. This extension is written against the
32
wording of the EGL 1.4 specification.
34
EGL_KHR_base_image is required.
36
The EGL implementation must be running on a Linux kernel supporting the
37
dma_buf buffer sharing mechanism.
41
This extension provides entry points for integrating EGLImage with the
42
dma-buf infrastructure. The extension allows creating a Linux dma_buf
43
file descriptor or multiple file descriptors, in the case of multi-plane
44
YUV image, from an EGLImage.
46
It is designed to provide the complementary functionality to
47
EGL_EXT_image_dma_buf_import.
51
Open-source; freely implementable.
55
This extension uses the 64-bit unsigned integer type EGLuint64KHR
56
first introduced by the EGL_KHR_stream extension, but does not
57
depend on that extension. The typedef may be reproduced separately
58
for this extension, if not already present in eglext.h.
60
typedef khronos_uint64_t EGLuint64KHR;
62
New Procedures and Functions
64
EGLBoolean eglExportDMABUFImageQueryMESA(EGLDisplay dpy,
68
EGLuint64KHR *modifiers);
70
EGLBoolean eglExportDMABUFImageMESA(EGLDisplay dpy,
81
Additions to the EGL 1.4 Specification:
83
To mirror the import extension, this extension attempts to return
84
enough information to enable an exported dma-buf to be imported
85
via eglCreateImageKHR and EGL_LINUX_DMA_BUF_EXT token.
87
Retrieving the information is a two step process, so two APIs
91
EGLBoolean eglExportDMABUFImageQueryMESA(EGLDisplay dpy,
95
EGLuint64KHR *modifiers);
97
is used to retrieve the pixel format of the buffer, as specified by
98
drm_fourcc.h, the number of planes in the image and the Linux
99
drm modifiers. <fourcc>, <num_planes> and <modifiers> may be NULL,
100
in which case no value is retrieved.
102
The second entrypoint retrieves the dma_buf file descriptors,
103
strides and offsets for the image. The caller should pass
104
arrays sized according to the num_planes values retrieved previously.
105
Passing arrays of the wrong size will have undefined results.
106
If the number of fds is less than the number of planes, then
107
subsequent fd slots should contain -1.
109
EGLBoolean eglExportDMABUFImageMESA(EGLDisplay dpy,
115
<fds>, <strides>, <offsets> can be NULL if the infomatation isn't
116
required by the caller.
120
1. Should the API look more like an attribute getting API?
122
ANSWER: No, from a user interface pov, having to iterate across calling
123
the API up to 12 times using attribs seems like the wrong solution.
125
2. Should the API take a plane and just get the fd/stride/offset for that
128
ANSWER: UNKNOWN,this might be just as valid an API.
130
3. Does ownership of the file descriptor remain with the app?
132
ANSWER: Yes, the app is responsible for closing any fds retrieved.
134
4. If number of planes and number of fds differ what should we do?
136
ANSWER: Return -1 for the secondary slots, as this avoids having
137
to dup the fd extra times to make the interface sane.
142
Just use the KHR 64-bit type.
143
Version 2, March, 2015
144
Add a query interface (Dave Airlie)
145
Version 1, June 3, 2014
146
Initial draft (Dave Airlie)