* [PATCH] drm: Take ownership of the dmabuf->obj when exporting
@ 2016-12-07 21:45 Chris Wilson
2016-12-07 23:15 ` ✓ Fi.CI.BAT: success for " Patchwork
2016-12-08 13:03 ` [Intel-gfx] [PATCH] " Joonas Lahtinen
0 siblings, 2 replies; 4+ messages in thread
From: Chris Wilson @ 2016-12-07 21:45 UTC (permalink / raw)
To: dri-devel; +Cc: intel-gfx
Currently the reference for the dmabuf->obj is incremented for the
dmabuf in drm_gem_prime_handle_to_fd() (at the high level userspace
interface), but is released in drm_gem_dmabuf_release() (the lowlevel
handler). Improve the symmetry of the dmabuf->obj ownership by acquiring
the reference in drm_gem_dmabuf_export(). This makes it easier to use
the prime functions directly.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
drivers/gpu/drm/drm_prime.c | 9 +++++----
drivers/gpu/drm/vgem/vgem_fence.c | 1 -
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
index b22a94dd7b53..5ef946d5a32d 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -300,8 +300,11 @@ struct dma_buf *drm_gem_dmabuf_export(struct drm_device *dev,
struct dma_buf *dma_buf;
dma_buf = dma_buf_export(exp_info);
- if (!IS_ERR(dma_buf))
- drm_dev_ref(dev);
+ if (IS_ERR(dma_buf))
+ return dma_buf;
+
+ drm_dev_ref(dev);
+ drm_gem_object_reference(exp_info->priv);
return dma_buf;
}
@@ -472,8 +475,6 @@ static struct dma_buf *export_and_register_object(struct drm_device *dev,
*/
obj->dma_buf = dmabuf;
get_dma_buf(obj->dma_buf);
- /* Grab a new ref since the callers is now used by the dma-buf */
- drm_gem_object_reference(obj);
return dmabuf;
}
diff --git a/drivers/gpu/drm/vgem/vgem_fence.c b/drivers/gpu/drm/vgem/vgem_fence.c
index 9cb00a5d5d08..da25dfe7b80e 100644
--- a/drivers/gpu/drm/vgem/vgem_fence.c
+++ b/drivers/gpu/drm/vgem/vgem_fence.c
@@ -126,7 +126,6 @@ static int attach_dmabuf(struct drm_device *dev,
return PTR_ERR(dmabuf);
obj->dma_buf = dmabuf;
- drm_gem_object_reference(obj);
return 0;
}
--
2.11.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* ✓ Fi.CI.BAT: success for drm: Take ownership of the dmabuf->obj when exporting
2016-12-07 21:45 [PATCH] drm: Take ownership of the dmabuf->obj when exporting Chris Wilson
@ 2016-12-07 23:15 ` Patchwork
2016-12-08 13:03 ` [Intel-gfx] [PATCH] " Joonas Lahtinen
1 sibling, 0 replies; 4+ messages in thread
From: Patchwork @ 2016-12-07 23:15 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx
== Series Details ==
Series: drm: Take ownership of the dmabuf->obj when exporting
URL : https://patchwork.freedesktop.org/series/16509/
State : success
== Summary ==
Series 16509v1 drm: Take ownership of the dmabuf->obj when exporting
https://patchwork.freedesktop.org/api/1.0/series/16509/revisions/1/mbox/
fi-bdw-5557u total:247 pass:219 dwarn:0 dfail:0 fail:0 skip:28
fi-bsw-n3050 total:247 pass:195 dwarn:0 dfail:0 fail:0 skip:52
fi-bxt-t5700 total:247 pass:206 dwarn:0 dfail:0 fail:0 skip:41
fi-byt-j1900 total:247 pass:206 dwarn:0 dfail:0 fail:0 skip:41
fi-byt-n2820 total:247 pass:202 dwarn:0 dfail:0 fail:0 skip:45
fi-hsw-4770 total:247 pass:214 dwarn:0 dfail:0 fail:0 skip:33
fi-hsw-4770r total:247 pass:214 dwarn:0 dfail:0 fail:0 skip:33
fi-ilk-650 total:247 pass:181 dwarn:0 dfail:0 fail:0 skip:66
fi-ivb-3520m total:247 pass:213 dwarn:0 dfail:0 fail:0 skip:34
fi-ivb-3770 total:247 pass:212 dwarn:0 dfail:0 fail:0 skip:35
fi-kbl-7500u total:247 pass:212 dwarn:0 dfail:0 fail:0 skip:35
fi-skl-6260u total:247 pass:220 dwarn:0 dfail:0 fail:0 skip:27
fi-skl-6700hq total:247 pass:214 dwarn:0 dfail:0 fail:0 skip:33
fi-skl-6700k total:247 pass:210 dwarn:3 dfail:0 fail:0 skip:34
fi-skl-6770hq total:247 pass:220 dwarn:0 dfail:0 fail:0 skip:27
fi-snb-2520m total:247 pass:202 dwarn:0 dfail:0 fail:0 skip:45
fi-snb-2600 total:247 pass:201 dwarn:0 dfail:0 fail:0 skip:46
ffcd96e45b3b3e4ca57d4879405d02b7b1b58946 drm-tip: 2016y-12m-07d-21h-45m-40s UTC integration manifest
e64145e4 drm: Take ownership of the dmabuf->obj when exporting
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3228/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Intel-gfx] [PATCH] drm: Take ownership of the dmabuf->obj when exporting
2016-12-07 21:45 [PATCH] drm: Take ownership of the dmabuf->obj when exporting Chris Wilson
2016-12-07 23:15 ` ✓ Fi.CI.BAT: success for " Patchwork
@ 2016-12-08 13:03 ` Joonas Lahtinen
2016-12-08 14:07 ` Daniel Vetter
1 sibling, 1 reply; 4+ messages in thread
From: Joonas Lahtinen @ 2016-12-08 13:03 UTC (permalink / raw)
To: Chris Wilson, dri-devel; +Cc: intel-gfx
On ke, 2016-12-07 at 21:45 +0000, Chris Wilson wrote:
> Currently the reference for the dmabuf->obj is incremented for the
> dmabuf in drm_gem_prime_handle_to_fd() (at the high level userspace
> interface), but is released in drm_gem_dmabuf_release() (the lowlevel
> handler). Improve the symmetry of the dmabuf->obj ownership by acquiring
> the reference in drm_gem_dmabuf_export(). This makes it easier to use
> the prime functions directly.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Regards, Joonas
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm: Take ownership of the dmabuf->obj when exporting
2016-12-08 13:03 ` [Intel-gfx] [PATCH] " Joonas Lahtinen
@ 2016-12-08 14:07 ` Daniel Vetter
0 siblings, 0 replies; 4+ messages in thread
From: Daniel Vetter @ 2016-12-08 14:07 UTC (permalink / raw)
To: Joonas Lahtinen; +Cc: intel-gfx, dri-devel
On Thu, Dec 08, 2016 at 03:03:29PM +0200, Joonas Lahtinen wrote:
> On ke, 2016-12-07 at 21:45 +0000, Chris Wilson wrote:
> > Currently the reference for the dmabuf->obj is incremented for the
> > dmabuf in drm_gem_prime_handle_to_fd() (at the high level userspace
> > interface), but is released in drm_gem_dmabuf_release() (the lowlevel
> > handler). Improve the symmetry of the dmabuf->obj ownership by acquiring
> > the reference in drm_gem_dmabuf_export(). This makes it easier to use
> > the prime functions directly.
> >
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
>
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Sorry forgot to reply here that I merged this, after some discussion with
Chris on irc to make sure the kerneldoc is updated.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-12-08 14:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-07 21:45 [PATCH] drm: Take ownership of the dmabuf->obj when exporting Chris Wilson
2016-12-07 23:15 ` ✓ Fi.CI.BAT: success for " Patchwork
2016-12-08 13:03 ` [Intel-gfx] [PATCH] " Joonas Lahtinen
2016-12-08 14:07 ` Daniel Vetter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox