diff mbox

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

Message ID 1305235044-9159-16-git-send-email-chris@chris-wilson.co.uk
State New, archived
Headers show

Commit Message

Chris Wilson May 12, 2011, 9:17 p.m. UTC
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Comments

Keith Packard May 13, 2011, 1:17 a.m. UTC | #1
On Thu, 12 May 2011 22:17:23 +0100, Chris Wilson <chris@chris-wilson.co.uk> wrote:

> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Can you justify this change with performance data?
diff mbox

Patch

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);