[PATCH libdrm 1/1] etnaviv: remove struct etna_specs
Christian Gmeiner
christian.gmeiner at gmail.com
Sun Mar 26 13:57:28 UTC 2017
There is no need to cache spec values directly as library
users will cache them anyway.
Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
---
etnaviv/etnaviv_gpu.c | 72 ++++++++++++++++++++------------------------------
etnaviv/etnaviv_priv.h | 22 ++-------------
2 files changed, 30 insertions(+), 64 deletions(-)
diff --git a/etnaviv/etnaviv_gpu.c b/etnaviv/etnaviv_gpu.c
index 35dec6c..bc355e8 100644
--- a/etnaviv/etnaviv_gpu.c
+++ b/etnaviv/etnaviv_gpu.c
@@ -61,32 +61,13 @@ struct etna_gpu *etna_gpu_new(struct etna_device *dev, unsigned int core)
gpu->dev = dev;
gpu->core = core;
- /* get specs from kernel space */
- gpu->specs.model = get_param(dev, core, ETNAVIV_PARAM_GPU_MODEL);
- gpu->specs.revision = get_param(dev, core, ETNAVIV_PARAM_GPU_REVISION);
- gpu->specs.features[0] = get_param(dev, core, ETNAVIV_PARAM_GPU_FEATURES_0);
- gpu->specs.features[1] = get_param(dev, core, ETNAVIV_PARAM_GPU_FEATURES_1);
- gpu->specs.features[2] = get_param(dev, core, ETNAVIV_PARAM_GPU_FEATURES_2);
- gpu->specs.features[3] = get_param(dev, core, ETNAVIV_PARAM_GPU_FEATURES_3);
- gpu->specs.features[4] = get_param(dev, core, ETNAVIV_PARAM_GPU_FEATURES_4);
- gpu->specs.features[5] = get_param(dev, core, ETNAVIV_PARAM_GPU_FEATURES_5);
- gpu->specs.features[6] = get_param(dev, core, ETNAVIV_PARAM_GPU_FEATURES_6);
- gpu->specs.stream_count = get_param(dev, core, ETNA_GPU_STREAM_COUNT);
- gpu->specs.register_max = get_param(dev, core, ETNA_GPU_REGISTER_MAX);
- gpu->specs.thread_count = get_param(dev, core, ETNA_GPU_THREAD_COUNT);
- gpu->specs.vertex_cache_size = get_param(dev, core, ETNA_GPU_VERTEX_CACHE_SIZE);
- gpu->specs.shader_core_count = get_param(dev, core, ETNA_GPU_SHADER_CORE_COUNT);
- gpu->specs.pixel_pipes = get_param(dev, core, ETNA_GPU_PIXEL_PIPES);
- gpu->specs.vertex_output_buffer_size = get_param(dev, core, ETNA_GPU_VERTEX_OUTPUT_BUFFER_SIZE);
- gpu->specs.buffer_size = get_param(dev, core, ETNA_GPU_BUFFER_SIZE);
- gpu->specs.instruction_count = get_param(dev, core, ETNA_GPU_INSTRUCTION_COUNT);
- gpu->specs.num_constants = get_param(dev, core, ETNA_GPU_NUM_CONSTANTS);
- gpu->specs.num_varyings = get_param(dev, core, ETNA_GPU_NUM_VARYINGS);
-
- if (!gpu->specs.model)
+ gpu->model = get_param(dev, core, ETNAVIV_PARAM_GPU_MODEL);
+ gpu->revision = get_param(dev, core, ETNAVIV_PARAM_GPU_REVISION);
+
+ if (!gpu->model)
goto fail;
- INFO_MSG(" GPU model: 0x%x (rev %x)", gpu->specs.model, gpu->specs.revision);
+ INFO_MSG(" GPU model: 0x%x (rev %x)", gpu->model, gpu->revision);
return gpu;
fail:
@@ -104,66 +85,69 @@ void etna_gpu_del(struct etna_gpu *gpu)
int etna_gpu_get_param(struct etna_gpu *gpu, enum etna_param_id param,
uint64_t *value)
{
+ struct etna_device *dev = gpu->dev;
+ unsigned int core = gpu->core;
+
switch(param) {
case ETNA_GPU_MODEL:
- *value = gpu->specs.model;
+ *value = gpu->model;
return 0;
case ETNA_GPU_REVISION:
- *value = gpu->specs.revision;
+ *value = gpu->revision;
return 0;
case ETNA_GPU_FEATURES_0:
- *value = gpu->specs.features[0];
+ *value = get_param(dev, core, ETNAVIV_PARAM_GPU_FEATURES_0);
return 0;
case ETNA_GPU_FEATURES_1:
- *value = gpu->specs.features[1];
+ *value = get_param(dev, core, ETNAVIV_PARAM_GPU_FEATURES_1);
return 0;
case ETNA_GPU_FEATURES_2:
- *value = gpu->specs.features[2];
+ *value = get_param(dev, core, ETNAVIV_PARAM_GPU_FEATURES_2);
return 0;
case ETNA_GPU_FEATURES_3:
- *value = gpu->specs.features[3];
+ *value = get_param(dev, core, ETNAVIV_PARAM_GPU_FEATURES_3);
return 0;
case ETNA_GPU_FEATURES_4:
- *value = gpu->specs.features[4];
+ *value = get_param(dev, core, ETNAVIV_PARAM_GPU_FEATURES_4);
return 0;
case ETNA_GPU_FEATURES_5:
- *value = gpu->specs.features[5];
+ *value = get_param(dev, core, ETNAVIV_PARAM_GPU_FEATURES_5);
return 0;
case ETNA_GPU_FEATURES_6:
- *value = gpu->specs.features[6];
+ *value = get_param(dev, core, ETNAVIV_PARAM_GPU_FEATURES_6);
return 0;
case ETNA_GPU_STREAM_COUNT:
- *value = gpu->specs.stream_count;
+ *value = get_param(dev, core, ETNA_GPU_STREAM_COUNT);
return 0;
case ETNA_GPU_REGISTER_MAX:
- *value = gpu->specs.register_max;
+ *value = get_param(dev, core, ETNA_GPU_REGISTER_MAX);
return 0;
case ETNA_GPU_THREAD_COUNT:
- *value = gpu->specs.thread_count;
+ *value = get_param(dev, core, ETNA_GPU_THREAD_COUNT);
return 0;
case ETNA_GPU_VERTEX_CACHE_SIZE:
- *value = gpu->specs.vertex_cache_size;
+ *value = get_param(dev, core, ETNA_GPU_VERTEX_CACHE_SIZE);
return 0;
case ETNA_GPU_SHADER_CORE_COUNT:
- *value = gpu->specs.shader_core_count;
+ *value = get_param(dev, core, ETNA_GPU_SHADER_CORE_COUNT);
return 0;
case ETNA_GPU_PIXEL_PIPES:
- *value = gpu->specs.pixel_pipes;
+ *value = get_param(dev, core, ETNA_GPU_PIXEL_PIPES);
return 0;
case ETNA_GPU_VERTEX_OUTPUT_BUFFER_SIZE:
- *value = gpu->specs.vertex_output_buffer_size;
+ *value = get_param(dev, core, ETNA_GPU_VERTEX_OUTPUT_BUFFER_SIZE);
return 0;
case ETNA_GPU_BUFFER_SIZE:
- *value = gpu->specs.buffer_size;
+ *value = get_param(dev, core, ETNA_GPU_BUFFER_SIZE);
return 0;
case ETNA_GPU_INSTRUCTION_COUNT:
- *value = gpu->specs.instruction_count;
+ *value = get_param(dev, core, ETNA_GPU_INSTRUCTION_COUNT);
return 0;
case ETNA_GPU_NUM_CONSTANTS:
- *value = gpu->specs.num_constants;
+ *value = get_param(dev, core, ETNA_GPU_NUM_CONSTANTS);
return 0;
case ETNA_GPU_NUM_VARYINGS:
- *value = gpu->specs.num_varyings;
+ *value = get_param(dev, core, ETNA_GPU_NUM_VARYINGS);
return 0;
default:
diff --git a/etnaviv/etnaviv_priv.h b/etnaviv/etnaviv_priv.h
index feaa5ad..1334ba3 100644
--- a/etnaviv/etnaviv_priv.h
+++ b/etnaviv/etnaviv_priv.h
@@ -47,25 +47,6 @@
#include "etnaviv_drmif.h"
#include "etnaviv_drm.h"
-#define VIV_FEATURES_WORD_COUNT 7
-
-struct etna_specs {
- uint32_t model;
- uint32_t revision;
- uint32_t features[VIV_FEATURES_WORD_COUNT];
- uint32_t stream_count;
- uint32_t register_max;
- uint32_t thread_count;
- uint32_t shader_core_count;
- uint32_t vertex_cache_size;
- uint32_t vertex_output_buffer_size;
- uint32_t pixel_pipes;
- uint32_t instruction_count;
- uint32_t num_constants;
- uint32_t num_varyings;
- uint32_t buffer_size;
-};
-
struct etna_bo_bucket {
uint32_t size;
struct list_head list;
@@ -134,8 +115,9 @@ struct etna_bo {
struct etna_gpu {
struct etna_device *dev;
- struct etna_specs specs;
uint32_t core;
+ uint32_t model;
+ uint32_t revision;
};
struct etna_pipe {
--
2.9.3
More information about the etnaviv
mailing list