[PATCH v2] Remove custom dumb_map_offset implementations in i915 driver

Jani Nikula jani.nikula at linux.intel.com
Mon Nov 13 17:53:01 UTC 2023


On Sat, 11 Nov 2023, Dipam Turkar <dipamt1729 at gmail.com> wrote:
> Making i915 use drm_gem_create_mmap_offset() instead of its custom
> implementations for associating GEM object with a fake offset.

It would probably help a lot if your commit messages explained what you
are trying to achieve and, especially, why. This only describes the
patch in English.

BR,
Jani.

>
> Signed-off-by: Dipam Turkar <dipamt1729 at gmail.com>
> ---
>  drivers/gpu/drm/i915/gem/i915_gem_mman.c | 21 ---------------------
>  drivers/gpu/drm/i915/gem/i915_gem_mman.h |  4 ----
>  drivers/gpu/drm/i915/i915_driver.c       |  3 ++-
>  3 files changed, 2 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
> index aa4d842d4c5a..71d621a1f249 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_mman.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
> @@ -771,27 +771,6 @@ __assign_mmap_offset_handle(struct drm_file *file,
>  	return err;
>  }
>  
> -int
> -i915_gem_dumb_mmap_offset(struct drm_file *file,
> -			  struct drm_device *dev,
> -			  u32 handle,
> -			  u64 *offset)
> -{
> -	struct drm_i915_private *i915 = to_i915(dev);
> -	enum i915_mmap_type mmap_type;
> -
> -	if (HAS_LMEM(to_i915(dev)))
> -		mmap_type = I915_MMAP_TYPE_FIXED;
> -	else if (pat_enabled())
> -		mmap_type = I915_MMAP_TYPE_WC;
> -	else if (!i915_ggtt_has_aperture(to_gt(i915)->ggtt))
> -		return -ENODEV;
> -	else
> -		mmap_type = I915_MMAP_TYPE_GTT;
> -
> -	return __assign_mmap_offset_handle(file, handle, mmap_type, offset);
> -}
> -
>  /**
>   * i915_gem_mmap_offset_ioctl - prepare an object for GTT mmap'ing
>   * @dev: DRM device
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_mman.h b/drivers/gpu/drm/i915/gem/i915_gem_mman.h
> index 196417fd0f5c..253435795caf 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_mman.h
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.h
> @@ -20,10 +20,6 @@ struct mutex;
>  int i915_gem_mmap_gtt_version(void);
>  int i915_gem_mmap(struct file *filp, struct vm_area_struct *vma);
>  
> -int i915_gem_dumb_mmap_offset(struct drm_file *file_priv,
> -			      struct drm_device *dev,
> -			      u32 handle, u64 *offset);
> -
>  void __i915_gem_object_release_mmap_gtt(struct drm_i915_gem_object *obj);
>  void i915_gem_object_release_mmap_gtt(struct drm_i915_gem_object *obj);
>  
> diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
> index d50347e5773a..48d7e53c49d6 100644
> --- a/drivers/gpu/drm/i915/i915_driver.c
> +++ b/drivers/gpu/drm/i915/i915_driver.c
> @@ -42,6 +42,7 @@
>  #include <drm/drm_aperture.h>
>  #include <drm/drm_atomic_helper.h>
>  #include <drm/drm_ioctl.h>
> +#include <drm/drm_gem.h>
>  #include <drm/drm_managed.h>
>  #include <drm/drm_probe_helper.h>
>  
> @@ -1826,7 +1827,7 @@ static const struct drm_driver i915_drm_driver = {
>  	.gem_prime_import = i915_gem_prime_import,
>  
>  	.dumb_create = i915_gem_dumb_create,
> -	.dumb_map_offset = i915_gem_dumb_mmap_offset,
> +	.dumb_map_offset = drm_gem_dumb_map_offset,
>  
>  	.ioctls = i915_ioctls,
>  	.num_ioctls = ARRAY_SIZE(i915_ioctls),

-- 
Jani Nikula, Intel


More information about the dri-devel mailing list