From: Chris Wilson <ch...@chris-wilson.co.uk>

Rely on the GPU snooping into the CPU cache for appropriately bound
objects on MI_FLUSH. Or perhaps one day we will have a cache-coherent
CPU/GPU package...

Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <e...@anholt.net>
---
 drivers/gpu/drm/i915/i915_gem.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

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);
-- 
1.7.4.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to