Mesa (main): etnaviv: use feature bit for one const src per instuction limitation

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Apr 27 09:19:02 UTC 2022


Module: Mesa
Branch: main
Commit: 8d6b6e31e1889a9b626e7284082777ba6469f91e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8d6b6e31e1889a9b626e7284082777ba6469f91e

Author: Lucas Stach <l.stach at pengutronix.de>
Date:   Sat Apr  9 19:00:12 2022 +0200

etnaviv: use feature bit for one const src per instuction limitation

Support for multiple constant sources per instruction is not a HALTI5
capability, there is a separate feature bit to signal the availability
of this shader core enhancement.

Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
Reviewed-by: Philipp Zabel <p.zabel at pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9255>

---

 src/gallium/drivers/etnaviv/etnaviv_asm.c          | 2 +-
 src/gallium/drivers/etnaviv/etnaviv_asm.h          | 2 +-
 src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c | 7 +++----
 src/gallium/drivers/etnaviv/etnaviv_internal.h     | 2 ++
 src/gallium/drivers/etnaviv/etnaviv_screen.c       | 2 ++
 5 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_asm.c b/src/gallium/drivers/etnaviv/etnaviv_asm.c
index ab6bb4c616e..0b6deca9b4f 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_asm.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_asm.c
@@ -65,7 +65,7 @@ etna_assemble(uint32_t *out, const struct etna_inst *inst)
    if (inst->imm && inst->src[2].use)
       return 1;
 
-   if (!inst->halti5 && !check_uniforms(inst))
+   if (!inst->no_oneconst_limit && !check_uniforms(inst))
       BUG("error: generating instruction that accesses two different uniforms");
 
    assert(!(inst->opcode&~0x7f));
diff --git a/src/gallium/drivers/etnaviv/etnaviv_asm.h b/src/gallium/drivers/etnaviv/etnaviv_asm.h
index 03e18a7b45a..a0ac116b092 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_asm.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_asm.h
@@ -97,7 +97,7 @@ struct etna_inst {
    unsigned sel_bit0:1; /* select low half mediump */
    unsigned sel_bit1:1; /* select high half mediump */
    unsigned dst_full:1; /* write to highp register */
-   unsigned halti5:1; /* allow multiple different uniform sources */
+   unsigned no_oneconst_limit:1; /* allow multiple different uniform sources */
    struct etna_inst_dst dst; /* destination operand */
    struct etna_inst_tex tex; /* texture operand */
    struct etna_inst_src src[ETNA_NUM_SRC]; /* source operand */
diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c
index 4ce6d3c125c..cb150749fdc 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c
@@ -732,7 +732,7 @@ insert_vec_mov(nir_alu_instr *vec, unsigned start_idx, nir_shader *shader)
  * -insert movs (nir_lower_vec_to_movs equivalent)
  * for non-vecN instructions:
  * -try to merge constants as single constant
- * -insert movs for multiple constants (pre-HALTI5)
+ * -insert movs for multiple constants if required
  */
 static void
 lower_alu(struct etna_compile *c, nir_alu_instr *alu)
@@ -749,8 +749,7 @@ lower_alu(struct etna_compile *c, nir_alu_instr *alu)
    case nir_op_vec4:
       break;
    default:
-      /* pre-GC7000L can only have 1 uniform src per instruction */
-      if (c->specs->halti >= 5)
+      if (c->specs->has_no_oneconst_limit)
          return;
 
       nir_const_value value[4] = {};
@@ -1195,7 +1194,7 @@ etna_compile_shader(struct etna_shader_variant *v)
       if (inst->opcode == INST_OPCODE_BRANCH)
          inst->imm = block_ptr[inst->imm];
 
-      inst->halti5 = specs->halti >= 5;
+      inst->no_oneconst_limit = specs->has_no_oneconst_limit;
       etna_assemble(&code[i * 4], inst);
    }
 
diff --git a/src/gallium/drivers/etnaviv/etnaviv_internal.h b/src/gallium/drivers/etnaviv/etnaviv_internal.h
index 36ddb3bc1ec..cab0d99d8f6 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_internal.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_internal.h
@@ -77,6 +77,8 @@ struct etna_specs {
    unsigned has_new_transcendentals : 1;
    /* has the new dp2/dpX_norm instructions, among others */
    unsigned has_halti2_instructions : 1;
+   /* has no limit on the number of constant sources per instruction */
+   unsigned has_no_oneconst_limit : 1;
    /* has V4_COMPRESSION */
    unsigned v4_compression : 1;
    /* supports single-buffer rendering with multiple pixel pipes */
diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c
index acf33ab6c5a..b82063f4858 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
@@ -837,6 +837,8 @@ etna_get_specs(struct etna_screen *screen)
       VIV_FEATURE(screen, chipMinorFeatures3, HAS_FAST_TRANSCENDENTALS);
    screen->specs.has_halti2_instructions =
       VIV_FEATURE(screen, chipMinorFeatures4, HALTI2);
+   screen->specs.has_no_oneconst_limit =
+      VIV_FEATURE(screen, chipMinorFeatures8, SH_NO_ONECONST_LIMIT);
    screen->specs.v4_compression =
       VIV_FEATURE(screen, chipMinorFeatures6, V4_COMPRESSION);
    screen->specs.seamless_cube_map =



More information about the mesa-commit mailing list