diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c index c7406358b70..4f8c0193c6e 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c +++ b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c @@ -241,7 +241,7 @@ static hw_src const_src(struct etna_compile *c, nir_const_value *value, unsigned num_components) { /* use inline immediates if possible */ - if (c->specs->halti >= 2 && num_components == 1 && + if (c->info->halti >= 2 && num_components == 1 && value[0].u64 >> 32 == ETNA_UNIFORM_CONSTANT) { uint32_t bits = value[0].u32; @@ -966,7 +966,7 @@ emit_shader(struct etna_compile *c, unsigned *num_temps, unsigned *num_consts) unsigned base = nir_intrinsic_base(intr); /* pre halti2 uniform offset will be float */ - if (c->specs->halti < 2) + if (c->info->halti < 2) base += (unsigned) off[0].f32; else base += off[0].u32; @@ -1113,6 +1113,7 @@ etna_compile_shader(struct etna_shader_variant *v) return false; c->variant = v; + c->info = v->shader->info; c->specs = v->shader->specs; c->nir = nir_shader_clone(NULL, v->shader->nir); @@ -1173,7 +1174,7 @@ etna_compile_shader(struct etna_shader_variant *v) NIR_PASS_V(s, etna_nir_lower_texture, &v->key); NIR_PASS_V(s, nir_lower_alu_to_scalar, etna_alu_to_scalar_filter_cb, specs); - if (c->specs->halti >= 2) { + if (c->info->halti >= 2) { nir_lower_idiv_options idiv_options = { .allow_fp16 = true, }; @@ -1195,7 +1196,7 @@ etna_compile_shader(struct etna_shader_variant *v) NIR_PASS_V(s, nir_lower_clip_halfz); /* lower pre-halti2 to float (halti0 has integers, but only scalar..) */ - if (c->specs->halti < 2) { + if (c->info->halti < 2) { /* use opt_algebraic between int_to_float and boot_to_float because * int_to_float emits ftrunc, and ftrunc lowering generates bool ops */ diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.h b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.h index dce8d3cdb40..273243c2304 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.h +++ b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.h @@ -28,6 +28,7 @@ #define H_ETNAVIV_COMPILER_NIR #include "compiler/nir/nir.h" +#include "etna_core_info.h" #include "etnaviv_asm.h" #include "etnaviv_compiler.h" #include "util/compiler.h" @@ -38,6 +39,7 @@ struct etna_compile { nir_shader *nir; nir_function_impl *impl; #define is_fs(c) ((c)->nir->info.stage == MESA_SHADER_FRAGMENT) + const struct etna_core_info *info; const struct etna_specs *specs; struct etna_shader_variant *variant; diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir_emit.c b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir_emit.c index 1138bc8c5fb..e745f5873ac 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir_emit.c +++ b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir_emit.c @@ -254,7 +254,7 @@ etna_emit_discard(struct etna_compile *c, struct etna_inst_src condition) struct etna_inst inst = { .opcode = ISA_OPC_TEXKILL, .cond = ISA_COND_NZ, - .type = (c->specs->halti < 2) ? ISA_TYPE_F32 : ISA_TYPE_U32, + .type = (c->info->halti < 2) ? ISA_TYPE_F32 : ISA_TYPE_U32, .src[0] = condition, }; inst.src[0].swiz = INST_SWIZ_BROADCAST(inst.src[0].swiz & 3); diff --git a/src/gallium/drivers/etnaviv/etnaviv_nir.c b/src/gallium/drivers/etnaviv/etnaviv_nir.c index baacbc22ef0..6ec29fba41e 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_nir.c +++ b/src/gallium/drivers/etnaviv/etnaviv_nir.c @@ -119,7 +119,7 @@ etna_lower_io(nir_shader *shader, struct etna_shader_variant *v) /* pre HALTI5 needs texture sources in a single source */ - if (!src1 || v->shader->specs->halti >= 5) + if (!src1 || v->shader->info->halti >= 5) continue; assert(coord && src1 && tex->coord_components < 4); diff --git a/src/gallium/drivers/etnaviv/etnaviv_shader.c b/src/gallium/drivers/etnaviv/etnaviv_shader.c index 8af86adcccd..884fae8c71c 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_shader.c +++ b/src/gallium/drivers/etnaviv/etnaviv_shader.c @@ -489,6 +489,7 @@ etna_create_shader_state(struct pipe_context *pctx, return NULL; shader->id = p_atomic_inc_return(&compiler->shader_count); + shader->info = screen->info; shader->specs = &screen->specs; shader->compiler = screen->compiler; util_queue_fence_init(&shader->ready); diff --git a/src/gallium/drivers/etnaviv/etnaviv_shader.h b/src/gallium/drivers/etnaviv/etnaviv_shader.h index 3336c6c6bc1..bc8ae52cab6 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_shader.h +++ b/src/gallium/drivers/etnaviv/etnaviv_shader.h @@ -28,6 +28,7 @@ #define H_ETNAVIV_SHADER #include "mesa/main/config.h" +#include "etna_core_info.h" #include "nir.h" #include "pipe/p_state.h" #include "util/disk_cache.h" @@ -80,6 +81,7 @@ struct etna_shader { uint32_t variant_count; struct nir_shader *nir; + const struct etna_core_info *info; const struct etna_specs *specs; struct etna_compiler *compiler;