[PATCH xf86-video-amdgpu] Fix hang when entering into dpms-off mode
Michel Dänzer
michel at daenzer.net
Thu Feb 28 12:05:25 UTC 2019
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:
On 2019-02-28 3:52 a.m., Aaron Liu wrote:
> 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,
>
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.
--
Earthling Michel Dänzer | https://www.amd.com
Libre software enthusiast | Mesa and X developer
More information about the amd-gfx
mailing list