public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Daniel Vetter <daniel.vetter@intel.com>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 2/2] drm/i915: Remove open-coded callers of flush_cpu_write_domain
Date: Wed, 21 Jan 2015 16:12:07 +0200	[thread overview]
Message-ID: <20150121141207.GL19354@intel.com> (raw)
In-Reply-To: <1421848429-25761-2-git-send-email-daniel.vetter@ffwll.ch>

On Wed, Jan 21, 2015 at 02:53:49PM +0100, Daniel Vetter wrote:
> Both places check the cpu domain and through some indirection
> obj->pin_display and whether cpu access is coherent. And then flush
> both cpu caches and the chipset cache. Which is what
> flush_cpu_write_domain does.
> 
> Only difference is that on top we get a tracepoint, frontbuffer
> tracking and and domain tracking updates. Which doesn't matter since
> both paths are slowpaths.
> 
> So lets go with more shared code for clearer idioms.
> 
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Daniel Vetter <daniel.vetter@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 783d1040bf83..b48c39230b80 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1019,11 +1019,8 @@ out:
>  		 * cachelines in-line while writing and the object moved
>  		 * out of the cpu write domain while we've dropped the lock.
>  		 */
> -		if (!needs_clflush_after &&
> -		    obj->base.write_domain != I915_GEM_DOMAIN_CPU) {
> -			if (i915_gem_clflush_object(obj, obj->pin_display))
> -				i915_gem_chipset_flush(dev);
> -		}
> +		if (!needs_clflush_after)
> +			i915_gem_object_flush_cpu_write_domain(obj);

Nack. You've just inverted the write domain check.

>  	}
>  
>  	if (needs_clflush_after)
> @@ -3825,12 +3822,8 @@ int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj,
>  		vma->node.color = cache_level;
>  	obj->cache_level = cache_level;
>  
> -	if (obj->cache_dirty &&
> -	    obj->base.write_domain != I915_GEM_DOMAIN_CPU &&
> -	    cpu_write_needs_clflush(obj)) {
> -		if (i915_gem_clflush_object(obj, true))
> -			i915_gem_chipset_flush(obj->base.dev);
> -	}
> +	if (obj->cache_dirty)
> +		i915_gem_object_flush_cpu_write_domain(obj);
>  
>  	return 0;
>  }
> -- 
> 2.1.4

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2015-01-21 14:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-21 13:53 [PATCH 1/2] drm/i915: Simplify flush_cpu_write_domain Daniel Vetter
2015-01-21 13:53 ` [PATCH 2/2] drm/i915: Remove open-coded callers of flush_cpu_write_domain Daniel Vetter
2015-01-21 14:08   ` Chris Wilson
2015-01-21 14:12   ` Ville Syrjälä [this message]
2015-01-21 14:55     ` Daniel Vetter
2015-01-21 15:02       ` Ville Syrjälä
2015-01-21 14:03 ` [PATCH 1/2] drm/i915: Simplify flush_cpu_write_domain Chris Wilson
2015-01-21 14:08 ` Ville Syrjälä
2015-01-21 14:13   ` Daniel Vetter
2015-01-21 14:21     ` Ville Syrjälä
2015-01-21 14:53       ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150121141207.GL19354@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox