[PATCH 49/49] drm/i915/gem: Ignore domain flushing for an unwritten object

Chris Wilson chris at chris-wilson.co.uk
Thu Jul 30 13:26:06 UTC 2020


Skip the locking around flush-if-display if we are confident that the
object has not been written to.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/gem/i915_gem_domain.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_domain.c b/drivers/gpu/drm/i915/gem/i915_gem_domain.c
index 30e4b163588b..6da805d2b732 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_domain.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_domain.c
@@ -32,8 +32,12 @@ void i915_gem_object_flush_if_display(struct drm_i915_gem_object *obj)
 	if (!i915_gem_object_is_framebuffer(obj))
 		return;
 
+	if (!READ_ONCE(obj->write_domain))
+		return;
+
 	i915_gem_object_lock(obj);
-	__i915_gem_object_flush_for_display(obj);
+	if (obj->write_domain)
+		__i915_gem_object_flush_for_display(obj);
 	i915_gem_object_unlock(obj);
 }
 
-- 
2.20.1



More information about the Intel-gfx-trybot mailing list