[PATCH v2] Remove custom dumb_map_offset implementations in i915 driver
From: Dipam Turkar
Date: Fri Nov 10 2023 - 14:50:03 EST
Making i915 use drm_gem_create_mmap_offset() instead of its custom
implementations for associating GEM object with a fake offset.
Signed-off-by: Dipam Turkar <dipamt1729@xxxxxxxxx>
---
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),
--
2.34.1