public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel-/w4YWyX8dFk@public.gmane.org>
To: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Ben Skeggs <bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Daniel Vetter
	<daniel.vetter-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [Nouveau] [PATCH 2/5] drm/prime: Export more helpers for drivers
Date: Fri, 12 Jan 2018 09:56:03 +0100	[thread overview]
Message-ID: <20180112085603.GG13066@phenom.ffwll.local> (raw)
In-Reply-To: <20180111214420.26203-2-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On Thu, Jan 11, 2018 at 10:44:17PM +0100, Thierry Reding wrote:
> From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> 
> Export some more of the helpers in order to allow drivers to more fine-
> grainedly select which helpers to use. This gives drivers an easy way to
> reuse a lot of the code in the helpers while at the same time allowing
> them to provide their own implementation for other functions in struct
> dma_buf_ops.
> 
> Signed-off-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

Same request as with the amd one: Pls supply a bit of kerneldoc and maybe
polished intro section. Otherwise lgtm.
-Daniel

> ---
>  drivers/gpu/drm/drm_prime.c | 23 +++++++++++++----------
>  include/drm/drm_prime.h     | 12 ++++++++++++
>  2 files changed, 25 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
> index 9a17725b0f7a..f9903e6b59f6 100644
> --- a/drivers/gpu/drm/drm_prime.c
> +++ b/drivers/gpu/drm/drm_prime.c
> @@ -180,9 +180,8 @@ static int drm_prime_lookup_buf_handle(struct drm_prime_file_private *prime_fpri
>  	return -ENOENT;
>  }
>  
> -static int drm_gem_map_attach(struct dma_buf *dma_buf,
> -			      struct device *target_dev,
> -			      struct dma_buf_attachment *attach)
> +int drm_gem_map_attach(struct dma_buf *dma_buf, struct device *target_dev,
> +		       struct dma_buf_attachment *attach)
>  {
>  	struct drm_prime_attachment *prime_attach;
>  	struct drm_gem_object *obj = dma_buf->priv;
> @@ -200,9 +199,10 @@ static int drm_gem_map_attach(struct dma_buf *dma_buf,
>  
>  	return dev->driver->gem_prime_pin(obj);
>  }
> +EXPORT_SYMBOL(drm_gem_map_attach);
>  
> -static void drm_gem_map_detach(struct dma_buf *dma_buf,
> -			       struct dma_buf_attachment *attach)
> +void drm_gem_map_detach(struct dma_buf *dma_buf,
> +			struct dma_buf_attachment *attach)
>  {
>  	struct drm_prime_attachment *prime_attach = attach->priv;
>  	struct drm_gem_object *obj = dma_buf->priv;
> @@ -228,6 +228,7 @@ static void drm_gem_map_detach(struct dma_buf *dma_buf,
>  	kfree(prime_attach);
>  	attach->priv = NULL;
>  }
> +EXPORT_SYMBOL(drm_gem_map_detach);
>  
>  void drm_prime_remove_buf_handle_locked(struct drm_prime_file_private *prime_fpriv,
>  					struct dma_buf *dma_buf)
> @@ -254,8 +255,8 @@ void drm_prime_remove_buf_handle_locked(struct drm_prime_file_private *prime_fpr
>  	}
>  }
>  
> -static struct sg_table *drm_gem_map_dma_buf(struct dma_buf_attachment *attach,
> -					    enum dma_data_direction dir)
> +struct sg_table *drm_gem_map_dma_buf(struct dma_buf_attachment *attach,
> +				     enum dma_data_direction dir)
>  {
>  	struct drm_prime_attachment *prime_attach = attach->priv;
>  	struct drm_gem_object *obj = attach->dmabuf->priv;
> @@ -291,13 +292,15 @@ static struct sg_table *drm_gem_map_dma_buf(struct dma_buf_attachment *attach,
>  
>  	return sgt;
>  }
> +EXPORT_SYMBOL(drm_gem_map_dma_buf);
>  
> -static void drm_gem_unmap_dma_buf(struct dma_buf_attachment *attach,
> -				  struct sg_table *sgt,
> -				  enum dma_data_direction dir)
> +void drm_gem_unmap_dma_buf(struct dma_buf_attachment *attach,
> +			   struct sg_table *sgt,
> +			   enum dma_data_direction dir)
>  {
>  	/* nothing to be done here */
>  }
> +EXPORT_SYMBOL(drm_gem_unmap_dma_buf);
>  
>  /**
>   * drm_gem_dmabuf_export - dma_buf export implementation for GEM
> diff --git a/include/drm/drm_prime.h b/include/drm/drm_prime.h
> index 59ccab402e85..3a9706815773 100644
> --- a/include/drm/drm_prime.h
> +++ b/include/drm/drm_prime.h
> @@ -50,8 +50,10 @@ struct drm_prime_file_private {
>  	struct rb_root handles;
>  };
>  
> +enum dma_data_direction;
>  struct device;
>  
> +struct dma_buf_attachment;
>  struct dma_buf_export_info;
>  struct dma_buf;
>  
> @@ -59,6 +61,16 @@ struct drm_device;
>  struct drm_gem_object;
>  struct drm_file;
>  
> +int drm_gem_map_attach(struct dma_buf *dma_buf, struct device *target_dev,
> +		       struct dma_buf_attachment *attach);
> +void drm_gem_map_detach(struct dma_buf *dma_buf,
> +			struct dma_buf_attachment *attach);
> +struct sg_table *drm_gem_map_dma_buf(struct dma_buf_attachment *attach,
> +				     enum dma_data_direction dir);
> +void drm_gem_unmap_dma_buf(struct dma_buf_attachment *attach,
> +			   struct sg_table *sgt,
> +			   enum dma_data_direction dir);
> +
>  struct dma_buf *drm_gem_prime_export(struct drm_device *dev,
>  				     struct drm_gem_object *obj,
>  				     int flags);
> -- 
> 2.15.1
> 
> _______________________________________________
> Nouveau mailing list
> Nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
> https://lists.freedesktop.org/mailman/listinfo/nouveau

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

  parent reply	other threads:[~2018-01-12  8:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-11 21:44 [PATCH 1/5] drm/prime: Remove duplicate forward declaration Thierry Reding
     [not found] ` <20180111214420.26203-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-01-11 21:44   ` [PATCH 2/5] drm/prime: Export more helpers for drivers Thierry Reding
     [not found]     ` <20180111214420.26203-2-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-01-12  8:56       ` Daniel Vetter [this message]
2018-01-11 21:44   ` [PATCH 3/5] drm/nouveau: Provide custom struct dma_buf_ops Thierry Reding
2018-01-11 21:44   ` [PATCH 4/5] drm/nouveau: prime: Implement mmap() Thierry Reding
2018-01-11 21:44   ` [PATCH 5/5] drm/nouveau: prime: Implement cache maintenance Thierry Reding

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=20180112085603.GG13066@phenom.ffwll.local \
    --to=daniel-/w4ywyx8dfk@public.gmane.org \
    --cc=bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=daniel.vetter-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox