Skip to content

fix(mangohud): report vram and total ram for devices with unified memory - #909

Open
ThuCommix wants to merge 1 commit into
armada-os:mainfrom
ThuCommix:feature/mango-report-vram-patch
Open

ThuCommix wants to merge 1 commit into
armada-os:mainfrom
ThuCommix:feature/mango-report-vram-patch

Conversation

@ThuCommix

Copy link
Copy Markdown
Contributor

Summary

On Armada's unified-memory handhelds the MangoHud/mangoapp overlay always
reports VRAM 0.0 GiB. The msm driver has no system-wide VRAM counter, so
MangoHud's msm_dpu path leaves drm_memory_type unset and both VRAM and
PVRAM remain at zero. The RAM row also only shows used memory, with no
indication of the device's total.

This adds an Armada MangoHud patch that:

  • reads the client's resident GPU memory from drm-resident-memory, which
    msm has exposed through fdinfo since Linux 6.5, so PVRAM reports real
    usage;
  • uses that value for the VRAM row on msm_dpu, where no system-wide VRAM
    counter exists;
  • renders the RAM row as used/total GiB so the device's total memory is
    visible.

The msm memory-type part is adapted from MangoHud PR #2073.

Behaviour

Before:

VRAM   0.0 GiB
PVRAM  0.0 GiB
RAM    4.8 GiB

After:

VRAM   1.2 GiB   (focused game/client's resident GPU memory)
PVRAM  1.2 GiB
RAM    4.8/11.4 GiB

Scope and caveats

  • msm_dpu does not expose a device-wide GPU memory counter. The VRAM row
    therefore reports the focused game/client's resident GPU allocations, not a
    system-wide total. A true device-wide value would need a new kernel
    sysfs/debugfs counter.
  • The RAM total is /proc/meminfo MemTotal, i.e. kernel-usable RAM. It is
    slightly lower than the installed capacity because firmware and
    reserved-memory regions are excluded.
  • The RAM-row change is global to MangoHud. GPUs that already report system
    VRAM keep their existing VRAM behaviour.
  • Only msm_dpu is changed; the downstream msm_drm/kgsl path is left alone.

Testing

  • All MangoHud patches apply cleanly on top of 0.8.4
  • just package mangohud builds with the new patch
  • Fork image builds and publishes
  • Retroid Pocket 6 (SM8550, Adreno 740): Steam performance overlay
    level 3/4 shows non-zero VRAM/PVRAM and RAM as used/total
  • Regression check on another GPU driver, if available

Verified GPU memory numbers against:

grep drm-resident-memory /proc/<game-pid>/fdinfo/*

Test image: ghcr.io/thucommix/armada:mango-report-vram-patch

IMG_5835 IMG_5837

Files changed

  • packages/mangohud/patches/0010-msm-report-gpu-memory-and-total-ram.patch —
    new patch
  • packages/mangohud/mangohud.spec — applies Patch10
  • packages/mangohud/PATCHES.md — documents the patch and upstream reference

References

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Disk image

armada-disk-pr909, built from 92354c5

Downloads as a zip holding armada-*.img.gz and its .sha256.
GitHub requires you to be signed in to download run artifacts.

@mydanyi

mydanyi commented Nov 17, 2026

Copy link
Copy Markdown
Contributor
image I have a question. The text shown as 4.8/11.4 GiB is too small and hard to read. Could it be displayed at the back instead? And the value in this rear part still shows 0 GiB.

@ThuCommix
ThuCommix force-pushed the feature/mango-report-vram-patch branch from fedaab0 to 7d1347d Compare November 17, 2026 17:09
@ThuCommix

Copy link
Copy Markdown
Contributor Author

I dug into the values a bit more.

  • The value right to the current ram usage (currently showing 0.0) is the SWAP usage not the total amount
  • 0°C is the temperature of the VRAM chip (not the gpu core) and my device has no sensor for it thus showing 0.

However, I'm preparing a patch improving on the original solution. SWAP will get it's own line and the total memory moves where the swap currently is.

IMG_5839

@ThuCommix

ThuCommix commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

Overlay rendering

  • RAM total in its own column. The total was previously appended to the used value in a smaller font (5.9/11.2 GiB), which crowded the number and shifted the row. It now occupies the next right-aligned column like every other value:

    VRAM   1.0 GiB
    RAM    5.9 GiB   11.2 GiB
    SWAP   0.0 GiB
    
  • Swap has its own SWAP row. It used to share the RAM row's third column; that column now holds the RAM total.

  • Cells without a backing sensor are hidden instead of rendering a permanent 0:

    • GPU memory temperature (vram_temp) — absent on msm
    • RAM temperature (spd5118) — absent on these handhelds
    • GPU memory clock — unified-memory GPUs have no memory clock, so the VRAM row printed a constant 0 MHz
    • GPU temperature — hidden when no sensor reports a value
  • Deterministic GPU temperature source. Qualcomm registers one hwmon device per GPU sensor (gpuss_0_thermal, gpuss_1_thermal, …). The generic "first hwmon whose name contains gpu" lookup returned an arbitrary one depending on directory order; prefer gpuss_0_thermal, and fall back to the gpuss-* thermal zones if the driver registers no GPU hwmon at all.

Files changed

File Change
src/gpu_fdinfo.cpp msm memory type, deterministic GPU sensor selection, thermal-zone fallback, suppress missing-sensor zeros
src/gpu_fdinfo.h drm-resident-memory for msm_dpu, thermal-zone stream
src/hud_elements.cpp RAM total column, SWAP row, hide temp / mem-clock cells
src/memory.cpp mem_temp = -1 when no RAM sensor exists

Tested on

Retroid Pocket 6 (SM8550/QCS8550, Adreno 740), Linux 6.5+ mainline msm:

  • VRAM and PVRAM report the game's GPU memory instead of 0.0
  • RAM row shows used and total in separate columns; SWAP on its own row
  • GPU temperature comes from gpuss-0-thermal
  • No stray 0°C / 0 MHz cells
  • drm-resident-memory verified against /proc/<pid>/fdinfo/*

How to Install

sudo bootc switch ghcr.io/thucommix/armada:mango-report-vram-patch

@mydanyi

mydanyi commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Let’s discuss this. I’ve found a new issue.
When we omit the "/" symbol, it makes the latter value look as if that much memory is also in use.
Maybe the latter value should instead show the percentage of total memory used.

msm shares RAM with the CPU and exposes no system-wide VRAM counter, so
the VRAM row always read 0.0. Use the client's drm-resident-memory
(Linux 6.5+) for the VRAM row and PVRAM on msm_dpu, and show the share
of MemTotal in use next to the used RAM value.

Drop the smaller "/total" suffix that crowded the used value, and move
swap to a labelled SWAP row. Hide the VRAM memory-temp, GPU temp and
memory-clock cells when no sensor backs them; msm has no vram sensor or
memory clock, and these handhelds have no RAM spd5118, so those cells
rendered a constant 0°C / 0 MHz.

Pick gpuss_0_thermal deterministically for the GPU temperature instead
of whichever hwmon device containing "gpu" is enumerated first, and
fall back to the gpuss-* thermal zones when no GPU hwmon exists.
@ThuCommix
ThuCommix force-pushed the feature/mango-report-vram-patch branch from 7d1347d to 92354c5 Compare November 17, 2026 18:20
@ThuCommix

ThuCommix commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

Changes

  • The last column of RAM now reports the usage%

Tested on

Retroid Pocket 6 (SM8550/QCS8550, Adreno 740), Linux 6.5+ mainline msm:

IMG_5840

How to Install

sudo bootc switch ghcr.io/thucommix/armada:mango-report-vram-patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants