vc4: Add a QIR value for the QPU element register.
authorEric Anholt <eric@anholt.net>
Thu, 25 Aug 2016 20:48:21 +0000 (13:48 -0700)
committerEric Anholt <eric@anholt.net>
Fri, 26 Aug 2016 00:24:11 +0000 (17:24 -0700)
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
src/gallium/drivers/vc4/vc4_qir.h
src/gallium/drivers/vc4/vc4_qir_validate.c
src/gallium/drivers/vc4/vc4_qpu_emit.c

index 9ff15611ef965a1d28943afc080f6a7058e18f52..0919d32a5284594b4ac91d4f63fceacd5a3d2ea7 100644 (file)
@@ -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) {
index 6b48959d257171a55d8c815a366d252691049699..9e61200ef649f1ceec37d8e272d3f51a01298425 100644 (file)
@@ -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
index e8d4372f19f898b602706547980c69e6d3fa0e4e..e7cfe5ad217368bb2f237b86578ecd2590bdf17d 100644 (file)
@@ -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:
index 82499296b5b7f221203550618bb6339ca16abf81..77aa4f674ae740dfd8ce4685570b1fedb2461e91 100644 (file)
@@ -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;
                 }