[v0.11] Print available more information for iGPU

This commit is contained in:
Dr-Noob
2021-11-27 11:22:16 +01:00
parent 8db60b614d
commit b00050e739
7 changed files with 49 additions and 29 deletions

View File

@@ -359,7 +359,12 @@ bool print_gpufetch_intel(struct gpu_info* gpu, STYLE s, struct color** cs, stru
return false;
char* gpu_name = get_str_gpu_name(gpu);
char* uarch = get_str_uarch(gpu->arch);
char* manufacturing_process = get_str_process(gpu->arch);
setAttribute(art, ATTRIBUTE_NAME, gpu_name);
setAttribute(art, ATTRIBUTE_UARCH, uarch);
setAttribute(art, ATTRIBUTE_TECHNOLOGY, manufacturing_process);
const char** attribute_fields = ATTRIBUTE_FIELDS;
uint32_t longest_attribute = longest_attribute_length(art, attribute_fields);

28
src/common/uarch.cpp Normal file
View File

@@ -0,0 +1,28 @@
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "global.hpp"
#include "uarch.hpp"
char* get_str_process(struct uarch* arch) {
char* str = (char *) emalloc(sizeof(char) * (strlen(STRING_UNKNOWN)+1));
int32_t process = arch->process;
if(process == UNK) {
snprintf(str, strlen(STRING_UNKNOWN)+1, STRING_UNKNOWN);
}
else if(process > 100) {
sprintf(str, "%.2fum", (double)process/100);
}
else if(process > 0){
sprintf(str, "%dnm", process);
}
else {
snprintf(str, strlen(STRING_UNKNOWN)+1, STRING_UNKNOWN);
printBug("Found invalid process: '%d'", process);
}
return str;
}

View File

@@ -1,6 +1,12 @@
#ifndef __COMMON_UARCH__
#define __COMMON_UARCH__
// Data not available
#define NA -1
// Unknown manufacturing process
#define UNK -1
typedef uint32_t GPUCHIP;
typedef uint32_t MICROARCH;