[PATCH 8/8] lift i915_gem_object_can_bypass_llc restriction
Tvrtko Ursulin
tvrtko.ursulin at linux.intel.com
Thu Jul 27 08:34:36 UTC 2023
From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
drivers/gpu/drm/i915/gem/i915_gem_object.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.c b/drivers/gpu/drm/i915/gem/i915_gem_object.c
index 1c2ce69d0b99..1b48cf8cc119 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_object.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_object.c
@@ -217,12 +217,6 @@ bool i915_gem_object_can_bypass_llc(struct drm_i915_gem_object *obj)
if (!(obj->flags & I915_BO_ALLOC_USER))
return false;
- /*
- * Always flush cache for UMD objects at creation time.
- */
- if (obj->pat_set_by_user)
- return true;
-
/*
* EHL and JSL add the 'Bypass LLC' MOCS entry, which should make it
* possible for userspace to bypass the GTT caching bits set by the
@@ -235,7 +229,17 @@ bool i915_gem_object_can_bypass_llc(struct drm_i915_gem_object *obj)
* it, but since i915 takes the stance of always zeroing memory before
* handing it to userspace, we need to prevent this.
*/
- return IS_JSL_EHL(i915);
+ if (IS_JSL_EHL(i915))
+ return true;
+
+ /*
+ * Any caching mode where writes via CPU cache are not coherent with
+ * the GPU needs explicit flushing to ensure GPU can not see stale data.
+ */
+ if (!(obj->cache_coherent & I915_BO_CACHE_COHERENT_FOR_WRITE))
+ return true;
+
+ return false;
}
static void i915_gem_close_object(struct drm_gem_object *gem, struct drm_file *file)
--
2.39.2
More information about the Intel-gfx-trybot
mailing list