Re: [PATCH v6 6/6] drm/i915/gvt: Adding interface so user space can get the dma-buf
From: Gerd Hoffmann
Date: Tue Jun 06 2017 - 03:35:36 EST
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