Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/etnaviv: add further minor features and varyings count

Export further minor feature bitmasks and the varyings count from
the GPU specifications registers to userspace.

Acked-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>

authored by

Russell King and committed by
Lucas Stach
602eb489 472f79dc

+73 -1
+61 -1
drivers/gpu/drm/etnaviv/etnaviv_gpu.c
··· 72 72 *value = gpu->identity.minor_features3; 73 73 break; 74 74 75 + case ETNAVIV_PARAM_GPU_FEATURES_5: 76 + *value = gpu->identity.minor_features4; 77 + break; 78 + 79 + case ETNAVIV_PARAM_GPU_FEATURES_6: 80 + *value = gpu->identity.minor_features5; 81 + break; 82 + 75 83 case ETNAVIV_PARAM_GPU_STREAM_COUNT: 76 84 *value = gpu->identity.stream_count; 77 85 break; ··· 120 112 *value = gpu->identity.num_constants; 121 113 break; 122 114 115 + case ETNAVIV_PARAM_GPU_NUM_VARYINGS: 116 + *value = gpu->identity.varyings_count; 117 + break; 118 + 123 119 default: 124 120 DBG("%s: invalid param: %u", dev_name(gpu->dev), param); 125 121 return -EINVAL; ··· 143 131 { 144 132 if (gpu->identity.minor_features0 & 145 133 chipMinorFeatures0_MORE_MINOR_FEATURES) { 146 - u32 specs[2]; 134 + u32 specs[4]; 135 + unsigned int streams; 147 136 148 137 specs[0] = gpu_read(gpu, VIVS_HI_CHIP_SPECS); 149 138 specs[1] = gpu_read(gpu, VIVS_HI_CHIP_SPECS_2); 139 + specs[2] = gpu_read(gpu, VIVS_HI_CHIP_SPECS_3); 140 + specs[3] = gpu_read(gpu, VIVS_HI_CHIP_SPECS_4); 150 141 151 142 gpu->identity.stream_count = etnaviv_field(specs[0], 152 143 VIVS_HI_CHIP_SPECS_STREAM_COUNT); ··· 173 158 VIVS_HI_CHIP_SPECS_2_INSTRUCTION_COUNT); 174 159 gpu->identity.num_constants = etnaviv_field(specs[1], 175 160 VIVS_HI_CHIP_SPECS_2_NUM_CONSTANTS); 161 + 162 + gpu->identity.varyings_count = etnaviv_field(specs[2], 163 + VIVS_HI_CHIP_SPECS_3_VARYINGS_COUNT); 164 + 165 + /* This overrides the value from older register if non-zero */ 166 + streams = etnaviv_field(specs[3], 167 + VIVS_HI_CHIP_SPECS_4_STREAM_COUNT); 168 + if (streams) 169 + gpu->identity.stream_count = streams; 176 170 } 177 171 178 172 /* Fill in the stream count if not specified */ ··· 263 239 264 240 if (gpu->identity.num_constants == 0) 265 241 gpu->identity.num_constants = 168; 242 + 243 + if (gpu->identity.varyings_count == 0) { 244 + if (gpu->identity.minor_features1 & chipMinorFeatures1_HALTI0) 245 + gpu->identity.varyings_count = 12; 246 + else 247 + gpu->identity.varyings_count = 8; 248 + } 249 + 250 + /* 251 + * For some cores, two varyings are consumed for position, so the 252 + * maximum varying count needs to be reduced by one. 253 + */ 254 + if (etnaviv_is_model_rev(gpu, GC5000, 0x5434) || 255 + etnaviv_is_model_rev(gpu, GC4000, 0x5222) || 256 + etnaviv_is_model_rev(gpu, GC4000, 0x5245) || 257 + etnaviv_is_model_rev(gpu, GC4000, 0x5208) || 258 + etnaviv_is_model_rev(gpu, GC3000, 0x5435) || 259 + etnaviv_is_model_rev(gpu, GC2200, 0x5244) || 260 + etnaviv_is_model_rev(gpu, GC2100, 0x5108) || 261 + etnaviv_is_model_rev(gpu, GC2000, 0x5108) || 262 + etnaviv_is_model_rev(gpu, GC1500, 0x5246) || 263 + etnaviv_is_model_rev(gpu, GC880, 0x5107) || 264 + etnaviv_is_model_rev(gpu, GC880, 0x5106)) 265 + gpu->identity.varyings_count -= 1; 266 266 } 267 267 268 268 static void etnaviv_hw_identify(struct etnaviv_gpu *gpu) ··· 353 305 gpu->identity.minor_features1 = 0; 354 306 gpu->identity.minor_features2 = 0; 355 307 gpu->identity.minor_features3 = 0; 308 + gpu->identity.minor_features4 = 0; 309 + gpu->identity.minor_features5 = 0; 356 310 } else 357 311 gpu->identity.minor_features0 = 358 312 gpu_read(gpu, VIVS_HI_CHIP_MINOR_FEATURE_0); ··· 367 317 gpu_read(gpu, VIVS_HI_CHIP_MINOR_FEATURE_2); 368 318 gpu->identity.minor_features3 = 369 319 gpu_read(gpu, VIVS_HI_CHIP_MINOR_FEATURE_3); 320 + gpu->identity.minor_features4 = 321 + gpu_read(gpu, VIVS_HI_CHIP_MINOR_FEATURE_4); 322 + gpu->identity.minor_features5 = 323 + gpu_read(gpu, VIVS_HI_CHIP_MINOR_FEATURE_5); 370 324 } 371 325 372 326 /* GC600 idle register reports zero bits where modules aren't present */ ··· 699 645 gpu->identity.minor_features2); 700 646 seq_printf(m, "\t minor_features3: 0x%08x\n", 701 647 gpu->identity.minor_features3); 648 + seq_printf(m, "\t minor_features4: 0x%08x\n", 649 + gpu->identity.minor_features4); 650 + seq_printf(m, "\t minor_features5: 0x%08x\n", 651 + gpu->identity.minor_features5); 702 652 703 653 seq_puts(m, "\tspecs\n"); 704 654 seq_printf(m, "\t stream_count: %d\n", ··· 725 667 gpu->identity.instruction_count); 726 668 seq_printf(m, "\t num_constants: %d\n", 727 669 gpu->identity.num_constants); 670 + seq_printf(m, "\t varyings_count: %d\n", 671 + gpu->identity.varyings_count); 728 672 729 673 seq_printf(m, "\taxi: 0x%08x\n", axi); 730 674 seq_printf(m, "\tidle: 0x%08x\n", idle);
+9
drivers/gpu/drm/etnaviv/etnaviv_gpu.h
··· 46 46 /* Supported minor feature 3 fields. */ 47 47 u32 minor_features3; 48 48 49 + /* Supported minor feature 4 fields. */ 50 + u32 minor_features4; 51 + 52 + /* Supported minor feature 5 fields. */ 53 + u32 minor_features5; 54 + 49 55 /* Number of streams supported. */ 50 56 u32 stream_count; 51 57 ··· 81 75 82 76 /* Buffer size */ 83 77 u32 buffer_size; 78 + 79 + /* Number of varyings */ 80 + u8 varyings_count; 84 81 }; 85 82 86 83 struct etnaviv_event {
+3
include/uapi/drm/etnaviv_drm.h
··· 48 48 #define ETNAVIV_PARAM_GPU_FEATURES_2 0x05 49 49 #define ETNAVIV_PARAM_GPU_FEATURES_3 0x06 50 50 #define ETNAVIV_PARAM_GPU_FEATURES_4 0x07 51 + #define ETNAVIV_PARAM_GPU_FEATURES_5 0x08 52 + #define ETNAVIV_PARAM_GPU_FEATURES_6 0x09 51 53 52 54 #define ETNAVIV_PARAM_GPU_STREAM_COUNT 0x10 53 55 #define ETNAVIV_PARAM_GPU_REGISTER_MAX 0x11 ··· 61 59 #define ETNAVIV_PARAM_GPU_BUFFER_SIZE 0x17 62 60 #define ETNAVIV_PARAM_GPU_INSTRUCTION_COUNT 0x18 63 61 #define ETNAVIV_PARAM_GPU_NUM_CONSTANTS 0x19 62 + #define ETNAVIV_PARAM_GPU_NUM_VARYINGS 0x1a 64 63 65 64 #define ETNA_MAX_PIPES 4 66 65