On 01/26/2017 12:45 PM, Chris Wilson wrote:
On Thu, Jan 26, 2017 at 11:36:05AM +0100, Daniel Vetter wrote:
On Thu, Jan 26, 2017 at 09:22:46AM +0200, Oleksandr Andrushchenko wrote:
From: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
From the description of the "DMA-BUF/GEM Object references
and lifetime overview" it is not clear when exactly
dma_buf gets destroyed and memory freed: only driver
.release function mentioned which makes confusion on the
real buffer's lifetime.
Add more description so all the paths are covered.
Cc: Rob Clark <robdclark@xxxxxxxxx>
Cc: Dave Airlie <airlied@xxxxxxxx>
Cc: Daniel Vetter <daniel.vetter@xxxxxxxx>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
---
drivers/gpu/drm/drm_prime.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
index 8d77b2462594..c061a0b29819 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -41,7 +41,7 @@
* object. It takes this reference in handle_to_fd_ioctl, when it
* first calls .prime_export and stores the exporting GEM object in
* the dma_buf priv. This reference is released when the dma_buf
- * object goes away in the driver .release function.
+ * object goes away.
This was meant to talke about the release function of the dma-buf file,
not the drm_driver. Note that not all drivers use the same _release
function, e.g. vmwgfx is ttm-based, not gem and hence can't use
drm_gem_dmabuf_release().
Maybe let's rewrite the entire sentence:
"This refernce needs to be released when the final reference to the
&dma_buf itself is dropped and its &dma_buf_ops.release function is
called. For GEM-based drivers this is done by using
drm_gem_dmabuf_release()."
For GEM-based drivers, the dmabuf should be exported using
drm_gem_dmabuf_export() and then released by drm_gem_dmabuf_release().
Will use this in v1
Just the emphasize the symmetry (because of the internal magics)?
-Chris
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel