[Mesa-dev] EXT_image_dma_buf_import FD ownership

Eric Anholt eric at anholt.net
Sat Oct 12 01:31:23 CEST 2013

John Sheu <sheu at google.com> writes:

> Hello folks:
> About the ownership of dmabuf file descriptors that are passed into EGL.
>  I'm looking in particular at this blurb from the spec:
>        * If <target> is EGL_LINUX_DMA_BUF_EXT and eglCreateImageKHR fails,
>          EGL does not retain ownership of the file descriptor and it is the
>          responsibility of the application to close it."
> My take on this is that this is different from most users of dmabuf, or
> even file descriptors in general.  For example, mmap() doesn't own the
> descriptor passed to it; and more specifically to dmabufs, neither does
> (say) DRM_IOCTL_PRIME_HANDLE_TO_FD, or any of the V4L2 entry points that
> support dmabuf (e.g. VIDIOC_QBUF).  They all increment the refcount on the
> descriptor, not own it.
> Since we're still iterating drafts on the EXT_image_dma_buf_import spec --
> I'd like to see the spec specify that EGL has the similar behavior of
> taking a reference, but not owning the descriptor.

It's still considered a draft?  I wasn't aware of this.  The file I have
of Version 5 says Status: Complete

I think it would be way more sane for the application to be always
responsible for closing its fd, and the GL had better reference any
resources it needs out of the fd before returning.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20131011/3a4f0135/attachment.pgp>

More information about the mesa-dev mailing list