Turning CRTC off may fail assert on KMS timestamp
Run weston -i5
on AMD card, wait for 5 seconds for the screensaving to kick in, and this will be hit when the CRTC has turned off:
[atomic] drmModeAtomicCommit
[repaint] Using mixed state composition
[repaint] view 0x564a58b63290 using renderer composition
[repaint] view 0x564a58b5ff30 using renderer composition
[repaint] view 0x564a58bbb5c0 using renderer composition
[repaint] view 0x564a58bac6d0 using renderer composition
[atomic] applying output 0 (HDMI-A-4) state
[atomic] DPMS state differs, modeset OK
[CRTC:52] 23 (MODE_ID) -> 0 (0x0)
[CRTC:52] 22 (ACTIVE) -> 0 (0x0)
[CONN:71] 20 (CRTC_ID) -> 0 (0x0)
[CONN:71] 7 (HDR_OUTPUT_METADATA) -> 0 (0x0)
[CONN:71] 72 (max bpc) -> 8 (0x8)
[PLANE:48] 17 (FB_ID) -> 0 (0x0)
[PLANE:48] 20 (CRTC_ID) -> 0 (0x0)
[PLANE:48] 9 (SRC_X) -> 0 (0x0)
[PLANE:48] 10 (SRC_Y) -> 0 (0x0)
[PLANE:48] 11 (SRC_W) -> 0 (0x0)
[PLANE:48] 12 (SRC_H) -> 0 (0x0)
[PLANE:48] 13 (CRTC_X) -> 0 (0x0)
[PLANE:48] 14 (CRTC_Y) -> 0 (0x0)
[PLANE:48] 15 (CRTC_W) -> 0 (0x0)
[PLANE:48] 16 (CRTC_H) -> 0 (0x0)
[PLANE:48] FORMAT: UNKNOWN
[atomic] drmModeAtomicCommit
[CRTC:52] setting pending flip
[repaint] flushed pending_state 0x564a58ab0420
[atomic][CRTC:52] flip processing started
weston: ../../git/weston/libweston/compositor.c:3162: weston_output_finish_frame: Assertion `timespec_sub_to_nsec(stamp, &output->frame_time) >= 0' failed.
Aborted (core dumped)
The cause for the assertion failure is amdgpu kernel driver returning a zero timestamp on the completion of the atomic commit that turns the CRTC off.
@derekf mentioned he has seen something similar with vmwgfx.
@danvet wants this issue reported upstream to AMD (@hwentland) with an IGT test that fails. All drivers should behave the same.
Me, @daniels and @daenzer agree that a compositor should just ignore the timestamp for a CRTC on->off transition completion, since it is not useful (by definition it cannot complete presenting any client frame) and not quite defined (what should the time instant correspond to).
Ideally we should do both:
- Patch weston to ignore the timestamp when it knows it is turning the CRTC off (i.e. use
WP_PRESENTATION_FEEDBACK_INVALID
). I think there might also be something to be fixed to not assume the repaint cycles will continue. - Try to find an IGT test that fails because of this exact issue. If there is none, create one.