OSDN Git Service

drm/amd/display: Rework vrr flip throttling for late vblank irq.
authorMario Kleiner <mario.kleiner.de@gmail.com>
Tue, 2 Apr 2019 22:00:06 +0000 (17:00 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 3 Apr 2019 15:00:33 +0000 (10:00 -0500)
commitfdd1fe57c00ef96c8a8ab6e5eab03d248deecca6
tree5b16dd5764b450a6a9198e4f76b8c699e6322c10
parent66b0c973d7f74e3f45dbe9904ad02298d1dc430f
drm/amd/display: Rework vrr flip throttling for late vblank irq.

For throttling to work correctly, we always need a baseline vblank
count last_flip_vblank that increments at start of front-porch.

This is the case for drm_crtc_vblank_count() in non-VRR mode, where
the vblank irq fires at start of front-porch and triggers DRM core
vblank handling, but it is no longer the case in VRR mode, where
core vblank handling is done later, after end of front-porch.

Therefore drm_crtc_vblank_count() is no longer useful for this.
We also can't use drm_crtc_accurate_vblank_count(), as that would
screw up vblank timestamps in VRR mode when called in front-porch.

To solve this, use the cooked hardware vblank counter returned by
amdgpu_get_vblank_counter_kms() instead, as that one is cooked to
always increment at start of front-porch, independent of when
vblank related irq's fire.

This patch allows vblank irq handling to happen anywhere within
vblank of even after it, without a negative impact on flip
throttling, so followup patches can shift the vblank core
handling trigger point wherever they need it.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c