mirror of https://github.com/yshui/picom.git
core: don't fully trust msc from present complete notify
Sometimes X sends bogus complete notifies with invalid msc number. Instead use a saved msc number to get the next complete notify. Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
1899ef0d49
commit
edeb17ad46
20
src/picom.c
20
src/picom.c
|
@ -1489,17 +1489,23 @@ handle_present_complete_notify(session_t *ps, xcb_present_complete_notify_event_
|
|||
return;
|
||||
}
|
||||
|
||||
bool event_is_invalid = false;
|
||||
if (ps->frame_pacing) {
|
||||
auto next_msc = cne->msc + 1;
|
||||
if (cne->msc <= ps->last_msc || cne->ust == 0) {
|
||||
// X sometimes sends duplicate/bogus MSC events, don't
|
||||
// use the msc value. Also ignore these events.
|
||||
//
|
||||
// See:
|
||||
// https://gitlab.freedesktop.org/xorg/xserver/-/issues/1418
|
||||
next_msc = ps->last_msc + 1;
|
||||
event_is_invalid = true;
|
||||
}
|
||||
auto cookie = xcb_present_notify_msc(ps->c, session_get_target_window(ps),
|
||||
0, cne->msc + 1, 0, 0);
|
||||
0, next_msc, 0, 0);
|
||||
set_cant_fail_cookie(ps, cookie);
|
||||
}
|
||||
|
||||
if (cne->msc <= ps->last_msc || cne->ust == 0) {
|
||||
// X sometimes sends duplicate/bogus MSC events, ignore them
|
||||
//
|
||||
// See:
|
||||
// https://gitlab.freedesktop.org/xorg/xserver/-/issues/1418
|
||||
if (event_is_invalid) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue