[PATCH 07/12] drm: export drm_gem_prime_dmabuf_ops
Daniel Vetter
daniel at ffwll.ch
Tue Jul 4 06:26:41 UTC 2017
On Tue, Jul 04, 2017 at 02:55:00PM +1000, Dave Airlie wrote:
> On 4 Jul. 2017 11:23, "Michel Dänzer" <michel at daenzer.net> wrote:
>
>
> Adding the dri-devel list, since this is a core DRM patch.
>
>
> On 04/07/17 06:11 AM, Felix Kuehling wrote:
> > From: Christian König <christian.koenig at amd.com>
> >
> > This allows drivers to check if a DMA-buf contains a GEM object or not.
>
>
> Please use an accessor function. I doubt it'll be a fast path.
I think even better if that helper checks against the driver instance too,
since that's really the answer you want drm_prime_try_cast_to_gem_bo or
similar, which will return NULL if it's not a prime dma-buf or not one for
the current driver instance. Feel free to improve the naming :-)
-Daniel
>
> Dave.
>
> >
> > Signed-off-by: Christian König <christian.koenig at amd.com>
> > Reviewed-by: Felix Kuehling <Felix.Kuehling at amd.com>
> > ---
> > drivers/gpu/drm/drm_prime.c | 3 ++-
> > include/drm/drmP.h | 2 ++
> > 2 files changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
> > index 25aa455..5cb4fd9 100644
> > --- a/drivers/gpu/drm/drm_prime.c
> > +++ b/drivers/gpu/drm/drm_prime.c
> > @@ -396,7 +396,7 @@ static int drm_gem_dmabuf_mmap(struct dma_buf
> *dma_buf,
> > return dev->driver->gem_prime_mmap(obj, vma);
> > }
> >
> > -static const struct dma_buf_ops drm_gem_prime_dmabuf_ops = {
> > +const struct dma_buf_ops drm_gem_prime_dmabuf_ops = {
> > .attach = drm_gem_map_attach,
> > .detach = drm_gem_map_detach,
> > .map_dma_buf = drm_gem_map_dma_buf,
> > @@ -410,6 +410,7 @@ static int drm_gem_dmabuf_mmap(struct dma_buf
> *dma_buf,
> > .vmap = drm_gem_dmabuf_vmap,
> > .vunmap = drm_gem_dmabuf_vunmap,
> > };
> > +EXPORT_SYMBOL(drm_gem_prime_dmabuf_ops);
> >
> > /**
> > * DOC: PRIME Helpers
> > diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> > index 6105c05..e0ea8f8 100644
> > --- a/include/drm/drmP.h
> > +++ b/include/drm/drmP.h
> > @@ -761,6 +761,8 @@ static inline int drm_debugfs_remove_files(const
> struct drm_info_list *files,
> >
> > struct dma_buf_export_info;
> >
> > +extern const struct dma_buf_ops drm_gem_prime_dmabuf_ops;
> > +
> > extern struct dma_buf *drm_gem_prime_export(struct drm_device *dev,
> > struct drm_gem_object *obj,
> > int flags);
> >
>
>
> --
> Earthling Michel Dänzer | http://www.amd.com
> Libre software enthusiast | Mesa and X developer
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
More information about the dri-devel
mailing list