diff mbox series

drm/i915: Use the i915_vma_flush_writes helper

Message ID 20230721130741.1306563-1-tvrtko.ursulin@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Use the i915_vma_flush_writes helper | expand

Commit Message

Tvrtko Ursulin July 21, 2023, 1:07 p.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

We can use the existing helper in flush_write_domain() and save some lines
of code.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_domain.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Sripada, Radhakrishna July 21, 2023, 3:53 p.m. UTC | #1
> -----Original Message-----
> From: dri-devel <dri-devel-bounces@lists.freedesktop.org> On Behalf Of Tvrtko
> Ursulin
> Sent: Friday, July 21, 2023 6:08 AM
> To: Intel-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org
> Cc: Ursulin, Tvrtko <tvrtko.ursulin@intel.com>
> Subject: [PATCH] drm/i915: Use the i915_vma_flush_writes helper
> 
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> We can use the existing helper in flush_write_domain() and save some lines
> of code.
> 
LGTM,
Radhakrishna Sripada <radhakrishna.sripada@intel.com>

--Radhakrishna(RK) Sripada
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>  drivers/gpu/drm/i915/gem/i915_gem_domain.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_domain.c
> b/drivers/gpu/drm/i915/gem/i915_gem_domain.c
> index dfaaa8b66ac3..ffddec1d2a76 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_domain.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_domain.c
> @@ -68,10 +68,8 @@ flush_write_domain(struct drm_i915_gem_object *obj,
> unsigned int flush_domains)
>  	switch (obj->write_domain) {
>  	case I915_GEM_DOMAIN_GTT:
>  		spin_lock(&obj->vma.lock);
> -		for_each_ggtt_vma(vma, obj) {
> -			if (i915_vma_unset_ggtt_write(vma))
> -				intel_gt_flush_ggtt_writes(vma->vm->gt);
> -		}
> +		for_each_ggtt_vma(vma, obj)
> +			i915_vma_flush_writes(vma);
>  		spin_unlock(&obj->vma.lock);
> 
>  		i915_gem_object_flush_frontbuffer(obj, ORIGIN_CPU);
> --
> 2.39.2
Andi Shyti July 25, 2023, 1:29 p.m. UTC | #2
Hi Tvrtko,

> --- a/drivers/gpu/drm/i915/gem/i915_gem_domain.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_domain.c
> @@ -68,10 +68,8 @@ flush_write_domain(struct drm_i915_gem_object *obj, unsigned int flush_domains)
>  	switch (obj->write_domain) {
>  	case I915_GEM_DOMAIN_GTT:
>  		spin_lock(&obj->vma.lock);
> -		for_each_ggtt_vma(vma, obj) {
> -			if (i915_vma_unset_ggtt_write(vma))
> -				intel_gt_flush_ggtt_writes(vma->vm->gt);
> -		}
> +		for_each_ggtt_vma(vma, obj)
> +			i915_vma_flush_writes(vma);

yes, that's some duplicated code removed here! Thanks! I believe
I'm in time to add my:

Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> 

Andi

>  		spin_unlock(&obj->vma.lock);
>  
>  		i915_gem_object_flush_frontbuffer(obj, ORIGIN_CPU);
> -- 
> 2.39.2
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_domain.c b/drivers/gpu/drm/i915/gem/i915_gem_domain.c
index dfaaa8b66ac3..ffddec1d2a76 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_domain.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_domain.c
@@ -68,10 +68,8 @@  flush_write_domain(struct drm_i915_gem_object *obj, unsigned int flush_domains)
 	switch (obj->write_domain) {
 	case I915_GEM_DOMAIN_GTT:
 		spin_lock(&obj->vma.lock);
-		for_each_ggtt_vma(vma, obj) {
-			if (i915_vma_unset_ggtt_write(vma))
-				intel_gt_flush_ggtt_writes(vma->vm->gt);
-		}
+		for_each_ggtt_vma(vma, obj)
+			i915_vma_flush_writes(vma);
 		spin_unlock(&obj->vma.lock);
 
 		i915_gem_object_flush_frontbuffer(obj, ORIGIN_CPU);