Lines Matching full:ring

14 unsigned int intel_ring_update_space(struct intel_ring *ring)  in intel_ring_update_space()  argument
18 space = __intel_ring_space(ring->head, ring->emit, ring->size); in intel_ring_update_space()
20 ring->space = space; in intel_ring_update_space()
24 void __intel_ring_pin(struct intel_ring *ring) in __intel_ring_pin() argument
26 GEM_BUG_ON(!atomic_read(&ring->pin_count)); in __intel_ring_pin()
27 atomic_inc(&ring->pin_count); in __intel_ring_pin()
30 int intel_ring_pin(struct intel_ring *ring, struct i915_gem_ww_ctx *ww) in intel_ring_pin() argument
32 struct i915_vma *vma = ring->vma; in intel_ring_pin()
37 if (atomic_fetch_inc(&ring->pin_count)) in intel_ring_pin()
40 /* Ring wraparound at offset 0 sometimes hangs. No idea why. */ in intel_ring_pin()
65 intel_ring_reset(ring, ring->emit); in intel_ring_pin()
67 ring->vaddr = addr; in intel_ring_pin()
73 atomic_dec(&ring->pin_count); in intel_ring_pin()
77 void intel_ring_reset(struct intel_ring *ring, u32 tail) in intel_ring_reset() argument
79 tail = intel_ring_wrap(ring, tail); in intel_ring_reset()
80 ring->tail = tail; in intel_ring_reset()
81 ring->head = tail; in intel_ring_reset()
82 ring->emit = tail; in intel_ring_reset()
83 intel_ring_update_space(ring); in intel_ring_reset()
86 void intel_ring_unpin(struct intel_ring *ring) in intel_ring_unpin() argument
88 struct i915_vma *vma = ring->vma; in intel_ring_unpin()
90 if (!atomic_dec_and_test(&ring->pin_count)) in intel_ring_unpin()
119 * Mark ring buffers as read-only from GPU side (so no stray overwrites) in create_ring_vma()
140 struct intel_ring *ring; in intel_engine_create_ring() local
146 ring = kzalloc(sizeof(*ring), GFP_KERNEL); in intel_engine_create_ring()
147 if (!ring) in intel_engine_create_ring()
150 kref_init(&ring->ref); in intel_engine_create_ring()
151 ring->size = size; in intel_engine_create_ring()
152 ring->wrap = BITS_PER_TYPE(ring->size) - ilog2(size); in intel_engine_create_ring()
159 ring->effective_size = size; in intel_engine_create_ring()
161 ring->effective_size -= 2 * CACHELINE_BYTES; in intel_engine_create_ring()
163 intel_ring_update_space(ring); in intel_engine_create_ring()
167 kfree(ring); in intel_engine_create_ring()
170 ring->vma = vma; in intel_engine_create_ring()
172 return ring; in intel_engine_create_ring()
177 struct intel_ring *ring = container_of(ref, typeof(*ring), ref); in intel_ring_free() local
179 i915_vma_put(ring->vma); in intel_ring_free()
180 kfree(ring); in intel_ring_free()
184 wait_for_space(struct intel_ring *ring, in wait_for_space() argument
191 if (intel_ring_update_space(ring) >= bytes) in wait_for_space()
196 if (target->ring != ring) in wait_for_space()
201 ring->emit, ring->size)) in wait_for_space()
216 intel_ring_update_space(ring); in wait_for_space()
217 GEM_BUG_ON(ring->space < bytes); in wait_for_space()
223 struct intel_ring *ring = rq->ring; in intel_ring_begin() local
224 const unsigned int remain_usable = ring->effective_size - ring->emit; in intel_ring_begin()
234 GEM_BUG_ON(total_bytes > ring->effective_size); in intel_ring_begin()
237 const int remain_actual = ring->size - ring->emit; in intel_ring_begin()
258 if (unlikely(total_bytes > ring->space)) { in intel_ring_begin()
272 ret = wait_for_space(ring, in intel_ring_begin()
281 GEM_BUG_ON(need_wrap > ring->space); in intel_ring_begin()
282 GEM_BUG_ON(ring->emit + need_wrap > ring->size); in intel_ring_begin()
286 memset64(ring->vaddr + ring->emit, 0, need_wrap / sizeof(u64)); in intel_ring_begin()
287 ring->space -= need_wrap; in intel_ring_begin()
288 ring->emit = 0; in intel_ring_begin()
291 GEM_BUG_ON(ring->emit > ring->size - bytes); in intel_ring_begin()
292 GEM_BUG_ON(ring->space < bytes); in intel_ring_begin()
293 cs = ring->vaddr + ring->emit; in intel_ring_begin()
295 ring->emit += bytes; in intel_ring_begin()
296 ring->space -= bytes; in intel_ring_begin()
301 /* Align the ring tail to a cacheline boundary */
307 num_dwords = (rq->ring->emit & (CACHELINE_BYTES - 1)) / sizeof(u32); in intel_ring_cacheline_align()
321 GEM_BUG_ON(rq->ring->emit & (CACHELINE_BYTES - 1)); in intel_ring_cacheline_align()