aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2020-03-18 23:03:07 -0400
committerMarge Bot <[email protected]>2020-03-19 03:23:07 +0000
commite06426ea85fa9092e3488c9e4600181f534454b6 (patch)
treea5ba76919d242c068a2df47470347f848e908a93 /src
parentb18d0ef7081540b6c8d60bfd4f13792878ea1b28 (diff)
pan/bi: Add ATEST packing
Only fp32 for now. Signed-off-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4242>
Diffstat (limited to 'src')
-rw-r--r--src/panfrost/bifrost/bi_pack.c22
-rw-r--r--src/panfrost/bifrost/bifrost.h16
2 files changed, 38 insertions, 0 deletions
diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c
index 2f961650d3e..705a43e3531 100644
--- a/src/panfrost/bifrost/bi_pack.c
+++ b/src/panfrost/bifrost/bi_pack.c
@@ -436,6 +436,26 @@ bi_pack_add_ld_vary(bi_clause *clause, bi_instruction *ins, struct bi_registers
}
static unsigned
+bi_pack_add_atest(bi_clause *clause, bi_instruction *ins, struct bi_registers *regs)
+{
+ /* TODO: fp16 */
+ assert(ins->src_types[1] == nir_type_float32);
+
+ struct bifrost_add_atest pack = {
+ .src0 = bi_get_src(ins, regs, 0, false),
+ .src1 = bi_get_src(ins, regs, 1, false),
+ .component = 1, /* Set for fp32 */
+ .op = BIFROST_ADD_OP_ATEST,
+ };
+
+ /* Despite *also* writing with the usual mechanism... quirky and
+ * perhaps unnecessary, but let's match the blob */
+ clause->data_register = ins->dest & ~BIR_INDEX_REGISTER;
+
+ RETURN_PACKED(pack);
+}
+
+static unsigned
bi_pack_add(bi_clause *clause, bi_bundle bundle, struct bi_registers *regs)
{
if (!bundle.add)
@@ -443,7 +463,9 @@ bi_pack_add(bi_clause *clause, bi_bundle bundle, struct bi_registers *regs)
switch (bundle.add->type) {
case BI_ADD:
+ return BIFROST_ADD_NOP;
case BI_ATEST:
+ return bi_pack_add_atest(clause, bundle.add, regs);
case BI_BRANCH:
case BI_CMP:
case BI_BLEND:
diff --git a/src/panfrost/bifrost/bifrost.h b/src/panfrost/bifrost/bifrost.h
index 959ef94f6c1..9fb063c32af 100644
--- a/src/panfrost/bifrost/bifrost.h
+++ b/src/panfrost/bifrost/bifrost.h
@@ -105,6 +105,22 @@ struct bifrost_add_inst {
unsigned op : 17;
} __attribute__((packed));
+#define BIFROST_ADD_OP_ATEST (0xc8f)
+
+struct bifrost_add_atest {
+ /* gl_SampleMask (R60) */
+ unsigned src0 : 3;
+
+ /* Alpha value */
+ unsigned src1 : 3;
+
+ /* If half, X/Y select. If !half, always set */
+ unsigned component : 1;
+ unsigned half : 1;
+
+ unsigned op : 12;
+} __attribute__((packed));
+
enum bifrost_outmod {
BIFROST_NONE = 0x0,
BIFROST_POS = 0x1,