etnaviv: drm: Query some id values in etna_gpu_new(..)

We want to fully initialise etna_device_info. We only query the kernel
for these values if the drm driver is recent enough.

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-02-28 09:23:24 +01:00
committed by Marge Bot
parent d600b45ccc
commit e1c6748cf4
2 changed files with 12 additions and 3 deletions

View File

@@ -67,6 +67,9 @@ enum etna_feature {
struct etna_core_info {
uint32_t model;
uint32_t revision;
uint32_t product_id;
uint32_t eco_id;
uint32_t customer_id;
BITSET_DECLARE(feature, ETNA_FEATURE_NUM);
};

View File

@@ -181,6 +181,12 @@ struct etna_gpu *etna_gpu_new(struct etna_device *dev, unsigned int core)
DEBUG_MSG(" GPU model: 0x%x (rev %x)", gpu->info.model, gpu->info.revision);
if (dev->drm_version >= ETNA_DRM_VERSION(1, 4)) {
gpu->info.product_id = get_param(dev, core, ETNAVIV_PARAM_GPU_PRODUCT_ID);
gpu->info.customer_id = get_param(dev, core, ETNAVIV_PARAM_GPU_CUSTOMER_ID);
gpu->info.eco_id = get_param(dev, core, ETNAVIV_PARAM_GPU_ECO_ID);
}
query_features_from_kernel(gpu);
return gpu;
@@ -285,13 +291,13 @@ int etna_gpu_get_param(struct etna_gpu *gpu, enum etna_param_id param,
*value = get_param(dev, core, ETNA_SOFTPIN_START_ADDR);
return 0;
case ETNA_GPU_PRODUCT_ID:
*value = get_param(dev, core, ETNA_GPU_PRODUCT_ID);
*value = gpu->info.product_id;
return 0;
case ETNA_GPU_CUSTOMER_ID:
*value = get_param(dev, core, ETNA_GPU_CUSTOMER_ID);
*value = gpu->info.customer_id;
return 0;
case ETNA_GPU_ECO_ID:
*value = get_param(dev, core, ETNA_GPU_ECO_ID);
*value = gpu->info.eco_id;
return 0;
case ETNA_GPU_NN_CORE_COUNT:
*value = get_param(dev, core, ETNA_GPU_NN_CORE_COUNT);