etnaviv: Move halti determination to drm

The ideal place to store the halti value is in struct etna_core_info.
Let's put it there and the determination of it into etna_gpu_new(..).
This makes it possible to reuse the halti level outside of gallium.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30394>
This commit is contained in:
Christian Gmeiner 2024-07-27 08:18:08 +02:00 committed by Marge Bot
parent 0324d4bcf5
commit ce2fc866ec
3 changed files with 27 additions and 16 deletions

View file

@ -103,6 +103,8 @@ struct etna_core_info {
uint32_t eco_id;
uint32_t customer_id;
int8_t halti; /* HALTI (gross architecture) level. -1 for pre-HALTI. */
enum etna_core_type type;
union {

View file

@ -203,6 +203,28 @@ static uint64_t get_param(struct etna_device *dev, uint32_t core, uint32_t param
return req.value;
}
static void determine_halti(struct etna_gpu *gpu)
{
struct etna_core_info *info = &gpu->info;
/* Figure out gross GPU architecture. See rnndb/common.xml for a specific
* description of the differences. */
if (etna_core_has_feature(info, ETNA_FEATURE_HALTI5))
info->halti = 5; /* New GC7000/GC8x00 */
else if (etna_core_has_feature(info, ETNA_FEATURE_HALTI4))
info->halti = 4; /* Old GC7000/GC7400 */
else if (etna_core_has_feature(info, ETNA_FEATURE_HALTI3))
info->halti = 3; /* None? */
else if (etna_core_has_feature(info, ETNA_FEATURE_HALTI2))
info->halti = 2; /* GC2500/GC3000/GC5000/GC6400 */
else if (etna_core_has_feature(info, ETNA_FEATURE_HALTI1))
info->halti = 1; /* GC900/GC4000/GC7000UL */
else if (etna_core_has_feature(info, ETNA_FEATURE_HALTI0))
info->halti = 0; /* GC880/GC2000/GC7000TM */
else
info->halti = -1; /* GC7000nanolite / pre-GC2000 except GC880 */
}
struct etna_gpu *etna_gpu_new(struct etna_device *dev, unsigned int core)
{
struct etna_gpu *gpu;
@ -239,6 +261,8 @@ struct etna_gpu *etna_gpu_new(struct etna_device *dev, unsigned int core)
query_limits_from_kernel(gpu);
}
determine_halti(gpu);
return gpu;
fail:
if (gpu)

View file

@ -881,22 +881,7 @@ etna_get_specs(struct etna_screen *screen)
screen->specs.nn_core_version = 6;
}
/* Figure out gross GPU architecture. See rnndb/common.xml for a specific
* description of the differences. */
if (VIV_FEATURE(screen, ETNA_FEATURE_HALTI5))
screen->specs.halti = 5; /* New GC7000/GC8x00 */
else if (VIV_FEATURE(screen, ETNA_FEATURE_HALTI4))
screen->specs.halti = 4; /* Old GC7000/GC7400 */
else if (VIV_FEATURE(screen, ETNA_FEATURE_HALTI3))
screen->specs.halti = 3; /* None? */
else if (VIV_FEATURE(screen, ETNA_FEATURE_HALTI2))
screen->specs.halti = 2; /* GC2500/GC3000/GC5000/GC6400 */
else if (VIV_FEATURE(screen, ETNA_FEATURE_HALTI1))
screen->specs.halti = 1; /* GC900/GC4000/GC7000UL */
else if (VIV_FEATURE(screen, ETNA_FEATURE_HALTI0))
screen->specs.halti = 0; /* GC880/GC2000/GC7000TM */
else
screen->specs.halti = -1; /* GC7000nanolite / pre-GC2000 except GC880 */
screen->specs.halti = info->halti;
if (screen->specs.halti >= 0)
DBG("etnaviv: GPU arch: HALTI%d", screen->specs.halti);
else