From a302a4508cf254ab06e57641e02dd1ea374377c2 Mon Sep 17 00:00:00 2001 From: Dr-Noob Date: Wed, 18 Aug 2021 12:31:59 +0200 Subject: [PATCH] [v0.99] Show new Intel logo only when the CPU was released after Intel started using the new logo --- src/common/printer.c | 18 ++++++++++++++---- src/x86/uarch.c | 10 ++++++++++ src/x86/uarch.h | 1 + 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/common/printer.c b/src/common/printer.c index 97cdb4c..39e2618 100644 --- a/src/common/printer.c +++ b/src/common/printer.c @@ -144,6 +144,7 @@ struct ascii { struct attribute** attributes; uint32_t n_attributes_set; uint32_t additional_spaces; + bool new_intel_logo; VENDOR vendor; STYLE style; }; @@ -260,10 +261,18 @@ void choose_ascii_art(struct ascii* art, struct color** cs, struct terminal* ter // 1. Choose logo #ifdef ARCH_X86 if(art->vendor == CPU_VENDOR_INTEL) { - if(term != NULL && ascii_fits_screen(term->w, logo_intel_l, lf)) - art->art = &logo_intel_l; - else - art->art = &logo_intel; + if(art->new_intel_logo) { + if(term != NULL && ascii_fits_screen(term->w, logo_intel_l_new, lf)) + art->art = &logo_intel_l_new; + else + art->art = &logo_intel_new; + } + else { + if(term != NULL && ascii_fits_screen(term->w, logo_intel_l, lf)) + art->art = &logo_intel_l; + else + art->art = &logo_intel; + } } else if(art->vendor == CPU_VENDOR_AMD) { if(term != NULL && ascii_fits_screen(term->w, logo_amd_l, lf)) @@ -428,6 +437,7 @@ bool print_cpufetch_x86(struct cpuInfo* cpu, STYLE s, struct color** cs, struct if(art == NULL) return false; + art->new_intel_logo = choose_new_intel_logo(cpu); char* uarch = get_str_uarch(cpu); char* manufacturing_process = get_str_process(cpu); char* sockets = get_str_sockets(cpu->topo); diff --git a/src/x86/uarch.c b/src/x86/uarch.c index b5ceff4..ceb7b69 100644 --- a/src/x86/uarch.c +++ b/src/x86/uarch.c @@ -399,6 +399,16 @@ int get_number_of_vpus(struct cpuInfo* cpu) { } } +bool choose_new_intel_logo(struct cpuInfo* cpu) { + switch(cpu->arch->uarch) { + case UARCH_ROCKET_LAKE: + // TODO: case UARCH_TIGER_LAKE: missing? + return true; + default: + return false; + } +} + char* get_str_uarch(struct cpuInfo* cpu) { return cpu->arch->uarch_str; } diff --git a/src/x86/uarch.h b/src/x86/uarch.h index 0fc3267..d03e0d2 100644 --- a/src/x86/uarch.h +++ b/src/x86/uarch.h @@ -11,6 +11,7 @@ struct uarch* get_uarch_from_cpuid(struct cpuInfo* cpu, uint32_t ef, uint32_t f, bool vpus_are_AVX512(struct cpuInfo* cpu); bool is_knights_landing(struct cpuInfo* cpu); int get_number_of_vpus(struct cpuInfo* cpu); +bool choose_new_intel_logo(struct cpuInfo* cpu); char* get_str_uarch(struct cpuInfo* cpu); char* get_str_process(struct cpuInfo* cpu); void free_uarch_struct(struct uarch* arch);