Messages in this thread | | | Subject | Re: [PATCH v6 6/6] drm/i915/gvt: Adding interface so user space can get the dma-buf | From | Gerd Hoffmann <> | Date | Tue, 06 Jun 2017 09:35:28 +0200 |
| |
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
| |