[Intel-gfx] [PATCH] drm/i915: Do an initial lockless wait for render completion before pread/pwrite

Chris Wilson chris at chris-wilson.co.uk
Sun Dec 16 18:51:55 CET 2012


Before performing the domain transition for pread/pwrite, and so a locked
completion if still required, wait for any pending rendering locklessly.
This should reduce contention when reading back results from the GPU, for
example.

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

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index a831641..447ad9d 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -599,6 +599,10 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data,
 
 	trace_i915_gem_object_pread(obj, args->offset, args->size);
 
+	ret = i915_gem_object_wait_rendering__nonblocking(obj, true);
+	if (ret)
+		goto out;
+
 	ret = i915_gem_shmem_pread(dev, obj, args, file);
 
 out:
@@ -1001,6 +1005,10 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
 		goto out;
 	}
 
+	ret = i915_gem_object_wait_rendering__nonblocking(obj, false);
+	if (ret)
+		goto out;
+
 	if (obj->cache_level == I915_CACHE_NONE &&
 	    obj->tiling_mode == I915_TILING_NONE &&
 	    obj->base.write_domain != I915_GEM_DOMAIN_CPU) {
-- 
1.7.10.4




More information about the Intel-gfx mailing list