Skip to content

Commit 30d3d00

Browse files
authored
Merge pull request #717 from fastfetch-cli/dev
Release v2.8.3
2 parents 1006f51 + 99fce80 commit 30d3d00

File tree

10 files changed

+153
-91
lines changed

10 files changed

+153
-91
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -371,16 +371,16 @@ jobs:
371371
run: ctest
372372

373373
- name: create zip archive
374-
run: 7z a -tzip -mx9 -bd -y fastfetch-$(./fastfetch --version-raw)-windows-amd64.zip *.dll fastfetch.exe flashfetch.exe presets
374+
run: 7z a -tzip -mx9 -bd -y fastfetch-windows-amd64.zip *.dll fastfetch.exe flashfetch.exe presets
375375

376376
- name: create 7z archive
377-
run: 7z a -t7z -mx9 -bd -y fastfetch-$(./fastfetch --version-raw)-windows-amd64.7z *.dll fastfetch.exe flashfetch.exe presets
377+
run: 7z a -t7z -mx9 -bd -y fastfetch-windows-amd64.7z *.dll fastfetch.exe flashfetch.exe presets
378378

379379
- name: upload artifacts
380380
uses: actions/upload-artifact@v4
381381
with:
382382
name: fastfetch-windows-amd64
383-
path: ./fastfetch-*-windows-amd64.*
383+
path: ./fastfetch-windows-amd64.*
384384

385385
windows-i686:
386386
name: Windows-i686
@@ -438,16 +438,16 @@ jobs:
438438
run: ctest
439439

440440
- name: create zip archive
441-
run: 7z a -tzip -mx9 -bd -y fastfetch-$(./fastfetch --version-raw)-windows-i686.zip *.dll fastfetch.exe flashfetch.exe presets
441+
run: 7z a -tzip -mx9 -bd -y fastfetch-windows-i686.zip *.dll fastfetch.exe flashfetch.exe presets
442442

443443
- name: create 7z archive
444-
run: 7z a -t7z -mx9 -bd -y fastfetch-$(./fastfetch --version-raw)-windows-i686.7z *.dll fastfetch.exe flashfetch.exe presets
444+
run: 7z a -t7z -mx9 -bd -y fastfetch-windows-i686.7z *.dll fastfetch.exe flashfetch.exe presets
445445

446446
- name: upload artifacts
447447
uses: actions/upload-artifact@v4
448448
with:
449449
name: fastfetch-windows-i686
450-
path: ./fastfetch-*-windows-i686.*
450+
path: ./fastfetch-windows-i686.*
451451

452452
release:
453453
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'fastfetch-cli/fastfetch'
@@ -474,6 +474,7 @@ jobs:
474474
uses: actions/download-artifact@v4
475475

476476
- name: rm old artifacts
477+
if: needs.linux-amd64.outputs.ffversion != steps.get_version_release.outputs.release
477478
run: |
478479
rm -rf fastfetch-*-old-*
479480

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 2.8.3
2+
3+
Bugfixes:
4+
* Fix GPU name detection for AMD graphic cards (GPU, Linux / FreeBSD)
5+
16
# 2.8.2
27

38
Changes:

CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url
22

33
project(fastfetch
4-
VERSION 2.8.2
4+
VERSION 2.8.3
55
LANGUAGES C
66
DESCRIPTION "Fast neofetch-like system information tool"
77
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
@@ -401,6 +401,7 @@ if(LINUX)
401401
src/detection/displayserver/linux/xlib.c
402402
src/detection/font/font_linux.c
403403
src/detection/gpu/gpu_linux.c
404+
src/detection/gpu/gpu_pci.c
404405
src/detection/gtk_qt/gtk.c
405406
src/detection/host/host_linux.c
406407
src/detection/icons/icons_linux.c
@@ -518,6 +519,7 @@ elseif(BSD)
518519
src/detection/displayserver/linux/xlib.c
519520
src/detection/font/font_linux.c
520521
src/detection/gpu/gpu_bsd.c
522+
src/detection/gpu/gpu_pci.c
521523
src/detection/gtk_qt/gtk.c
522524
src/detection/host/host_bsd.c
523525
src/detection/lm/lm_linux.c
@@ -1108,9 +1110,9 @@ install(
11081110

11091111
set(CPACK_GENERATOR "TGZ;ZIP")
11101112
if(APPLE)
1111-
string(TOLOWER "${CMAKE_PROJECT_NAME}-${CMAKE_PROJECT_VERSION}-macos-universal" CPACK_PACKAGE_FILE_NAME)
1113+
string(TOLOWER "${CMAKE_PROJECT_NAME}-macos-universal" CPACK_PACKAGE_FILE_NAME)
11121114
else() # We don't use this in Windows
1113-
string(TOLOWER "${CMAKE_PROJECT_NAME}-${CMAKE_PROJECT_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}" CPACK_PACKAGE_FILE_NAME)
1115+
string(TOLOWER "${CMAKE_PROJECT_NAME}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}" CPACK_PACKAGE_FILE_NAME)
11141116
endif()
11151117

11161118
if(LINUX)

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,28 @@ There are [screenshots on different platforms](https://github.com/fastfetch-cli/
2828
### Linux
2929

3030
* Debian / Ubuntu: Download `fastfetch-<version>-Linux.deb` from [Github release page](https://github.com/fastfetch-cli/fastfetch/releases/latest) and `dpkg -i fastfetch-<version>-Linux.deb`
31-
* Arch Linux: `sudo pacman -S fastfetch`
31+
* Arch Linux: `sudo pacman -S fastfetch`. You can also find fastfetch [on the AUR](https://aur.archlinux.org/packages/fastfetch-git).
3232
* Fedora: `sudo dnf install fastfetch`
3333
* Gentoo: `sudo emerge --ask app-misc/fastfetch`
34+
* Alpine: `apk add --upgrade fastfetch`
3435
* NixOS: `sudo nix-shell -p fastfetch`
3536
* openSUSE: `sudo zypper install fastfetch`
37+
* ALT Linux: `sudo apt-get install fastfetch`
3638

3739
Replace sudo with doas depending on what you use.
3840

3941
[See also if fastfetch has been packaged for your favorite Linux distro](#Packaging)
4042

4143
### macOS
4244

45+
...via [HomeBrew](https://brew.sh):
46+
4347
`brew install fastfetch`
4448

49+
...via [MacPorts](https://www.macports.org):
50+
51+
`sudo port install fastfetch`
52+
4553
### Windows
4654

4755
`scoop install fastfetch`

src/detection/gpu/gpu.c

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -118,75 +118,3 @@ const char* ffDetectGPU(const FFGPUOptions* options, FFlist* result)
118118

119119
return "GPU detection failed";
120120
}
121-
122-
#ifndef _WIN32
123-
void ffGPUParsePciIds(FFstrbuf* content, uint8_t subclass, uint16_t vendor, uint16_t device, FFGPUResult* gpu)
124-
{
125-
if (content->length)
126-
{
127-
char buffer[32];
128-
uint32_t len = (uint32_t) snprintf(buffer, sizeof(buffer), "\n%04x ", vendor);
129-
char* start = (char*) memmem(content->chars, content->length, buffer, len);
130-
char* end = content->chars + content->length;
131-
if (start)
132-
{
133-
start += len;
134-
end = memchr(start, '\n', (uint32_t) (end - start));
135-
if (!end)
136-
end = content->chars + content->length;
137-
if (!gpu->vendor.length)
138-
ffStrbufSetNS(&gpu->vendor, (uint32_t) (end - start), start);
139-
140-
start = end; // point to '\n' of vendor
141-
end = start + 1; // point to start of devices
142-
// find the start of next vendor
143-
while (end[0] == '\t' || end[0] == '#')
144-
{
145-
end = strchr(end, '\n');
146-
if (!end)
147-
{
148-
end = content->chars + content->length;
149-
break;
150-
}
151-
else
152-
end++;
153-
}
154-
155-
len = (uint32_t) snprintf(buffer, sizeof(buffer), "\n\t%04x ", device);
156-
start = memmem(start, (size_t) (end - start), buffer, len);
157-
if (start)
158-
{
159-
start += len;
160-
end = memchr(start, '\n', (uint32_t) (end - start));
161-
if (!end)
162-
end = content->chars + content->length;
163-
164-
char* openingBracket = memchr(start, '[', (uint32_t) (end - start));
165-
if (openingBracket)
166-
{
167-
openingBracket++;
168-
char* closingBracket = memchr(openingBracket, ']', (uint32_t) (end - openingBracket));
169-
if (closingBracket)
170-
ffStrbufSetNS(&gpu->name, (uint32_t) (closingBracket - openingBracket), openingBracket);
171-
}
172-
if (!gpu->name.length)
173-
ffStrbufSetNS(&gpu->name, (uint32_t) (end - start), start);
174-
}
175-
}
176-
}
177-
178-
if (!gpu->name.length)
179-
{
180-
const char* subclassStr;
181-
switch (subclass)
182-
{
183-
case 0 /*PCI_CLASS_DISPLAY_VGA*/: subclassStr = " (VGA compatible)"; break;
184-
case 1 /*PCI_CLASS_DISPLAY_XGA*/: subclassStr = " (XGA compatible)"; break;
185-
case 2 /*PCI_CLASS_DISPLAY_3D*/: subclassStr = " (3D)"; break;
186-
default: subclassStr = ""; break;
187-
}
188-
189-
ffStrbufSetF(&gpu->name, "%s Device %04X%s", gpu->vendor.length ? gpu->vendor.chars : "Unknown", device, subclassStr);
190-
}
191-
}
192-
#endif

src/detection/gpu/gpu.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus);
4343

4444
const char* ffGetGPUVendorString(unsigned vendorId);
4545

46-
#ifndef _WIN32
47-
void ffGPUParsePciIds(FFstrbuf* content, uint8_t subclass, uint16_t vendor, uint16_t device, FFGPUResult* gpu);
46+
#if defined(__linux__) || defined(__FreeBSD__)
47+
void ffGPUParsePciIds(FFstrbuf* content, uint8_t subclass, uint16_t vendor, uint16_t device, uint16_t subVendor, uint16_t subDevice, FFGPUResult* gpu);
4848
#endif

src/detection/gpu/gpu_bsd.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#include "gpu_driver_specific.h"
22

33
#include "common/io/io.h"
4+
#include "common/properties.h"
45
#include "3rdparty/nvml/nvml.h"
56
#include "util/mallocHelper.h"
6-
#include "common/io/io.h"
77

88
#include <dev/pci/pcireg.h>
99
#include <sys/pciio.h>
@@ -46,7 +46,6 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus)
4646
return "ioctl(fd, PCIOCGETCONF, &pc) returned error";
4747

4848
FF_STRBUF_AUTO_DESTROY pciids = ffStrbufCreate();
49-
loadPciIds(&pciids);
5049

5150
for (uint32_t i = 0; i < pcio.num_matches; ++i)
5251
{
@@ -64,7 +63,19 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus)
6463
gpu->deviceId = ((uint64_t) pc->pc_sel.pc_domain << 6) | ((uint64_t) pc->pc_sel.pc_bus << 4) | ((uint64_t) pc->pc_sel.pc_dev << 2) | pc->pc_sel.pc_func;
6564
gpu->frequency = FF_GPU_FREQUENCY_UNSET;
6665

67-
ffGPUParsePciIds(&pciids, pc->pc_subclass, pc->pc_vendor, pc->pc_device, gpu);
66+
if (gpu->vendor.chars == FF_GPU_VENDOR_NAME_AMD)
67+
{
68+
char query[32];
69+
snprintf(query, sizeof(query), "%X,\t%X,", (unsigned) pc->pc_device, (unsigned) pc->pc_revid);
70+
ffParsePropFileData("libdrm/amdgpu.ids", query, &gpu->name);
71+
}
72+
73+
if (gpu->name.length == 0)
74+
{
75+
if (pciids.length == 0)
76+
loadPciIds(&pciids);
77+
ffGPUParsePciIds(&pciids, pc->pc_subclass, pc->pc_vendor, pc->pc_device, pc->pc_subvendor, pc->pc_subdevice, gpu);
78+
}
6879

6980
#ifdef FF_USE_PROPRIETARY_GPU_DRIVER_API
7081
if (gpu->vendor.chars == FF_GPU_VENDOR_NAME_NVIDIA && (options->temp || options->driverSpecific))

src/detection/gpu/gpu_linux.c

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "detection/vulkan/vulkan.h"
33
#include "detection/temps/temps_linux.h"
44
#include "common/io/io.h"
5+
#include "common/properties.h"
56
#include "util/stringUtils.h"
67

78
#ifdef FF_USE_PROPRIETARY_GPU_DRIVER_API
@@ -80,7 +81,6 @@ static const char* pciDetectGPUs(const FFGPUOptions* options, FFlist* gpus)
8081

8182
FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate();
8283
FF_STRBUF_AUTO_DESTROY pciids = ffStrbufCreate();
83-
loadPciIds(&pciids);
8484

8585
struct dirent* entry;
8686
while((entry = readdir(dirp)) != NULL)
@@ -98,9 +98,9 @@ static const char* pciDetectGPUs(const FFGPUOptions* options, FFlist* gpus)
9898
continue;
9999
ffStrbufSubstrBefore(&pciDir, pciDevDirLength);
100100

101-
uint32_t vendorId, deviceId;
101+
uint32_t vendorId, deviceId, subVendorId, subDeviceId;
102102
uint8_t classId, subclassId;
103-
if (sscanf(buffer.chars, "pci:v%8" SCNx32 "d%8" SCNx32 "sv%*8ssd%*8sbc%2" SCNx8 "sc%2" SCNx8, &vendorId, &deviceId, &classId, &subclassId) != 4)
103+
if (sscanf(buffer.chars, "pci:v%8" SCNx32 "d%8" SCNx32 "sv%8" SCNx32 "sd%8" SCNx32 "bc%2" SCNx8 "sc%2" SCNx8, &vendorId, &deviceId, &subVendorId, &subDeviceId, &classId, &subclassId) != 6)
104104
continue;
105105

106106
if (classId != 0x03 /*PCI_BASE_CLASS_DISPLAY*/)
@@ -122,7 +122,29 @@ static const char* pciDetectGPUs(const FFGPUOptions* options, FFlist* gpus)
122122
gpu->deviceId = ((uint64_t) pciDomain << 6) | ((uint64_t) pciBus << 4) | (deviceId << 2) | pciFunc;
123123
gpu->frequency = FF_GPU_FREQUENCY_UNSET;
124124

125-
ffGPUParsePciIds(&pciids, subclassId, (uint16_t) vendorId, (uint16_t) deviceId, gpu);
125+
if (gpu->vendor.chars == FF_GPU_VENDOR_NAME_AMD)
126+
{
127+
ffStrbufAppendS(&pciDir, "/revision");
128+
if (ffReadFileBuffer(pciDir.chars, &buffer))
129+
{
130+
char* pend;
131+
uint64_t revision = strtoul(buffer.chars, &pend, 16);
132+
if (pend != buffer.chars)
133+
{
134+
char query[32];
135+
snprintf(query, sizeof(query), "%X,\t%X,", (unsigned) deviceId, (unsigned) revision);
136+
ffParsePropFileData("libdrm/amdgpu.ids", query, &gpu->name);
137+
}
138+
}
139+
ffStrbufSubstrBefore(&pciDir, pciDevDirLength);
140+
}
141+
142+
if (gpu->name.length == 0)
143+
{
144+
if (!pciids.length)
145+
loadPciIds(&pciids);
146+
ffGPUParsePciIds(&pciids, subclassId, (uint16_t) vendorId, (uint16_t) deviceId, (uint16_t) subVendorId, (uint16_t) subDeviceId, gpu);
147+
}
126148

127149
pciDetectDriver(gpu, &pciDir, &buffer);
128150
ffStrbufSubstrBefore(&pciDir, pciDevDirLength);

src/detection/gpu/gpu_pci.c

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#include "gpu.h"
2+
3+
void ffGPUParsePciIds(FFstrbuf* content, uint8_t subclass, uint16_t vendor, uint16_t device, uint16_t subVendor, uint16_t subDevice, FFGPUResult* gpu)
4+
{
5+
if (content->length)
6+
{
7+
char buffer[32];
8+
9+
// Search for vendor
10+
uint32_t len = (uint32_t) snprintf(buffer, sizeof(buffer), "\n%04x ", vendor);
11+
char* start = (char*) memmem(content->chars, content->length, buffer, len);
12+
char* end = content->chars + content->length;
13+
if (start)
14+
{
15+
start += len;
16+
end = memchr(start, '\n', (uint32_t) (end - start));
17+
if (!end)
18+
end = content->chars + content->length;
19+
if (!gpu->vendor.length)
20+
ffStrbufSetNS(&gpu->vendor, (uint32_t) (end - start), start);
21+
22+
start = end; // point to '\n' of vendor
23+
end = start + 1; // point to start of devices
24+
// find the start of next vendor
25+
while (end[0] == '\t' || end[0] == '#')
26+
{
27+
end = strchr(end, '\n');
28+
if (!end)
29+
{
30+
end = content->chars + content->length;
31+
break;
32+
}
33+
else
34+
end++;
35+
}
36+
37+
// Search for device
38+
len = (uint32_t) snprintf(buffer, sizeof(buffer), "\n\t%04x ", device);
39+
start = memmem(start, (size_t) (end - start), buffer, len);
40+
if (start)
41+
{
42+
start += len;
43+
44+
// Search for subvendor and subdevice
45+
len = (uint32_t) snprintf(buffer, sizeof(buffer), "\n\t\t%04x %04x ", subVendor, subDevice);
46+
char* subStart = memmem(start, (size_t) (end - start), buffer, len);
47+
if (subStart)
48+
start = subStart + len;
49+
50+
end = memchr(start, '\n', (uint32_t) (end - start));
51+
if (!end)
52+
end = content->chars + content->length;
53+
54+
char* openingBracket = memchr(start, '[', (uint32_t) (end - start));
55+
if (openingBracket)
56+
{
57+
openingBracket++;
58+
char* closingBracket = memchr(openingBracket, ']', (uint32_t) (end - openingBracket));
59+
if (closingBracket)
60+
ffStrbufSetNS(&gpu->name, (uint32_t) (closingBracket - openingBracket), openingBracket);
61+
}
62+
if (!gpu->name.length)
63+
ffStrbufSetNS(&gpu->name, (uint32_t) (end - start), start);
64+
}
65+
}
66+
}
67+
68+
if (!gpu->name.length)
69+
{
70+
const char* subclassStr;
71+
switch (subclass)
72+
{
73+
case 0 /*PCI_CLASS_DISPLAY_VGA*/: subclassStr = " (VGA compatible)"; break;
74+
case 1 /*PCI_CLASS_DISPLAY_XGA*/: subclassStr = " (XGA compatible)"; break;
75+
case 2 /*PCI_CLASS_DISPLAY_3D*/: subclassStr = " (3D)"; break;
76+
default: subclassStr = ""; break;
77+
}
78+
79+
ffStrbufSetF(&gpu->name, "%s Device %04X%s", gpu->vendor.length ? gpu->vendor.chars : "Unknown", device, subclassStr);
80+
}
81+
}

0 commit comments

Comments
 (0)