Skip to content

Commit 8a612b2

Browse files
Jonathan-CavittAndi Shyti
authored andcommitted
drm/i915/gt: Simplify shmem_create_from_object map_type selection
The object pin created for shmem_create_from_object is just a single use mapping with the sole purpose of reading the contents of the whole object in bulk. And the whole source object is also even a throw-away. Ergo, the additional logic required by i915_coherent_map_type can be safely dropped and simplified. Suggested-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230801153242.2445478-2-jonathan.cavitt@intel.com Link: https://patchwork.freedesktop.org/patch/msgid/20230807121957.598420-2-andi.shyti@linux.intel.com
1 parent 9f77173 commit 8a612b2

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/gpu/drm/i915/gt/shmem_utils.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ struct file *shmem_create_from_data(const char *name, void *data, size_t len)
3333

3434
struct file *shmem_create_from_object(struct drm_i915_gem_object *obj)
3535
{
36-
struct drm_i915_private *i915 = to_i915(obj->base.dev);
3736
enum i915_map_type map_type;
3837
struct file *file;
3938
void *ptr;
@@ -44,7 +43,7 @@ struct file *shmem_create_from_object(struct drm_i915_gem_object *obj)
4443
return file;
4544
}
4645

47-
map_type = i915_coherent_map_type(i915, obj, true);
46+
map_type = i915_gem_object_is_lmem(obj) ? I915_MAP_WC : I915_MAP_WB;
4847
ptr = i915_gem_object_pin_map_unlocked(obj, map_type);
4948
if (IS_ERR(ptr))
5049
return ERR_CAST(ptr);

0 commit comments

Comments
 (0)