diff mbox

[2/3] drm/i915: Use cpu relocations if the object is in the GTT but not mappable

Message ID 1345723973-22092-2-git-send-email-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson Aug. 23, 2012, 12:12 p.m. UTC
This prevents the case of unbinding the object in order to process the
relocations through the GTT and then rebinding it only to then proceed
to use cpu relocations as the object is now in the CPU write domain. By
choosing to use cpu relocations up front, we can therefore avoid the
rebind penalty.

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

Comments

Daniel Vetter Aug. 24, 2012, 12:29 a.m. UTC | #1
On Thu, Aug 23, 2012 at 01:12:52PM +0100, Chris Wilson wrote:
> This prevents the case of unbinding the object in order to process the
> relocations through the GTT and then rebinding it only to then proceed
> to use cpu relocations as the object is now in the CPU write domain. By
> choosing to use cpu relocations up front, we can therefore avoid the
> rebind penalty.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
lgtm, applied to dinq.
-Daniel
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 834a636..23aa324 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -95,6 +95,7 @@  eb_destroy(struct eb_objects *eb)
 static inline int use_cpu_reloc(struct drm_i915_gem_object *obj)
 {
 	return (obj->base.write_domain == I915_GEM_DOMAIN_CPU ||
+		!obj->map_and_fenceable ||
 		obj->cache_level != I915_CACHE_NONE);
 }