-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #717 from fastfetch-cli/dev
Release v2.8.3
- Loading branch information
Showing
10 changed files
with
153 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
# 2.8.3 | ||
|
||
Bugfixes: | ||
* Fix GPU name detection for AMD graphic cards (GPU, Linux / FreeBSD) | ||
|
||
# 2.8.2 | ||
|
||
Changes: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#include "gpu.h" | ||
|
||
void ffGPUParsePciIds(FFstrbuf* content, uint8_t subclass, uint16_t vendor, uint16_t device, uint16_t subVendor, uint16_t subDevice, FFGPUResult* gpu) | ||
{ | ||
if (content->length) | ||
{ | ||
char buffer[32]; | ||
|
||
// Search for vendor | ||
uint32_t len = (uint32_t) snprintf(buffer, sizeof(buffer), "\n%04x ", vendor); | ||
char* start = (char*) memmem(content->chars, content->length, buffer, len); | ||
char* end = content->chars + content->length; | ||
if (start) | ||
{ | ||
start += len; | ||
end = memchr(start, '\n', (uint32_t) (end - start)); | ||
if (!end) | ||
end = content->chars + content->length; | ||
if (!gpu->vendor.length) | ||
ffStrbufSetNS(&gpu->vendor, (uint32_t) (end - start), start); | ||
|
||
start = end; // point to '\n' of vendor | ||
end = start + 1; // point to start of devices | ||
// find the start of next vendor | ||
while (end[0] == '\t' || end[0] == '#') | ||
{ | ||
end = strchr(end, '\n'); | ||
if (!end) | ||
{ | ||
end = content->chars + content->length; | ||
break; | ||
} | ||
else | ||
end++; | ||
} | ||
|
||
// Search for device | ||
len = (uint32_t) snprintf(buffer, sizeof(buffer), "\n\t%04x ", device); | ||
start = memmem(start, (size_t) (end - start), buffer, len); | ||
if (start) | ||
{ | ||
start += len; | ||
|
||
// Search for subvendor and subdevice | ||
len = (uint32_t) snprintf(buffer, sizeof(buffer), "\n\t\t%04x %04x ", subVendor, subDevice); | ||
char* subStart = memmem(start, (size_t) (end - start), buffer, len); | ||
if (subStart) | ||
start = subStart + len; | ||
|
||
end = memchr(start, '\n', (uint32_t) (end - start)); | ||
if (!end) | ||
end = content->chars + content->length; | ||
|
||
char* openingBracket = memchr(start, '[', (uint32_t) (end - start)); | ||
if (openingBracket) | ||
{ | ||
openingBracket++; | ||
char* closingBracket = memchr(openingBracket, ']', (uint32_t) (end - openingBracket)); | ||
if (closingBracket) | ||
ffStrbufSetNS(&gpu->name, (uint32_t) (closingBracket - openingBracket), openingBracket); | ||
} | ||
if (!gpu->name.length) | ||
ffStrbufSetNS(&gpu->name, (uint32_t) (end - start), start); | ||
} | ||
} | ||
} | ||
|
||
if (!gpu->name.length) | ||
{ | ||
const char* subclassStr; | ||
switch (subclass) | ||
{ | ||
case 0 /*PCI_CLASS_DISPLAY_VGA*/: subclassStr = " (VGA compatible)"; break; | ||
case 1 /*PCI_CLASS_DISPLAY_XGA*/: subclassStr = " (XGA compatible)"; break; | ||
case 2 /*PCI_CLASS_DISPLAY_3D*/: subclassStr = " (3D)"; break; | ||
default: subclassStr = ""; break; | ||
} | ||
|
||
ffStrbufSetF(&gpu->name, "%s Device %04X%s", gpu->vendor.length ? gpu->vendor.chars : "Unknown", device, subclassStr); | ||
} | ||
} |
Oops, something went wrong.