mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 13:10:10 +01:00
etnaviv: Turn ETNA_CORE_ into ETNA_FEATURE_CORE_
The Vivante GC8000 Nano Ultra VIP r6205 present in ST STM32MP25xx is a combined GPU and NPU single device. The either ETNA_CORE_GPU or ETNA_CORE_NPU behavior does not apply to this device. Instead of adding new combined ETNA_CORE_GPU_AND_NPU variant, convert the ETNA_CORE_GPU and ETNA_CORE_NPU into ETNA_FEATURE_CORE_GPU and ETNA_FEATURE_CORE_NPU, so they can be tested as flags. This allows handling of such combined devices. Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com> Signed-off-by: Marek Vasut <marek.vasut@mailbox.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37488>
This commit is contained in:
parent
2873f47aeb
commit
5eafa246ab
5 changed files with 22 additions and 35 deletions
|
|
@ -11,6 +11,8 @@
|
|||
#include "util/bitset.h"
|
||||
|
||||
enum etna_feature {
|
||||
ETNA_FEATURE_CORE_GPU,
|
||||
ETNA_FEATURE_CORE_NPU,
|
||||
ETNA_FEATURE_FAST_CLEAR,
|
||||
ETNA_FEATURE_PIPE_3D,
|
||||
ETNA_FEATURE_32_BIT_INDICES,
|
||||
|
|
@ -73,12 +75,6 @@ enum etna_feature {
|
|||
ETNA_FEATURE_NUM,
|
||||
};
|
||||
|
||||
enum etna_core_type {
|
||||
ETNA_CORE_NOT_SUPPORTED = 0,
|
||||
ETNA_CORE_GPU,
|
||||
ETNA_CORE_NPU,
|
||||
};
|
||||
|
||||
struct etna_core_gpu_info {
|
||||
unsigned max_instructions; /* vertex/fragment shader max instructions */
|
||||
unsigned vertex_output_buffer_size; /* size of vertex shader output buffer */
|
||||
|
|
@ -111,12 +107,8 @@ struct etna_core_info {
|
|||
|
||||
int8_t halti; /* HALTI (gross architecture) level. -1 for pre-HALTI. */
|
||||
|
||||
enum etna_core_type type;
|
||||
|
||||
union {
|
||||
struct etna_core_gpu_info gpu;
|
||||
struct etna_core_npu_info npu;
|
||||
};
|
||||
struct etna_core_gpu_info gpu;
|
||||
struct etna_core_npu_info npu;
|
||||
|
||||
BITSET_DECLARE(feature, ETNA_FEATURE_NUM);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ query_features_from_kernel(struct etna_gpu *gpu)
|
|||
features[i - ETNA_GPU_FEATURES_0] = val;
|
||||
}
|
||||
|
||||
gpu->info.type = ETNA_CORE_GPU;
|
||||
etna_core_enable_feature(&gpu->info, ETNA_FEATURE_CORE_GPU);
|
||||
|
||||
ETNA_FEATURE(chipFeatures, FAST_CLEAR);
|
||||
ETNA_FEATURE(chipFeatures, PIPE_3D);
|
||||
|
|
@ -155,7 +155,7 @@ query_limits_from_kernel(struct etna_gpu *gpu)
|
|||
struct etna_core_info *info = &gpu->info;
|
||||
uint64_t val;
|
||||
|
||||
assert(info->type == ETNA_CORE_GPU);
|
||||
assert(etna_core_has_feature(info, ETNA_FEATURE_CORE_GPU));
|
||||
|
||||
etna_gpu_get_param(gpu, ETNA_GPU_INSTRUCTION_COUNT, &val);
|
||||
info->gpu.max_instructions = val;
|
||||
|
|
|
|||
|
|
@ -34,10 +34,10 @@ etna_query_feature_db(struct etna_core_info *info)
|
|||
if (!db)
|
||||
return false;
|
||||
|
||||
etna_core_enable_feature(info, ETNA_FEATURE_CORE_GPU);
|
||||
|
||||
if (db->NNCoreCount)
|
||||
info->type = ETNA_CORE_NPU;
|
||||
else
|
||||
info->type = ETNA_CORE_GPU;
|
||||
etna_core_enable_feature(info, ETNA_FEATURE_CORE_NPU);
|
||||
|
||||
/* Features: */
|
||||
ETNA_FEATURE(REG_FastClear, FAST_CLEAR);
|
||||
|
|
@ -114,7 +114,7 @@ etna_query_feature_db(struct etna_core_info *info)
|
|||
ETNA_FEATURE(HWTFB, HWTFB);
|
||||
|
||||
/* Limits: */
|
||||
if (info->type == ETNA_CORE_GPU) {
|
||||
if (etna_core_has_feature(info, ETNA_FEATURE_CORE_GPU)) {
|
||||
info->gpu.max_instructions = db->InstructionCount;
|
||||
info->gpu.vertex_output_buffer_size = db->VertexOutputBufferSize;
|
||||
info->gpu.vertex_cache_size = db->VertexCacheSize;
|
||||
|
|
@ -124,7 +124,9 @@ etna_query_feature_db(struct etna_core_info *info)
|
|||
info->gpu.pixel_pipes = db->NumPixelPipes;
|
||||
info->gpu.max_varyings = db->VaryingCount;
|
||||
info->gpu.num_constants = db->NumberOfConstants;
|
||||
} else {
|
||||
}
|
||||
|
||||
if (etna_core_has_feature(info, ETNA_FEATURE_CORE_NPU)) {
|
||||
info->npu.nn_core_count = db->NNCoreCount;
|
||||
info->npu.nn_mad_per_core = db->NNMadPerCore;
|
||||
info->npu.tp_core_count = db->TPEngine_CoreCount;
|
||||
|
|
|
|||
|
|
@ -808,7 +808,7 @@ etna_get_specs(struct etna_screen *screen)
|
|||
uint32_t instruction_count = 0;
|
||||
|
||||
/* Copy all relevant limits from etna_core_info. */
|
||||
if (info->type == ETNA_CORE_GPU) {
|
||||
if (etna_core_has_feature(info, ETNA_FEATURE_CORE_GPU)) {
|
||||
instruction_count = info->gpu.max_instructions;
|
||||
screen->specs.pixel_pipes = info->gpu.pixel_pipes;
|
||||
|
||||
|
|
@ -816,7 +816,7 @@ etna_get_specs(struct etna_screen *screen)
|
|||
info = etna_gpu_get_core_info(screen->npu);
|
||||
}
|
||||
|
||||
if (info->type == ETNA_CORE_NPU) {
|
||||
if (etna_core_has_feature(info, ETNA_FEATURE_CORE_NPU)) {
|
||||
if (etna_core_has_feature(info, ETNA_FEATURE_NN_XYDP0))
|
||||
screen->specs.nn_core_version = 8;
|
||||
else if (etna_core_has_feature(info, ETNA_FEATURE_VIP_V7))
|
||||
|
|
|
|||
|
|
@ -56,23 +56,16 @@ screen_create(int gpu_fd, const struct pipe_screen_config *config, struct render
|
|||
break;
|
||||
|
||||
info = etna_gpu_get_core_info(core);
|
||||
switch (info->type) {
|
||||
case ETNA_CORE_GPU:
|
||||
/* Look for a 3D capable GPU */
|
||||
if (!gpu && etna_core_has_feature(info, ETNA_FEATURE_PIPE_3D)) {
|
||||
if (!gpu && /* Look for a 3D capable GPU */
|
||||
etna_core_has_feature(info, ETNA_FEATURE_CORE_GPU) &&
|
||||
etna_core_has_feature(info, ETNA_FEATURE_PIPE_3D))
|
||||
gpu = core;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case ETNA_CORE_NPU:
|
||||
if (!npu) {
|
||||
|
||||
if (!npu && etna_core_has_feature(info, ETNA_FEATURE_CORE_NPU))
|
||||
npu = core;
|
||||
|
||||
if (gpu || npu)
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("invalid core type");
|
||||
}
|
||||
|
||||
etna_gpu_del(core);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue