dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse
@ 2018-01-04 21:12 Samuel Li
  2018-01-05  9:16 ` Christian König
  0 siblings, 1 reply; 8+ messages in thread
From: Samuel Li @ 2018-01-04 21:12 UTC (permalink / raw)
  To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Samuel Li

Change-Id: I03c22a890d2305f3243d88019d1a28bddd4ddda7
Signed-off-by: Samuel Li <Samuel.Li@amd.com>
---
 drivers/gpu/drm/drm_prime.c | 53 ++++++++++++++++++++++++++-------------------
 include/drm/drm_prime.h     | 22 +++++++++++++++++++
 2 files changed, 53 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
index 8de93a2..68a69e9 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;
@@ -227,6 +227,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)
@@ -253,8 +254,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;
@@ -289,13 +290,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
@@ -346,47 +349,52 @@ void drm_gem_dmabuf_release(struct dma_buf *dma_buf)
 }
 EXPORT_SYMBOL(drm_gem_dmabuf_release);
 
-static void *drm_gem_dmabuf_vmap(struct dma_buf *dma_buf)
+void *drm_gem_dmabuf_vmap(struct dma_buf *dma_buf)
 {
 	struct drm_gem_object *obj = dma_buf->priv;
 	struct drm_device *dev = obj->dev;
 
 	return dev->driver->gem_prime_vmap(obj);
 }
+EXPORT_SYMBOL(drm_gem_dmabuf_vmap);
 
-static void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void *vaddr)
+void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void *vaddr)
 {
 	struct drm_gem_object *obj = dma_buf->priv;
 	struct drm_device *dev = obj->dev;
 
 	dev->driver->gem_prime_vunmap(obj, vaddr);
 }
+EXPORT_SYMBOL(drm_gem_dmabuf_vunmap);
 
-static void *drm_gem_dmabuf_kmap_atomic(struct dma_buf *dma_buf,
-					unsigned long page_num)
+void *drm_gem_dmabuf_kmap_atomic(struct dma_buf *dma_buf,
+				 unsigned long page_num)
 {
 	return NULL;
 }
+EXPORT_SYMBOL(drm_gem_dmabuf_kmap_atomic);
 
-static void drm_gem_dmabuf_kunmap_atomic(struct dma_buf *dma_buf,
-					 unsigned long page_num, void *addr)
+void drm_gem_dmabuf_kunmap_atomic(struct dma_buf *dma_buf,
+				  unsigned long page_num, void *addr)
 {
 
 }
-static void *drm_gem_dmabuf_kmap(struct dma_buf *dma_buf,
-				 unsigned long page_num)
+EXPORT_SYMBOL(drm_gem_dmabuf_kunmap_atomic);
+
+void *drm_gem_dmabuf_kmap(struct dma_buf *dma_buf, unsigned long page_num)
 {
 	return NULL;
 }
+EXPORT_SYMBOL(drm_gem_dmabuf_kmap);
 
-static void drm_gem_dmabuf_kunmap(struct dma_buf *dma_buf,
-				  unsigned long page_num, void *addr)
+void drm_gem_dmabuf_kunmap(struct dma_buf *dma_buf, unsigned long page_num,
+			   void *addr)
 {
 
 }
+EXPORT_SYMBOL(drm_gem_dmabuf_kunmap);
 
-static int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf,
-			       struct vm_area_struct *vma)
+int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct vm_area_struct *vma)
 {
 	struct drm_gem_object *obj = dma_buf->priv;
 	struct drm_device *dev = obj->dev;
@@ -396,6 +404,7 @@ static int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf,
 
 	return dev->driver->gem_prime_mmap(obj, vma);
 }
+EXPORT_SYMBOL(drm_gem_dmabuf_mmap);
 
 static const struct dma_buf_ops drm_gem_prime_dmabuf_ops =  {
 	.attach = drm_gem_map_attach,
diff --git a/include/drm/drm_prime.h b/include/drm/drm_prime.h
index 9cd9e36..4d5f5d6 100644
--- a/include/drm/drm_prime.h
+++ b/include/drm/drm_prime.h
@@ -54,6 +54,9 @@ struct device;
 
 struct dma_buf_export_info;
 struct dma_buf;
+struct dma_buf_attachment;
+
+enum dma_data_direction;
 
 struct drm_device;
 struct drm_gem_object;
@@ -79,6 +82,25 @@ int drm_gem_prime_fd_to_handle(struct drm_device *dev,
 struct dma_buf *drm_gem_dmabuf_export(struct drm_device *dev,
 				      struct dma_buf_export_info *exp_info);
 void drm_gem_dmabuf_release(struct dma_buf *dma_buf);
+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);
+void *drm_gem_dmabuf_vmap(struct dma_buf *dma_buf);
+void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void *vaddr);
+void *drm_gem_dmabuf_kmap_atomic(struct dma_buf *dma_buf,
+				 unsigned long page_num);
+void drm_gem_dmabuf_kunmap_atomic(struct dma_buf *dma_buf,
+				  unsigned long page_num, void *addr);
+void *drm_gem_dmabuf_kmap(struct dma_buf *dma_buf, unsigned long page_num);
+void drm_gem_dmabuf_kunmap(struct dma_buf *dma_buf, unsigned long page_num,
+			   void *addr);
+int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct vm_area_struct *vma);
 
 int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page **pages,
 				     dma_addr_t *addrs, int max_pages);
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse
  2018-01-04 21:12 [PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse Samuel Li
@ 2018-01-05  9:16 ` Christian König
       [not found]   ` <c816da24-7676-8cef-528f-77bfa44af049-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Christian König @ 2018-01-05  9:16 UTC (permalink / raw)
  To: Samuel Li, dri-devel, amd-gfx

Am 04.01.2018 um 22:12 schrieb Samuel Li:
> Change-Id: I03c22a890d2305f3243d88019d1a28bddd4ddda7
> Signed-off-by: Samuel Li <Samuel.Li@amd.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/drm_prime.c | 53 ++++++++++++++++++++++++++-------------------
>   include/drm/drm_prime.h     | 22 +++++++++++++++++++
>   2 files changed, 53 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
> index 8de93a2..68a69e9 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;
> @@ -227,6 +227,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)
> @@ -253,8 +254,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;
> @@ -289,13 +290,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
> @@ -346,47 +349,52 @@ void drm_gem_dmabuf_release(struct dma_buf *dma_buf)
>   }
>   EXPORT_SYMBOL(drm_gem_dmabuf_release);
>   
> -static void *drm_gem_dmabuf_vmap(struct dma_buf *dma_buf)
> +void *drm_gem_dmabuf_vmap(struct dma_buf *dma_buf)
>   {
>   	struct drm_gem_object *obj = dma_buf->priv;
>   	struct drm_device *dev = obj->dev;
>   
>   	return dev->driver->gem_prime_vmap(obj);
>   }
> +EXPORT_SYMBOL(drm_gem_dmabuf_vmap);
>   
> -static void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void *vaddr)
> +void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void *vaddr)
>   {
>   	struct drm_gem_object *obj = dma_buf->priv;
>   	struct drm_device *dev = obj->dev;
>   
>   	dev->driver->gem_prime_vunmap(obj, vaddr);
>   }
> +EXPORT_SYMBOL(drm_gem_dmabuf_vunmap);
>   
> -static void *drm_gem_dmabuf_kmap_atomic(struct dma_buf *dma_buf,
> -					unsigned long page_num)
> +void *drm_gem_dmabuf_kmap_atomic(struct dma_buf *dma_buf,
> +				 unsigned long page_num)
>   {
>   	return NULL;
>   }
> +EXPORT_SYMBOL(drm_gem_dmabuf_kmap_atomic);
>   
> -static void drm_gem_dmabuf_kunmap_atomic(struct dma_buf *dma_buf,
> -					 unsigned long page_num, void *addr)
> +void drm_gem_dmabuf_kunmap_atomic(struct dma_buf *dma_buf,
> +				  unsigned long page_num, void *addr)
>   {
>   
>   }
> -static void *drm_gem_dmabuf_kmap(struct dma_buf *dma_buf,
> -				 unsigned long page_num)
> +EXPORT_SYMBOL(drm_gem_dmabuf_kunmap_atomic);
> +
> +void *drm_gem_dmabuf_kmap(struct dma_buf *dma_buf, unsigned long page_num)
>   {
>   	return NULL;
>   }
> +EXPORT_SYMBOL(drm_gem_dmabuf_kmap);
>   
> -static void drm_gem_dmabuf_kunmap(struct dma_buf *dma_buf,
> -				  unsigned long page_num, void *addr)
> +void drm_gem_dmabuf_kunmap(struct dma_buf *dma_buf, unsigned long page_num,
> +			   void *addr)
>   {
>   
>   }
> +EXPORT_SYMBOL(drm_gem_dmabuf_kunmap);
>   
> -static int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf,
> -			       struct vm_area_struct *vma)
> +int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct vm_area_struct *vma)
>   {
>   	struct drm_gem_object *obj = dma_buf->priv;
>   	struct drm_device *dev = obj->dev;
> @@ -396,6 +404,7 @@ static int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf,
>   
>   	return dev->driver->gem_prime_mmap(obj, vma);
>   }
> +EXPORT_SYMBOL(drm_gem_dmabuf_mmap);
>   
>   static const struct dma_buf_ops drm_gem_prime_dmabuf_ops =  {
>   	.attach = drm_gem_map_attach,
> diff --git a/include/drm/drm_prime.h b/include/drm/drm_prime.h
> index 9cd9e36..4d5f5d6 100644
> --- a/include/drm/drm_prime.h
> +++ b/include/drm/drm_prime.h
> @@ -54,6 +54,9 @@ struct device;
>   
>   struct dma_buf_export_info;
>   struct dma_buf;
> +struct dma_buf_attachment;
> +
> +enum dma_data_direction;
>   
>   struct drm_device;
>   struct drm_gem_object;
> @@ -79,6 +82,25 @@ int drm_gem_prime_fd_to_handle(struct drm_device *dev,
>   struct dma_buf *drm_gem_dmabuf_export(struct drm_device *dev,
>   				      struct dma_buf_export_info *exp_info);
>   void drm_gem_dmabuf_release(struct dma_buf *dma_buf);
> +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);
> +void *drm_gem_dmabuf_vmap(struct dma_buf *dma_buf);
> +void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void *vaddr);
> +void *drm_gem_dmabuf_kmap_atomic(struct dma_buf *dma_buf,
> +				 unsigned long page_num);
> +void drm_gem_dmabuf_kunmap_atomic(struct dma_buf *dma_buf,
> +				  unsigned long page_num, void *addr);
> +void *drm_gem_dmabuf_kmap(struct dma_buf *dma_buf, unsigned long page_num);
> +void drm_gem_dmabuf_kunmap(struct dma_buf *dma_buf, unsigned long page_num,
> +			   void *addr);
> +int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct vm_area_struct *vma);
>   
>   int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page **pages,
>   				     dma_addr_t *addrs, int max_pages);

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse
       [not found]   ` <c816da24-7676-8cef-528f-77bfa44af049-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2018-01-09  9:22     ` Daniel Vetter
       [not found]       ` <20180109092201.GE26573-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Vetter @ 2018-01-09  9:22 UTC (permalink / raw)
  To: christian.koenig-5C7GfCeVMHo
  Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Samuel Li

On Fri, Jan 05, 2018 at 10:16:04AM +0100, Christian König wrote:
> Am 04.01.2018 um 22:12 schrieb Samuel Li:
> > Change-Id: I03c22a890d2305f3243d88019d1a28bddd4ddda7
> > Signed-off-by: Samuel Li <Samuel.Li@amd.com>
> 
> Reviewed-by: Christian König <christian.koenig@amd.com>

Want to push to drm-misc or some other plan with this?
-Daniel

> 
> > ---
> >   drivers/gpu/drm/drm_prime.c | 53 ++++++++++++++++++++++++++-------------------
> >   include/drm/drm_prime.h     | 22 +++++++++++++++++++
> >   2 files changed, 53 insertions(+), 22 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
> > index 8de93a2..68a69e9 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;
> > @@ -227,6 +227,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)
> > @@ -253,8 +254,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;
> > @@ -289,13 +290,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
> > @@ -346,47 +349,52 @@ void drm_gem_dmabuf_release(struct dma_buf *dma_buf)
> >   }
> >   EXPORT_SYMBOL(drm_gem_dmabuf_release);
> > -static void *drm_gem_dmabuf_vmap(struct dma_buf *dma_buf)
> > +void *drm_gem_dmabuf_vmap(struct dma_buf *dma_buf)
> >   {
> >   	struct drm_gem_object *obj = dma_buf->priv;
> >   	struct drm_device *dev = obj->dev;
> >   	return dev->driver->gem_prime_vmap(obj);
> >   }
> > +EXPORT_SYMBOL(drm_gem_dmabuf_vmap);
> > -static void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void *vaddr)
> > +void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void *vaddr)
> >   {
> >   	struct drm_gem_object *obj = dma_buf->priv;
> >   	struct drm_device *dev = obj->dev;
> >   	dev->driver->gem_prime_vunmap(obj, vaddr);
> >   }
> > +EXPORT_SYMBOL(drm_gem_dmabuf_vunmap);
> > -static void *drm_gem_dmabuf_kmap_atomic(struct dma_buf *dma_buf,
> > -					unsigned long page_num)
> > +void *drm_gem_dmabuf_kmap_atomic(struct dma_buf *dma_buf,
> > +				 unsigned long page_num)
> >   {
> >   	return NULL;
> >   }
> > +EXPORT_SYMBOL(drm_gem_dmabuf_kmap_atomic);
> > -static void drm_gem_dmabuf_kunmap_atomic(struct dma_buf *dma_buf,
> > -					 unsigned long page_num, void *addr)
> > +void drm_gem_dmabuf_kunmap_atomic(struct dma_buf *dma_buf,
> > +				  unsigned long page_num, void *addr)
> >   {
> >   }
> > -static void *drm_gem_dmabuf_kmap(struct dma_buf *dma_buf,
> > -				 unsigned long page_num)
> > +EXPORT_SYMBOL(drm_gem_dmabuf_kunmap_atomic);
> > +
> > +void *drm_gem_dmabuf_kmap(struct dma_buf *dma_buf, unsigned long page_num)
> >   {
> >   	return NULL;
> >   }
> > +EXPORT_SYMBOL(drm_gem_dmabuf_kmap);
> > -static void drm_gem_dmabuf_kunmap(struct dma_buf *dma_buf,
> > -				  unsigned long page_num, void *addr)
> > +void drm_gem_dmabuf_kunmap(struct dma_buf *dma_buf, unsigned long page_num,
> > +			   void *addr)
> >   {
> >   }
> > +EXPORT_SYMBOL(drm_gem_dmabuf_kunmap);
> > -static int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf,
> > -			       struct vm_area_struct *vma)
> > +int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct vm_area_struct *vma)
> >   {
> >   	struct drm_gem_object *obj = dma_buf->priv;
> >   	struct drm_device *dev = obj->dev;
> > @@ -396,6 +404,7 @@ static int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf,
> >   	return dev->driver->gem_prime_mmap(obj, vma);
> >   }
> > +EXPORT_SYMBOL(drm_gem_dmabuf_mmap);
> >   static const struct dma_buf_ops drm_gem_prime_dmabuf_ops =  {
> >   	.attach = drm_gem_map_attach,
> > diff --git a/include/drm/drm_prime.h b/include/drm/drm_prime.h
> > index 9cd9e36..4d5f5d6 100644
> > --- a/include/drm/drm_prime.h
> > +++ b/include/drm/drm_prime.h
> > @@ -54,6 +54,9 @@ struct device;
> >   struct dma_buf_export_info;
> >   struct dma_buf;
> > +struct dma_buf_attachment;
> > +
> > +enum dma_data_direction;
> >   struct drm_device;
> >   struct drm_gem_object;
> > @@ -79,6 +82,25 @@ int drm_gem_prime_fd_to_handle(struct drm_device *dev,
> >   struct dma_buf *drm_gem_dmabuf_export(struct drm_device *dev,
> >   				      struct dma_buf_export_info *exp_info);
> >   void drm_gem_dmabuf_release(struct dma_buf *dma_buf);
> > +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);
> > +void *drm_gem_dmabuf_vmap(struct dma_buf *dma_buf);
> > +void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void *vaddr);
> > +void *drm_gem_dmabuf_kmap_atomic(struct dma_buf *dma_buf,
> > +				 unsigned long page_num);
> > +void drm_gem_dmabuf_kunmap_atomic(struct dma_buf *dma_buf,
> > +				  unsigned long page_num, void *addr);
> > +void *drm_gem_dmabuf_kmap(struct dma_buf *dma_buf, unsigned long page_num);
> > +void drm_gem_dmabuf_kunmap(struct dma_buf *dma_buf, unsigned long page_num,
> > +			   void *addr);
> > +int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct vm_area_struct *vma);
> >   int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page **pages,
> >   				     dma_addr_t *addrs, int max_pages);
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse
       [not found]       ` <20180109092201.GE26573-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
@ 2018-01-09 15:20         ` Li, Samuel
       [not found]           ` <BLUPR12MB06285B53BBB52C80D9F15780F5100-7LeqcoF/hwrL9O90+oShTwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Li, Samuel @ 2018-01-09 15:20 UTC (permalink / raw)
  To: Daniel Vetter, Koenig, Christian
  Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org

Yes, please hush this for me.

Regards,
Samuel Li


> -----Original Message-----
> From: Daniel Vetter [mailto:daniel.vetter@ffwll.ch] On Behalf Of Daniel
> Vetter
> Sent: Tuesday, January 09, 2018 4:22 AM
> To: Koenig, Christian <Christian.Koenig@amd.com>
> Cc: Li, Samuel <Samuel.Li@amd.com>; dri-devel@lists.freedesktop.org; amd-
> gfx@lists.freedesktop.org
> Subject: Re: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse
> 
> On Fri, Jan 05, 2018 at 10:16:04AM +0100, Christian König wrote:
> > Am 04.01.2018 um 22:12 schrieb Samuel Li:
> > > Change-Id: I03c22a890d2305f3243d88019d1a28bddd4ddda7
> > > Signed-off-by: Samuel Li <Samuel.Li@amd.com>
> >
> > Reviewed-by: Christian König <christian.koenig@amd.com>
> 
> Want to push to drm-misc or some other plan with this?
> -Daniel
> 
> >
> > > ---
> > >   drivers/gpu/drm/drm_prime.c | 53 ++++++++++++++++++++++++++---
> ----------------
> > >   include/drm/drm_prime.h     | 22 +++++++++++++++++++
> > >   2 files changed, 53 insertions(+), 22 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/drm_prime.c
> > > b/drivers/gpu/drm/drm_prime.c index 8de93a2..68a69e9 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; @@ -227,6 +227,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)
> > > @@ -253,8 +254,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; @@ -289,13
> > > +290,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
> > > @@ -346,47 +349,52 @@ void drm_gem_dmabuf_release(struct
> dma_buf *dma_buf)
> > >   }
> > >   EXPORT_SYMBOL(drm_gem_dmabuf_release);
> > > -static void *drm_gem_dmabuf_vmap(struct dma_buf *dma_buf)
> > > +void *drm_gem_dmabuf_vmap(struct dma_buf *dma_buf)
> > >   {
> > >   	struct drm_gem_object *obj = dma_buf->priv;
> > >   	struct drm_device *dev = obj->dev;
> > >   	return dev->driver->gem_prime_vmap(obj);
> > >   }
> > > +EXPORT_SYMBOL(drm_gem_dmabuf_vmap);
> > > -static void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void
> > > *vaddr)
> > > +void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void
> *vaddr)
> > >   {
> > >   	struct drm_gem_object *obj = dma_buf->priv;
> > >   	struct drm_device *dev = obj->dev;
> > >   	dev->driver->gem_prime_vunmap(obj, vaddr);
> > >   }
> > > +EXPORT_SYMBOL(drm_gem_dmabuf_vunmap);
> > > -static void *drm_gem_dmabuf_kmap_atomic(struct dma_buf
> *dma_buf,
> > > -					unsigned long page_num)
> > > +void *drm_gem_dmabuf_kmap_atomic(struct dma_buf *dma_buf,
> > > +				 unsigned long page_num)
> > >   {
> > >   	return NULL;
> > >   }
> > > +EXPORT_SYMBOL(drm_gem_dmabuf_kmap_atomic);
> > > -static void drm_gem_dmabuf_kunmap_atomic(struct dma_buf
> *dma_buf,
> > > -					 unsigned long page_num, void *addr)
> > > +void drm_gem_dmabuf_kunmap_atomic(struct dma_buf *dma_buf,
> > > +				  unsigned long page_num, void *addr)
> > >   {
> > >   }
> > > -static void *drm_gem_dmabuf_kmap(struct dma_buf *dma_buf,
> > > -				 unsigned long page_num)
> > > +EXPORT_SYMBOL(drm_gem_dmabuf_kunmap_atomic);
> > > +
> > > +void *drm_gem_dmabuf_kmap(struct dma_buf *dma_buf, unsigned
> long
> > > +page_num)
> > >   {
> > >   	return NULL;
> > >   }
> > > +EXPORT_SYMBOL(drm_gem_dmabuf_kmap);
> > > -static void drm_gem_dmabuf_kunmap(struct dma_buf *dma_buf,
> > > -				  unsigned long page_num, void *addr)
> > > +void drm_gem_dmabuf_kunmap(struct dma_buf *dma_buf, unsigned
> long page_num,
> > > +			   void *addr)
> > >   {
> > >   }
> > > +EXPORT_SYMBOL(drm_gem_dmabuf_kunmap);
> > > -static int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf,
> > > -			       struct vm_area_struct *vma)
> > > +int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct
> > > +vm_area_struct *vma)
> > >   {
> > >   	struct drm_gem_object *obj = dma_buf->priv;
> > >   	struct drm_device *dev = obj->dev; @@ -396,6 +404,7 @@ static int
> > > drm_gem_dmabuf_mmap(struct dma_buf *dma_buf,
> > >   	return dev->driver->gem_prime_mmap(obj, vma);
> > >   }
> > > +EXPORT_SYMBOL(drm_gem_dmabuf_mmap);
> > >   static const struct dma_buf_ops drm_gem_prime_dmabuf_ops =  {
> > >   	.attach = drm_gem_map_attach,
> > > diff --git a/include/drm/drm_prime.h b/include/drm/drm_prime.h index
> > > 9cd9e36..4d5f5d6 100644
> > > --- a/include/drm/drm_prime.h
> > > +++ b/include/drm/drm_prime.h
> > > @@ -54,6 +54,9 @@ struct device;
> > >   struct dma_buf_export_info;
> > >   struct dma_buf;
> > > +struct dma_buf_attachment;
> > > +
> > > +enum dma_data_direction;
> > >   struct drm_device;
> > >   struct drm_gem_object;
> > > @@ -79,6 +82,25 @@ int drm_gem_prime_fd_to_handle(struct
> drm_device *dev,
> > >   struct dma_buf *drm_gem_dmabuf_export(struct drm_device *dev,
> > >   				      struct dma_buf_export_info *exp_info);
> > >   void drm_gem_dmabuf_release(struct dma_buf *dma_buf);
> > > +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); void
> > > +*drm_gem_dmabuf_vmap(struct dma_buf *dma_buf); void
> > > +drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void *vaddr);
> void
> > > +*drm_gem_dmabuf_kmap_atomic(struct dma_buf *dma_buf,
> > > +				 unsigned long page_num);
> > > +void drm_gem_dmabuf_kunmap_atomic(struct dma_buf *dma_buf,
> > > +				  unsigned long page_num, void *addr); void
> > > +*drm_gem_dmabuf_kmap(struct dma_buf *dma_buf, unsigned long
> > > +page_num); void drm_gem_dmabuf_kunmap(struct dma_buf
> *dma_buf, unsigned long page_num,
> > > +			   void *addr);
> > > +int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct
> > > +vm_area_struct *vma);
> > >   int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct
> page **pages,
> > >   				     dma_addr_t *addrs, int max_pages);
> >
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse
       [not found]           ` <BLUPR12MB06285B53BBB52C80D9F15780F5100-7LeqcoF/hwrL9O90+oShTwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
@ 2018-01-09 15:56             ` Deucher, Alexander
  2018-01-09 18:13               ` Alex Deucher
  0 siblings, 1 reply; 8+ messages in thread
From: Deucher, Alexander @ 2018-01-09 15:56 UTC (permalink / raw)
  To: Li, Samuel, Daniel Vetter, Koenig, Christian
  Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org


[-- Attachment #1.1: Type: text/plain, Size: 10376 bytes --]

I'll can push this and a few other misc patches today.

Alex
________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Li, Samuel <Samuel.Li-5C7GfCeVMHo@public.gmane.org>
Sent: Tuesday, January 9, 2018 10:20 AM
To: Daniel Vetter; Koenig, Christian
Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org; dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: RE: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse

Yes, please hush this for me.

Regards,
Samuel Li


> -----Original Message-----
> From: Daniel Vetter [mailto:daniel.vetter-/w4YWyX8dFk@public.gmane.org] On Behalf Of Daniel
> Vetter
> Sent: Tuesday, January 09, 2018 4:22 AM
> To: Koenig, Christian <Christian.Koenig-5C7GfCeVMHo@public.gmane.org>
> Cc: Li, Samuel <Samuel.Li-5C7GfCeVMHo@public.gmane.org>; dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org; amd-
> gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
> Subject: Re: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse
>
> On Fri, Jan 05, 2018 at 10:16:04AM +0100, Christian König wrote:
> > Am 04.01.2018 um 22:12 schrieb Samuel Li:
> > > Change-Id: I03c22a890d2305f3243d88019d1a28bddd4ddda7
> > > Signed-off-by: Samuel Li <Samuel.Li-5C7GfCeVMHo@public.gmane.org>
> >
> > Reviewed-by: Christian König <christian.koenig-5C7GfCeVMHo@public.gmane.org>
>
> Want to push to drm-misc or some other plan with this?
> -Daniel
>
> >
> > > ---
> > >   drivers/gpu/drm/drm_prime.c | 53 ++++++++++++++++++++++++++---
> ----------------
> > >   include/drm/drm_prime.h     | 22 +++++++++++++++++++
> > >   2 files changed, 53 insertions(+), 22 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/drm_prime.c
> > > b/drivers/gpu/drm/drm_prime.c index 8de93a2..68a69e9 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; @@ -227,6 +227,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)
> > > @@ -253,8 +254,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; @@ -289,13
> > > +290,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
> > > @@ -346,47 +349,52 @@ void drm_gem_dmabuf_release(struct
> dma_buf *dma_buf)
> > >   }
> > >   EXPORT_SYMBOL(drm_gem_dmabuf_release);
> > > -static void *drm_gem_dmabuf_vmap(struct dma_buf *dma_buf)
> > > +void *drm_gem_dmabuf_vmap(struct dma_buf *dma_buf)
> > >   {
> > >    struct drm_gem_object *obj = dma_buf->priv;
> > >    struct drm_device *dev = obj->dev;
> > >    return dev->driver->gem_prime_vmap(obj);
> > >   }
> > > +EXPORT_SYMBOL(drm_gem_dmabuf_vmap);
> > > -static void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void
> > > *vaddr)
> > > +void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void
> *vaddr)
> > >   {
> > >    struct drm_gem_object *obj = dma_buf->priv;
> > >    struct drm_device *dev = obj->dev;
> > >    dev->driver->gem_prime_vunmap(obj, vaddr);
> > >   }
> > > +EXPORT_SYMBOL(drm_gem_dmabuf_vunmap);
> > > -static void *drm_gem_dmabuf_kmap_atomic(struct dma_buf
> *dma_buf,
> > > -                                 unsigned long page_num)
> > > +void *drm_gem_dmabuf_kmap_atomic(struct dma_buf *dma_buf,
> > > +                          unsigned long page_num)
> > >   {
> > >    return NULL;
> > >   }
> > > +EXPORT_SYMBOL(drm_gem_dmabuf_kmap_atomic);
> > > -static void drm_gem_dmabuf_kunmap_atomic(struct dma_buf
> *dma_buf,
> > > -                                  unsigned long page_num, void *addr)
> > > +void drm_gem_dmabuf_kunmap_atomic(struct dma_buf *dma_buf,
> > > +                           unsigned long page_num, void *addr)
> > >   {
> > >   }
> > > -static void *drm_gem_dmabuf_kmap(struct dma_buf *dma_buf,
> > > -                          unsigned long page_num)
> > > +EXPORT_SYMBOL(drm_gem_dmabuf_kunmap_atomic);
> > > +
> > > +void *drm_gem_dmabuf_kmap(struct dma_buf *dma_buf, unsigned
> long
> > > +page_num)
> > >   {
> > >    return NULL;
> > >   }
> > > +EXPORT_SYMBOL(drm_gem_dmabuf_kmap);
> > > -static void drm_gem_dmabuf_kunmap(struct dma_buf *dma_buf,
> > > -                           unsigned long page_num, void *addr)
> > > +void drm_gem_dmabuf_kunmap(struct dma_buf *dma_buf, unsigned
> long page_num,
> > > +                    void *addr)
> > >   {
> > >   }
> > > +EXPORT_SYMBOL(drm_gem_dmabuf_kunmap);
> > > -static int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf,
> > > -                        struct vm_area_struct *vma)
> > > +int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct
> > > +vm_area_struct *vma)
> > >   {
> > >    struct drm_gem_object *obj = dma_buf->priv;
> > >    struct drm_device *dev = obj->dev; @@ -396,6 +404,7 @@ static int
> > > drm_gem_dmabuf_mmap(struct dma_buf *dma_buf,
> > >    return dev->driver->gem_prime_mmap(obj, vma);
> > >   }
> > > +EXPORT_SYMBOL(drm_gem_dmabuf_mmap);
> > >   static const struct dma_buf_ops drm_gem_prime_dmabuf_ops =  {
> > >    .attach = drm_gem_map_attach,
> > > diff --git a/include/drm/drm_prime.h b/include/drm/drm_prime.h index
> > > 9cd9e36..4d5f5d6 100644
> > > --- a/include/drm/drm_prime.h
> > > +++ b/include/drm/drm_prime.h
> > > @@ -54,6 +54,9 @@ struct device;
> > >   struct dma_buf_export_info;
> > >   struct dma_buf;
> > > +struct dma_buf_attachment;
> > > +
> > > +enum dma_data_direction;
> > >   struct drm_device;
> > >   struct drm_gem_object;
> > > @@ -79,6 +82,25 @@ int drm_gem_prime_fd_to_handle(struct
> drm_device *dev,
> > >   struct dma_buf *drm_gem_dmabuf_export(struct drm_device *dev,
> > >                                  struct dma_buf_export_info *exp_info);
> > >   void drm_gem_dmabuf_release(struct dma_buf *dma_buf);
> > > +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); void
> > > +*drm_gem_dmabuf_vmap(struct dma_buf *dma_buf); void
> > > +drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void *vaddr);
> void
> > > +*drm_gem_dmabuf_kmap_atomic(struct dma_buf *dma_buf,
> > > +                          unsigned long page_num);
> > > +void drm_gem_dmabuf_kunmap_atomic(struct dma_buf *dma_buf,
> > > +                           unsigned long page_num, void *addr); void
> > > +*drm_gem_dmabuf_kmap(struct dma_buf *dma_buf, unsigned long
> > > +page_num); void drm_gem_dmabuf_kunmap(struct dma_buf
> *dma_buf, unsigned long page_num,
> > > +                    void *addr);
> > > +int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct
> > > +vm_area_struct *vma);
> > >   int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct
> page **pages,
> > >                                 dma_addr_t *addrs, int max_pages);
> >
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
_______________________________________________
amd-gfx mailing list
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

[-- Attachment #1.2: Type: text/html, Size: 19226 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse
  2018-01-09 15:56             ` Deucher, Alexander
@ 2018-01-09 18:13               ` Alex Deucher
       [not found]                 ` <CADnq5_PGXFpez4kJ5RERrbJwGwmrHbFmYHQx+s3w8YoxMRJZTA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Alex Deucher @ 2018-01-09 18:13 UTC (permalink / raw)
  To: Deucher, Alexander
  Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
	Li, Samuel, Koenig, Christian

On Tue, Jan 9, 2018 at 10:56 AM, Deucher, Alexander
<Alexander.Deucher@amd.com> wrote:
> I'll can push this and a few other misc patches today.
>

Pushed to drm-misc-next.

Thanks,

Alex


>
> Alex
> ________________________________
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Li,
> Samuel <Samuel.Li@amd.com>
> Sent: Tuesday, January 9, 2018 10:20 AM
> To: Daniel Vetter; Koenig, Christian
> Cc: amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org
> Subject: RE: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse
>
> Yes, please hush this for me.
>
> Regards,
> Samuel Li
>
>
>> -----Original Message-----
>> From: Daniel Vetter [mailto:daniel.vetter@ffwll.ch] On Behalf Of Daniel
>> Vetter
>> Sent: Tuesday, January 09, 2018 4:22 AM
>> To: Koenig, Christian <Christian.Koenig@amd.com>
>> Cc: Li, Samuel <Samuel.Li@amd.com>; dri-devel@lists.freedesktop.org; amd-
>> gfx@lists.freedesktop.org
>> Subject: Re: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse
>>
>> On Fri, Jan 05, 2018 at 10:16:04AM +0100, Christian König wrote:
>> > Am 04.01.2018 um 22:12 schrieb Samuel Li:
>> > > Change-Id: I03c22a890d2305f3243d88019d1a28bddd4ddda7
>> > > Signed-off-by: Samuel Li <Samuel.Li@amd.com>
>> >
>> > Reviewed-by: Christian König <christian.koenig@amd.com>
>>
>> Want to push to drm-misc or some other plan with this?
>> -Daniel
>>
>> >
>> > > ---
>> > >   drivers/gpu/drm/drm_prime.c | 53 ++++++++++++++++++++++++++---
>> ----------------
>> > >   include/drm/drm_prime.h     | 22 +++++++++++++++++++
>> > >   2 files changed, 53 insertions(+), 22 deletions(-)
>> > >
>> > > diff --git a/drivers/gpu/drm/drm_prime.c
>> > > b/drivers/gpu/drm/drm_prime.c index 8de93a2..68a69e9 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; @@ -227,6 +227,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)
>> > > @@ -253,8 +254,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; @@ -289,13
>> > > +290,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
>> > > @@ -346,47 +349,52 @@ void drm_gem_dmabuf_release(struct
>> dma_buf *dma_buf)
>> > >   }
>> > >   EXPORT_SYMBOL(drm_gem_dmabuf_release);
>> > > -static void *drm_gem_dmabuf_vmap(struct dma_buf *dma_buf)
>> > > +void *drm_gem_dmabuf_vmap(struct dma_buf *dma_buf)
>> > >   {
>> > >    struct drm_gem_object *obj = dma_buf->priv;
>> > >    struct drm_device *dev = obj->dev;
>> > >    return dev->driver->gem_prime_vmap(obj);
>> > >   }
>> > > +EXPORT_SYMBOL(drm_gem_dmabuf_vmap);
>> > > -static void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void
>> > > *vaddr)
>> > > +void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void
>> *vaddr)
>> > >   {
>> > >    struct drm_gem_object *obj = dma_buf->priv;
>> > >    struct drm_device *dev = obj->dev;
>> > >    dev->driver->gem_prime_vunmap(obj, vaddr);
>> > >   }
>> > > +EXPORT_SYMBOL(drm_gem_dmabuf_vunmap);
>> > > -static void *drm_gem_dmabuf_kmap_atomic(struct dma_buf
>> *dma_buf,
>> > > -                                 unsigned long page_num)
>> > > +void *drm_gem_dmabuf_kmap_atomic(struct dma_buf *dma_buf,
>> > > +                          unsigned long page_num)
>> > >   {
>> > >    return NULL;
>> > >   }
>> > > +EXPORT_SYMBOL(drm_gem_dmabuf_kmap_atomic);
>> > > -static void drm_gem_dmabuf_kunmap_atomic(struct dma_buf
>> *dma_buf,
>> > > -                                  unsigned long page_num, void *addr)
>> > > +void drm_gem_dmabuf_kunmap_atomic(struct dma_buf *dma_buf,
>> > > +                           unsigned long page_num, void *addr)
>> > >   {
>> > >   }
>> > > -static void *drm_gem_dmabuf_kmap(struct dma_buf *dma_buf,
>> > > -                          unsigned long page_num)
>> > > +EXPORT_SYMBOL(drm_gem_dmabuf_kunmap_atomic);
>> > > +
>> > > +void *drm_gem_dmabuf_kmap(struct dma_buf *dma_buf, unsigned
>> long
>> > > +page_num)
>> > >   {
>> > >    return NULL;
>> > >   }
>> > > +EXPORT_SYMBOL(drm_gem_dmabuf_kmap);
>> > > -static void drm_gem_dmabuf_kunmap(struct dma_buf *dma_buf,
>> > > -                           unsigned long page_num, void *addr)
>> > > +void drm_gem_dmabuf_kunmap(struct dma_buf *dma_buf, unsigned
>> long page_num,
>> > > +                    void *addr)
>> > >   {
>> > >   }
>> > > +EXPORT_SYMBOL(drm_gem_dmabuf_kunmap);
>> > > -static int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf,
>> > > -                        struct vm_area_struct *vma)
>> > > +int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct
>> > > +vm_area_struct *vma)
>> > >   {
>> > >    struct drm_gem_object *obj = dma_buf->priv;
>> > >    struct drm_device *dev = obj->dev; @@ -396,6 +404,7 @@ static int
>> > > drm_gem_dmabuf_mmap(struct dma_buf *dma_buf,
>> > >    return dev->driver->gem_prime_mmap(obj, vma);
>> > >   }
>> > > +EXPORT_SYMBOL(drm_gem_dmabuf_mmap);
>> > >   static const struct dma_buf_ops drm_gem_prime_dmabuf_ops =  {
>> > >    .attach = drm_gem_map_attach,
>> > > diff --git a/include/drm/drm_prime.h b/include/drm/drm_prime.h index
>> > > 9cd9e36..4d5f5d6 100644
>> > > --- a/include/drm/drm_prime.h
>> > > +++ b/include/drm/drm_prime.h
>> > > @@ -54,6 +54,9 @@ struct device;
>> > >   struct dma_buf_export_info;
>> > >   struct dma_buf;
>> > > +struct dma_buf_attachment;
>> > > +
>> > > +enum dma_data_direction;
>> > >   struct drm_device;
>> > >   struct drm_gem_object;
>> > > @@ -79,6 +82,25 @@ int drm_gem_prime_fd_to_handle(struct
>> drm_device *dev,
>> > >   struct dma_buf *drm_gem_dmabuf_export(struct drm_device *dev,
>> > >                                  struct dma_buf_export_info
>> > > *exp_info);
>> > >   void drm_gem_dmabuf_release(struct dma_buf *dma_buf);
>> > > +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); void
>> > > +*drm_gem_dmabuf_vmap(struct dma_buf *dma_buf); void
>> > > +drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void *vaddr);
>> void
>> > > +*drm_gem_dmabuf_kmap_atomic(struct dma_buf *dma_buf,
>> > > +                          unsigned long page_num);
>> > > +void drm_gem_dmabuf_kunmap_atomic(struct dma_buf *dma_buf,
>> > > +                           unsigned long page_num, void *addr); void
>> > > +*drm_gem_dmabuf_kmap(struct dma_buf *dma_buf, unsigned long
>> > > +page_num); void drm_gem_dmabuf_kunmap(struct dma_buf
>> *dma_buf, unsigned long page_num,
>> > > +                    void *addr);
>> > > +int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct
>> > > +vm_area_struct *vma);
>> > >   int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct
>> page **pages,
>> > >                                 dma_addr_t *addrs, int max_pages);
>> >
>> > _______________________________________________
>> > dri-devel mailing list
>> > dri-devel@lists.freedesktop.org
>> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
>>
>> --
>> Daniel Vetter
>> Software Engineer, Intel Corporation
>> http://blog.ffwll.ch
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse
       [not found]                 ` <CADnq5_PGXFpez4kJ5RERrbJwGwmrHbFmYHQx+s3w8YoxMRJZTA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2018-01-10  8:17                   ` Daniel Vetter
  2018-01-10 14:52                     ` Li, Samuel
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Vetter @ 2018-01-10  8:17 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Li, Samuel,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	Daniel Vetter, Deucher, Alexander, Koenig, Christian

On Tue, Jan 09, 2018 at 01:13:08PM -0500, Alex Deucher wrote:
> On Tue, Jan 9, 2018 at 10:56 AM, Deucher, Alexander
> <Alexander.Deucher@amd.com> wrote:
> > I'll can push this and a few other misc patches today.
> >
> 
> Pushed to drm-misc-next.

One thing I just noticed: Some kerneldoc for the newly exported functions
and maybe a small update to the intro section to explain what to do with
this would be neat.
-Daniel

> 
> Thanks,
> 
> Alex
> 
> 
> >
> > Alex
> > ________________________________
> > From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Li,
> > Samuel <Samuel.Li@amd.com>
> > Sent: Tuesday, January 9, 2018 10:20 AM
> > To: Daniel Vetter; Koenig, Christian
> > Cc: amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org
> > Subject: RE: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse
> >
> > Yes, please hush this for me.
> >
> > Regards,
> > Samuel Li
> >
> >
> >> -----Original Message-----
> >> From: Daniel Vetter [mailto:daniel.vetter@ffwll.ch] On Behalf Of Daniel
> >> Vetter
> >> Sent: Tuesday, January 09, 2018 4:22 AM
> >> To: Koenig, Christian <Christian.Koenig@amd.com>
> >> Cc: Li, Samuel <Samuel.Li@amd.com>; dri-devel@lists.freedesktop.org; amd-
> >> gfx@lists.freedesktop.org
> >> Subject: Re: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse
> >>
> >> On Fri, Jan 05, 2018 at 10:16:04AM +0100, Christian König wrote:
> >> > Am 04.01.2018 um 22:12 schrieb Samuel Li:
> >> > > Change-Id: I03c22a890d2305f3243d88019d1a28bddd4ddda7
> >> > > Signed-off-by: Samuel Li <Samuel.Li@amd.com>
> >> >
> >> > Reviewed-by: Christian König <christian.koenig@amd.com>
> >>
> >> Want to push to drm-misc or some other plan with this?
> >> -Daniel
> >>
> >> >
> >> > > ---
> >> > >   drivers/gpu/drm/drm_prime.c | 53 ++++++++++++++++++++++++++---
> >> ----------------
> >> > >   include/drm/drm_prime.h     | 22 +++++++++++++++++++
> >> > >   2 files changed, 53 insertions(+), 22 deletions(-)
> >> > >
> >> > > diff --git a/drivers/gpu/drm/drm_prime.c
> >> > > b/drivers/gpu/drm/drm_prime.c index 8de93a2..68a69e9 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; @@ -227,6 +227,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)
> >> > > @@ -253,8 +254,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; @@ -289,13
> >> > > +290,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
> >> > > @@ -346,47 +349,52 @@ void drm_gem_dmabuf_release(struct
> >> dma_buf *dma_buf)
> >> > >   }
> >> > >   EXPORT_SYMBOL(drm_gem_dmabuf_release);
> >> > > -static void *drm_gem_dmabuf_vmap(struct dma_buf *dma_buf)
> >> > > +void *drm_gem_dmabuf_vmap(struct dma_buf *dma_buf)
> >> > >   {
> >> > >    struct drm_gem_object *obj = dma_buf->priv;
> >> > >    struct drm_device *dev = obj->dev;
> >> > >    return dev->driver->gem_prime_vmap(obj);
> >> > >   }
> >> > > +EXPORT_SYMBOL(drm_gem_dmabuf_vmap);
> >> > > -static void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void
> >> > > *vaddr)
> >> > > +void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void
> >> *vaddr)
> >> > >   {
> >> > >    struct drm_gem_object *obj = dma_buf->priv;
> >> > >    struct drm_device *dev = obj->dev;
> >> > >    dev->driver->gem_prime_vunmap(obj, vaddr);
> >> > >   }
> >> > > +EXPORT_SYMBOL(drm_gem_dmabuf_vunmap);
> >> > > -static void *drm_gem_dmabuf_kmap_atomic(struct dma_buf
> >> *dma_buf,
> >> > > -                                 unsigned long page_num)
> >> > > +void *drm_gem_dmabuf_kmap_atomic(struct dma_buf *dma_buf,
> >> > > +                          unsigned long page_num)
> >> > >   {
> >> > >    return NULL;
> >> > >   }
> >> > > +EXPORT_SYMBOL(drm_gem_dmabuf_kmap_atomic);
> >> > > -static void drm_gem_dmabuf_kunmap_atomic(struct dma_buf
> >> *dma_buf,
> >> > > -                                  unsigned long page_num, void *addr)
> >> > > +void drm_gem_dmabuf_kunmap_atomic(struct dma_buf *dma_buf,
> >> > > +                           unsigned long page_num, void *addr)
> >> > >   {
> >> > >   }
> >> > > -static void *drm_gem_dmabuf_kmap(struct dma_buf *dma_buf,
> >> > > -                          unsigned long page_num)
> >> > > +EXPORT_SYMBOL(drm_gem_dmabuf_kunmap_atomic);
> >> > > +
> >> > > +void *drm_gem_dmabuf_kmap(struct dma_buf *dma_buf, unsigned
> >> long
> >> > > +page_num)
> >> > >   {
> >> > >    return NULL;
> >> > >   }
> >> > > +EXPORT_SYMBOL(drm_gem_dmabuf_kmap);
> >> > > -static void drm_gem_dmabuf_kunmap(struct dma_buf *dma_buf,
> >> > > -                           unsigned long page_num, void *addr)
> >> > > +void drm_gem_dmabuf_kunmap(struct dma_buf *dma_buf, unsigned
> >> long page_num,
> >> > > +                    void *addr)
> >> > >   {
> >> > >   }
> >> > > +EXPORT_SYMBOL(drm_gem_dmabuf_kunmap);
> >> > > -static int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf,
> >> > > -                        struct vm_area_struct *vma)
> >> > > +int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct
> >> > > +vm_area_struct *vma)
> >> > >   {
> >> > >    struct drm_gem_object *obj = dma_buf->priv;
> >> > >    struct drm_device *dev = obj->dev; @@ -396,6 +404,7 @@ static int
> >> > > drm_gem_dmabuf_mmap(struct dma_buf *dma_buf,
> >> > >    return dev->driver->gem_prime_mmap(obj, vma);
> >> > >   }
> >> > > +EXPORT_SYMBOL(drm_gem_dmabuf_mmap);
> >> > >   static const struct dma_buf_ops drm_gem_prime_dmabuf_ops =  {
> >> > >    .attach = drm_gem_map_attach,
> >> > > diff --git a/include/drm/drm_prime.h b/include/drm/drm_prime.h index
> >> > > 9cd9e36..4d5f5d6 100644
> >> > > --- a/include/drm/drm_prime.h
> >> > > +++ b/include/drm/drm_prime.h
> >> > > @@ -54,6 +54,9 @@ struct device;
> >> > >   struct dma_buf_export_info;
> >> > >   struct dma_buf;
> >> > > +struct dma_buf_attachment;
> >> > > +
> >> > > +enum dma_data_direction;
> >> > >   struct drm_device;
> >> > >   struct drm_gem_object;
> >> > > @@ -79,6 +82,25 @@ int drm_gem_prime_fd_to_handle(struct
> >> drm_device *dev,
> >> > >   struct dma_buf *drm_gem_dmabuf_export(struct drm_device *dev,
> >> > >                                  struct dma_buf_export_info
> >> > > *exp_info);
> >> > >   void drm_gem_dmabuf_release(struct dma_buf *dma_buf);
> >> > > +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); void
> >> > > +*drm_gem_dmabuf_vmap(struct dma_buf *dma_buf); void
> >> > > +drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void *vaddr);
> >> void
> >> > > +*drm_gem_dmabuf_kmap_atomic(struct dma_buf *dma_buf,
> >> > > +                          unsigned long page_num);
> >> > > +void drm_gem_dmabuf_kunmap_atomic(struct dma_buf *dma_buf,
> >> > > +                           unsigned long page_num, void *addr); void
> >> > > +*drm_gem_dmabuf_kmap(struct dma_buf *dma_buf, unsigned long
> >> > > +page_num); void drm_gem_dmabuf_kunmap(struct dma_buf
> >> *dma_buf, unsigned long page_num,
> >> > > +                    void *addr);
> >> > > +int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct
> >> > > +vm_area_struct *vma);
> >> > >   int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct
> >> page **pages,
> >> > >                                 dma_addr_t *addrs, int max_pages);
> >> >
> >> > _______________________________________________
> >> > dri-devel mailing list
> >> > dri-devel@lists.freedesktop.org
> >> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> >>
> >> --
> >> Daniel Vetter
> >> Software Engineer, Intel Corporation
> >> http://blog.ffwll.ch
> > _______________________________________________
> > amd-gfx mailing list
> > amd-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> >
> > _______________________________________________
> > amd-gfx mailing list
> > amd-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> >

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse
  2018-01-10  8:17                   ` Daniel Vetter
@ 2018-01-10 14:52                     ` Li, Samuel
  0 siblings, 0 replies; 8+ messages in thread
From: Li, Samuel @ 2018-01-10 14:52 UTC (permalink / raw)
  To: Daniel Vetter, Alex Deucher
  Cc: Deucher, Alexander, amd-gfx@lists.freedesktop.org,
	Koenig, Christian, dri-devel@lists.freedesktop.org

OK. I'll do it.

Samuel Li


> -----Original Message-----
> From: Daniel Vetter [mailto:daniel.vetter@ffwll.ch] On Behalf Of Daniel
> Vetter
> Sent: Wednesday, January 10, 2018 3:17 AM
> To: Alex Deucher <alexdeucher@gmail.com>
> Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Li, Samuel
> <Samuel.Li@amd.com>; Daniel Vetter <daniel@ffwll.ch>; Koenig, Christian
> <Christian.Koenig@amd.com>; dri-devel@lists.freedesktop.org; amd-
> gfx@lists.freedesktop.org
> Subject: Re: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse
> 
> On Tue, Jan 09, 2018 at 01:13:08PM -0500, Alex Deucher wrote:
> > On Tue, Jan 9, 2018 at 10:56 AM, Deucher, Alexander
> > <Alexander.Deucher@amd.com> wrote:
> > > I'll can push this and a few other misc patches today.
> > >
> >
> > Pushed to drm-misc-next.
> 
> One thing I just noticed: Some kerneldoc for the newly exported functions
> and maybe a small update to the intro section to explain what to do with this
> would be neat.
> -Daniel
> 
> >
> > Thanks,
> >
> > Alex
> >
> >
> > >
> > > Alex
> > > ________________________________
> > > From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of
> > > Li, Samuel <Samuel.Li@amd.com>
> > > Sent: Tuesday, January 9, 2018 10:20 AM
> > > To: Daniel Vetter; Koenig, Christian
> > > Cc: amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org
> > > Subject: RE: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to
> > > reuse
> > >
> > > Yes, please hush this for me.
> > >
> > > Regards,
> > > Samuel Li
> > >
> > >
> > >> -----Original Message-----
> > >> From: Daniel Vetter [mailto:daniel.vetter@ffwll.ch] On Behalf Of
> > >> Daniel Vetter
> > >> Sent: Tuesday, January 09, 2018 4:22 AM
> > >> To: Koenig, Christian <Christian.Koenig@amd.com>
> > >> Cc: Li, Samuel <Samuel.Li@amd.com>;
> > >> dri-devel@lists.freedesktop.org; amd- gfx@lists.freedesktop.org
> > >> Subject: Re: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to
> > >> reuse
> > >>
> > >> On Fri, Jan 05, 2018 at 10:16:04AM +0100, Christian König wrote:
> > >> > Am 04.01.2018 um 22:12 schrieb Samuel Li:
> > >> > > Change-Id: I03c22a890d2305f3243d88019d1a28bddd4ddda7
> > >> > > Signed-off-by: Samuel Li <Samuel.Li@amd.com>
> > >> >
> > >> > Reviewed-by: Christian König <christian.koenig@amd.com>
> > >>
> > >> Want to push to drm-misc or some other plan with this?
> > >> -Daniel
> > >>
> > >> >
> > >> > > ---
> > >> > >   drivers/gpu/drm/drm_prime.c | 53
> > >> > > ++++++++++++++++++++++++++---
> > >> ----------------
> > >> > >   include/drm/drm_prime.h     | 22 +++++++++++++++++++
> > >> > >   2 files changed, 53 insertions(+), 22 deletions(-)
> > >> > >
> > >> > > diff --git a/drivers/gpu/drm/drm_prime.c
> > >> > > b/drivers/gpu/drm/drm_prime.c index 8de93a2..68a69e9 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; @@ -227,6 +227,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) @@
> > >> > > -253,8 +254,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; @@
> > >> > > -289,13
> > >> > > +290,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
> > >> > > @@ -346,47 +349,52 @@ void drm_gem_dmabuf_release(struct
> > >> dma_buf *dma_buf)
> > >> > >   }
> > >> > >   EXPORT_SYMBOL(drm_gem_dmabuf_release);
> > >> > > -static void *drm_gem_dmabuf_vmap(struct dma_buf *dma_buf)
> > >> > > +void *drm_gem_dmabuf_vmap(struct dma_buf *dma_buf)
> > >> > >   {
> > >> > >    struct drm_gem_object *obj = dma_buf->priv;
> > >> > >    struct drm_device *dev = obj->dev;
> > >> > >    return dev->driver->gem_prime_vmap(obj);
> > >> > >   }
> > >> > > +EXPORT_SYMBOL(drm_gem_dmabuf_vmap);
> > >> > > -static void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf,
> > >> > > void
> > >> > > *vaddr)
> > >> > > +void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void
> > >> *vaddr)
> > >> > >   {
> > >> > >    struct drm_gem_object *obj = dma_buf->priv;
> > >> > >    struct drm_device *dev = obj->dev;
> > >> > >    dev->driver->gem_prime_vunmap(obj, vaddr);
> > >> > >   }
> > >> > > +EXPORT_SYMBOL(drm_gem_dmabuf_vunmap);
> > >> > > -static void *drm_gem_dmabuf_kmap_atomic(struct dma_buf
> > >> *dma_buf,
> > >> > > -                                 unsigned long page_num)
> > >> > > +void *drm_gem_dmabuf_kmap_atomic(struct dma_buf *dma_buf,
> > >> > > +                          unsigned long page_num)
> > >> > >   {
> > >> > >    return NULL;
> > >> > >   }
> > >> > > +EXPORT_SYMBOL(drm_gem_dmabuf_kmap_atomic);
> > >> > > -static void drm_gem_dmabuf_kunmap_atomic(struct dma_buf
> > >> *dma_buf,
> > >> > > -                                  unsigned long page_num, void *addr)
> > >> > > +void drm_gem_dmabuf_kunmap_atomic(struct dma_buf
> *dma_buf,
> > >> > > +                           unsigned long page_num, void *addr)
> > >> > >   {
> > >> > >   }
> > >> > > -static void *drm_gem_dmabuf_kmap(struct dma_buf *dma_buf,
> > >> > > -                          unsigned long page_num)
> > >> > > +EXPORT_SYMBOL(drm_gem_dmabuf_kunmap_atomic);
> > >> > > +
> > >> > > +void *drm_gem_dmabuf_kmap(struct dma_buf *dma_buf,
> unsigned
> > >> long
> > >> > > +page_num)
> > >> > >   {
> > >> > >    return NULL;
> > >> > >   }
> > >> > > +EXPORT_SYMBOL(drm_gem_dmabuf_kmap);
> > >> > > -static void drm_gem_dmabuf_kunmap(struct dma_buf *dma_buf,
> > >> > > -                           unsigned long page_num, void *addr)
> > >> > > +void drm_gem_dmabuf_kunmap(struct dma_buf *dma_buf,
> unsigned
> > >> long page_num,
> > >> > > +                    void *addr)
> > >> > >   {
> > >> > >   }
> > >> > > +EXPORT_SYMBOL(drm_gem_dmabuf_kunmap);
> > >> > > -static int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf,
> > >> > > -                        struct vm_area_struct *vma)
> > >> > > +int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct
> > >> > > +vm_area_struct *vma)
> > >> > >   {
> > >> > >    struct drm_gem_object *obj = dma_buf->priv;
> > >> > >    struct drm_device *dev = obj->dev; @@ -396,6 +404,7 @@
> > >> > > static int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf,
> > >> > >    return dev->driver->gem_prime_mmap(obj, vma);
> > >> > >   }
> > >> > > +EXPORT_SYMBOL(drm_gem_dmabuf_mmap);
> > >> > >   static const struct dma_buf_ops drm_gem_prime_dmabuf_ops =  {
> > >> > >    .attach = drm_gem_map_attach, diff --git
> > >> > > a/include/drm/drm_prime.h b/include/drm/drm_prime.h index
> > >> > > 9cd9e36..4d5f5d6 100644
> > >> > > --- a/include/drm/drm_prime.h
> > >> > > +++ b/include/drm/drm_prime.h
> > >> > > @@ -54,6 +54,9 @@ struct device;
> > >> > >   struct dma_buf_export_info;
> > >> > >   struct dma_buf;
> > >> > > +struct dma_buf_attachment;
> > >> > > +
> > >> > > +enum dma_data_direction;
> > >> > >   struct drm_device;
> > >> > >   struct drm_gem_object;
> > >> > > @@ -79,6 +82,25 @@ int drm_gem_prime_fd_to_handle(struct
> > >> drm_device *dev,
> > >> > >   struct dma_buf *drm_gem_dmabuf_export(struct drm_device
> *dev,
> > >> > >                                  struct dma_buf_export_info
> > >> > > *exp_info);
> > >> > >   void drm_gem_dmabuf_release(struct dma_buf *dma_buf);
> > >> > > +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); void
> > >> > > +*drm_gem_dmabuf_vmap(struct dma_buf *dma_buf); void
> > >> > > +drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void
> *vaddr);
> > >> void
> > >> > > +*drm_gem_dmabuf_kmap_atomic(struct dma_buf *dma_buf,
> > >> > > +                          unsigned long page_num); void
> > >> > > +drm_gem_dmabuf_kunmap_atomic(struct dma_buf *dma_buf,
> > >> > > +                           unsigned long page_num, void
> > >> > > +*addr); void *drm_gem_dmabuf_kmap(struct dma_buf *dma_buf,
> > >> > > +unsigned long page_num); void drm_gem_dmabuf_kunmap(struct
> > >> > > +dma_buf
> > >> *dma_buf, unsigned long page_num,
> > >> > > +                    void *addr); int
> > >> > > +drm_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct
> > >> > > +vm_area_struct *vma);
> > >> > >   int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt,
> > >> > > struct
> > >> page **pages,
> > >> > >                                 dma_addr_t *addrs, int
> > >> > > max_pages);
> > >> >
> > >> > _______________________________________________
> > >> > dri-devel mailing list
> > >> > dri-devel@lists.freedesktop.org
> > >> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> > >>
> > >> --
> > >> Daniel Vetter
> > >> Software Engineer, Intel Corporation http://blog.ffwll.ch
> > > _______________________________________________
> > > amd-gfx mailing list
> > > amd-gfx@lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> > >
> > > _______________________________________________
> > > amd-gfx mailing list
> > > amd-gfx@lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> > >
> 
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-01-10 14:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-04 21:12 [PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse Samuel Li
2018-01-05  9:16 ` Christian König
     [not found]   ` <c816da24-7676-8cef-528f-77bfa44af049-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-01-09  9:22     ` Daniel Vetter
     [not found]       ` <20180109092201.GE26573-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2018-01-09 15:20         ` Li, Samuel
     [not found]           ` <BLUPR12MB06285B53BBB52C80D9F15780F5100-7LeqcoF/hwrL9O90+oShTwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-01-09 15:56             ` Deucher, Alexander
2018-01-09 18:13               ` Alex Deucher
     [not found]                 ` <CADnq5_PGXFpez4kJ5RERrbJwGwmrHbFmYHQx+s3w8YoxMRJZTA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-10  8:17                   ` Daniel Vetter
2018-01-10 14:52                     ` Li, Samuel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox