Commit Graph

10 Commits

Author SHA1 Message Date
Chia-I Wu 5c63fc626f turnip: provide both emit_ib and emit_call
tu_cs_emit_ib emits a CP_INDIRECT_BUFFER for a BO.  tu_cs_emit_call
emits a CP_INDIRECT_BUFFER for each entry of a target cs.
2019-03-11 10:02:13 -07:00
Chia-I Wu 741a4325df turnip: add tu_cs_sanity_check
It replaces tu_cs_reserve_space_assert and can be called at any
time to sanity check tu_cs.
2019-03-11 10:02:13 -07:00
Chia-I Wu 29f1110003 turnip: never fail tu_cs_begin/tu_cs_end
Error checking tu_cs_begin/tu_cs_end is too tedious for the callers.
Move tu_cs_add_bo and tu_cs_reserve_entry to tu_cs_reserve_space
such that tu_cs_begin/tu_cs_end never fails.
2019-03-11 10:02:13 -07:00
Chia-I Wu 0d81be3959 turnip: specify initial size in tu_cs_init
We will drop size parameter from tu_cs_begin shortly, such that
tu_cs_begin never fails.
2019-03-11 10:02:13 -07:00
Chia-I Wu 3b3af6321b turnip: add tu_cs_reserve_space(_assert)
They are used like

 tu_cs_reserve_space(...);
 tu_cs_emit(...);
 ...;
 tu_cs_reserve_space_assert();

to make sure we reserved enough space at the beginning.
2019-03-11 10:01:41 -07:00
Chia-I Wu c969d8b975 turnip: add more tu_cs helpers 2019-03-11 10:01:41 -07:00
Chia-I Wu 39ba2b20d1 turnip: inline tu_cs_check_space
This allows the fast path (size check) to be inlined.
2019-03-11 10:01:41 -07:00
Chia-I Wu ae9a72b48b turnip: document tu_cs 2019-03-11 10:01:41 -07:00
Chia-I Wu 45120127ea turnip: run sed and clang-format on tu_cs 2019-03-11 10:01:41 -07:00
Bas Nieuwenhuizen ac2a845abf turnip: Add emit functions in a header.
This adds a radv-style check_space functions + emit functions.

Also puts them in a header as a bunch of inlines, so

(1) we can use them from meta code.
(2) they are inline for performance as these are common and small.

Did not put them in tu_private.h as a bunch of inlines only
clutters up that huge headerfile.

Precise error propagation for memory allocation failures is still
todo.
2019-03-11 10:01:41 -07:00