vc4: Introduce scheduling of QPU instructions.
[mesa.git] / src / gallium / drivers / vc4 / vc4_qpu.c
index 093ca077e6dd6b7cb1674bf61a7863e700b30f00..723b36136651572f64646a36a6355d74f046ef9c 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 #include <stdbool.h>
+#include "vc4_qir.h"
 #include "vc4_qpu.h"
 
 static uint64_t
@@ -267,3 +268,14 @@ qpu_inst_is_tlb(uint64_t inst)
                 sig == QPU_SIG_COLOR_LOAD ||
                 sig == QPU_SIG_WAIT_FOR_SCOREBOARD);
 }
+
+void
+qpu_serialize_one_inst(struct vc4_compile *c, uint64_t inst)
+{
+        if (c->qpu_inst_count >= c->qpu_inst_size) {
+                c->qpu_inst_size = MAX2(16, c->qpu_inst_size * 2);
+                c->qpu_insts = realloc(c->qpu_insts,
+                                       c->qpu_inst_size * sizeof(uint64_t));
+        }
+        c->qpu_insts[c->qpu_inst_count++] = inst;
+}