Lines Matching refs:ring
98 void (*grow)(struct fd_ringbuffer *ring, uint32_t size);
99 void (*emit_reloc)(struct fd_ringbuffer *ring,
101 uint32_t (*emit_reloc_ring)(struct fd_ringbuffer *ring,
103 uint32_t (*cmd_count)(struct fd_ringbuffer *ring);
104 void (*destroy)(struct fd_ringbuffer *ring);
128 fd_ringbuffer_del(struct fd_ringbuffer *ring) in fd_ringbuffer_del() argument
130 if (--ring->refcnt > 0) in fd_ringbuffer_del()
133 ring->funcs->destroy(ring); in fd_ringbuffer_del()
138 fd_ringbuffer_ref(struct fd_ringbuffer *ring) in fd_ringbuffer_ref() argument
140 ring->refcnt++; in fd_ringbuffer_ref()
141 return ring; in fd_ringbuffer_ref()
145 fd_ringbuffer_grow(struct fd_ringbuffer *ring, uint32_t ndwords) in fd_ringbuffer_grow() argument
147 assert(ring->funcs->grow); /* unsupported on kgsl */ in fd_ringbuffer_grow()
150 if (ring->size < 0x100000) in fd_ringbuffer_grow()
151 ring->size *= 2; in fd_ringbuffer_grow()
153 ring->funcs->grow(ring, ring->size); in fd_ringbuffer_grow()
157 fd_ringbuffer_emit(struct fd_ringbuffer *ring, in fd_ringbuffer_emit() argument
160 (*ring->cur++) = data; in fd_ringbuffer_emit()
187 fd_ringbuffer_reloc(struct fd_ringbuffer *ring, in fd_ringbuffer_reloc() argument
190 ring->funcs->emit_reloc(ring, reloc); in fd_ringbuffer_reloc()
194 fd_ringbuffer_cmd_count(struct fd_ringbuffer *ring) in fd_ringbuffer_cmd_count() argument
196 if (!ring->funcs->cmd_count) in fd_ringbuffer_cmd_count()
198 return ring->funcs->cmd_count(ring); in fd_ringbuffer_cmd_count()
202 fd_ringbuffer_emit_reloc_ring_full(struct fd_ringbuffer *ring, in fd_ringbuffer_emit_reloc_ring_full() argument
205 return ring->funcs->emit_reloc_ring(ring, target, cmd_idx); in fd_ringbuffer_emit_reloc_ring_full()
215 fd_ringbuffer_size(struct fd_ringbuffer *ring) in fd_ringbuffer_size() argument
221 debug_assert(!(ring->flags & FD_RINGBUFFER_GROWABLE)); in fd_ringbuffer_size()
222 return offset_bytes(ring->cur, ring->start); in fd_ringbuffer_size()
228 OUT_RING(struct fd_ringbuffer *ring, uint32_t data) in OUT_RING() argument
231 fprintf(stderr, "ring[%p]: OUT_RING %04x: %08x", ring, in OUT_RING()
232 (uint32_t)(ring->cur - ring->start), data); in OUT_RING()
234 fd_ringbuffer_emit(ring, data); in OUT_RING()
241 OUT_RELOC(struct fd_ringbuffer *ring, struct fd_bo *bo, in OUT_RELOC() argument
245 fprintf(stderr, "ring[%p]: OUT_RELOC %04x: %p+%u << %d", ring, in OUT_RELOC()
246 (uint32_t)(ring->cur - ring->start), bo, offset, shift); in OUT_RELOC()
249 fd_ringbuffer_reloc(ring, &(struct fd_reloc){ in OUT_RELOC()
259 OUT_RB(struct fd_ringbuffer *ring, struct fd_ringbuffer *target) in OUT_RB() argument
261 fd_ringbuffer_emit_reloc_ring_full(ring, target, 0); in OUT_RB()
264 static inline void BEGIN_RING(struct fd_ringbuffer *ring, uint32_t ndwords) in BEGIN_RING() argument
266 if (unlikely(ring->cur + ndwords > ring->end)) in BEGIN_RING()
267 fd_ringbuffer_grow(ring, ndwords); in BEGIN_RING()
271 OUT_PKT0(struct fd_ringbuffer *ring, uint16_t regindx, uint16_t cnt) in OUT_PKT0() argument
273 BEGIN_RING(ring, cnt+1); in OUT_PKT0()
274 OUT_RING(ring, CP_TYPE0_PKT | ((cnt-1) << 16) | (regindx & 0x7FFF)); in OUT_PKT0()
278 OUT_PKT2(struct fd_ringbuffer *ring) in OUT_PKT2() argument
280 BEGIN_RING(ring, 1); in OUT_PKT2()
281 OUT_RING(ring, CP_TYPE2_PKT); in OUT_PKT2()
285 OUT_PKT3(struct fd_ringbuffer *ring, uint8_t opcode, uint16_t cnt) in OUT_PKT3() argument
287 BEGIN_RING(ring, cnt+1); in OUT_PKT3()
288 OUT_RING(ring, CP_TYPE3_PKT | ((cnt-1) << 16) | ((opcode & 0xFF) << 8)); in OUT_PKT3()
309 OUT_PKT4(struct fd_ringbuffer *ring, uint16_t regindx, uint16_t cnt) in OUT_PKT4() argument
311 BEGIN_RING(ring, cnt+1); in OUT_PKT4()
312 OUT_RING(ring, CP_TYPE4_PKT | cnt | in OUT_PKT4()
319 OUT_PKT7(struct fd_ringbuffer *ring, uint8_t opcode, uint16_t cnt) in OUT_PKT7() argument
321 BEGIN_RING(ring, cnt+1); in OUT_PKT7()
322 OUT_RING(ring, CP_TYPE7_PKT | cnt | in OUT_PKT7()
329 OUT_WFI(struct fd_ringbuffer *ring) in OUT_WFI() argument
331 OUT_PKT3(ring, CP_WAIT_FOR_IDLE, 1); in OUT_WFI()
332 OUT_RING(ring, 0x00000000); in OUT_WFI()
336 OUT_WFI5(struct fd_ringbuffer *ring) in OUT_WFI5() argument
338 OUT_PKT7(ring, CP_WAIT_FOR_IDLE, 0); in OUT_WFI5()