drm/v3d: New debugfs end-points to query GPU usage stats.
authorJose Maria Casanova Crespo <jmcasanova@igalia.com>
Tue, 7 Feb 2023 12:54:02 +0000 (13:54 +0100)
committerDom Cobley <popcornmix@gmail.com>
Mon, 19 Feb 2024 11:33:34 +0000 (11:33 +0000)
commit247c84528e7f2c902a4f78322edac493e166e89f
tree53420168b4fe39a3169075b4e24ccb06bfb3feda
parentcca1b7c51154b327c6041691dc410639f614d0bc
drm/v3d: New debugfs end-points to query GPU usage stats.

Two new debugfs interfaces are implemented:

- gpu_usage: exposes the total runtime since boot of each
of the 5 scheduling queues available at V3D (BIN, RENDER,
CSD, TFU, CACHE_CLEAN). So if the interface is queried at
two different points of time the usage percentage of each
of the queues can be calculated.

- gpu_pid_usage: exposes the same information but to the
level of detail of each process using the V3D driver. The
runtime for process using the driver is stored. So the
percentages of usage by PID can be calculated with
measures at different timestamps.

The storage of gpu_pid_usage stats is only done if
the debugfs interface is polled during the last 70 seconds.
If a process does not submit a GPU job during last 70
seconds its stats will also be purged.

Signed-off-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
drivers/gpu/drm/v3d/v3d_debugfs.c
drivers/gpu/drm/v3d/v3d_drv.h
drivers/gpu/drm/v3d/v3d_gem.c
drivers/gpu/drm/v3d/v3d_irq.c
drivers/gpu/drm/v3d/v3d_sched.c