Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animations aren't started if there's no window events #22926

Open
asajeffrey opened this issue Feb 22, 2019 · 8 comments
Open

Animations aren't started if there's no window events #22926

asajeffrey opened this issue Feb 22, 2019 · 8 comments

Comments

@asajeffrey
Copy link
Member

If a page with requestAnimationFrame is loaded, it doesn't start animating until a window event is generated. The reason why is that servo has two modes: AnimationState::Animating (which blocks on vsync when swapping the GL buffers) and AnimationState::Idle (which blocks on window events). The problem is that the transition from one to the other needs a window event to trigger it.

@asajeffrey
Copy link
Member Author

Really we should select between a window event and a compositor event, but window events aren't arriving from an mpsc channel, so we can't select on them. We could spin up a routing thread that wakes up the window when a compositor event arrives?

@paulrouget
Copy link
Contributor

When switching from Idle to Animating, isn't the compositor thread waken up via the EventLoopWaker? The embedder would then call perform_udpates which will then call WindowMethods::set_animation_state ?

@asajeffrey
Copy link
Member Author

I don't think so, which thread does this?

@paulrouget
Copy link
Contributor

The constellation is supposed to wake up the compositor thread.

The constellation is supposed to be getting a ChangeRunningAnimationsState message, and then send a message to the compositor via the compositor_proxy (which will make sure the compositor/embedder thread is woken up).

I'm wondering what is not working here.

@asajeffrey
Copy link
Member Author

I think what's happening is that the compositor thread is blocked waiting for a window event, not a compositor event. Wouldn't the constellation have to generate a window event if it wants to wake up the compositor thread?

@paulrouget
Copy link
Contributor

Wouldn't the constellation have to generate a window event if it wants to wake up the compositor thread?

Yes. It's exactly what it's supposed to happen. Via

@asajeffrey
Copy link
Member Author

Oh, you're right. OK, I don't understand what's going on then :/ I'll do a bit more digging, it's possible this is a problem with my code.

@paulrouget
Copy link
Contributor

@asajeffrey is still happening?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants