Lines Matching refs:ring
16 unsigned int intel_ring_update_space(struct intel_ring *ring) in intel_ring_update_space() argument
20 space = __intel_ring_space(ring->head, ring->emit, ring->size); in intel_ring_update_space()
22 ring->space = space; in intel_ring_update_space()
26 void __intel_ring_pin(struct intel_ring *ring) in __intel_ring_pin() argument
28 GEM_BUG_ON(!atomic_read(&ring->pin_count)); in __intel_ring_pin()
29 atomic_inc(&ring->pin_count); in __intel_ring_pin()
32 int intel_ring_pin(struct intel_ring *ring, struct i915_gem_ww_ctx *ww) in intel_ring_pin() argument
34 struct i915_vma *vma = ring->vma; in intel_ring_pin()
39 if (atomic_fetch_inc(&ring->pin_count)) in intel_ring_pin()
70 intel_ring_reset(ring, ring->emit); in intel_ring_pin()
72 ring->vaddr = addr; in intel_ring_pin()
78 atomic_dec(&ring->pin_count); in intel_ring_pin()
82 void intel_ring_reset(struct intel_ring *ring, u32 tail) in intel_ring_reset() argument
84 tail = intel_ring_wrap(ring, tail); in intel_ring_reset()
85 ring->tail = tail; in intel_ring_reset()
86 ring->head = tail; in intel_ring_reset()
87 ring->emit = tail; in intel_ring_reset()
88 intel_ring_update_space(ring); in intel_ring_reset()
91 void intel_ring_unpin(struct intel_ring *ring) in intel_ring_unpin() argument
93 struct i915_vma *vma = ring->vma; in intel_ring_unpin()
95 if (!atomic_dec_and_test(&ring->pin_count)) in intel_ring_unpin()
146 struct intel_ring *ring; in intel_engine_create_ring() local
152 ring = kzalloc(sizeof(*ring), GFP_KERNEL); in intel_engine_create_ring()
153 if (!ring) in intel_engine_create_ring()
156 kref_init(&ring->ref); in intel_engine_create_ring()
157 ring->size = size; in intel_engine_create_ring()
158 ring->wrap = BITS_PER_TYPE(ring->size) - ilog2(size); in intel_engine_create_ring()
165 ring->effective_size = size; in intel_engine_create_ring()
167 ring->effective_size -= 2 * CACHELINE_BYTES; in intel_engine_create_ring()
169 intel_ring_update_space(ring); in intel_engine_create_ring()
173 kfree(ring); in intel_engine_create_ring()
176 ring->vma = vma; in intel_engine_create_ring()
178 return ring; in intel_engine_create_ring()
183 struct intel_ring *ring = container_of(ref, typeof(*ring), ref); in intel_ring_free() local
185 i915_vma_put(ring->vma); in intel_ring_free()
186 kfree(ring); in intel_ring_free()
190 wait_for_space(struct intel_ring *ring, in wait_for_space() argument
197 if (intel_ring_update_space(ring) >= bytes) in wait_for_space()
202 if (target->ring != ring) in wait_for_space()
207 ring->emit, ring->size)) in wait_for_space()
222 intel_ring_update_space(ring); in wait_for_space()
223 GEM_BUG_ON(ring->space < bytes); in wait_for_space()
229 struct intel_ring *ring = rq->ring; in intel_ring_begin() local
230 const unsigned int remain_usable = ring->effective_size - ring->emit; in intel_ring_begin()
240 GEM_BUG_ON(total_bytes > ring->effective_size); in intel_ring_begin()
243 const int remain_actual = ring->size - ring->emit; in intel_ring_begin()
264 if (unlikely(total_bytes > ring->space)) { in intel_ring_begin()
278 ret = wait_for_space(ring, in intel_ring_begin()
287 GEM_BUG_ON(need_wrap > ring->space); in intel_ring_begin()
288 GEM_BUG_ON(ring->emit + need_wrap > ring->size); in intel_ring_begin()
292 memset64(ring->vaddr + ring->emit, 0, need_wrap / sizeof(u64)); in intel_ring_begin()
293 ring->space -= need_wrap; in intel_ring_begin()
294 ring->emit = 0; in intel_ring_begin()
297 GEM_BUG_ON(ring->emit > ring->size - bytes); in intel_ring_begin()
298 GEM_BUG_ON(ring->space < bytes); in intel_ring_begin()
299 cs = ring->vaddr + ring->emit; in intel_ring_begin()
301 ring->emit += bytes; in intel_ring_begin()
302 ring->space -= bytes; in intel_ring_begin()
313 num_dwords = (rq->ring->emit & (CACHELINE_BYTES - 1)) / sizeof(u32); in intel_ring_cacheline_align()
327 GEM_BUG_ON(rq->ring->emit & (CACHELINE_BYTES - 1)); in intel_ring_cacheline_align()