[Intel-gfx] [PATCH 09/59] drm/prime: Align gem_prime_export with obj_funcs.export

Daniel Vetter daniel at ffwll.ch
Fri Jun 21 10:37:22 UTC 2019


On Fri, Jun 14, 2019 at 10:35:25PM +0200, Daniel Vetter wrote:
> The idea is that gem_prime_export is deprecated in favor of
> obj_funcs.export. That's much easier to do if both have matching
> function signatures.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
> Cc: Russell King <linux at armlinux.org.uk>
> Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
> Cc: Maxime Ripard <maxime.ripard at bootlin.com>
> Cc: Sean Paul <sean at poorly.run>
> Cc: David Airlie <airlied at linux.ie>
> Cc: Daniel Vetter <daniel at ffwll.ch>
> Cc: Zhenyu Wang <zhenyuw at linux.intel.com>
> Cc: Zhi Wang <zhi.a.wang at intel.com>
> Cc: Jani Nikula <jani.nikula at linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
> Cc: Tomi Valkeinen <tomi.valkeinen at ti.com>
> Cc: Alex Deucher <alexander.deucher at amd.com>
> Cc: "Christian König" <christian.koenig at amd.com>
> Cc: "David (ChunMing) Zhou" <David1.Zhou at amd.com>
> Cc: Thierry Reding <thierry.reding at gmail.com>
> Cc: Jonathan Hunter <jonathanh at nvidia.com>
> Cc: Dave Airlie <airlied at redhat.com>
> Cc: Eric Anholt <eric at anholt.net>
> Cc: "Michel Dänzer" <michel.daenzer at amd.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Huang Rui <ray.huang at amd.com>
> Cc: Felix Kuehling <Felix.Kuehling at amd.com>
> Cc: Hawking Zhang <Hawking.Zhang at amd.com>
> Cc: Feifei Xu <Feifei.Xu at amd.com>
> Cc: Jim Qu <Jim.Qu at amd.com>
> Cc: Evan Quan <evan.quan at amd.com>
> Cc: Matthew Auld <matthew.auld at intel.com>
> Cc: Mika Kuoppala <mika.kuoppala at linux.intel.com>
> Cc: Thomas Zimmermann <tdz at users.sourceforge.net>
> Cc: Kate Stewart <kstewart at linuxfoundation.org>
> Cc: Sumit Semwal <sumit.semwal at linaro.org>
> Cc: Jilayne Lovejoy <opensource at jilayne.com>
> Cc: Thomas Gleixner <tglx at linutronix.de>
> Cc: Mikulas Patocka <mpatocka at redhat.com>
> Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
> Cc: Junwei Zhang <Jerry.Zhang at amd.com>
> Cc: intel-gvt-dev at lists.freedesktop.org
> Cc: intel-gfx at lists.freedesktop.org
> Cc: amd-gfx at lists.freedesktop.org
> Cc: linux-tegra at vger.kernel.org

Merged up to this one to drm-misc-next (for 5.4), thanks everyone for the
review and comments thus far.
-Daniel

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c          | 7 +++----
>  drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.h          | 3 +--
>  drivers/gpu/drm/armada/armada_gem.c                  | 5 ++---
>  drivers/gpu/drm/armada/armada_gem.h                  | 3 +--
>  drivers/gpu/drm/drm_prime.c                          | 9 ++++-----
>  drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c           | 5 ++---
>  drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c | 8 ++++----
>  drivers/gpu/drm/i915/gvt/dmabuf.c                    | 2 +-
>  drivers/gpu/drm/i915/i915_drv.h                      | 3 +--
>  drivers/gpu/drm/omapdrm/omap_gem.h                   | 3 +--
>  drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c            | 5 ++---
>  drivers/gpu/drm/radeon/radeon_drv.c                  | 3 +--
>  drivers/gpu/drm/radeon/radeon_prime.c                | 5 ++---
>  drivers/gpu/drm/tegra/gem.c                          | 7 +++----
>  drivers/gpu/drm/tegra/gem.h                          | 3 +--
>  drivers/gpu/drm/udl/udl_dmabuf.c                     | 5 ++---
>  drivers/gpu/drm/udl/udl_drv.h                        | 3 +--
>  drivers/gpu/drm/vc4/vc4_bo.c                         | 5 ++---
>  drivers/gpu/drm/vc4/vc4_drv.h                        | 3 +--
>  drivers/gpu/drm/vgem/vgem_fence.c                    | 2 +-
>  include/drm/drm_drv.h                                | 4 ++--
>  include/drm/drm_prime.h                              | 3 +--
>  22 files changed, 39 insertions(+), 57 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
> index 489041df1f45..4809d4a5d72a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
> @@ -345,8 +345,7 @@ const struct dma_buf_ops amdgpu_dmabuf_ops = {
>   * Returns:
>   * Shared DMA buffer representing the GEM BO from the given device.
>   */
> -struct dma_buf *amdgpu_gem_prime_export(struct drm_device *dev,
> -					struct drm_gem_object *gobj,
> +struct dma_buf *amdgpu_gem_prime_export(struct drm_gem_object *gobj,
>  					int flags)
>  {
>  	struct amdgpu_bo *bo = gem_to_amdgpu_bo(gobj);
> @@ -356,9 +355,9 @@ struct dma_buf *amdgpu_gem_prime_export(struct drm_device *dev,
>  	    bo->flags & AMDGPU_GEM_CREATE_VM_ALWAYS_VALID)
>  		return ERR_PTR(-EPERM);
>  
> -	buf = drm_gem_prime_export(dev, gobj, flags);
> +	buf = drm_gem_prime_export(gobj, flags);
>  	if (!IS_ERR(buf)) {
> -		buf->file->f_mapping = dev->anon_inode->i_mapping;
> +		buf->file->f_mapping = gobj->dev->anon_inode->i_mapping;
>  		buf->ops = &amdgpu_dmabuf_ops;
>  	}
>  
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.h
> index c7056cbe8685..7f73a4f94204 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.h
> @@ -30,8 +30,7 @@ struct drm_gem_object *
>  amdgpu_gem_prime_import_sg_table(struct drm_device *dev,
>  				 struct dma_buf_attachment *attach,
>  				 struct sg_table *sg);
> -struct dma_buf *amdgpu_gem_prime_export(struct drm_device *dev,
> -					struct drm_gem_object *gobj,
> +struct dma_buf *amdgpu_gem_prime_export(struct drm_gem_object *gobj,
>  					int flags);
>  struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev,
>  					    struct dma_buf *dma_buf);
> diff --git a/drivers/gpu/drm/armada/armada_gem.c b/drivers/gpu/drm/armada/armada_gem.c
> index 642d0e70d0f8..7e7fcc3f1f7f 100644
> --- a/drivers/gpu/drm/armada/armada_gem.c
> +++ b/drivers/gpu/drm/armada/armada_gem.c
> @@ -485,8 +485,7 @@ static const struct dma_buf_ops armada_gem_prime_dmabuf_ops = {
>  };
>  
>  struct dma_buf *
> -armada_gem_prime_export(struct drm_device *dev, struct drm_gem_object *obj,
> -	int flags)
> +armada_gem_prime_export(struct drm_gem_object *obj, int flags)
>  {
>  	DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
>  
> @@ -495,7 +494,7 @@ armada_gem_prime_export(struct drm_device *dev, struct drm_gem_object *obj,
>  	exp_info.flags = O_RDWR;
>  	exp_info.priv = obj;
>  
> -	return drm_gem_dmabuf_export(dev, &exp_info);
> +	return drm_gem_dmabuf_export(obj->dev, &exp_info);
>  }
>  
>  struct drm_gem_object *
> diff --git a/drivers/gpu/drm/armada/armada_gem.h b/drivers/gpu/drm/armada/armada_gem.h
> index 1ac90792b166..c619381eeeff 100644
> --- a/drivers/gpu/drm/armada/armada_gem.h
> +++ b/drivers/gpu/drm/armada/armada_gem.h
> @@ -35,8 +35,7 @@ struct armada_gem_object *armada_gem_alloc_private_object(struct drm_device *,
>  	size_t);
>  int armada_gem_dumb_create(struct drm_file *, struct drm_device *,
>  	struct drm_mode_create_dumb *);
> -struct dma_buf *armada_gem_prime_export(struct drm_device *dev,
> -	struct drm_gem_object *obj, int flags);
> +struct dma_buf *armada_gem_prime_export(struct drm_gem_object *obj, int flags);
>  struct drm_gem_object *armada_gem_prime_import(struct drm_device *,
>  	struct dma_buf *);
>  int armada_gem_map_import(struct armada_gem_object *);
> diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
> index 78f6f10b2060..d545e681cb41 100644
> --- a/drivers/gpu/drm/drm_prime.c
> +++ b/drivers/gpu/drm/drm_prime.c
> @@ -382,9 +382,9 @@ static struct dma_buf *export_and_register_object(struct drm_device *dev,
>  	if (obj->funcs && obj->funcs->export)
>  		dmabuf = obj->funcs->export(obj, flags);
>  	else if (dev->driver->gem_prime_export)
> -		dmabuf = dev->driver->gem_prime_export(dev, obj, flags);
> +		dmabuf = dev->driver->gem_prime_export(obj, flags);
>  	else
> -		dmabuf = drm_gem_prime_export(dev, obj, flags);
> +		dmabuf = drm_gem_prime_export(obj, flags);
>  	if (IS_ERR(dmabuf)) {
>  		/* normally the created dma-buf takes ownership of the ref,
>  		 * but if that fails then drop the ref
> @@ -812,17 +812,16 @@ EXPORT_SYMBOL(drm_prime_pages_to_sg);
>  
>  /**
>   * drm_gem_prime_export - helper library implementation of the export callback
> - * @dev: drm_device to export from
>   * @obj: GEM object to export
>   * @flags: flags like DRM_CLOEXEC and DRM_RDWR
>   *
>   * This is the implementation of the &drm_gem_object_funcs.export functions for GEM drivers
>   * using the PRIME helpers.
>   */
> -struct dma_buf *drm_gem_prime_export(struct drm_device *dev,
> -				     struct drm_gem_object *obj,
> +struct dma_buf *drm_gem_prime_export(struct drm_gem_object *obj,
>  				     int flags)
>  {
> +	struct drm_device *dev = obj->dev;
>  	struct dma_buf_export_info exp_info = {
>  		.exp_name = KBUILD_MODNAME, /* white lie for debug */
>  		.owner = dev->driver->fops->owner,
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
> index a93e233cfaa9..50b1b73c303a 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
> @@ -204,8 +204,7 @@ static const struct dma_buf_ops i915_dmabuf_ops =  {
>  	.end_cpu_access = i915_gem_end_cpu_access,
>  };
>  
> -struct dma_buf *i915_gem_prime_export(struct drm_device *dev,
> -				      struct drm_gem_object *gem_obj, int flags)
> +struct dma_buf *i915_gem_prime_export(struct drm_gem_object *gem_obj, int flags)
>  {
>  	struct drm_i915_gem_object *obj = to_intel_bo(gem_obj);
>  	DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
> @@ -222,7 +221,7 @@ struct dma_buf *i915_gem_prime_export(struct drm_device *dev,
>  			return ERR_PTR(ret);
>  	}
>  
> -	return drm_gem_dmabuf_export(dev, &exp_info);
> +	return drm_gem_dmabuf_export(gem_obj->dev, &exp_info);
>  }
>  
>  static int i915_gem_object_get_pages_dmabuf(struct drm_i915_gem_object *obj)
> diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c
> index e3a64edef918..d85d1ce273ca 100644
> --- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c
> +++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c
> @@ -20,7 +20,7 @@ static int igt_dmabuf_export(void *arg)
>  	if (IS_ERR(obj))
>  		return PTR_ERR(obj);
>  
> -	dmabuf = i915_gem_prime_export(&i915->drm, &obj->base, 0);
> +	dmabuf = i915_gem_prime_export(&obj->base, 0);
>  	i915_gem_object_put(obj);
>  	if (IS_ERR(dmabuf)) {
>  		pr_err("i915_gem_prime_export failed with err=%d\n",
> @@ -44,7 +44,7 @@ static int igt_dmabuf_import_self(void *arg)
>  	if (IS_ERR(obj))
>  		return PTR_ERR(obj);
>  
> -	dmabuf = i915_gem_prime_export(&i915->drm, &obj->base, 0);
> +	dmabuf = i915_gem_prime_export(&obj->base, 0);
>  	if (IS_ERR(dmabuf)) {
>  		pr_err("i915_gem_prime_export failed with err=%d\n",
>  		       (int)PTR_ERR(dmabuf));
> @@ -219,7 +219,7 @@ static int igt_dmabuf_export_vmap(void *arg)
>  	if (IS_ERR(obj))
>  		return PTR_ERR(obj);
>  
> -	dmabuf = i915_gem_prime_export(&i915->drm, &obj->base, 0);
> +	dmabuf = i915_gem_prime_export(&obj->base, 0);
>  	if (IS_ERR(dmabuf)) {
>  		pr_err("i915_gem_prime_export failed with err=%d\n",
>  		       (int)PTR_ERR(dmabuf));
> @@ -266,7 +266,7 @@ static int igt_dmabuf_export_kmap(void *arg)
>  	if (IS_ERR(obj))
>  		return PTR_ERR(obj);
>  
> -	dmabuf = i915_gem_prime_export(&i915->drm, &obj->base, 0);
> +	dmabuf = i915_gem_prime_export(&obj->base, 0);
>  	i915_gem_object_put(obj);
>  	if (IS_ERR(dmabuf)) {
>  		err = PTR_ERR(dmabuf);
> diff --git a/drivers/gpu/drm/i915/gvt/dmabuf.c b/drivers/gpu/drm/i915/gvt/dmabuf.c
> index 41c8ebc60c63..13044c027f27 100644
> --- a/drivers/gpu/drm/i915/gvt/dmabuf.c
> +++ b/drivers/gpu/drm/i915/gvt/dmabuf.c
> @@ -491,7 +491,7 @@ int intel_vgpu_get_dmabuf(struct intel_vgpu *vgpu, unsigned int dmabuf_id)
>  
>  	obj->gvt_info = dmabuf_obj->info;
>  
> -	dmabuf = i915_gem_prime_export(dev, &obj->base, DRM_CLOEXEC | DRM_RDWR);
> +	dmabuf = i915_gem_prime_export(&obj->base, DRM_CLOEXEC | DRM_RDWR);
>  	if (IS_ERR(dmabuf)) {
>  		gvt_vgpu_err("export dma-buf failed\n");
>  		ret = PTR_ERR(dmabuf);
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 9dce1c71bb9d..a8af77162567 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2587,8 +2587,7 @@ int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj,
>  struct drm_gem_object *i915_gem_prime_import(struct drm_device *dev,
>  				struct dma_buf *dma_buf);
>  
> -struct dma_buf *i915_gem_prime_export(struct drm_device *dev,
> -				struct drm_gem_object *gem_obj, int flags);
> +struct dma_buf *i915_gem_prime_export(struct drm_gem_object *gem_obj, int flags);
>  
>  static inline struct i915_gem_context *
>  __i915_gem_context_lookup_rcu(struct drm_i915_file_private *file_priv, u32 id)
> diff --git a/drivers/gpu/drm/omapdrm/omap_gem.h b/drivers/gpu/drm/omapdrm/omap_gem.h
> index c1c45fbde155..ee0f217cf59d 100644
> --- a/drivers/gpu/drm/omapdrm/omap_gem.h
> +++ b/drivers/gpu/drm/omapdrm/omap_gem.h
> @@ -76,8 +76,7 @@ u64 omap_gem_mmap_offset(struct drm_gem_object *obj);
>  size_t omap_gem_mmap_size(struct drm_gem_object *obj);
>  
>  /* PRIME Interface */
> -struct dma_buf *omap_gem_prime_export(struct drm_device *dev,
> -		struct drm_gem_object *obj, int flags);
> +struct dma_buf *omap_gem_prime_export(struct drm_gem_object *obj, int flags);
>  struct drm_gem_object *omap_gem_prime_import(struct drm_device *dev,
>  		struct dma_buf *buffer);
>  
> diff --git a/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c b/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c
> index 0f8b597ccd10..7e7ad275e3cf 100644
> --- a/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c
> +++ b/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c
> @@ -136,8 +136,7 @@ static const struct dma_buf_ops omap_dmabuf_ops = {
>  	.mmap = omap_gem_dmabuf_mmap,
>  };
>  
> -struct dma_buf *omap_gem_prime_export(struct drm_device *dev,
> -		struct drm_gem_object *obj, int flags)
> +struct dma_buf *omap_gem_prime_export(struct drm_gem_object *obj, int flags)
>  {
>  	DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
>  
> @@ -146,7 +145,7 @@ struct dma_buf *omap_gem_prime_export(struct drm_device *dev,
>  	exp_info.flags = flags;
>  	exp_info.priv = obj;
>  
> -	return drm_gem_dmabuf_export(dev, &exp_info);
> +	return drm_gem_dmabuf_export(obj->dev, &exp_info);
>  }
>  
>  /* -----------------------------------------------------------------------------
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> index 3b07aa6e551d..4a6acaa3f843 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -130,8 +130,7 @@ int radeon_gem_object_open(struct drm_gem_object *obj,
>  				struct drm_file *file_priv);
>  void radeon_gem_object_close(struct drm_gem_object *obj,
>  				struct drm_file *file_priv);
> -struct dma_buf *radeon_gem_prime_export(struct drm_device *dev,
> -					struct drm_gem_object *gobj,
> +struct dma_buf *radeon_gem_prime_export(struct drm_gem_object *gobj,
>  					int flags);
>  extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int crtc,
>  				      unsigned int flags, int *vpos, int *hpos,
> diff --git a/drivers/gpu/drm/radeon/radeon_prime.c b/drivers/gpu/drm/radeon/radeon_prime.c
> index d3a5bea9a2c5..deaffce50a2e 100644
> --- a/drivers/gpu/drm/radeon/radeon_prime.c
> +++ b/drivers/gpu/drm/radeon/radeon_prime.c
> @@ -124,12 +124,11 @@ struct reservation_object *radeon_gem_prime_res_obj(struct drm_gem_object *obj)
>  	return bo->tbo.resv;
>  }
>  
> -struct dma_buf *radeon_gem_prime_export(struct drm_device *dev,
> -					struct drm_gem_object *gobj,
> +struct dma_buf *radeon_gem_prime_export(struct drm_gem_object *gobj,
>  					int flags)
>  {
>  	struct radeon_bo *bo = gem_to_radeon_bo(gobj);
>  	if (radeon_ttm_tt_has_userptr(bo->tbo.ttm))
>  		return ERR_PTR(-EPERM);
> -	return drm_gem_prime_export(dev, gobj, flags);
> +	return drm_gem_prime_export(gobj, flags);
>  }
> diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c
> index 4cce11fd8836..fd5e9c3a2789 100644
> --- a/drivers/gpu/drm/tegra/gem.c
> +++ b/drivers/gpu/drm/tegra/gem.c
> @@ -629,20 +629,19 @@ static const struct dma_buf_ops tegra_gem_prime_dmabuf_ops = {
>  	.vunmap = tegra_gem_prime_vunmap,
>  };
>  
> -struct dma_buf *tegra_gem_prime_export(struct drm_device *drm,
> -				       struct drm_gem_object *gem,
> +struct dma_buf *tegra_gem_prime_export(struct drm_gem_object *gem,
>  				       int flags)
>  {
>  	DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
>  
>  	exp_info.exp_name = KBUILD_MODNAME;
> -	exp_info.owner = drm->driver->fops->owner;
> +	exp_info.owner = gem->dev->driver->fops->owner;
>  	exp_info.ops = &tegra_gem_prime_dmabuf_ops;
>  	exp_info.size = gem->size;
>  	exp_info.flags = flags;
>  	exp_info.priv = gem;
>  
> -	return drm_gem_dmabuf_export(drm, &exp_info);
> +	return drm_gem_dmabuf_export(gem->dev, &exp_info);
>  }
>  
>  struct drm_gem_object *tegra_gem_prime_import(struct drm_device *drm,
> diff --git a/drivers/gpu/drm/tegra/gem.h b/drivers/gpu/drm/tegra/gem.h
> index 6bd7dd7e55b4..85ebf83c7e43 100644
> --- a/drivers/gpu/drm/tegra/gem.h
> +++ b/drivers/gpu/drm/tegra/gem.h
> @@ -73,8 +73,7 @@ extern const struct vm_operations_struct tegra_bo_vm_ops;
>  int __tegra_gem_mmap(struct drm_gem_object *gem, struct vm_area_struct *vma);
>  int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma);
>  
> -struct dma_buf *tegra_gem_prime_export(struct drm_device *drm,
> -				       struct drm_gem_object *gem,
> +struct dma_buf *tegra_gem_prime_export(struct drm_gem_object *gem,
>  				       int flags);
>  struct drm_gem_object *tegra_gem_prime_import(struct drm_device *drm,
>  					      struct dma_buf *buf);
> diff --git a/drivers/gpu/drm/udl/udl_dmabuf.c b/drivers/gpu/drm/udl/udl_dmabuf.c
> index a28892146f7c..10a60e7e93d6 100644
> --- a/drivers/gpu/drm/udl/udl_dmabuf.c
> +++ b/drivers/gpu/drm/udl/udl_dmabuf.c
> @@ -170,8 +170,7 @@ static const struct dma_buf_ops udl_dmabuf_ops = {
>  	.release		= drm_gem_dmabuf_release,
>  };
>  
> -struct dma_buf *udl_gem_prime_export(struct drm_device *dev,
> -				     struct drm_gem_object *obj, int flags)
> +struct dma_buf *udl_gem_prime_export(struct drm_gem_object *obj, int flags)
>  {
>  	DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
>  
> @@ -180,7 +179,7 @@ struct dma_buf *udl_gem_prime_export(struct drm_device *dev,
>  	exp_info.flags = flags;
>  	exp_info.priv = obj;
>  
> -	return drm_gem_dmabuf_export(dev, &exp_info);
> +	return drm_gem_dmabuf_export(obj->dev, &exp_info);
>  }
>  
>  static int udl_prime_create(struct drm_device *dev,
> diff --git a/drivers/gpu/drm/udl/udl_drv.h b/drivers/gpu/drm/udl/udl_drv.h
> index a928801026c1..9d0790be544f 100644
> --- a/drivers/gpu/drm/udl/udl_drv.h
> +++ b/drivers/gpu/drm/udl/udl_drv.h
> @@ -126,8 +126,7 @@ int udl_gem_mmap(struct drm_file *file_priv, struct drm_device *dev,
>  void udl_gem_free_object(struct drm_gem_object *gem_obj);
>  struct udl_gem_object *udl_gem_alloc_object(struct drm_device *dev,
>  					    size_t size);
> -struct dma_buf *udl_gem_prime_export(struct drm_device *dev,
> -				     struct drm_gem_object *obj, int flags);
> +struct dma_buf *udl_gem_prime_export(struct drm_gem_object *obj, int flags);
>  struct drm_gem_object *udl_gem_prime_import(struct drm_device *dev,
>  				struct dma_buf *dma_buf);
>  
> diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c
> index 1434bb829267..b0f9eb6632a2 100644
> --- a/drivers/gpu/drm/vc4/vc4_bo.c
> +++ b/drivers/gpu/drm/vc4/vc4_bo.c
> @@ -658,8 +658,7 @@ static void vc4_bo_cache_time_timer(struct timer_list *t)
>  	schedule_work(&vc4->bo_cache.time_work);
>  }
>  
> -struct dma_buf *
> -vc4_prime_export(struct drm_device *dev, struct drm_gem_object *obj, int flags)
> +struct dma_buf * vc4_prime_export(struct drm_gem_object *obj, int flags)
>  {
>  	struct vc4_bo *bo = to_vc4_bo(obj);
>  	struct dma_buf *dmabuf;
> @@ -681,7 +680,7 @@ vc4_prime_export(struct drm_device *dev, struct drm_gem_object *obj, int flags)
>  		return ERR_PTR(ret);
>  	}
>  
> -	dmabuf = drm_gem_prime_export(dev, obj, flags);
> +	dmabuf = drm_gem_prime_export(obj, flags);
>  	if (IS_ERR(dmabuf))
>  		vc4_bo_dec_usecnt(bo);
>  
> diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
> index 9170a24ec5f5..efd1ec3430f5 100644
> --- a/drivers/gpu/drm/vc4/vc4_drv.h
> +++ b/drivers/gpu/drm/vc4/vc4_drv.h
> @@ -708,8 +708,7 @@ struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t size,
>  int vc4_dumb_create(struct drm_file *file_priv,
>  		    struct drm_device *dev,
>  		    struct drm_mode_create_dumb *args);
> -struct dma_buf *vc4_prime_export(struct drm_device *dev,
> -				 struct drm_gem_object *obj, int flags);
> +struct dma_buf *vc4_prime_export(struct drm_gem_object *obj, int flags);
>  int vc4_create_bo_ioctl(struct drm_device *dev, void *data,
>  			struct drm_file *file_priv);
>  int vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data,
> diff --git a/drivers/gpu/drm/vgem/vgem_fence.c b/drivers/gpu/drm/vgem/vgem_fence.c
> index eb17c0cd3727..72d43d5ec5ab 100644
> --- a/drivers/gpu/drm/vgem/vgem_fence.c
> +++ b/drivers/gpu/drm/vgem/vgem_fence.c
> @@ -108,7 +108,7 @@ static int attach_dmabuf(struct drm_device *dev,
>  	if (obj->dma_buf)
>  		return 0;
>  
> -	dmabuf = dev->driver->gem_prime_export(dev, obj, 0);
> +	dmabuf = dev->driver->gem_prime_export(obj, 0);
>  	if (IS_ERR(dmabuf))
>  		return PTR_ERR(dmabuf);
>  
> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> index 7bc4795319c4..ec1c638927b0 100644
> --- a/include/drm/drm_drv.h
> +++ b/include/drm/drm_drv.h
> @@ -584,8 +584,8 @@ struct drm_driver {
>  	 * Export hook for GEM drivers. Deprecated in favour of
>  	 * &drm_gem_object_funcs.export.
>  	 */
> -	struct dma_buf * (*gem_prime_export)(struct drm_device *dev,
> -				struct drm_gem_object *obj, int flags);
> +	struct dma_buf * (*gem_prime_export)(struct drm_gem_object *obj,
> +					     int flags);
>  	/**
>  	 * @gem_prime_import:
>  	 *
> diff --git a/include/drm/drm_prime.h b/include/drm/drm_prime.h
> index ee32b07f3eb0..d89311b822d5 100644
> --- a/include/drm/drm_prime.h
> +++ b/include/drm/drm_prime.h
> @@ -91,8 +91,7 @@ int drm_gem_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma);
>  int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct vm_area_struct *vma);
>  
>  struct sg_table *drm_prime_pages_to_sg(struct page **pages, unsigned int nr_pages);
> -struct dma_buf *drm_gem_prime_export(struct drm_device *dev,
> -				     struct drm_gem_object *obj,
> +struct dma_buf *drm_gem_prime_export(struct drm_gem_object *obj,
>  				     int flags);
>  
>  /* helper functions for importing */
> -- 
> 2.20.1
> 

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


More information about the Intel-gfx mailing list