RE: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse

2018-01-10 Thread Li, Samuel
OK. I'll do it.

Samuel Li


> -Original Message-
> From: Daniel Vetter [mailto:daniel.vet...@ffwll.ch] On Behalf Of Daniel
> Vetter
> Sent: Wednesday, January 10, 2018 3:17 AM
> To: Alex Deucher <alexdeuc...@gmail.com>
> Cc: Deucher, Alexander <alexander.deuc...@amd.com>; Li, Samuel
> <samuel...@amd.com>; Daniel Vetter <dan...@ffwll.ch>; Koenig, Christian
> <christian.koe...@amd.com>; dri-devel@lists.freedesktop.org; amd-
> g...@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.deuc...@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-boun...@lists.freedesktop.org> on behalf of
> > > Li, Samuel <samuel...@amd.com>
> > > Sent: Tuesday, January 9, 2018 10:20 AM
> > > To: Daniel Vetter; Koenig, Christian
> > > Cc: amd-...@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.vet...@ffwll.ch] On Behalf Of
> > >> Daniel Vetter
> > >> Sent: Tuesday, January 09, 2018 4:22 AM
> > >> To: Koenig, Christian <christian.koe...@amd.com>
> > >> Cc: Li, Samuel <samuel...@amd.com>;
> > >> dri-devel@lists.freedesktop.org; amd- g...@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...@amd.com>
> > >> >
> > >> > Reviewed-by: Christian König <christian.koe...@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_det

Re: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse

2018-01-10 Thread Daniel Vetter
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.deuc...@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-boun...@lists.freedesktop.org> on behalf of Li,
> > Samuel <samuel...@amd.com>
> > Sent: Tuesday, January 9, 2018 10:20 AM
> > To: Daniel Vetter; Koenig, Christian
> > Cc: amd-...@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.vet...@ffwll.ch] On Behalf Of Daniel
> >> Vetter
> >> Sent: Tuesday, January 09, 2018 4:22 AM
> >> To: Koenig, Christian <christian.koe...@amd.com>
> >> Cc: Li, Samuel <samuel...@amd.com>; dri-devel@lists.freedesktop.org; amd-
> >> g...@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...@amd.com>
> >> >
> >> > Reviewed-by: Christian König <christian.koe...@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
> >> > >}

Re: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse

2018-01-09 Thread Alex Deucher
On Tue, Jan 9, 2018 at 10:56 AM, Deucher, Alexander
<alexander.deuc...@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-boun...@lists.freedesktop.org> on behalf of Li,
> Samuel <samuel...@amd.com>
> Sent: Tuesday, January 9, 2018 10:20 AM
> To: Daniel Vetter; Koenig, Christian
> Cc: amd-...@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.vet...@ffwll.ch] On Behalf Of Daniel
>> Vetter
>> Sent: Tuesday, January 09, 2018 4:22 AM
>> To: Koenig, Christian <christian.koe...@amd.com>
>> Cc: Li, Samuel <samuel...@amd.com>; dri-devel@lists.freedesktop.org; amd-
>> g...@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...@amd.com>
>> >
>> > Reviewed-by: Christian König <christian.koe...@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,

Re: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse

2018-01-09 Thread Deucher, Alexander
I'll can push this and a few other misc patches today.

Alex

From: amd-gfx <amd-gfx-boun...@lists.freedesktop.org> on behalf of Li, Samuel 
<samuel...@amd.com>
Sent: Tuesday, January 9, 2018 10:20 AM
To: Daniel Vetter; Koenig, Christian
Cc: amd-...@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.vet...@ffwll.ch] On Behalf Of Daniel
> Vetter
> Sent: Tuesday, January 09, 2018 4:22 AM
> To: Koenig, Christian <christian.koe...@amd.com>
> Cc: Li, Samuel <samuel...@amd.com>; dri-devel@lists.freedesktop.org; amd-
> g...@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...@amd.com>
> >
> > Reviewed-by: Christian König <christian.koe...@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)
> > >   {
> > 

RE: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse

2018-01-09 Thread Li, Samuel
Yes, please hush this for me.

Regards,
Samuel Li


> -Original Message-
> From: Daniel Vetter [mailto:daniel.vet...@ffwll.ch] On Behalf Of Daniel
> Vetter
> Sent: Tuesday, January 09, 2018 4:22 AM
> To: Koenig, Christian <christian.koe...@amd.com>
> Cc: Li, Samuel <samuel...@amd.com>; dri-devel@lists.freedesktop.org; amd-
> g...@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...@amd.com>
> >
> > Reviewed-by: Christian König <christian.koe...@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

Re: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse

2018-01-09 Thread Daniel Vetter
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 
> 
> Reviewed-by: Christian König 

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 

Re: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse

2018-01-05 Thread Christian König

Am 04.01.2018 um 22:12 schrieb Samuel Li:

Change-Id: I03c22a890d2305f3243d88019d1a28bddd4ddda7
Signed-off-by: Samuel Li 


Reviewed-by: Christian König 


---
  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 

[PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse

2018-01-04 Thread Samuel Li
Change-Id: I03c22a890d2305f3243d88019d1a28bddd4ddda7
Signed-off-by: Samuel Li 
---
 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)
 {
 
 }