This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository enigmatic.
View the commit online.
commit 8502db5ae9893ed190dab47012874dece134fc8a
Author: Alastair Poole <m...@alastairpoole.com>
AuthorDate: Wed Jul 17 08:40:00 2024 +0100
memory: Fix Linux video RAM.
Card index can begin greater than zero.
---
src/bin/system/machine/memory.x | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/bin/system/machine/memory.x b/src/bin/system/machine/memory.x
index e688aca..304e849 100644
--- a/src/bin/system/machine/memory.x
+++ b/src/bin/system/machine/memory.x
@@ -92,11 +92,11 @@ memory_info(Meminfo *memory)
{
struct stat st;
char buf[256];
+ bool found = false;
- // if no more drm devices exist - end of card list
snprintf(buf, sizeof(buf),
"/sys/class/drm/card%i/device", i);
- if (stat(buf, &st) != 0) break;
+ if (stat(buf, &st) != 0) continue;
// not all drivers expose this, so video devices with no exposed video
// ram info will appear as 0 sized... much like swap.
snprintf(buf, sizeof(buf),
@@ -105,8 +105,9 @@ memory_info(Meminfo *memory)
if (f)
{
if (fgets(buf, sizeof(buf), f))
- memory->video[i].total = atoll(buf);
+ memory->video[memory->video_count].total = atoll(buf);
fclose(f);
+ found = true;
}
snprintf(buf, sizeof(buf),
"/sys/class/drm/card%i/device/mem_info_vram_used", i);
@@ -114,11 +115,12 @@ memory_info(Meminfo *memory)
if (f)
{
if (fgets(buf, sizeof(buf), f))
- memory->video[i].used = atoll(buf);
+ memory->video[memory->video_count].used = atoll(buf);
fclose(f);
+ found = true;
}
+ if (found) memory->video_count++;
}
- memory->video_count = i;
#elif defined(__FreeBSD__) || defined(__DragonFly__)
unsigned int free = 0, active = 0, inactive = 0, wired = 0;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.