expected userspace prime/dma-buf usage
rob.clark at linaro.org
Fri Mar 16 06:22:36 PDT 2012
On Fri, Mar 16, 2012 at 5:53 AM, Dave Airlie <airlied at gmail.com> wrote:
> Just wondering how we expect userspace to use dma-buf/prime interfaces.
> Currently I see one driver in sharing the buffer with handle->fd, then
> passing the fd to the other driver and it using fd->handle, do we then
> expect the importing driver to close the fd?
Importing driver should:
dbuf = dma_buf_get(fd);
... store the 'struct dma_buf *' for however long is needed.. this holds
a ref to the 'struct file' that backs the dma-buf.. and then when no
think of dma_buf_get()/dma_buf_put() as basically similar to
fget()/fput().. the fget() would either atomically succeed (if the
file descriptor was still valid) and increment the ref count, or fail.
The fput() would decrement the refcnt. The last fput() triggers
->release() (which then in turn decrements the ref count of the
original gem buffer object, etc).
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
More information about the dri-devel