From 84816c22e4cf782bf521a005cff6063932a11872 Mon Sep 17 00:00:00 2001 From: Christian Gmeiner Date: Fri, 14 Feb 2020 13:24:07 +0100 Subject: [PATCH] etnaviv: ask kernel for max number of supported varyings The inital etnaviv kernel driver in 4.5 has support for this param. See kernel commit 602eb48966d7b7f7e64dca8d9ea2842d83bfae73 Signed-off-by: Christian Gmeiner Reviewed-by: Jonathan Marek Part-of: --- src/gallium/drivers/etnaviv/etnaviv_screen.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c index 51154a3df11..6fb75193430 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c @@ -700,6 +700,12 @@ etna_get_specs(struct etna_screen *screen) } screen->specs.num_constants = val; + if (etna_gpu_get_param(screen->gpu, ETNA_GPU_NUM_VARYINGS, &val)) { + DBG("could not get ETNA_GPU_NUM_VARYINGS"); + goto fail; + } + screen->specs.max_varyings = MAX2(val, ETNA_NUM_VARYINGS); + /* Figure out gross GPU architecture. See rnndb/common.xml for a specific * description of the differences. */ if (VIV_FEATURE(screen, chipMinorFeatures5, HALTI5)) @@ -791,22 +797,14 @@ etna_get_specs(struct etna_screen *screen) } if (VIV_FEATURE(screen, chipMinorFeatures1, HALTI0)) { - screen->specs.max_varyings = 12; screen->specs.vertex_max_elements = 16; } else { - screen->specs.max_varyings = 8; /* Etna_viv documentation seems confused over the correct value * here so choose the lower to be safe: HALTI0 says 16 i.s.o. * 10, but VERTEX_ELEMENT_CONFIG register says 16 i.s.o. 12. */ screen->specs.vertex_max_elements = 10; } - /* Etna_viv documentation does not indicate where varyings above 8 are - * stored. Moreover, if we are passed more than 8 varyings, we will - * walk off the end of some arrays. Limit the maximum number of varyings. */ - if (screen->specs.max_varyings > ETNA_NUM_VARYINGS) - screen->specs.max_varyings = ETNA_NUM_VARYINGS; - etna_determine_uniform_limits(screen); if (screen->specs.halti >= 5) {