aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-11-07 11:52:04 -0500
committerChris Wilson <chris@chris-wilson.co.uk>2016-11-07 15:54:39 -0500
commit7aa6ca61ee5546d74b76610894924cdb0d4a1af0 (patch)
treea109c41bbe5450e4199a6316625e0fc845d1e7ed
parent31ab49abde41c4056b17ca3d63456a62964834c0 (diff)
drm/i915: Mark CPU cache as dirty when used for rendering
On LLC, or even snooped, machines rendering via the GPU ends up in the CPU cache. This cacheline dirt also needs to be flushed to main memory when moving to an incoherent domain, such as the display's scanout engine. Mostly, this happens because either the object is marked as dirty from its first use or is avoided by setting the object into the display domain from the start. v2: Treat WT as not requiring a clflush prior to use on the display engine as well. Fixes: 0f71979ab7fb ("drm/i915: Performed deferred clflush inside set-cache-level") References: https://bugs.freedesktop.org/show_bug.cgi?id=95414 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Jani Nikula <jani.nikula@linux.intel.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: <stable@vger.kernel.org> # v4.0+ Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/20161107165204.7008-1-chris@chris-wilson.co.uk
-rw-r--r--drivers/gpu/drm/i915/i915_gem_execbuffer.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 322c580a739f..fb5b44339f71 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -1247,6 +1247,12 @@ i915_gem_validate_context(struct drm_device *dev, struct drm_file *file,
1247 return ctx; 1247 return ctx;
1248} 1248}
1249 1249
1250static bool gpu_write_needs_clflush(struct drm_i915_gem_object *obj)
1251{
1252 return !(obj->cache_level == I915_CACHE_NONE ||
1253 obj->cache_level == I915_CACHE_WT);
1254}
1255
1250void i915_vma_move_to_active(struct i915_vma *vma, 1256void i915_vma_move_to_active(struct i915_vma *vma,
1251 struct drm_i915_gem_request *req, 1257 struct drm_i915_gem_request *req,
1252 unsigned int flags) 1258 unsigned int flags)
@@ -1276,6 +1282,8 @@ void i915_vma_move_to_active(struct i915_vma *vma,
1276 1282
1277 /* update for the implicit flush after a batch */ 1283 /* update for the implicit flush after a batch */
1278 obj->base.write_domain &= ~I915_GEM_GPU_DOMAINS; 1284 obj->base.write_domain &= ~I915_GEM_GPU_DOMAINS;
1285 if (!obj->cache_dirty && gpu_write_needs_clflush(obj))
1286 obj->cache_dirty = true;
1279 } 1287 }
1280 1288
1281 if (flags & EXEC_OBJECT_NEEDS_FENCE) 1289 if (flags & EXEC_OBJECT_NEEDS_FENCE)