etnaviv: remove struct etna_specs

There is no need to cache spec values directly as library
users will cache them anyway.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
main
Christian Gmeiner 2017-03-26 15:57:28 +02:00
parent 8d61a9a923
commit 18fbd7f089
2 changed files with 29 additions and 63 deletions

View File

@ -61,32 +61,13 @@ struct etna_gpu *etna_gpu_new(struct etna_device *dev, unsigned int core)
gpu->dev = dev; gpu->dev = dev;
gpu->core = core; gpu->core = core;
/* get specs from kernel space */ gpu->model = get_param(dev, core, ETNAVIV_PARAM_GPU_MODEL);
gpu->specs.model = get_param(dev, core, ETNAVIV_PARAM_GPU_MODEL); gpu->revision = get_param(dev, core, ETNAVIV_PARAM_GPU_REVISION);
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) if (!gpu->model)
goto fail; 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; return gpu;
fail: 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, int etna_gpu_get_param(struct etna_gpu *gpu, enum etna_param_id param,
uint64_t *value) uint64_t *value)
{ {
struct etna_device *dev = gpu->dev;
unsigned int core = gpu->core;
switch(param) { switch(param) {
case ETNA_GPU_MODEL: case ETNA_GPU_MODEL:
*value = gpu->specs.model; *value = gpu->model;
return 0; return 0;
case ETNA_GPU_REVISION: case ETNA_GPU_REVISION:
*value = gpu->specs.revision; *value = gpu->revision;
return 0; return 0;
case ETNA_GPU_FEATURES_0: case ETNA_GPU_FEATURES_0:
*value = gpu->specs.features[0]; *value = get_param(dev, core, ETNAVIV_PARAM_GPU_FEATURES_0);
return 0; return 0;
case ETNA_GPU_FEATURES_1: case ETNA_GPU_FEATURES_1:
*value = gpu->specs.features[1]; *value = get_param(dev, core, ETNAVIV_PARAM_GPU_FEATURES_1);
return 0; return 0;
case ETNA_GPU_FEATURES_2: case ETNA_GPU_FEATURES_2:
*value = gpu->specs.features[2]; *value = get_param(dev, core, ETNAVIV_PARAM_GPU_FEATURES_2);
return 0; return 0;
case ETNA_GPU_FEATURES_3: case ETNA_GPU_FEATURES_3:
*value = gpu->specs.features[3]; *value = get_param(dev, core, ETNAVIV_PARAM_GPU_FEATURES_3);
return 0; return 0;
case ETNA_GPU_FEATURES_4: case ETNA_GPU_FEATURES_4:
*value = gpu->specs.features[4]; *value = get_param(dev, core, ETNAVIV_PARAM_GPU_FEATURES_4);
return 0; return 0;
case ETNA_GPU_FEATURES_5: case ETNA_GPU_FEATURES_5:
*value = gpu->specs.features[5]; *value = get_param(dev, core, ETNAVIV_PARAM_GPU_FEATURES_5);
return 0; return 0;
case ETNA_GPU_FEATURES_6: case ETNA_GPU_FEATURES_6:
*value = gpu->specs.features[6]; *value = get_param(dev, core, ETNAVIV_PARAM_GPU_FEATURES_6);
return 0; return 0;
case ETNA_GPU_STREAM_COUNT: case ETNA_GPU_STREAM_COUNT:
*value = gpu->specs.stream_count; *value = get_param(dev, core, ETNA_GPU_STREAM_COUNT);
return 0; return 0;
case ETNA_GPU_REGISTER_MAX: case ETNA_GPU_REGISTER_MAX:
*value = gpu->specs.register_max; *value = get_param(dev, core, ETNA_GPU_REGISTER_MAX);
return 0; return 0;
case ETNA_GPU_THREAD_COUNT: case ETNA_GPU_THREAD_COUNT:
*value = gpu->specs.thread_count; *value = get_param(dev, core, ETNA_GPU_THREAD_COUNT);
return 0; return 0;
case ETNA_GPU_VERTEX_CACHE_SIZE: case ETNA_GPU_VERTEX_CACHE_SIZE:
*value = gpu->specs.vertex_cache_size; *value = get_param(dev, core, ETNA_GPU_VERTEX_CACHE_SIZE);
return 0; return 0;
case ETNA_GPU_SHADER_CORE_COUNT: case ETNA_GPU_SHADER_CORE_COUNT:
*value = gpu->specs.shader_core_count; *value = get_param(dev, core, ETNA_GPU_SHADER_CORE_COUNT);
return 0; return 0;
case ETNA_GPU_PIXEL_PIPES: case ETNA_GPU_PIXEL_PIPES:
*value = gpu->specs.pixel_pipes; *value = get_param(dev, core, ETNA_GPU_PIXEL_PIPES);
return 0; return 0;
case ETNA_GPU_VERTEX_OUTPUT_BUFFER_SIZE: 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; return 0;
case ETNA_GPU_BUFFER_SIZE: case ETNA_GPU_BUFFER_SIZE:
*value = gpu->specs.buffer_size; *value = get_param(dev, core, ETNA_GPU_BUFFER_SIZE);
return 0; return 0;
case ETNA_GPU_INSTRUCTION_COUNT: case ETNA_GPU_INSTRUCTION_COUNT:
*value = gpu->specs.instruction_count; *value = get_param(dev, core, ETNA_GPU_INSTRUCTION_COUNT);
return 0; return 0;
case ETNA_GPU_NUM_CONSTANTS: case ETNA_GPU_NUM_CONSTANTS:
*value = gpu->specs.num_constants; *value = get_param(dev, core, ETNA_GPU_NUM_CONSTANTS);
return 0; return 0;
case ETNA_GPU_NUM_VARYINGS: case ETNA_GPU_NUM_VARYINGS:
*value = gpu->specs.num_varyings; *value = get_param(dev, core, ETNA_GPU_NUM_VARYINGS);
return 0; return 0;
default: default:

View File

@ -47,25 +47,6 @@
#include "etnaviv_drmif.h" #include "etnaviv_drmif.h"
#include "etnaviv_drm.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 { struct etna_bo_bucket {
uint32_t size; uint32_t size;
struct list_head list; struct list_head list;
@ -134,8 +115,9 @@ struct etna_bo {
struct etna_gpu { struct etna_gpu {
struct etna_device *dev; struct etna_device *dev;
struct etna_specs specs;
uint32_t core; uint32_t core;
uint32_t model;
uint32_t revision;
}; };
struct etna_pipe { struct etna_pipe {