drm/radeon/kms: implement timestamp userspace query (v2)
Returns a snapshot of the GPU clock counter. Needed for certain OpenGL extensions. v2: agd5f - address Jerome's comments - add function documentation Signed-off-by: Marek Olšák <maraeo@gmail.com> Reviewed-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
b51ad12a36
commit
6759a0a7a0
@ -3968,3 +3968,22 @@ void si_fini(struct radeon_device *rdev)
|
||||
rdev->bios = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* si_get_gpu_clock - return GPU clock counter snapshot
|
||||
*
|
||||
* @rdev: radeon_device pointer
|
||||
*
|
||||
* Fetches a GPU clock counter snapshot (SI).
|
||||
* Returns the 64 bit clock counter snapshot.
|
||||
*/
|
||||
uint64_t si_get_gpu_clock(struct radeon_device *rdev)
|
||||
{
|
||||
uint64_t clock;
|
||||
|
||||
mutex_lock(&rdev->gpu_clock_mutex);
|
||||
WREG32(RLC_CAPTURE_GPU_CLOCK_COUNT, 1);
|
||||
clock = (uint64_t)RREG32(RLC_GPU_CLOCK_COUNT_LSB) |
|
||||
((uint64_t)RREG32(RLC_GPU_CLOCK_COUNT_MSB) << 32ULL);
|
||||
mutex_unlock(&rdev->gpu_clock_mutex);
|
||||
return clock;
|
||||
}
|
||||
|
Reference in New Issue
Block a user