etnaviv: support more VS outputs on halti5 GPUs

Halti5 GPUs doubled the number of available VS outputs, as documented
in rnndb. Double the size of the driver structure and use the size
defines generated by rnndb to emit the correct number of VS output
states, depending on GPU generation.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31032>
This commit is contained in:
Lucas Stach 2024-09-04 15:24:19 +02:00 committed by Marge Bot
parent a71003b1b8
commit ea34c7972b
4 changed files with 9 additions and 5 deletions

View file

@ -134,7 +134,7 @@ emit_halti5_only_state(struct etna_context *ctx, int vs_output_count)
/*007C4*/ EMIT_STATE(FE_HALTI5_ID_CONFIG, ctx->shader_state.FE_HALTI5_ID_CONFIG);
/*00870*/ EMIT_STATE(VS_HALTI5_OUTPUT_COUNT, vs_output_count | ((vs_output_count * 0x10) << 8));
/*008A0*/ EMIT_STATE(VS_HALTI5_UNK008A0, 0x0001000e | ((0x110/vs_output_count) << 20));
for (int x = 0; x < 4; ++x) {
for (int x = 0; x < VIVS_VS_HALTI5_OUTPUT__LEN; ++x) {
/*008E0*/ EMIT_STATE(VS_HALTI5_OUTPUT(x), ctx->shader_state.VS_OUTPUT[x]);
}
}
@ -167,7 +167,7 @@ emit_pre_halti5_state(struct etna_context *ctx)
/*00800*/ EMIT_STATE(VS_END_PC, ctx->shader_state.VS_END_PC);
}
if (unlikely(dirty & (ETNA_DIRTY_SHADER))) {
for (int x = 0; x < 4; ++x) {
for (int x = 0; x < VIVS_VS_OUTPUT__LEN; ++x) {
/*00810*/ EMIT_STATE(VS_OUTPUT(x), ctx->shader_state.VS_OUTPUT[x]);
}
}

View file

@ -109,6 +109,8 @@ struct etna_specs {
uint32_t ps_uniforms_offset;
/* vertex/fragment shader max instructions */
uint32_t max_instructions;
/* maximum number of VS outputs */
unsigned max_vs_outputs;
/* maximum number of varyings */
unsigned max_varyings;
/* maximum vertex uniforms */
@ -218,7 +220,7 @@ struct compiled_shader_state {
uint32_t VS_OUTPUT_COUNT_PSIZE; /* number of outputs of point size per vertex enabled */
uint32_t VS_INPUT_COUNT;
uint32_t VS_TEMP_REGISTER_CONTROL;
uint32_t VS_OUTPUT[4];
uint32_t VS_OUTPUT[8];
uint32_t VS_INPUT[4];
uint32_t VS_LOAD_BALANCING;
uint32_t VS_START_PC;

View file

@ -394,7 +394,7 @@ etna_screen_get_shader_param(struct pipe_screen *pscreen,
return shader == PIPE_SHADER_FRAGMENT ? screen->specs.max_varyings
: screen->specs.vertex_max_elements;
case PIPE_SHADER_CAP_MAX_OUTPUTS:
return 16; /* see VIVS_VS_OUTPUT */
return screen->specs.max_vs_outputs;
case PIPE_SHADER_CAP_MAX_TEMPS:
return 64; /* Max native temporaries. */
case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
@ -964,6 +964,8 @@ etna_get_specs(struct etna_screen *screen)
screen->specs.ps_uniforms_offset = VIVS_PS_UNIFORMS(0);
}
screen->specs.max_vs_outputs = screen->info->halti >= 5 ? 32 : 16;
screen->specs.max_texture_size =
VIV_FEATURE(screen, ETNA_FEATURE_TEXTURE_8K) ? 8192 : 2048;
screen->specs.max_rendertarget_size =

View file

@ -155,7 +155,7 @@ etna_link_shaders(struct etna_context *ctx, struct compiled_shader_state *cs,
cs->VS_OUTPUT_COUNT = 1 + link.num_varyings; /* position + varyings */
/* vs outputs (varyings) */
DEFINE_ETNA_BITARRAY(vs_output, 16, 8) = {0};
DEFINE_ETNA_BITARRAY(vs_output, ARRAY_SIZE(cs->VS_OUTPUT) * 4, 8) = {0};
int varid = 0;
etna_bitarray_set(vs_output, 8, varid++, vs->vs_pos_out_reg);
for (int idx = 0; idx < link.num_varyings; ++idx)