[Intel-gfx] [PATCH v6 6/6] drm/i915/gvt: Adding interface so user space can get the dma-buf

Gerd Hoffmann kraxel at redhat.com
Tue Jun 6 07:35:28 UTC 2017


  Hi,

> > Why the ref count is one?  
> 
> The gem object is created by us while creating the dma-buf(the ref
> count of the gem object is initialized to 1).
> Later when user import the dma-buf the ref count of the gem object
> associate with the dma-buf will increased.

Creating the dma-buf should increase the gem object reference count
too.  So you should be able to unref the gem object after creating the
dma-buf.  That way the dma-buf is the only instance holding a reference
to the gem object, and when the dma-buf goes away (due to userspace
closing all file handles referring to it) the gem object will be
released too because the refcount goes down to zero then.

cheers,
  Gerd


More information about the Intel-gfx mailing list