etnaviv: common: Add enum etna_core_type

We support the following two core types: GPU and NPU.

Both are using the 3d pipe to submit work so the only way to
differentiate is the nn core count.

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/28574>
This commit is contained in:
Christian Gmeiner 2024-04-08 16:05:54 +02:00 committed by Marge Bot
parent aaccc25a4d
commit ef19966e38
3 changed files with 22 additions and 0 deletions

View file

@ -64,6 +64,12 @@ enum etna_feature {
ETNA_FEATURE_NUM,
};
enum etna_core_type {
ETNA_CORE_NOT_SUPPORTED = 0,
ETNA_CORE_GPU,
ETNA_CORE_NPU,
};
struct etna_core_info {
uint32_t model;
uint32_t revision;
@ -71,6 +77,8 @@ struct etna_core_info {
uint32_t eco_id;
uint32_t customer_id;
enum etna_core_type type;
BITSET_DECLARE(feature, ETNA_FEATURE_NUM);
};

View file

@ -61,6 +61,7 @@ static void
query_features_from_kernel(struct etna_gpu *gpu)
{
uint32_t features[VIV_FEATURES_WORD_COUNT];
uint64_t nn_core_count;
STATIC_ASSERT(ETNA_GPU_FEATURES_0 == 0x3);
STATIC_ASSERT(ETNA_GPU_FEATURES_1 == 0x4);
@ -83,6 +84,14 @@ query_features_from_kernel(struct etna_gpu *gpu)
features[i - ETNA_GPU_FEATURES_0] = val;
}
etna_gpu_get_param(gpu, ETNA_GPU_NN_CORE_COUNT, &nn_core_count);
if (nn_core_count)
gpu->info.type = ETNA_CORE_NPU;
else
gpu->info.type = ETNA_CORE_GPU;
ETNA_FEATURE(chipFeatures, FAST_CLEAR);
ETNA_FEATURE(chipFeatures, 32_BIT_INDICES);
ETNA_FEATURE(chipFeatures, MSAA);

View file

@ -23,6 +23,11 @@ etna_query_feature_db(struct etna_core_info *info)
if (!db)
return false;
if (db->NNCoreCount)
info->type = ETNA_CORE_NPU;
else
info->type = ETNA_CORE_GPU;
ETNA_FEATURE(REG_FastClear, FAST_CLEAR);
ETNA_FEATURE(REG_FE20BitIndex, 32_BIT_INDICES);
ETNA_FEATURE(REG_MSAA, MSAA);