From 31da39ddc92e780dc539bf34d2de7f82fc65fa86 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 25 Aug 2016 13:48:21 -0700 Subject: [PATCH] vc4: Add a QIR value for the QPU element register. This will be used in the ddx/ddy support for "Am I the top half?" or "Am I the left half?" checks. --- src/gallium/drivers/vc4/vc4_qir.c | 1 + src/gallium/drivers/vc4/vc4_qir.h | 1 + src/gallium/drivers/vc4/vc4_qir_validate.c | 2 ++ src/gallium/drivers/vc4/vc4_qpu_emit.c | 4 ++++ 4 files changed, 8 insertions(+) diff --git a/src/gallium/drivers/vc4/vc4_qir.c b/src/gallium/drivers/vc4/vc4_qir.c index 9ff1561..0919d32 100644 --- a/src/gallium/drivers/vc4/vc4_qir.c +++ b/src/gallium/drivers/vc4/vc4_qir.c @@ -292,6 +292,7 @@ qir_print_reg(struct vc4_compile *c, struct qreg reg, bool write) [QFILE_FRAG_X] = "frag_x", [QFILE_FRAG_Y] = "frag_y", [QFILE_FRAG_REV_FLAG] = "frag_rev_flag", + [QFILE_QPU_ELEMENT] = "elem", }; switch (reg.file) { diff --git a/src/gallium/drivers/vc4/vc4_qir.h b/src/gallium/drivers/vc4/vc4_qir.h index 6b48959..9e61200 100644 --- a/src/gallium/drivers/vc4/vc4_qir.h +++ b/src/gallium/drivers/vc4/vc4_qir.h @@ -61,6 +61,7 @@ enum qfile { QFILE_FRAG_X, QFILE_FRAG_Y, QFILE_FRAG_REV_FLAG, + QFILE_QPU_ELEMENT, /** * Stores an immediate value in the index field that will be used diff --git a/src/gallium/drivers/vc4/vc4_qir_validate.c b/src/gallium/drivers/vc4/vc4_qir_validate.c index e8d4372f..e7cfe5a 100644 --- a/src/gallium/drivers/vc4/vc4_qir_validate.c +++ b/src/gallium/drivers/vc4/vc4_qir_validate.c @@ -79,6 +79,7 @@ void qir_validate(struct vc4_compile *c) case QFILE_FRAG_X: case QFILE_FRAG_Y: case QFILE_FRAG_REV_FLAG: + case QFILE_QPU_ELEMENT: case QFILE_SMALL_IMM: case QFILE_LOAD_IMM: fail_instr(c, inst, "Bad dest file"); @@ -98,6 +99,7 @@ void qir_validate(struct vc4_compile *c) case QFILE_UNIF: case QFILE_VPM: case QFILE_LOAD_IMM: + case QFILE_QPU_ELEMENT: break; case QFILE_SMALL_IMM: diff --git a/src/gallium/drivers/vc4/vc4_qpu_emit.c b/src/gallium/drivers/vc4/vc4_qpu_emit.c index 8249929..77aa4f6 100644 --- a/src/gallium/drivers/vc4/vc4_qpu_emit.c +++ b/src/gallium/drivers/vc4/vc4_qpu_emit.c @@ -339,6 +339,9 @@ vc4_generate_code_block(struct vc4_compile *c, case QFILE_FRAG_REV_FLAG: src[i] = qpu_rb(QPU_R_MS_REV_FLAGS); break; + case QFILE_QPU_ELEMENT: + src[i] = qpu_ra(QPU_R_ELEM_QPU); + break; case QFILE_TLB_COLOR_WRITE: case QFILE_TLB_COLOR_WRITE_MS: @@ -383,6 +386,7 @@ vc4_generate_code_block(struct vc4_compile *c, case QFILE_FRAG_X: case QFILE_FRAG_Y: case QFILE_FRAG_REV_FLAG: + case QFILE_QPU_ELEMENT: assert(!"not reached"); break; } -- 2.7.4