aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2019-01-16 14:40:37 -0800
committerChia-I Wu <[email protected]>2019-03-11 10:01:41 -0700
commitc969d8b975072221adc898a34cf9bc5be8ab3402 (patch)
tree999ec738ba1d23a721ffdc55591b7e79a2ae4f07
parent39ba2b20d112c6235d89683a68314a48fb5571f4 (diff)
turnip: add more tu_cs helpers
-rw-r--r--src/freedreno/vulkan/tu_cs.h30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/freedreno/vulkan/tu_cs.h b/src/freedreno/vulkan/tu_cs.h
index a81652ce353..94d9bf7cdde 100644
--- a/src/freedreno/vulkan/tu_cs.h
+++ b/src/freedreno/vulkan/tu_cs.h
@@ -25,7 +25,7 @@
#include "tu_private.h"
-#include "adreno_pm4.xml.h"
+#include "registers/adreno_pm4.xml.h"
void
tu_cs_init(struct tu_cs *cs);
@@ -101,9 +101,35 @@ tu_cs_emit_pkt7(struct tu_cs *cs, uint8_t opcode, uint16_t cnt)
}
static inline void
-tu_cs_emit_wfi5(struct tu_cs *cs)
+tu_cs_emit_wfi(struct tu_cs *cs)
{
tu_cs_emit_pkt7(cs, CP_WAIT_FOR_IDLE, 0);
}
+static inline void
+tu_cs_emit_qw(struct tu_cs *cs, uint64_t value)
+{
+ tu_cs_emit(cs, (uint32_t) value);
+ tu_cs_emit(cs, (uint32_t) (value >> 32));
+}
+
+static inline void
+tu_cs_emit_write_reg(struct tu_cs *cs, uint16_t reg, uint32_t value)
+{
+ tu_cs_emit_pkt4(cs, reg, 1);
+ tu_cs_emit(cs, value);
+}
+
+static inline void
+tu_cs_emit_ib(struct tu_cs *cs, const struct tu_cs *target)
+{
+ for (uint32_t i = 0; i < target->entry_count; i++) {
+ const struct tu_cs_entry *entry = target->entries + i;
+
+ tu_cs_emit_pkt7(cs, CP_INDIRECT_BUFFER, 3);
+ tu_cs_emit_qw(cs, entry->bo->iova + entry->offset);
+ tu_cs_emit(cs, entry->size / sizeof(uint32_t));
+ }
+}
+
#endif /* TU_CS_H */