#include "tu_cs.h"
+/**
+ * Initialize a command stream.
+ */
void
tu_cs_init(struct tu_cs *cs)
{
cs->bos = NULL;
}
+/**
+ * Finish and release all resources owned by a command stream.
+ */
void
tu_cs_finish(struct tu_device *dev, struct tu_cs *cs)
{
free(cs->bos);
}
+/**
+ * Begin (or continue) command packet emission. This will reserve space from
+ * the command stream for at least \a reserve_size uint32_t values.
+ */
VkResult
tu_cs_begin(struct tu_device *dev, struct tu_cs *cs, uint32_t reserve_size)
{
return VK_SUCCESS;
}
+/**
+ * End command packet emission by adding an IB entry for the command packets
+ * emitted since the last call to tu_cs_begin.
+ */
VkResult
tu_cs_end(struct tu_cs *cs)
{
return VK_SUCCESS;
}
+/**
+ * Reset a command stream to its initial state. This discards all comand
+ * packets in \a cs, but does not necessarily release all resources.
+ */
void
tu_cs_reset(struct tu_device *dev, struct tu_cs *cs)
{
cs->entry_count = 0;
}
+/**
+ * Reserve space from a command stream for \a size uint32_t values.
+ */
VkResult
tu_cs_check_space(struct tu_device *dev, struct tu_cs *cs, size_t size)
{
VkResult
tu_cs_check_space(struct tu_device *dev, struct tu_cs *cs, size_t size);
+/**
+ * Emit a uint32_t value into a command stream, without boundary checking.
+ */
static inline void
tu_cs_emit(struct tu_cs *cs, uint32_t value)
{
return (~0x6996 >> val) & 1;
}
+/**
+ * Emit a type-4 command packet header into a command stream.
+ */
static inline void
tu_cs_emit_pkt4(struct tu_cs *cs, uint16_t regindx, uint16_t cnt)
{
((tu_odd_parity_bit(regindx) << 27)));
}
+/**
+ * Emit a type-7 command packet header into a command stream.
+ */
static inline void
tu_cs_emit_pkt7(struct tu_cs *cs, uint8_t opcode, uint16_t cnt)
{