[Intel-gfx] [PATCH 15/16] drm/i915: Convert partial to full CPU read domain if we touch every page

Chris Wilson chris at chris-wilson.co.uk
Thu May 12 23:17:23 CEST 2011


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

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index afdbbd9..b92e8ea 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3206,7 +3206,9 @@ i915_gem_object_set_cpu_read_domain_range(struct drm_i915_gem_object *obj,
 	uint32_t old_read_domains;
 	int i, ret;
 
-	if (offset == 0 && size == obj->base.size)
+	/* If we touch all pages, just move the bo entirely to the CPU. */
+	if ((offset & PAGE_MASK) == 0 &&
+	    ALIGN(offset+size, PAGE_SIZE) == obj->base.size)
 		return i915_gem_object_set_to_cpu_domain(obj, 0);
 
 	ret = i915_gem_object_flush_gpu_write_domain(obj);
-- 
1.7.5.1




More information about the Intel-gfx mailing list