Re: expected userspace prime/dma-buf usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 16, 2012 at 5:53 AM, Dave Airlie <airlied@xxxxxxxxx> 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
      longer needed:
  dma_buf_put(dbuf);

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).

BR,
-R

> Dave.
> _______________________________________________
> dri-devel mailing list
> dri-devel@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux