[Intel-gfx] [PATCH 1/3] drm/i915/gt: Simplify shmem_create_from_object map_type selection

2023-08-01 Thread Jonathan Cavitt
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 
Signed-off-by: Jonathan Cavitt 
Reviewed-by: Tvrtko Ursulin 
Reviewed-by: Andi Shyti 
---
 drivers/gpu/drm/i915/gt/shmem_utils.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/shmem_utils.c 
b/drivers/gpu/drm/i915/gt/shmem_utils.c
index 449c9ed44382..bccc3a1200bc 100644
--- a/drivers/gpu/drm/i915/gt/shmem_utils.c
+++ b/drivers/gpu/drm/i915/gt/shmem_utils.c
@@ -33,7 +33,6 @@ struct file *shmem_create_from_data(const char *name, void 
*data, size_t len)
 
 struct file *shmem_create_from_object(struct drm_i915_gem_object *obj)
 {
-   struct drm_i915_private *i915 = to_i915(obj->base.dev);
enum i915_map_type map_type;
struct file *file;
void *ptr;
@@ -44,7 +43,7 @@ struct file *shmem_create_from_object(struct 
drm_i915_gem_object *obj)
return file;
}
 
-   map_type = i915_coherent_map_type(i915, obj, true);
+   map_type = i915_gem_object_is_lmem(obj) ? I915_MAP_WC : I915_MAP_WB;
ptr = i915_gem_object_pin_map_unlocked(obj, map_type);
if (IS_ERR(ptr))
return ERR_CAST(ptr);
-- 
2.25.1



Re: [Intel-gfx] [PATCH 1/3] drm/i915/gt: Simplify shmem_create_from_object map_type selection

2023-07-27 Thread Andi Shyti
Hi Jonathan,

On Wed, Jul 26, 2023 at 08:53:54AM -0700, Jonathan Cavitt wrote:
> 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.
> 
> Signed-off-by: Jonathan Cavitt 
> Suggested-by: Tvrtko Ursulin 
> ---
>  drivers/gpu/drm/i915/gt/shmem_utils.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/shmem_utils.c 
> b/drivers/gpu/drm/i915/gt/shmem_utils.c
> index 449c9ed44382..bccc3a1200bc 100644
> --- a/drivers/gpu/drm/i915/gt/shmem_utils.c
> +++ b/drivers/gpu/drm/i915/gt/shmem_utils.c
> @@ -33,7 +33,6 @@ struct file *shmem_create_from_data(const char *name, void 
> *data, size_t len)
>  
>  struct file *shmem_create_from_object(struct drm_i915_gem_object *obj)
>  {
> - struct drm_i915_private *i915 = to_i915(obj->base.dev);
>   enum i915_map_type map_type;
>   struct file *file;
>   void *ptr;
> @@ -44,7 +43,7 @@ struct file *shmem_create_from_object(struct 
> drm_i915_gem_object *obj)
>   return file;
>   }
>  
> - map_type = i915_coherent_map_type(i915, obj, true);
> + map_type = i915_gem_object_is_lmem(obj) ? I915_MAP_WC : I915_MAP_WB;
>   ptr = i915_gem_object_pin_map_unlocked(obj, map_type);
>   if (IS_ERR(ptr))
>   return ERR_CAST(ptr);

Reviewed-by: Andi Shyti  

Thanks,
Andi

[ Nitpick section ]

Next time, please:

 1. Number your patches.
 2. Add a changelog (either in the cover letter (which is best
for multi-patch series) or after the '---' section (for
single patches)).
 3. Don't forget the previous tags, e.g. Acked-by Fei.


Re: [Intel-gfx] [PATCH 1/3] drm/i915/gt: Simplify shmem_create_from_object map_type selection

2023-07-27 Thread Tvrtko Ursulin



On 26/07/2023 16:53, Jonathan Cavitt wrote:

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.

Signed-off-by: Jonathan Cavitt 
Suggested-by: Tvrtko Ursulin 
---
  drivers/gpu/drm/i915/gt/shmem_utils.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/shmem_utils.c 
b/drivers/gpu/drm/i915/gt/shmem_utils.c
index 449c9ed44382..bccc3a1200bc 100644
--- a/drivers/gpu/drm/i915/gt/shmem_utils.c
+++ b/drivers/gpu/drm/i915/gt/shmem_utils.c
@@ -33,7 +33,6 @@ struct file *shmem_create_from_data(const char *name, void 
*data, size_t len)
  
  struct file *shmem_create_from_object(struct drm_i915_gem_object *obj)

  {
-   struct drm_i915_private *i915 = to_i915(obj->base.dev);
enum i915_map_type map_type;
struct file *file;
void *ptr;
@@ -44,7 +43,7 @@ struct file *shmem_create_from_object(struct 
drm_i915_gem_object *obj)
return file;
}
  
-	map_type = i915_coherent_map_type(i915, obj, true);

+   map_type = i915_gem_object_is_lmem(obj) ? I915_MAP_WC : I915_MAP_WB;
ptr = i915_gem_object_pin_map_unlocked(obj, map_type);
if (IS_ERR(ptr))
return ERR_CAST(ptr);


Reviewed-by: Tvrtko Ursulin 

Regards,

Tvrtko


[Intel-gfx] [PATCH 1/3] drm/i915/gt: Simplify shmem_create_from_object map_type selection

2023-07-26 Thread Jonathan Cavitt
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.

Signed-off-by: Jonathan Cavitt 
Suggested-by: Tvrtko Ursulin 
---
 drivers/gpu/drm/i915/gt/shmem_utils.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/shmem_utils.c 
b/drivers/gpu/drm/i915/gt/shmem_utils.c
index 449c9ed44382..bccc3a1200bc 100644
--- a/drivers/gpu/drm/i915/gt/shmem_utils.c
+++ b/drivers/gpu/drm/i915/gt/shmem_utils.c
@@ -33,7 +33,6 @@ struct file *shmem_create_from_data(const char *name, void 
*data, size_t len)
 
 struct file *shmem_create_from_object(struct drm_i915_gem_object *obj)
 {
-   struct drm_i915_private *i915 = to_i915(obj->base.dev);
enum i915_map_type map_type;
struct file *file;
void *ptr;
@@ -44,7 +43,7 @@ struct file *shmem_create_from_object(struct 
drm_i915_gem_object *obj)
return file;
}
 
-   map_type = i915_coherent_map_type(i915, obj, true);
+   map_type = i915_gem_object_is_lmem(obj) ? I915_MAP_WC : I915_MAP_WB;
ptr = i915_gem_object_pin_map_unlocked(obj, map_type);
if (IS_ERR(ptr))
return ERR_CAST(ptr);
-- 
2.25.1