From b89eeaa95421c5c21e5927ab4ae8733cd03558e2 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Mon, 22 Jul 2024 22:14:43 +0800 Subject: [PATCH 1/7] CPU: fix double frequency value when using custom formation Fix #1111 --- src/modules/cpu/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/cpu/cpu.c b/src/modules/cpu/cpu.c index a0df7cb7f..eef95001f 100644 --- a/src/modules/cpu/cpu.c +++ b/src/modules/cpu/cpu.c @@ -95,7 +95,7 @@ void ffPrintCPU(FFCPUOptions* options) FF_STRBUF_AUTO_DESTROY freqBase = ffStrbufCreate(); ffParseFrequency(cpu.frequencyBase, &freqBase); FF_STRBUF_AUTO_DESTROY freqMax = ffStrbufCreate(); - ffParseFrequency(cpu.frequencyBase, &freqBase); + ffParseFrequency(cpu.frequencyBase, &freqMax); FF_STRBUF_AUTO_DESTROY freqBioslimit = ffStrbufCreate(); ffParseFrequency(cpu.frequencyBiosLimit, &freqBioslimit); From 9559db556ddc0ba2202d2cbc7987d974054120ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sun, 21 Jul 2024 00:05:11 +0800 Subject: [PATCH 2/7] Display: print `[HDR]` if enabled --- src/modules/display/display.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/modules/display/display.c b/src/modules/display/display.c index 707336432..93cdecbe5 100644 --- a/src/modules/display/display.c +++ b/src/modules/display/display.c @@ -6,7 +6,7 @@ #include -#define FF_DISPLAY_NUM_FORMAT_ARGS 13 +#define FF_DISPLAY_NUM_FORMAT_ARGS 16 static int sortByNameAsc(FFDisplayResult* a, FFDisplayResult* b) { @@ -126,6 +126,9 @@ void ffPrintDisplay(FFDisplayOptions* options) if(result->type != FF_DISPLAY_TYPE_UNKNOWN) ffStrbufAppendS(&buffer, result->type == FF_DISPLAY_TYPE_BUILTIN ? " [Built-in]" : " [External]"); + if (result->hdrEnabled) + ffStrbufAppendS(&buffer, " [HDR]"); + if(moduleIndex > 0 && result->primary) ffStrbufAppendS(&buffer, " *"); @@ -150,6 +153,9 @@ void ffPrintDisplay(FFDisplayOptions* options) {FF_FORMAT_ARG_TYPE_UINT, &result->physicalHeight, "physical-height"}, {FF_FORMAT_ARG_TYPE_DOUBLE, &inch, "inch"}, {FF_FORMAT_ARG_TYPE_DOUBLE, &ppi, "ppi"}, + {FF_FORMAT_ARG_TYPE_UINT8, &result->bitDepth, "bit-depth"}, + {FF_FORMAT_ARG_TYPE_BOOL, &result->hdrEnabled, "hdr-enabled"}, + {FF_FORMAT_ARG_TYPE_BOOL, &result->wcgEnabled, "wcg-enabled"}, })); } } @@ -352,6 +358,9 @@ void ffPrintDisplayHelpFormat(void) "Screen physical height (in millimeters) - physical-height", "Physical diagonal length in inches - inch", "Pixels per inch (PPI) - ppi", + "Bits per color channel - bit-depth", + "True if high dynamic range (HDR) is enabled - hdr-enabled", + "True if wide color gamut (WCG) is enabled - wcg-enabled", })); } From f3e48a00a0a04ba5df8567bd1163efb0f5129753 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 22 Jul 2024 19:24:29 +0800 Subject: [PATCH 3/7] Display (Android): fix MiUI 560 is density dpi, not physical dpi --- src/detection/displayserver/displayserver_android.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/detection/displayserver/displayserver_android.c b/src/detection/displayserver/displayserver_android.c index a81f763b2..a51d850f4 100644 --- a/src/detection/displayserver/displayserver_android.c +++ b/src/detection/displayserver/displayserver_android.c @@ -82,25 +82,25 @@ static bool detectWithGetprop(FFDisplayServerResult* ds) if (ffSettingsGetAndroidProperty("persist.sys.miui_resolution", &buffer) && ffStrbufContainC(&buffer, ',')) { - // 1440,3200,560 => width,height,ppi + // 1440,3200,560 => width,height,densityDpi uint32_t width = (uint32_t) ffStrbufToUInt(&buffer, 0); ffStrbufSubstrAfterFirstC(&buffer, ','); uint32_t height = (uint32_t) ffStrbufToUInt(&buffer, 0); ffStrbufSubstrAfterFirstC(&buffer, ','); - uint32_t ppi = (uint32_t) ffStrbufToUInt(&buffer, 0); + double scaleFactor = (double) ffStrbufToUInt(&buffer, 0) / 160.; return ffdsAppendDisplay(ds, width, height, 0, - 0, - 0, + (uint32_t) (width / scaleFactor + .5), + (uint32_t) (height / scaleFactor + .5), 0, 0, FF_DISPLAY_TYPE_BUILTIN, false, 0, - (uint32_t) (width / ppi * 25.4), - (uint32_t) (height / ppi * 25.4) + 0, + 0 ); } From 2c29465f698163b2da397354b93a2841c55366f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Tue, 23 Jul 2024 09:39:22 +0800 Subject: [PATCH 4/7] Doc: update README [ci skip] --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 54bcf1fd4..cd25100d8 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,8 @@ Alternatively, you can refer to the presets in [`presets` directory](https://git The **correct** way to edit the configuration: +This is an example that [changes size prefix from MiB / GiB to MB / GB](https://github.com/fastfetch-cli/fastfetch/discussions/1014). Editor used: [helix](https://github.com/helix-editor/helix) + [![asciicast](https://asciinema.org/a/1uF6sTPGKrHKI1MVaFcikINSQ.svg)](https://asciinema.org/a/1uF6sTPGKrHKI1MVaFcikINSQ) ### Q: I WANT THE DOCUMENTATION! From 83dcdaa726332eb114be0dae7eaa98ef497c9fca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Tue, 23 Jul 2024 09:50:51 +0800 Subject: [PATCH 5/7] GPU: fix frequency printing when using custom formation --- src/modules/gpu/gpu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/gpu/gpu.c b/src/modules/gpu/gpu.c index 22cef578c..a653b34ac 100644 --- a/src/modules/gpu/gpu.c +++ b/src/modules/gpu/gpu.c @@ -87,6 +87,9 @@ static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResu if (gpu->shared.total != FF_GPU_VMEM_SIZE_UNSET) ffParseSize(gpu->shared.total, &sTotal); if (gpu->shared.used != FF_GPU_VMEM_SIZE_UNSET) ffParseSize(gpu->shared.used, &sUsed); + FF_STRBUF_AUTO_DESTROY frequency = ffStrbufCreate(); + ffParseFrequency(gpu->frequency, &frequency); + FF_PRINT_FORMAT_CHECKED(FF_GPU_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_GPU_NUM_FORMAT_ARGS, ((FFformatarg[]) { {FF_FORMAT_ARG_TYPE_STRBUF, &gpu->vendor, "vendor"}, {FF_FORMAT_ARG_TYPE_STRBUF, &gpu->name, "name"}, @@ -99,7 +102,7 @@ static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResu {FF_FORMAT_ARG_TYPE_STRBUF, &sTotal, "shared-total"}, {FF_FORMAT_ARG_TYPE_STRBUF, &sUsed, "shared-used"}, {FF_FORMAT_ARG_TYPE_STRBUF, &gpu->platformApi, "platform-api"}, - {FF_FORMAT_ARG_TYPE_DOUBLE, &gpu->frequency, "frequency"}, + {FF_FORMAT_ARG_TYPE_STRBUF, &frequency, "frequency"}, })); } } From deacecdc11babed84a5e474854a180f27127c93e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Tue, 23 Jul 2024 09:55:48 +0800 Subject: [PATCH 6/7] Fastfetch: print error when invalid freq option is found --- src/options/display.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/options/display.c b/src/options/display.c index 117cd689f..c29370864 100644 --- a/src/options/display.c +++ b/src/options/display.c @@ -392,6 +392,8 @@ bool ffOptionsParseDisplayCommandLine(FFOptionsDisplay* options, const char* key const char* subkey = key + strlen("--freq-"); if(ffStrEqualsIgnCase(subkey, "ndigits")) options->freqNdigits = (int8_t) ffOptionParseInt32(key, value); + else + return false; } else return false; From 4c6e14bcc2812a7187af7e87045c49b2dfbb039e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Tue, 23 Jul 2024 09:56:17 +0800 Subject: [PATCH 7/7] Release: v2.19.1 --- CHANGELOG.md | 10 ++++++++++ CMakeLists.txt | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0099ee179..6f89f97f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +# 2.19.1 + +Bugfixes +* Fix frequency value printing when using custom format (#1111, CPU / GPU) +* Fix display detection for XiaoMi Android phone (Display, Android) + +Features: +* Display if HDR mode is enabled for screens (Display) + * Supported in Windows and Linux (KDE) correctly + # 2.19.0 Changes: diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a9a4b9a0..f22ac9896 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url project(fastfetch - VERSION 2.19.0 + VERSION 2.19.1 LANGUAGES C DESCRIPTION "Fast neofetch-like system information tool" HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"