Fix hang when entering into dpms-off mode
PATCH 1/1 Fix hang when entering into dpms-off mode
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.
--- src/amdgpu_dri2.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
src/amdgpu_dri2.c +7 -2
@@ -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,
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1551322325-19958-1-git-send-email-aaron.liu-5C7GfCeVMHo@public.gmane.org
Hi Aaron,
thanks for the patch. xf86-video-amdgpu now uses GitLab merge requests for patch submission and review:
https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgpu/merge_requests
That said, comments on the patch below:
Quoted 34 lines · Aaron Liu
The hang happened in CTS 4.6 glcts. It is dued to inconsistent process in
amdgpu_dri2_schedule_swapwhen system entering into dpms-off mode.Normally,
drmmode_wait_vblankwill be excuted. But when entering into dpms-off mode,drmmode_wait_vblankcan't be excuted and fallback toamdgpu_dri2_schedule_eventto process.
Finally inamdgpu_dri2_deferred_event,vblank_handlerwill be excuted. It is the root cause of hang. Instead ofvblank_handler, it just useamdgpu_dri2_frame_event_handlerto process under dpms-off mode.Change-Id I6bfed9692fc02c8c3c86df2a816884c4a1f46cb1Signed-off-by Aaron Liu <[email protected]>--- src/amdgpu_dri2.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)src/amdgpu_dri2.c +1
-1@@ -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;
src/amdgpu_dri2.c CARD32 amdgpu_dri2_deferred_event(OsTimerPtr timer, CARD32 now, pointer data) · line 911
Quoted 10 lines
src/amdgpu_dri2.c +6
-1-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,
This isn't a good solution I'm afraid, as it'll leave the struct amdgpu_drm_queue_entry memory associated with event_info->drm_queue_seq linked into the amdgpu_drm_queue list, which would gradually slow down processing of that list.
I think I know what the issue is, I'll work on a fix in the afternoon.
Signature · 6 lines
Earthling Michel Dänzer | https://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): dd111c99-c1f9-d1d7-5c40-3fcf7b75b1ea-otUistvHUpPR7s880joybQ@public.gmane.org
Quoted 24 lines · Michel Dänzer
Quoted 6 lines · Aaron Liu
src/amdgpu_dri2.c +0
-0@@ -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;src/amdgpu_dri2.c CARD32 amdgpu_dri2_deferred_event(OsTimerPtr timer, CARD32 now, pointer data) · line 911
Quoted 10 lines
src/amdgpu_dri2.c +6
-1-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,This isn't a good solution I'm afraid, as it'll leave the struct
amdgpu_drm_queue_entrymemory associated withevent_info->drm_queue_seqlinked into theamdgpu_drm_queuelist, which would gradually slow down processing of that list.
Quoted 1 line
I think I know what the issue is, I'll work on a fix in the afternoon.
Please test
https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgpu/merge_requests/29
.
Signature · 6 lines
Earthling Michel Dänzer | https://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 814ff51d-cde2-8a3e-6755-fd656a900a87-otUistvHUpPR7s880joybQ@public.gmane.org
@Michel Dänzer,
I have reviewed your patch and verified it passed.
I couldn't merge this merge request to your master manually. The log is below:
aaliu@lnx-aaliu:~/work/brahma/xf86-video-amdgpu-gitlab$ git push origin master Username for 'https://gitlab.freedesktop.org': aaliu Password for 'https://[email protected]': remote: HTTP Basic: Access denied remote: You must use a personal access token with 'api' scope for Git over HTTP. remote: You can generate one at https://gitlab.freedesktop.org/profile/personal_access_tokens fatal: Authentication failed for 'https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgpu.git/'
BR,
Aaron Liu
Quoted 44 lines
-----Original Message-----
From: Michel Dänzer <[email protected]>
Sent: Friday, March 01, 2019 12:36 AM
To: Liu, Aaron <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH xf86-video-amdgpu] Fix hang when entering into dpms- off modeQuoted 3 lines · Michel Dänzer
Review CARD32
Quoted 2 lines · Aaron Liu
(quoted diff) +0
-0@@ -900,7 +900,12 @@ CARD32
amdgpu_dri2_deferred_event(OsTimerPtr timer, CARD32 now, pointer data)Quoted 4 lines
Quoted 4 lines
src/amdgpu_dri2.c +0
-1delta_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)Quoted 8 lines
src/amdgpu_dri2.c CARD32 amdgpu_dri2_deferred_event(OsTimerPtr timer, CARD32 now, pointer data)
Quoted 8 lines
src/amdgpu_dri2.c +6
-0+/* +* 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,
Quoted 6 lines
src/amdgpu_dri2.c CARD32 amdgpu_dri2_deferred_event(OsTimerPtr timer, CARD32 now, pointer data) · line 911
Quoted 2 lines
src/amdgpu_dri2.c +0
-0drm_now % 1000000,This isn't a good solution I'm afraid, as it'll leave the struct
amdgpu_drm_queue_entrymemory associated withevent_info->drm_queue_seqlinked into theamdgpu_drm_queuelist,which
Quoted 4 lines
would gradually slow down processing of that list.
I think I know what the issue is, I'll work on a fix in the afternoon.
Please test
https://gitlab.freedesktop.org/xorg/driver/xf86-video-
amdgpu/merge_requests/29
.
Quoted 3 lines
--
Earthling Michel Dänzer | https://www.amd.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): DM6PR12MB361173B0EF321F8862519D85F0760-lmeGfMZKVrGUZgGQSl7qawdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
Quoted 3 lines · Aaron
@Michel Dänzer,
I have reviewed your patch and verified it passed.
Thanks Aaron, so I assume I can add
?
Quoted 1 line
I couldn't merge this merge request to your master manually.
Don't worry, I'll merge it via the GitLab merge request UI.
Signature · 6 lines
Earthling Michel Dänzer | https://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): a274ff35-60ba-d735-2656-0508556ad5b1-otUistvHUpPR7s880joybQ@public.gmane.org
Quoted 11 lines
-----Original Message-----
From: Michel Dänzer <[email protected]>
Sent: Friday, March 01, 2019 4:43 PM
To: Liu, Aaron <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH xf86-video-amdgpu] Fix hang when entering into dpms- off modeQuoted 2 lines · Aaron
@Michel Dänzer,
Quoted 8 lines
Quoted 1 line
I have reviewed your patch and verified it passed.
Thanks Aaron, so I assume I can add
Reviewed-by Aaron Liu <[email protected]>Tested-by Aaron Liu <[email protected]>?
Sure😊
Quoted 10 lines
Quoted 3 lines
I couldn't merge this merge request to your master manually.
Don't worry, I'll merge it via the GitLab merge request UI.
--
Earthling Michel Dänzer | https://www.amd.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx