[PATCH 2/2] drm/i915: optimize the shmem_pwrite slowpath handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since we drop dev->struct_mutex when going through the slowpath, the
object might have been moved out of the cpu domain. Hence we need to
clflush the entire object to ensure that after the ioctl returns,
everything is coherent again (interwoven writes are ill-defined
anyway).

But we only need to do this if we start in the cpu domain and the
object requires flushing for coherency. So don't do the flushing if
the object is coherent anyway or if we've done in-line clfushing
already.

Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 drivers/gpu/drm/i915/i915_gem.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index eaaf095..feb0b0c 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -831,8 +831,9 @@ out:
 
 	if (hit_slowpath) {
 		/* Fixup: Flush dirty cachelines in case the object isn't in the
-		 * cpu write domain anymore. */
-		if (obj->base.write_domain != I915_GEM_DOMAIN_CPU) {
+		 * cpu write domain anymore, and we haven't flushed it manually. */
+		if (obj->base.write_domain != I915_GEM_DOMAIN_CPU &&
+		    !needs_clflush_after && obj->cache_level == I915_CACHE_NONE) {
 			i915_gem_clflush_object(obj);
 			i915_gem_chipset_flush(dev);
 		}
-- 
1.7.10.4



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux