From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
intel-gfx@lists.freedesktop.org, Ben Widawsky <ben@bwidawsk.net>
Subject: Re: [PATCH 2/2] drm/i915: Use Write-Through cacheing for the display plane on Iris
Date: Tue, 30 Jul 2013 21:01:22 +0300 [thread overview]
Message-ID: <20130730180122.GW5004@intel.com> (raw)
In-Reply-To: <20130730173615.GA6785@cantiga.alporthouse.com>
On Tue, Jul 30, 2013 at 06:36:15PM +0100, Chris Wilson wrote:
> On Tue, Jul 30, 2013 at 08:19:28PM +0300, Ville Syrjälä wrote:
> > On Tue, Jul 30, 2013 at 05:58:36PM +0100, Chris Wilson wrote:
> > > Haswell GT3e has the unique feature of supporting Write-Through cacheing
> > > of objects within the eLLC. The purpose of this is to enable the display
> > > plane to remain coherent whilst objects lie resident in the eLLC - so
> > > that we in theory get the best of both worlds, perfect display and fast
> > > access.
> >
> > The description here talks about eLLC only, but you set the PTE for
> > WT in LLC/eLLC both.
>
> s/eLLC/LLC/
>
> For some reason, I keep telling myself that it is a magic property of
> the eLLC otherwise why wouldn't they do it for all LLC!
>
> > > - ret = i915_gem_object_set_cache_level(obj, I915_CACHE_NONE);
> > > + ret = i915_gem_object_set_cache_level(obj,
> > > + HAS_WT(obj->base.dev) ? I915_CACHE_WT : I915_CACHE_NONE);
> >
> > Don't we need to tweak the write domain like we do for UC to make sure
> > already dirty lines get flushed from caches?
>
> You need to explicitly do the flush, which gets ugly.
Ah right, because i915_gem_clflush_object() checks the cache_level.
> I choose to ignore
> the problem as unlike the LLC -> UC transition, I haven't spotted any
> dirt. However, it doesn't look too bad if we replace it like so:
Hmm, and what about CPU access in general? CPU doesn't know about the
WT policy, so I'm assuming we'd need to flush after all CPU writes.
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index ac1b9cd..0e089e2 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -3362,27 +3362,32 @@ int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj,
> i915_gem_obj_ggtt_set_color(obj, cache_level);
> }
>
> - if (cache_level == I915_CACHE_NONE) {
> - u32 old_read_domains, old_write_domain;
> -
> + if (cache_level == I915_CACHE_NONE ||
> + cache_level == I915_CACHE_WT) {
> /* If we're coming from LLC cached, then we haven't
> * actually been tracking whether the data is in the
> * CPU cache or not, since we only allow one bit set
> * in obj->write_domain and have been skipping the clflushes.
> - * Just set it to the CPU cache for now.
> + * Do them now.
> */
> - WARN_ON(obj->base.write_domain & ~I915_GEM_DOMAIN_CPU);
> - WARN_ON(obj->base.read_domains & ~I915_GEM_DOMAIN_CPU);
> + if (obj->base.read_domains & I915_GEM_DOMAIN_CPU) {
> + u32 old_read_domains, old_write_domain;
>
> - old_read_domains = obj->base.read_domains;
> - old_write_domain = obj->base.write_domain;
> + BUG_ON(obj->pages == NULL);
>
> - obj->base.read_domains = I915_GEM_DOMAIN_CPU;
> - obj->base.write_domain = I915_GEM_DOMAIN_CPU;
> + trace_i915_gem_object_clflush(obj);
> + drm_clflush_sg(obj->pages);
>
> - trace_i915_gem_object_change_domain(obj,
> - old_read_domains,
> - old_write_domain);
> + old_read_domains = obj->base.read_domains;
> + old_write_domain = obj->base.write_domain;
> +
> + obj->base.read_domains &= ~I915_GEM_DOMAIN_CPU;
> + obj->base.write_domain &= ~I915_GEM_DOMAIN_CPU;
> +
> + trace_i915_gem_object_change_domain(obj,
> + old_read_domains,
> + old_write_domain);
> + }
> }
>
> obj->cache_level = cache_level;
>
> --
> Chris Wilson, Intel Open Source Technology Centre
--
Ville Syrjälä
Intel OTC
next prev parent reply other threads:[~2013-07-30 18:01 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-30 16:58 [PATCH 1/2] drm/i915: Use the same pte_encoding for ppgtt as for gtt Chris Wilson
2013-07-30 16:58 ` [PATCH 2/2] drm/i915: Use Write-Through cacheing for the display plane on Iris Chris Wilson
2013-07-30 17:19 ` Ville Syrjälä
2013-07-30 17:36 ` Chris Wilson
2013-07-30 18:01 ` Ville Syrjälä [this message]
2013-07-30 18:10 ` Chris Wilson
2013-07-30 18:29 ` Chris Wilson
2013-07-30 17:45 ` [PATCH] " Chris Wilson
2013-07-30 19:25 ` Chris Wilson
2013-07-31 13:16 ` Ville Syrjälä
2013-07-31 13:36 ` Chris Wilson
2013-07-31 15:16 ` Ville Syrjälä
2013-07-31 15:26 ` Chris Wilson
2013-07-31 15:54 ` Ville Syrjälä
2013-07-31 16:14 ` Chris Wilson
2013-07-30 17:39 ` [PATCH 2/2] " Kenneth Graunke
2013-07-30 17:39 ` [PATCH 1/2] drm/i915: Use the same pte_encoding for ppgtt as for gtt Kenneth Graunke
2013-07-30 18:04 ` [PATCH] " Chris Wilson
2013-07-31 7:42 ` Ben Widawsky
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=20130730180122.GW5004@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=ben@bwidawsk.net \
--cc=chris@chris-wilson.co.uk \
--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