From: Daniel Vetter <daniel@ffwll.ch>
To: Maarten Lankhorst <m.b.lankhorst@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/7] drm: add unpin function to prime helpers
Date: Tue, 9 Apr 2013 15:01:09 +0200 [thread overview]
Message-ID: <20130409130109.GY2228@phenom.ffwll.local> (raw)
In-Reply-To: <1365507466-11586-1-git-send-email-maarten.lankhorst@canonical.com>
On Tue, Apr 09, 2013 at 01:37:40PM +0200, Maarten Lankhorst wrote:
> Prevents buffers from being pinned forever.
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Did I mention in my review of Aaron's patch that is feels a bit inflexible
to move the dma_buf vtable to here and has a midlayer touch to it? Looks
like we fix this by adding an vtable which pretty much just forwards the
dma-buf calls 1:1 ;-)
Whatever, i915.ko does use this, so patches 1-2 are
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
The others are acked on principle, but I'm too lazy to dig into that
driver code to do a real review.
-Daniel
> ---
> drivers/gpu/drm/drm_prime.c | 13 +++++++++++--
> include/drm/drmP.h | 1 +
> 2 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
> index 366910d..85bbc52 100644
> --- a/drivers/gpu/drm/drm_prime.c
> +++ b/drivers/gpu/drm/drm_prime.c
> @@ -91,10 +91,13 @@ static void drm_gem_unmap_dma_buf(struct dma_buf_attachment *attach,
> static void drm_gem_dmabuf_release(struct dma_buf *dma_buf)
> {
> struct drm_gem_object *obj = dma_buf->priv;
> + struct drm_device *dev = obj->dev;
>
> if (obj->export_dma_buf == dma_buf) {
> /* drop the reference on the export fd holds */
> obj->export_dma_buf = NULL;
> + if (dev->driver->gem_prime_unpin)
> + dev->driver->gem_prime_unpin(obj);
> drm_gem_object_unreference_unlocked(obj);
> }
> }
> @@ -184,13 +187,19 @@ static const struct dma_buf_ops drm_gem_prime_dmabuf_ops = {
> struct dma_buf *drm_gem_prime_export(struct drm_device *dev,
> struct drm_gem_object *obj, int flags)
> {
> + struct dma_buf *buf;
> +
> if (dev->driver->gem_prime_pin) {
> int ret = dev->driver->gem_prime_pin(obj);
> if (ret)
> return ERR_PTR(ret);
> }
> - return dma_buf_export(obj, &drm_gem_prime_dmabuf_ops, obj->size,
> - 0600);
> + buf = dma_buf_export(obj, &drm_gem_prime_dmabuf_ops, obj->size,
> + 0600);
> +
> + if (IS_ERR(buf) && dev->driver->gem_prime_unpin)
> + dev->driver->gem_prime_unpin(obj);
> + return buf;
> }
> EXPORT_SYMBOL(drm_gem_prime_export);
>
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index 2d94d74..99dc622 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -932,6 +932,7 @@ struct drm_driver {
> struct dma_buf *dma_buf);
> /* low-level interface used by drm_gem_prime_{import,export} */
> int (*gem_prime_pin)(struct drm_gem_object *obj);
> + void (*gem_prime_unpin)(struct drm_gem_object *obj);
> struct sg_table *(*gem_prime_get_sg_table)(struct drm_gem_object *obj);
> struct drm_gem_object *(*gem_prime_import_sg_table)(
> struct drm_device *dev, size_t size,
> --
> 1.8.2
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
next prev parent reply other threads:[~2013-04-09 12:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-09 11:37 [PATCH 1/7] drm: add unpin function to prime helpers Maarten Lankhorst
2013-04-09 11:37 ` [PATCH 2/7] drm: move pinning/unpinning to buffer attach Maarten Lankhorst
2013-04-09 11:37 ` [PATCH 3/7] drm/radeon: implement unpin function Maarten Lankhorst
2013-04-09 14:16 ` Jerome Glisse
2013-04-09 14:26 ` Maarten Lankhorst
2013-04-09 14:53 ` Daniel Vetter
2013-04-09 11:37 ` [PATCH 4/7] drm/nouveau: implement prime helper " Maarten Lankhorst
2013-04-09 11:37 ` [PATCH 5/7] drm/nouveau: unpin notify object in chan_fini Maarten Lankhorst
2013-04-09 11:37 ` [PATCH 6/7] drm/nouveau: fixup fbcon failure paths Maarten Lankhorst
2013-04-09 11:37 ` [PATCH 7/7] drm/nouveau: complain loudly if buffer is pinned during destruction Maarten Lankhorst
2013-04-09 13:01 ` Daniel Vetter [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-05-01 8:52 [PATCH 1/7] drm: add unpin function to prime helpers Maarten Lankhorst
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130409130109.GY2228@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=m.b.lankhorst@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.