diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-08-18 17:16:56 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-08-18 22:36:48 +0100 |
commit | 9d80841ea4c9df420da3f9a61a819d09a03f2161 (patch) | |
tree | 51cd7c74bc0d94dd37cac9b2fbd0f8d9107894df | |
parent | 05a20d098db1e3318228e7c281cd9b2d3d25f12b (diff) | |
download | linux-9d80841ea4c9df420da3f9a61a819d09a03f2161.tar.bz2 |
drm/i915: Allow ringbuffers to be bound anywhere
Now that we have WC vmapping available, we can bind our rings anywhere
in the GGTT and do not need to restrict them to the mappable region.
Except for stolen objects, for which direct access is verbatim and we
must use the mappable aperture.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20160818161718.27187-17-chris@chris-wilson.co.uk
-rw-r--r-- | drivers/gpu/drm/i915/intel_ringbuffer.c | 15 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_ringbuffer.h | 1 |
2 files changed, 8 insertions, 8 deletions
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index 12703ea27259..21bfc69e9dc6 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c @@ -1892,17 +1892,20 @@ int intel_ring_pin(struct intel_ring *ring) { /* Ring wraparound at offset 0 sometimes hangs. No idea why. */ unsigned int flags = PIN_GLOBAL | PIN_OFFSET_BIAS | 4096; + enum i915_map_type map; struct i915_vma *vma = ring->vma; void *addr; int ret; GEM_BUG_ON(ring->vaddr); - if (ring->needs_iomap) + map = HAS_LLC(ring->engine->i915) ? I915_MAP_WB : I915_MAP_WC; + + if (vma->obj->stolen) flags |= PIN_MAPPABLE; if (!(vma->flags & I915_VMA_GLOBAL_BIND)) { - if (flags & PIN_MAPPABLE) + if (flags & PIN_MAPPABLE || map == I915_MAP_WC) ret = i915_gem_object_set_to_gtt_domain(vma->obj, true); else ret = i915_gem_object_set_to_cpu_domain(vma->obj, true); @@ -1914,10 +1917,10 @@ int intel_ring_pin(struct intel_ring *ring) if (unlikely(ret)) return ret; - if (flags & PIN_MAPPABLE) + if (i915_vma_is_map_and_fenceable(vma)) addr = (void __force *)i915_vma_pin_iomap(vma); else - addr = i915_gem_object_pin_map(vma->obj, I915_MAP_WB); + addr = i915_gem_object_pin_map(vma->obj, map); if (IS_ERR(addr)) goto err; @@ -1934,7 +1937,7 @@ void intel_ring_unpin(struct intel_ring *ring) GEM_BUG_ON(!ring->vma); GEM_BUG_ON(!ring->vaddr); - if (ring->needs_iomap) + if (i915_vma_is_map_and_fenceable(ring->vma)) i915_vma_unpin_iomap(ring->vma); else i915_gem_object_unpin_map(ring->vma->obj); @@ -2005,8 +2008,6 @@ intel_engine_create_ring(struct intel_engine_cs *engine, int size) return ERR_CAST(vma); } ring->vma = vma; - if (!HAS_LLC(engine->i915) || vma->obj->stolen) - ring->needs_iomap = true; list_add(&ring->link, &engine->buffers); return ring; diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h index 86612d502c65..84aea549de5d 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.h +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h @@ -96,7 +96,6 @@ struct intel_ring { int space; int size; int effective_size; - bool needs_iomap; /** We track the position of the requests in the ring buffer, and * when each is retired we increment last_retired_head as the GPU |