drm/msm: Add performance counter tracking
Adreno GPUs have a certain number of fixed performance counters
most of which can be programmed to a large number of different
items (countables). A centralized database in the kernel is
needed to make the most efficient use of counters across processes.
Add performance counter tracking and APIs to allow applications to
reserve performance counters by requesting a group ID and a countable
(countables differ from block to block). The kernel will check to
see if an active counter is already selected for that countable or
if a new one should be assigned. Different processes can share the
same counter if they both need the same countable.
Counters are reserved with DRM_IOCTL_MSM_COUNTER_GET which returns
a counter ID for the reserved counter and the hi/lo offset of
the counter register. The reserving application can either read the
counter from within a PM4 stream or it can use the group ID and
counter ID and read the value of the counter with
DRM_MSM_COUNTER_READ. After the counter is no longer needed
DRM_IOCTL_MSM_COUNTER_PUT returns it and it can be released for
other countables if no other processes are sharing it.
Reservations are tracked for each process and cleaned up if the
process dies without putting back the counters.
Change-Id: Ic0dedbadc45e85ab0063331b39ca6f3289523038
Signed-off-by:
Jordan Crouse <jcrouse@codeaurora.org>
Loading
Please register or sign in to comment