mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 05:16:01 +00:00
On phones where Android blocks the GPU's sysfs files for apps, the HUD
reads the GPU without root (#1969). On Adreno 8xx that showed no GPU
clock and only the partial load from Vulkan timing (OnePlus 13, Adreno
830, reported by iamTooShaar).
- GPU clock: the clock job used the Adreno 6xx/7xx registers. The
register layout is now picked from the KGSL chip id: on 8xx
CP_ALWAYS_ON_COUNTER is 0x8e7 and the RBBM cycle countable is 1.
Unknown later generations read nothing.
- GPU load: hardware-scheduled kgsl kernels (every 8xx, and some 7xx
such as the AYANEO Pocket FIT's) never write the memstore ringbuffer
timestamps. When those stay 0, the reader samples the contexts' own
memstore entries (every context that has submitted work, up to 64,
contexts with new or running work first).
- HUD diagnostics report: a "GPU readers without root" line with the
reason each reader works or fails, "none" instead of "null", and the
per-core CPU % source named honestly.
Tested: iamTooShaar's OnePlus 13 shows GPU clock and load with the PR
test build (06be2c5). Pocket FIT standalone build of the final readers
against the kernel's sysfs numbers: idle 1-2 % vs 3-4 %, GPU job loop
25-29 % vs 28-30 %, clock 1050 MHz vs 1050 MHz. The review fixes after
the test build were not tested on the OnePlus 13.
28 lines
1.3 KiB
C
28 lines
1.3 KiB
C
#ifndef DROIDDECK_KGSL_LAYOUT_H
|
|
#define DROIDDECK_KGSL_LAYOUT_H
|
|
#include <stddef.h>
|
|
|
|
// Register layout per GPU generation. A counter kgsl places outside the range the kernel's CP protection lets
|
|
// command buffers read (adreno-gpulist.h *_protected_regs) is not read.
|
|
struct kgsl_layout {
|
|
unsigned always_on; // CP_ALWAYS_ON_COUNTER
|
|
unsigned cycles; // RBBM countable that counts GPU cycles
|
|
unsigned readable_last; // last register of the readable range starting at 0
|
|
};
|
|
// A6xx/A7xx: CP_ALWAYS_ON_COUNTER 0x980, RBBM countable 0 = ALWAYS_COUNT, 0x000-0x4ff readable (gen7 list).
|
|
static const struct kgsl_layout KGSL_LAYOUT_A7XX = {0x980u, 0u, 0x4ffu};
|
|
// A8xx: CP_ALWAYS_ON_COUNTER 0x8e7 (gen8_reg.h), RBBM countable 1 = US_ALWAYS_COUNT (0 is NEVER_COUNT, Mesa
|
|
// a8xx_perfcntrs.xml), 0x000-0x3a3 readable (gen8_0_0_protected_regs).
|
|
static const struct kgsl_layout KGSL_LAYOUT_A8XX = {0x8e7u, 1u, 0x3a3u};
|
|
|
|
// The KGSL chip id's top byte: 0x44 on every A8xx (Adreno 810/829/830/840, Mesa freedreno_devices.py),
|
|
// 0x43 or the generation number on A6xx/A7xx. Later generations are not known, so nothing is read there.
|
|
static inline const struct kgsl_layout *kgsl_layout_for(unsigned chip_id) {
|
|
unsigned core = chip_id >> 24;
|
|
if (core == 0x44u) return &KGSL_LAYOUT_A8XX;
|
|
if (core > 0x44u) return NULL;
|
|
return &KGSL_LAYOUT_A7XX;
|
|
}
|
|
|
|
#endif
|