[PATCH xf86-video-amdgpu] Fix hang when entering into dpms-off mode
Aaron Liu
aaron.liu at amd.com
Thu Feb 28 02:52:05 UTC 2019
The hang happened in CTS 4.6 glcts. It is dued to inconsistent process
in amdgpu_dri2_schedule_swap when system entering into dpms-off mode.
Normally, drmmode_wait_vblank will be excuted. But when entering into
dpms-off mode, drmmode_wait_vblank can't be excuted and fallback to
amdgpu_dri2_schedule_event to process.
Finally in amdgpu_dri2_deferred_event, vblank_handler will be excuted.
It is the root cause of hang. Instead of vblank_handler, it just use
amdgpu_dri2_frame_event_handler to process under dpms-off mode.
Change-Id: I6bfed9692fc02c8c3c86df2a816884c4a1f46cb1
Signed-off-by: Aaron Liu <aaron.liu at amd.com>
---
src/amdgpu_dri2.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c
index a6b76a1..c54ad0c 100644
--- a/src/amdgpu_dri2.c
+++ b/src/amdgpu_dri2.c
@@ -884,7 +884,7 @@ CARD32 amdgpu_dri2_deferred_event(OsTimerPtr timer, CARD32 now, pointer data)
if (ret) {
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
"%s cannot get current time\n", __func__);
- if (event_info->drm_queue_seq)
+ if (event_info->drm_queue_seq && amdgpu_crtc_is_enabled(crtc))
drmmode_crtc->drmmode->event_context.
vblank_handler(pAMDGPUEnt->fd, 0, 0, 0,
(void*)event_info->drm_queue_seq);
@@ -900,7 +900,12 @@ CARD32 amdgpu_dri2_deferred_event(OsTimerPtr timer, CARD32 now, pointer data)
delta_seq = delta_t * drmmode_crtc->dpms_last_fps;
delta_seq /= 1000000;
frame = (CARD64) drmmode_crtc->dpms_last_seq + delta_seq;
- if (event_info->drm_queue_seq)
+ /*
+ * If CRTC is in DPMS off state, it can't use vblank_handler.
+ * Because drmmode_wait_vblank is not excuted in such as
+ * amdgpu_dri2_schedule_swap/amdgpu_dri2_schedule_wait_msc.
+ */
+ if (event_info->drm_queue_seq && amdgpu_crtc_is_enabled(crtc))
drmmode_crtc->drmmode->event_context.
vblank_handler(pAMDGPUEnt->fd, frame, drm_now / 1000000,
drm_now % 1000000,
--
2.7.4
More information about the amd-gfx
mailing list