Lines Matching full:ring

19 unsigned int intel_ring_update_space(struct intel_ring *ring)  in intel_ring_update_space()  argument
23 space = __intel_ring_space(ring->head, ring->emit, ring->size); in intel_ring_update_space()
25 ring->space = space; in intel_ring_update_space()
29 void __intel_ring_pin(struct intel_ring *ring) in __intel_ring_pin() argument
31 GEM_BUG_ON(!atomic_read(&ring->pin_count)); in __intel_ring_pin()
32 atomic_inc(&ring->pin_count); in __intel_ring_pin()
35 int intel_ring_pin(struct intel_ring *ring, struct i915_gem_ww_ctx *ww) in intel_ring_pin() argument
37 struct i915_vma *vma = ring->vma; in intel_ring_pin()
42 if (atomic_fetch_inc(&ring->pin_count)) in intel_ring_pin()
45 /* Ring wraparound at offset 0 sometimes hangs. No idea why. */ in intel_ring_pin()
73 intel_ring_reset(ring, ring->emit); in intel_ring_pin()
75 ring->vaddr = addr; in intel_ring_pin()
81 atomic_dec(&ring->pin_count); in intel_ring_pin()
85 void intel_ring_reset(struct intel_ring *ring, u32 tail) in intel_ring_reset() argument
87 tail = intel_ring_wrap(ring, tail); in intel_ring_reset()
88 ring->tail = tail; in intel_ring_reset()
89 ring->head = tail; in intel_ring_reset()
90 ring->emit = tail; in intel_ring_reset()
91 intel_ring_update_space(ring); in intel_ring_reset()
94 void intel_ring_unpin(struct intel_ring *ring) in intel_ring_unpin() argument
96 struct i915_vma *vma = ring->vma; in intel_ring_unpin()
98 if (!atomic_dec_and_test(&ring->pin_count)) in intel_ring_unpin()
128 * Mark ring buffers as read-only from GPU side (so no stray overwrites) in create_ring_vma()
149 struct intel_ring *ring; in intel_engine_create_ring() local
155 ring = kzalloc(sizeof(*ring), GFP_KERNEL); in intel_engine_create_ring()
156 if (!ring) in intel_engine_create_ring()
159 kref_init(&ring->ref); in intel_engine_create_ring()
160 ring->size = size; in intel_engine_create_ring()
161 ring->wrap = BITS_PER_TYPE(ring->size) - ilog2(size); in intel_engine_create_ring()
168 ring->effective_size = size; in intel_engine_create_ring()
170 ring->effective_size -= 2 * CACHELINE_BYTES; in intel_engine_create_ring()
172 intel_ring_update_space(ring); in intel_engine_create_ring()
176 kfree(ring); in intel_engine_create_ring()
179 ring->vma = vma; in intel_engine_create_ring()
181 return ring; in intel_engine_create_ring()
186 struct intel_ring *ring = container_of(ref, typeof(*ring), ref); in intel_ring_free() local
188 i915_vma_put(ring->vma); in intel_ring_free()
189 kfree(ring); in intel_ring_free()
193 wait_for_space(struct intel_ring *ring, in wait_for_space() argument
200 if (intel_ring_update_space(ring) >= bytes) in wait_for_space()
205 if (target->ring != ring) in wait_for_space()
210 ring->emit, ring->size)) in wait_for_space()
225 intel_ring_update_space(ring); in wait_for_space()
226 GEM_BUG_ON(ring->space < bytes); in wait_for_space()
232 struct intel_ring *ring = rq->ring; in intel_ring_begin() local
233 const unsigned int remain_usable = ring->effective_size - ring->emit; in intel_ring_begin()
243 GEM_BUG_ON(total_bytes > ring->effective_size); in intel_ring_begin()
246 const int remain_actual = ring->size - ring->emit; in intel_ring_begin()
267 if (unlikely(total_bytes > ring->space)) { in intel_ring_begin()
281 ret = wait_for_space(ring, in intel_ring_begin()
290 GEM_BUG_ON(need_wrap > ring->space); in intel_ring_begin()
291 GEM_BUG_ON(ring->emit + need_wrap > ring->size); in intel_ring_begin()
295 memset64(ring->vaddr + ring->emit, 0, need_wrap / sizeof(u64)); in intel_ring_begin()
296 ring->space -= need_wrap; in intel_ring_begin()
297 ring->emit = 0; in intel_ring_begin()
300 GEM_BUG_ON(ring->emit > ring->size - bytes); in intel_ring_begin()
301 GEM_BUG_ON(ring->space < bytes); in intel_ring_begin()
302 cs = ring->vaddr + ring->emit; in intel_ring_begin()
305 ring->emit += bytes; in intel_ring_begin()
306 ring->space -= bytes; in intel_ring_begin()
311 /* Align the ring tail to a cacheline boundary */
317 num_dwords = (rq->ring->emit & (CACHELINE_BYTES - 1)) / sizeof(u32); in intel_ring_cacheline_align()
331 GEM_BUG_ON(rq->ring->emit & (CACHELINE_BYTES - 1)); in intel_ring_cacheline_align()