Message ID | 1302640318-23165-18-git-send-email-chris@chris-wilson.co.uk (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Tue, Apr 12, 2011 at 09:31:45PM +0100, Chris Wilson wrote: > + /* If the GPU is snooping the contents of the CPU cache, > + * we do not need to clear the CPU cache lines. Instead we need > + * to be sure to flush/invalidate the RENDER cache when the contents > + * must be refreshed. > + */ The "Instead we need to be sure to flush the RENDER cache ..." is a bit confusing to me: There's no instead, we have to do this always when writing with the cpu. Besides this minor comment-nitpick it makes sense. Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
On Wed, 13 Apr 2011 18:04:38 +0200, Daniel Vetter <daniel@ffwll.ch> wrote: > On Tue, Apr 12, 2011 at 09:31:45PM +0100, Chris Wilson wrote: > > + /* If the GPU is snooping the contents of the CPU cache, > > + * we do not need to clear the CPU cache lines. Instead we need > > + * to be sure to flush/invalidate the RENDER cache when the contents > > + * must be refreshed. > > + */ > > The "Instead we need to be sure to flush the RENDER cache ..." is a bit > confusing to me: There's no instead, we have to do this always when > writing with the cpu. Besides this minor comment-nitpick it makes sense. I changed the comment to: /* If the GPU is snooping the contents of the CPU cache, * we do not need to manually clear the CPU cache lines. Instead, * the caches are only snooped when the render cache is * flushed/invalidated. As we always have to emit invalidations * and flushes when moving into and out of the RENDER domain, correct * snooping behaviour occurs naturally as the result of our domain * tracking. */ -Chris
On Wed, Apr 13, 2011 at 06:34:57PM +0100, Chris Wilson wrote: > I changed the comment to: > > /* If the GPU is snooping the contents of the CPU cache, > * we do not need to manually clear the CPU cache lines. Instead, > * the caches are only snooped when the render cache is > * flushed/invalidated. As we always have to emit invalidations > * and flushes when moving into and out of the RENDER domain, correct > * snooping behaviour occurs naturally as the result of our domain > * tracking. > */ Perfect!
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 264bec8..fa483d8 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -2878,6 +2878,14 @@ i915_gem_clflush_object(struct drm_i915_gem_object *obj) if (obj->pages == NULL) return; + /* If the GPU is snooping the contents of the CPU cache, + * we do not need to clear the CPU cache lines. Instead we need + * to be sure to flush/invalidate the RENDER cache when the contents + * must be refreshed. + */ + if (obj->cache_level != I915_CACHE_NONE) + return; + trace_i915_gem_object_clflush(obj); drm_clflush_pages(obj->pages, obj->base.size / PAGE_SIZE);