mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 05:16:01 +00:00
feat: FusionHUD replaces the session HUD, with MangoHud's readings (#1743)
The session HUD is FusionHUD (Bannerlator's HUD) with every reading taken from the same source, and worked out the same way, as the MangoHud build that runs Steam's performance overlay in a DroidDeck session. - gamescope patch 0125 (gamescope-3.16.29-p19) shares the frame times that mangoapp reads (one per signalled commit of connector 0) in a ring named by DROIDDECK_HUD_FRAMES; the app reads it once per display frame and counts the compositor's frames when gamescope sends none. - MangoHud's rules: FPS over periods of at least 500 ms, frame time = 1000/FPS, 200-frame graph on a fixed 0-50 ms scale; CPU, GPU, temperatures, RAM, swap, VRAM and battery from MangoHud's sources. Zones 22/26/28 are typed as GPU and DDR sensors, so Steam's overlay CPU temperature no longer includes them. - Five sizes in a panel shaped like the DroidDeck mark, with a centred header, one left edge, neon outline and FPS; Minimal is the default size. Settings on a new "Performance HUD" drawer page, with Bannerlator's options. - The HUD reads sensors and polls frames only while it is drawn (not while hidden, in picture-in-picture or behind another app), keeps its place after picture-in-picture, and the diagnostics export has its own reader. Device-tested on the AYANEO Pocket FIT: same readings as Steam's overlay side by side in Dead Cells; the HUD updates in a game, hides in picture-in-picture and comes back in place, no crashes.
This commit is contained in:
1 parent
e871557bf2
commit
110cfc28f8
70 files changed
+7269
-320
No files matched your search
@@ -341,9 +341,9 @@ public final class LinuxRuntime {
|
||||
}
|
||||
|
||||
public static String cpuTempSource() {
|
||||
for (java.util.Map.Entry<String, File> e : new java.util.TreeMap<>(thermalZones()).entrySet()) {
|
||||
File temp = new File(e.getValue(), "temp");
|
||||
if (e.getKey().contains("cpu") && !e.getKey().contains("gpu") && temp.canRead()) return temp.getPath();
|
||||
for (File zone : cpuTempZones()) {
|
||||
File temp = new File(zone, "temp");
|
||||
if (temp.canRead()) return temp.getPath();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -353,7 +353,7 @@ public final class LinuxRuntime {
|
||||
return firstReadable(kgsl + "temp", kgsl + "devfreq/temp", thermalZone("gpu"));
|
||||
}
|
||||
|
||||
private static String gpuLoadSource() {
|
||||
public static String gpuLoadSource() {
|
||||
String kgsl = "/sys/class/kgsl/kgsl-3d0/";
|
||||
return firstReadable(kgsl + "gpu_busy_percentage", kgsl + "devfreq/gpu_load");
|
||||
}
|
||||
@@ -367,7 +367,7 @@ public final class LinuxRuntime {
|
||||
"/sys/devices/platform/soc@0/3d00000.gpu/devfreq/3d00000.gpu/cur_freq"},
|
||||
{gpuTemp, "/sys/class/thermal/thermal_zone28/temp"},
|
||||
{gpuTemp, "/sys/class/thermal/thermal_zone26/temp"},
|
||||
{thermalZone("ddr"), "/sys/class/thermal/thermal_zone22/temp"},
|
||||
{ddrTempSource(), "/sys/class/thermal/thermal_zone22/temp"},
|
||||
};
|
||||
for (String[] stat : stats) {
|
||||
boolean fed = false;
|
||||
@@ -384,6 +384,36 @@ public final class LinuxRuntime {
|
||||
return path != null ? path : "none";
|
||||
}
|
||||
|
||||
private static String ddrTempSource() {
|
||||
return thermalZone("ddr");
|
||||
}
|
||||
|
||||
// MangoHud reads the GPU and DDR temperatures from these zone numbers (bindAdrenoStats). On phones
|
||||
// where they are CPU zones, their type follows the temperature put there, so they stay out of the
|
||||
// CPU average.
|
||||
private static java.util.Map<String, String> replacedZoneTypes() {
|
||||
java.util.Map<String, String> replaced = new java.util.HashMap<>();
|
||||
if (gpuTempSource() != null) {
|
||||
replaced.put("thermal_zone28", "gpu-thermal");
|
||||
replaced.put("thermal_zone26", "gpu-thermal");
|
||||
}
|
||||
if (ddrTempSource() != null) replaced.put("thermal_zone22", "ddr-thermal");
|
||||
return replaced;
|
||||
}
|
||||
|
||||
/** The zones the session's MangoHud averages for the CPU temperature (all typed cpuN-thermal there). */
|
||||
public static List<File> cpuTempZones() {
|
||||
java.util.Map<String, String> replaced = replacedZoneTypes();
|
||||
List<File> zones = new ArrayList<>();
|
||||
for (java.util.Map.Entry<String, File> zone : new java.util.TreeMap<>(thermalZones()).entrySet()) {
|
||||
String type = zone.getKey();
|
||||
if (type.contains("cpu") && !type.contains("gpu") && !replaced.containsKey(zone.getValue().getName())) {
|
||||
zones.add(zone.getValue());
|
||||
}
|
||||
}
|
||||
return zones;
|
||||
}
|
||||
|
||||
private static void bindCpuTemps(List<String> cmd, File root) {
|
||||
File name = new File(root, "etc/droiddeck/cpu-thermal-type");
|
||||
try {
|
||||
@@ -391,9 +421,18 @@ public final class LinuxRuntime {
|
||||
} catch (IOException e) {
|
||||
return;
|
||||
}
|
||||
java.util.Map<String, String> replaced = replacedZoneTypes();
|
||||
for (java.util.Map.Entry<String, File> zone : thermalZones().entrySet()) {
|
||||
String type = zone.getKey();
|
||||
if (type.contains("cpu") && !type.contains("gpu") && !type.matches("cpu\\d-(top-)?thermal")) {
|
||||
String other = replaced.get(zone.getValue().getName());
|
||||
if (other != null) {
|
||||
File typeFile = new File(root, "etc/droiddeck/" + other + "-type");
|
||||
try {
|
||||
if (!typeFile.isFile()) Files.write(typeFile.toPath(), (other + "\n").getBytes(StandardCharsets.US_ASCII));
|
||||
bind(cmd, typeFile.getPath() + ":" + new File(zone.getValue(), "type").getPath());
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
} else if (type.contains("cpu") && !type.contains("gpu") && !type.matches("cpu\\d-(top-)?thermal")) {
|
||||
bind(cmd, name.getPath() + ":" + new File(zone.getValue(), "type").getPath());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user