[Intel-gfx] [PATCH 7/8] drm/i915: Tidy up flush cpu/gtt write domains

Joonas Lahtinen joonas.lahtinen at linux.intel.com
Thu Jun 9 13:12:02 UTC 2016


On to, 2016-06-09 at 12:29 +0100, Chris Wilson wrote:
> Since we know the write domain, we can drop the local variable and make
> the code look a tiny bit simpler.
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

Reviewed-by: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>

> ---
>  drivers/gpu/drm/i915/i915_gem.c | 15 ++++-----------
>  1 file changed, 4 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 8c90b6a12d45..45f878350d66 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -2913,7 +2913,6 @@ static void
>  i915_gem_object_flush_gtt_write_domain(struct drm_i915_gem_object *obj)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(obj->base.dev);
> -	uint32_t old_write_domain;
>  
>  	if (obj->base.write_domain != I915_GEM_DOMAIN_GTT)
>  		return;
> @@ -2937,36 +2936,30 @@ i915_gem_object_flush_gtt_write_domain(struct drm_i915_gem_object *obj)
>  	if (INTEL_INFO(dev_priv)->gen >= 6 && !HAS_LLC(dev_priv))
>  		POSTING_READ(RING_ACTHD(dev_priv->engine[RCS].mmio_base));
>  
> -	old_write_domain = obj->base.write_domain;
> -	obj->base.write_domain = 0;
> -
>  	intel_fb_obj_flush(obj, false, ORIGIN_GTT);
>  
> +	obj->base.write_domain = 0;
>  	trace_i915_gem_object_change_domain(obj,
>  					    obj->base.read_domains,
> -					    old_write_domain);
> +					    I915_GEM_DOMAIN_GTT);
>  }
>  
>  /** Flushes the CPU write domain for the object if it's dirty. */
>  static void
>  i915_gem_object_flush_cpu_write_domain(struct drm_i915_gem_object *obj)
>  {
> -	uint32_t old_write_domain;
> -
>  	if (obj->base.write_domain != I915_GEM_DOMAIN_CPU)
>  		return;
>  
>  	if (i915_gem_clflush_object(obj, obj->pin_display))
>  		i915_gem_chipset_flush(to_i915(obj->base.dev));
>  
> -	old_write_domain = obj->base.write_domain;
> -	obj->base.write_domain = 0;
> -
>  	intel_fb_obj_flush(obj, false, ORIGIN_CPU);
>  
> +	obj->base.write_domain = 0;
>  	trace_i915_gem_object_change_domain(obj,
>  					    obj->base.read_domains,
> -					    old_write_domain);
> +					    I915_GEM_DOMAIN_CPU);
>  }
>  
>  /**
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation


More information about the Intel-gfx mailing list