Commit 8b62e204 authored by Neil Roberts's avatar Neil Roberts Committed by Kristian H. Kristensen

Set new state before emitting wake signal in weston_compsitor_wake

The wake handler set up by the shell will try to unlock the screen
which works by setting up an animation which fades in the display. The
animation is started by first scheduling a repaint. Subsequent
repaints are scheduled whenever the previous frame is finished.
However in the case of the wake up signal the state is still
WESTON_COMPOSITOR_SLEEPING when the animation is started.
weston_output_schedule_repaint() ignores attempts to schedule a
repaint if the compositor is sleeping which means the animation never
gets run and will never complete.

The animation gets unstuck and continues if anything else schedules a
repaint after the state has been changed so the bug only gets hit in
certain conditions. The first wake up creates the lock surface which
causes a redraw when the first buffer is attached so the first wake up
is always ok. A redraw can be triggered in the subsequent wake ups
just by moving the mouse.

A good way to trigger the bug is to try to wake up the compositor by
pressing the shift key. If you let the compositor go back to sleep
after waking it up without unlocking it, the second press of the shift
key will not cause a redraw so the animation will not run and it won't
fade in.

https://bugs.freedesktop.org/show_bug.cgi?id=69719
parent 1b45e5ed
......@@ -2542,7 +2542,14 @@ weston_compositor_dpms(struct weston_compositor *compositor,
WL_EXPORT void
weston_compositor_wake(struct weston_compositor *compositor)
{
switch (compositor->state) {
uint32_t old_state = compositor->state;
/* The state needs to be changed before emitting the wake
* signal because that may try to schedule a repaint which
* will not work if the compositor is still sleeping */
compositor->state = WESTON_COMPOSITOR_ACTIVE;
switch (old_state) {
case WESTON_COMPOSITOR_SLEEPING:
weston_compositor_dpms(compositor, WESTON_DPMS_ON);
/* fall through */
......@@ -2551,7 +2558,6 @@ weston_compositor_wake(struct weston_compositor *compositor)
wl_signal_emit(&compositor->wake_signal, compositor);
/* fall through */
default:
compositor->state = WESTON_COMPOSITOR_ACTIVE;
wl_event_source_timer_update(compositor->idle_source,
compositor->idle_time * 1000);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment