mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-23 06:46:02 +00:00
feat(hud): GPU load and clock without root where Android blocks kgsl (#1969)
On some Adreno devices (the Retroid Pocket Duo) SELinux hides kgsl's sysfs nodes from apps, so the HUD showed no GPU % and no GPU clock. Devices whose nodes are readable keep using them; nothing changes there or on GPUs without kgsl. Where the nodes are blocked: - GPU %: a native reader maps kgsl's memstore read-only (any kgsl client may) and samples the ringbuffer start/end timestamps once a millisecond while a HUD is shown. That covers all GPU work, Android's own composition included. - Backup for GPU %: an implicit Vulkan layer in the guest (tools/gpuload) and the compositor time their own GPU work with timestamp queries. It runs until the memstore stamps are seen moving, and for the whole session if they never move. - GPU clock: a small GPU job of our own reads the always-on and RBBM cycle counters (libgpuclock). The HUD diagnostics export lists which source each GPU value came from. tools/gpuload/build.sh takes the Vulkan headers from build_local.sh's NDK first and keeps NDK paths with spaces intact.
This commit is contained in:
1 parent
6cd844ea51
commit
8cb5c2168e
30 files changed
+1891
-10
No files matched your search
@@ -0,0 +1,24 @@
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "gpuload_busy.h"
|
||||
|
||||
int main(void) {
|
||||
const uint64_t max = 1000;
|
||||
assert(gpuload_interval(10, 20, max) == 10);
|
||||
// Each batch counts on its own, even when the counter restarted in between (later batch has smaller ticks).
|
||||
assert(gpuload_interval(900000, 900400, max) == 400);
|
||||
assert(gpuload_interval(50, 350, max) == 300);
|
||||
// Backwards, empty or too long: nothing.
|
||||
assert(gpuload_interval(60, 50, max) == 0);
|
||||
assert(gpuload_interval(70, 70, max) == 0);
|
||||
assert(gpuload_interval(100, 100 + max + 1, max) == 0);
|
||||
assert(gpuload_interval(100, 100 + max, max) == max);
|
||||
// Query results: both halves available and an end that differs from the last harvested one.
|
||||
assert(gpuload_result_is_new(1, 1, 500, 400));
|
||||
assert(!gpuload_result_is_new(1, 1, 400, 400));
|
||||
assert(!gpuload_result_is_new(1, 0, 500, 400));
|
||||
assert(!gpuload_result_is_new(0, 1, 500, 400));
|
||||
puts("test_gpuload_busy: ok");
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user