Lines Matching refs:cs

31 tu_cs_init(struct tu_cs *cs,
37 tu_cs_init_external(struct tu_cs *cs, uint32_t *start, uint32_t *end);
40 tu_cs_finish(struct tu_cs *cs);
43 tu_cs_begin(struct tu_cs *cs);
46 tu_cs_end(struct tu_cs *cs);
49 tu_cs_begin_sub_stream(struct tu_cs *cs, uint32_t size, struct tu_cs *sub_cs);
52 tu_cs_alloc(struct tu_cs *cs,
58 tu_cs_end_sub_stream(struct tu_cs *cs, struct tu_cs *sub_cs);
61 tu_cs_end_draw_state(struct tu_cs *cs, struct tu_cs *sub_cs) in tu_cs_end_draw_state() argument
63 struct tu_cs_entry entry = tu_cs_end_sub_stream(cs, sub_cs); in tu_cs_end_draw_state()
71 tu_cs_reserve_space(struct tu_cs *cs, uint32_t reserved_size);
74 tu_cs_draw_state(struct tu_cs *sub_cs, struct tu_cs *cs, uint32_t size) in tu_cs_draw_state() argument
80 tu_cs_init_external(cs, memory.map, memory.map + size); in tu_cs_draw_state()
81 tu_cs_begin(cs); in tu_cs_draw_state()
82 tu_cs_reserve_space(cs, size); in tu_cs_draw_state()
91 tu_cs_reset(struct tu_cs *cs);
94 tu_cs_add_entries(struct tu_cs *cs, struct tu_cs *target);
101 tu_cs_get_size(const struct tu_cs *cs) in tu_cs_get_size() argument
103 return cs->cur - cs->start; in tu_cs_get_size()
111 tu_cs_is_empty(const struct tu_cs *cs) in tu_cs_is_empty() argument
113 return tu_cs_get_size(cs) == 0; in tu_cs_is_empty()
121 tu_cs_discard_entries(struct tu_cs *cs) in tu_cs_discard_entries() argument
123 assert(cs->mode == TU_CS_MODE_GROW); in tu_cs_discard_entries()
124 cs->entry_count = 0; in tu_cs_discard_entries()
131 tu_cs_get_call_size(const struct tu_cs *cs) in tu_cs_get_call_size() argument
133 assert(cs->mode == TU_CS_MODE_GROW); in tu_cs_get_call_size()
135 return cs->entry_count * 4; in tu_cs_get_call_size()
142 tu_cs_sanity_check(const struct tu_cs *cs) in tu_cs_sanity_check() argument
144 assert(cs->start <= cs->cur); in tu_cs_sanity_check()
145 assert(cs->cur <= cs->reserved_end); in tu_cs_sanity_check()
146 assert(cs->reserved_end <= cs->end); in tu_cs_sanity_check()
153 tu_cs_emit(struct tu_cs *cs, uint32_t value) in tu_cs_emit() argument
155 assert(cs->cur < cs->reserved_end); in tu_cs_emit()
156 *cs->cur = value; in tu_cs_emit()
157 ++cs->cur; in tu_cs_emit()
164 tu_cs_emit_array(struct tu_cs *cs, const uint32_t *values, uint32_t length) in tu_cs_emit_array() argument
166 assert(cs->cur + length <= cs->reserved_end); in tu_cs_emit_array()
167 memcpy(cs->cur, values, sizeof(uint32_t) * length); in tu_cs_emit_array()
168 cs->cur += length; in tu_cs_emit_array()
188 tu_cs_get_space(const struct tu_cs *cs) in tu_cs_get_space() argument
190 return cs->end - cs->cur; in tu_cs_get_space()
194 tu_cs_reserve(struct tu_cs *cs, uint32_t reserved_size) in tu_cs_reserve() argument
196 if (cs->mode != TU_CS_MODE_GROW) { in tu_cs_reserve()
197 assert(tu_cs_get_space(cs) >= reserved_size); in tu_cs_reserve()
198 assert(cs->reserved_end == cs->end); in tu_cs_reserve()
202 if (tu_cs_get_space(cs) >= reserved_size && in tu_cs_reserve()
203 cs->entry_count < cs->entry_capacity) { in tu_cs_reserve()
204 cs->reserved_end = cs->cur + reserved_size; in tu_cs_reserve()
208 VkResult result = tu_cs_reserve_space(cs, reserved_size); in tu_cs_reserve()
217 tu_cs_emit_pkt4(struct tu_cs *cs, uint16_t regindx, uint16_t cnt) in tu_cs_emit_pkt4() argument
219 tu_cs_reserve(cs, cnt + 1); in tu_cs_emit_pkt4()
220 tu_cs_emit(cs, CP_TYPE4_PKT | cnt | (tu_odd_parity_bit(cnt) << 7) | in tu_cs_emit_pkt4()
229 tu_cs_emit_pkt7(struct tu_cs *cs, uint8_t opcode, uint16_t cnt) in tu_cs_emit_pkt7() argument
231 tu_cs_reserve(cs, cnt + 1); in tu_cs_emit_pkt7()
232 tu_cs_emit(cs, CP_TYPE7_PKT | cnt | (tu_odd_parity_bit(cnt) << 15) | in tu_cs_emit_pkt7()
238 tu_cs_emit_wfi(struct tu_cs *cs) in tu_cs_emit_wfi() argument
240 tu_cs_emit_pkt7(cs, CP_WAIT_FOR_IDLE, 0); in tu_cs_emit_wfi()
244 tu_cs_emit_qw(struct tu_cs *cs, uint64_t value) in tu_cs_emit_qw() argument
246 tu_cs_emit(cs, (uint32_t) value); in tu_cs_emit_qw()
247 tu_cs_emit(cs, (uint32_t) (value >> 32)); in tu_cs_emit_qw()
251 tu_cs_emit_write_reg(struct tu_cs *cs, uint16_t reg, uint32_t value) in tu_cs_emit_write_reg() argument
253 tu_cs_emit_pkt4(cs, reg, 1); in tu_cs_emit_write_reg()
254 tu_cs_emit(cs, value); in tu_cs_emit_write_reg()
261 tu_cs_emit_ib(struct tu_cs *cs, const struct tu_cs_entry *entry) in tu_cs_emit_ib() argument
268 tu_cs_emit_pkt7(cs, CP_INDIRECT_BUFFER, 3); in tu_cs_emit_ib()
269 tu_cs_emit_qw(cs, entry->bo->iova + entry->offset); in tu_cs_emit_ib()
270 tu_cs_emit(cs, entry->size / sizeof(uint32_t)); in tu_cs_emit_ib()
275 tu_cs_emit_state_ib(struct tu_cs *cs, struct tu_draw_state state) in tu_cs_emit_state_ib() argument
278 tu_cs_emit_pkt7(cs, CP_INDIRECT_BUFFER, 3); in tu_cs_emit_state_ib()
279 tu_cs_emit_qw(cs, state.iova); in tu_cs_emit_state_ib()
280 tu_cs_emit(cs, state.size); in tu_cs_emit_state_ib()
289 tu_cs_emit_call(struct tu_cs *cs, const struct tu_cs *target) in tu_cs_emit_call() argument
293 tu_cs_emit_ib(cs, target->entries + i); in tu_cs_emit_call()
300 tu_cond_exec_start(struct tu_cs *cs, uint32_t cond_flags) in tu_cond_exec_start() argument
302 assert(cs->mode == TU_CS_MODE_GROW); in tu_cond_exec_start()
303 assert(!cs->cond_flags && cond_flags); in tu_cond_exec_start()
305 tu_cs_emit_pkt7(cs, CP_COND_REG_EXEC, 2); in tu_cond_exec_start()
306 tu_cs_emit(cs, cond_flags); in tu_cond_exec_start()
308 cs->cond_flags = cond_flags; in tu_cond_exec_start()
309 cs->cond_dwords = cs->cur; in tu_cond_exec_start()
312 tu_cs_emit(cs, CP_COND_REG_EXEC_1_DWORDS(0)); in tu_cond_exec_start()
320 tu_cond_exec_end(struct tu_cs *cs) in tu_cond_exec_end() argument
322 assert(cs->cond_flags); in tu_cond_exec_end()
324 cs->cond_flags = 0; in tu_cond_exec_end()
326 *cs->cond_dwords = cs->cur - cs->cond_dwords - 1; in tu_cond_exec_end()
375 #define tu_cs_emit_regs(cs, ...) do { \ argument
382 tu_cs_emit_pkt4((cs), regs[0].reg, count); \
383 uint32_t *p = (cs)->cur; \
400 (cs)->cur = p; \