diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-08-18 12:16:56 -0400 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-08-18 17:36:48 -0400 |
commit | 9d80841ea4c9df420da3f9a61a819d09a03f2161 (patch) | |
tree | 51cd7c74bc0d94dd37cac9b2fbd0f8d9107894df /drivers/gpu | |
parent | 05a20d098db1e3318228e7c281cd9b2d3d25f12b (diff) |
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
Diffstat (limited to 'drivers/gpu')
-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) | |||
1892 | { | 1892 | { |
1893 | /* Ring wraparound at offset 0 sometimes hangs. No idea why. */ | 1893 | /* Ring wraparound at offset 0 sometimes hangs. No idea why. */ |
1894 | unsigned int flags = PIN_GLOBAL | PIN_OFFSET_BIAS | 4096; | 1894 | unsigned int flags = PIN_GLOBAL | PIN_OFFSET_BIAS | 4096; |
1895 | enum i915_map_type map; | ||
1895 | struct i915_vma *vma = ring->vma; | 1896 | struct i915_vma *vma = ring->vma; |
1896 | void *addr; | 1897 | void *addr; |
1897 | int ret; | 1898 | int ret; |
1898 | 1899 | ||
1899 | GEM_BUG_ON(ring->vaddr); | 1900 | GEM_BUG_ON(ring->vaddr); |
1900 | 1901 | ||
1901 | if (ring->needs_iomap) | 1902 | map = HAS_LLC(ring->engine->i915) ? I915_MAP_WB : I915_MAP_WC; |
1903 | |||
1904 | if (vma->obj->stolen) | ||
1902 | flags |= PIN_MAPPABLE; | 1905 | flags |= PIN_MAPPABLE; |
1903 | 1906 | ||
1904 | if (!(vma->flags & I915_VMA_GLOBAL_BIND)) { | 1907 | if (!(vma->flags & I915_VMA_GLOBAL_BIND)) { |
1905 | if (flags & PIN_MAPPABLE) | 1908 | if (flags & PIN_MAPPABLE || map == I915_MAP_WC) |
1906 | ret = i915_gem_object_set_to_gtt_domain(vma->obj, true); | 1909 | ret = i915_gem_object_set_to_gtt_domain(vma->obj, true); |
1907 | else | 1910 | else |
1908 | ret = i915_gem_object_set_to_cpu_domain(vma->obj, true); | 1911 | ret = i915_gem_object_set_to_cpu_domain(vma->obj, true); |
@@ -1914,10 +1917,10 @@ int intel_ring_pin(struct intel_ring *ring) | |||
1914 | if (unlikely(ret)) | 1917 | if (unlikely(ret)) |
1915 | return ret; | 1918 | return ret; |
1916 | 1919 | ||
1917 | if (flags & PIN_MAPPABLE) | 1920 | if (i915_vma_is_map_and_fenceable(vma)) |
1918 | addr = (void __force *)i915_vma_pin_iomap(vma); | 1921 | addr = (void __force *)i915_vma_pin_iomap(vma); |
1919 | else | 1922 | else |
1920 | addr = i915_gem_object_pin_map(vma->obj, I915_MAP_WB); | 1923 | addr = i915_gem_object_pin_map(vma->obj, map); |
1921 | if (IS_ERR(addr)) | 1924 | if (IS_ERR(addr)) |
1922 | goto err; | 1925 | goto err; |
1923 | 1926 | ||
@@ -1934,7 +1937,7 @@ void intel_ring_unpin(struct intel_ring *ring) | |||
1934 | GEM_BUG_ON(!ring->vma); | 1937 | GEM_BUG_ON(!ring->vma); |
1935 | GEM_BUG_ON(!ring->vaddr); | 1938 | GEM_BUG_ON(!ring->vaddr); |
1936 | 1939 | ||
1937 | if (ring->needs_iomap) | 1940 | if (i915_vma_is_map_and_fenceable(ring->vma)) |
1938 | i915_vma_unpin_iomap(ring->vma); | 1941 | i915_vma_unpin_iomap(ring->vma); |
1939 | else | 1942 | else |
1940 | i915_gem_object_unpin_map(ring->vma->obj); | 1943 | i915_gem_object_unpin_map(ring->vma->obj); |
@@ -2005,8 +2008,6 @@ intel_engine_create_ring(struct intel_engine_cs *engine, int size) | |||
2005 | return ERR_CAST(vma); | 2008 | return ERR_CAST(vma); |
2006 | } | 2009 | } |
2007 | ring->vma = vma; | 2010 | ring->vma = vma; |
2008 | if (!HAS_LLC(engine->i915) || vma->obj->stolen) | ||
2009 | ring->needs_iomap = true; | ||
2010 | 2011 | ||
2011 | list_add(&ring->link, &engine->buffers); | 2012 | list_add(&ring->link, &engine->buffers); |
2012 | return ring; | 2013 | 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 { | |||
96 | int space; | 96 | int space; |
97 | int size; | 97 | int size; |
98 | int effective_size; | 98 | int effective_size; |
99 | bool needs_iomap; | ||
100 | 99 | ||
101 | /** We track the position of the requests in the ring buffer, and | 100 | /** We track the position of the requests in the ring buffer, and |
102 | * when each is retired we increment last_retired_head as the GPU | 101 | * when each is retired we increment last_retired_head as the GPU |