summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2016-11-15 12:36:20 -0800
committerEric Anholt <[email protected]>2016-11-29 08:38:59 -0800
commit51087327f2ba929739719b2ae243d8c69d31346f (patch)
treeabdb18b2c979269ee92b963a2e46e6550ad4beb9 /src/gallium/drivers
parenta220f1b5a9beaba146096971354ae37c6f75d4ef (diff)
vc4: Replace the qinst src[] with a fixed-size array.
This may have made a tiny bit of sense when we had one 4-arg inst per shader, but if we only ever put 2 things in, having a pointer to 2 things almost every instruction is pointless indirection.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/vc4/vc4_qir.c2
-rw-r--r--src/gallium/drivers/vc4/vc4_qir.h2
-rw-r--r--src/gallium/drivers/vc4/vc4_qpu_emit.c2
3 files changed, 2 insertions, 4 deletions
diff --git a/src/gallium/drivers/vc4/vc4_qir.c b/src/gallium/drivers/vc4/vc4_qir.c
index 5999cc175ed..8bd016c5535 100644
--- a/src/gallium/drivers/vc4/vc4_qir.c
+++ b/src/gallium/drivers/vc4/vc4_qir.c
@@ -477,7 +477,6 @@ qir_inst(enum qop op, struct qreg dst, struct qreg src0, struct qreg src1)
inst->op = op;
inst->dst = dst;
- inst->src = calloc(2, sizeof(inst->src[0]));
inst->src[0] = src0;
inst->src[1] = src1;
inst->cond = QPU_COND_ALWAYS;
@@ -598,7 +597,6 @@ qir_remove_instruction(struct vc4_compile *c, struct qinst *qinst)
c->defs[qinst->dst.index] = NULL;
list_del(&qinst->link);
- free(qinst->src);
free(qinst);
}
diff --git a/src/gallium/drivers/vc4/vc4_qir.h b/src/gallium/drivers/vc4/vc4_qir.h
index 4c240c71c66..eec50c3439e 100644
--- a/src/gallium/drivers/vc4/vc4_qir.h
+++ b/src/gallium/drivers/vc4/vc4_qir.h
@@ -203,7 +203,7 @@ struct qinst {
enum qop op;
struct qreg dst;
- struct qreg *src;
+ struct qreg src[2];
bool sf;
bool cond_is_exec_mask;
uint8_t cond;
diff --git a/src/gallium/drivers/vc4/vc4_qpu_emit.c b/src/gallium/drivers/vc4/vc4_qpu_emit.c
index e2f04253855..2cc0f3013ef 100644
--- a/src/gallium/drivers/vc4/vc4_qpu_emit.c
+++ b/src/gallium/drivers/vc4/vc4_qpu_emit.c
@@ -288,7 +288,7 @@ vc4_generate_code_block(struct vc4_compile *c,
};
uint64_t unpack = 0;
- struct qpu_reg src[4];
+ struct qpu_reg src[ARRAY_SIZE(qinst->src)];
for (int i = 0; i < qir_get_op_nsrc(qinst->op); i++) {
int index = qinst->src[i].index;
switch (qinst->src[i].file) {