This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository evisum.

View the commit online.

commit 6d8d8a8d52cff4338145d246146615671e6a8e35
Author: Alastair Poole <m...@alastairpoole.com>
AuthorDate: Tue Jul 16 09:06:51 2024 +0100

    memory: fix reporting of video RAM on Linux.
    
    Cannot guarantee video card begins at zero index.
    
    Updated NEWS, VERSION and meson.build.
    
    This commit is literally from a bed in a psychiatric hospital.
    
    What a boss :)
---
 NEWS                            | 13 ++++++++++++-
 VERSION                         |  2 +-
 meson.build                     |  2 +-
 src/bin/system/machine/memory.x | 15 ++++++++++-----
 4 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/NEWS b/NEWS
index a9193a7..ece5b98 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,15 @@
-=============
+============
+Evisum 0.6.1
+============
+
+  * Fix reporting of video RAM usage on Linux.
+
+============
+Evisum 0.6.0
+============
+
+  * God knows. Carsten did a release. :)
+
 Evisum 0.5.13
 =============
 
diff --git a/VERSION b/VERSION
index 6d0dc3b..ee6cdce 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.5.99
+0.6.1
diff --git a/meson.build b/meson.build
index ca795ec..1dc6061 100644
--- a/meson.build
+++ b/meson.build
@@ -1,6 +1,6 @@
 ##### Project
 project('evisum', 'c',
-        version       : '0.5.99',
+        version       : '0.6.1',
         meson_version : '>= 0.40.0')
 
 efl_version = '>= 1.22.0'
diff --git a/src/bin/system/machine/memory.x b/src/bin/system/machine/memory.x
index 90fa1e2..0bae167 100644
--- a/src/bin/system/machine/memory.x
+++ b/src/bin/system/machine/memory.x
@@ -107,11 +107,13 @@ system_memory_usage_get(meminfo_t *memory)
      {
         struct stat st;
         char buf[256];
+        bool found = false;
 
-        // if no more drm devices exist - end of card list
+        // Card numbering does not always start at zero.
+        // Keep iterating until a device is found.
         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),
@@ -120,8 +122,9 @@ system_memory_usage_get(meminfo_t *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);
@@ -129,11 +132,13 @@ system_memory_usage_get(meminfo_t *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.

Reply via email to