etnaviv: Move nir_shader_compiler_options to compiler

It fits there much better and is an other step to get the
compiler to common code.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17819>
This commit is contained in:
Christian Gmeiner
2022-07-31 13:50:57 +02:00
committed by Marge Bot
parent 5a000b4eb6
commit d5cd8f18c2
5 changed files with 41 additions and 32 deletions
+34 -1
View File
@@ -31,10 +31,37 @@
#include "util/ralloc.h"
struct etna_compiler *
etna_compiler_create(const char *renderer)
etna_compiler_create(const char *renderer, const struct etna_specs *specs)
{
struct etna_compiler *compiler = rzalloc(NULL, struct etna_compiler);
compiler->options = (nir_shader_compiler_options) {
.lower_fpow = true,
.lower_ftrunc = true,
.fuse_ffma16 = true,
.fuse_ffma32 = true,
.fuse_ffma64 = true,
.lower_bitops = true,
.lower_all_io_to_temps = true,
.vertex_id_zero_based = true,
.lower_flrp32 = true,
.lower_fmod = true,
.lower_vector_cmp = true,
.lower_fdph = true,
.lower_insert_byte = true,
.lower_insert_word = true,
.lower_fdiv = true, /* !specs->has_new_transcendentals */
.lower_fsign = !specs->has_sign_floor_ceil,
.lower_ffloor = !specs->has_sign_floor_ceil,
.lower_fceil = !specs->has_sign_floor_ceil,
.lower_fsqrt = !specs->has_sin_cos_sqrt,
.lower_sincos = !specs->has_sin_cos_sqrt,
.lower_uniforms_to_ubo = specs->halti >= 2,
.force_indirect_unrolling = nir_var_all,
.max_unroll_iterations = 32,
.vectorize_io = true,
};
compiler->regs = etna_ra_setup(compiler);
if (!compiler->regs) {
ralloc_free((void *)compiler);
@@ -51,3 +78,9 @@ etna_compiler_destroy(const struct etna_compiler *compiler)
{
ralloc_free((void *)compiler);
}
const nir_shader_compiler_options *
etna_compiler_get_options(struct etna_compiler *compiler)
{
return &compiler->options;
}
@@ -52,6 +52,7 @@ struct etna_compiler {
uint32_t shader_count;
struct ra_regs *regs;
nir_shader_compiler_options options;
struct disk_cache *disk_cache;
};
@@ -146,11 +147,14 @@ struct etna_shader_link_info {
};
struct etna_compiler *
etna_compiler_create(const char *renderer);
etna_compiler_create(const char *renderer, const struct etna_specs *specs);
void
etna_compiler_destroy(const struct etna_compiler *compiler);
const nir_shader_compiler_options *
etna_compiler_get_options(struct etna_compiler *compiler);
bool
etna_compile_shader(struct etna_shader_variant *shader);
+1 -28
View File
@@ -956,7 +956,7 @@ static const void *
etna_get_compiler_options(struct pipe_screen *pscreen,
enum pipe_shader_ir ir, unsigned shader)
{
return &etna_screen(pscreen)->options;
return etna_compiler_get_options(etna_screen(pscreen)->compiler);
}
static struct disk_cache *
@@ -1095,33 +1095,6 @@ etna_screen_create(struct etna_device *dev, struct etna_gpu *gpu,
goto fail;
}
screen->options = (nir_shader_compiler_options) {
.lower_fpow = true,
.lower_ftrunc = true,
.fuse_ffma16 = true,
.fuse_ffma32 = true,
.fuse_ffma64 = true,
.lower_bitops = true,
.lower_all_io_to_temps = true,
.vertex_id_zero_based = true,
.lower_flrp32 = true,
.lower_fmod = true,
.lower_vector_cmp = true,
.lower_fdph = true,
.lower_insert_byte = true,
.lower_insert_word = true,
.lower_fdiv = true, /* !screen->specs.has_new_transcendentals */
.lower_fsign = !screen->specs.has_sign_floor_ceil,
.lower_ffloor = !screen->specs.has_sign_floor_ceil,
.lower_fceil = !screen->specs.has_sign_floor_ceil,
.lower_fsqrt = !screen->specs.has_sin_cos_sqrt,
.lower_sincos = !screen->specs.has_sin_cos_sqrt,
.lower_uniforms_to_ubo = screen->specs.halti >= 2,
.force_indirect_unrolling = nir_var_all,
.max_unroll_iterations = 32,
.vectorize_io = true,
};
/* apply debug options that disable individual features */
if (DBG_ENABLED(ETNA_DBG_NO_EARLY_Z))
screen->features[viv_chipFeatures] |= chipFeatures_NO_EARLY_Z;
@@ -93,7 +93,6 @@ struct etna_screen {
uint32_t drm_version;
struct etna_compiler *compiler;
nir_shader_compiler_options options;
struct util_queue shader_compiler_queue;
/* dummy render target for GPUs that can't fully disable the color pipe */
+1 -1
View File
@@ -591,7 +591,7 @@ etna_shader_screen_init(struct pipe_screen *pscreen)
/* Create at least one thread - even on single core CPU systems. */
num_threads = MAX2(1, num_threads);
screen->compiler = etna_compiler_create(pscreen->get_name(pscreen));
screen->compiler = etna_compiler_create(pscreen->get_name(pscreen), &screen->specs);
if (!screen->compiler)
return false;