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

Do not wait for rAF to be requested #114

Merged
merged 1 commit into from Dec 24, 2019
Merged

Conversation

@Manishearth
Copy link
Member

Manishearth commented Dec 19, 2019

This does not make the render loop completely independent of script: it still waits for script to submit a frame. If we don't, frames will be dropped (and I'm not sure what strategy to use there).

I'm going to test this soon and see if it actually improves our framerate.

Servo side: servo/servo#25343

r? @jdm

@@ -113,8 +113,8 @@ impl Session {
let _ = self.sender.send(SessionMsg::SetSwapChain(swap_chain_id));
}

pub fn request_animation_frame(&mut self, dest: Sender<Frame>) {
let _ = self.sender.send(SessionMsg::RequestAnimationFrame(dest));
pub fn start_render_loop(&mut self) {

This comment has been minimized.

@Manishearth

Manishearth Dec 19, 2019

Author Member

This isn't strictly necessary, but makes things a bit easier

return false;
}
};
let _ = self.frame_sender.send(frame);

This comment has been minimized.

@jdm

jdm Dec 19, 2019

Member

So if I understand correctly, this is the big difference here - immediately after finishing a frame we wait for the new frame, but instead of storing it in current_frame and then grabbing it next time script tells us that it's time to start a rAF, we send it to script immediately which then causes a rAF callback task to be queued.

This comment has been minimized.

@Manishearth

Manishearth Dec 19, 2019

Author Member

Yes. Note that in the current implementation script always calls request_animation_frame immediately after render_animation_frame, so it seems like this should not cause any improvement, however it's possible that the extra IPC overhead plus the fact that the event loop is being pumped by the main thread which may decide to do something else are conspiring to cause problems.

@Manishearth Manishearth marked this pull request as ready for review Dec 23, 2019
@Manishearth
Copy link
Member Author

Manishearth commented Dec 23, 2019

This provides a slight improvement, might as well land it. r? @jdm

@jdm
Copy link
Member

jdm commented Dec 24, 2019

@bors-servo
Copy link
Contributor

bors-servo commented Dec 24, 2019

📌 Commit 58e8786 has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented Dec 24, 2019

Testing commit 58e8786 with merge c6abf4c...

bors-servo added a commit that referenced this pull request Dec 24, 2019
Do not wait for rAF to be requested

This does not make the render loop _completely_ independent of script: it still waits for script to submit a frame. If we don't, frames will be dropped (and I'm not sure what strategy to use there).

I'm going to test this soon and see if it actually improves our framerate.

Servo side: servo/servo#25343

r? @jdm
@bors-servo
Copy link
Contributor

bors-servo commented Dec 24, 2019

☀️ Test successful - checks-travis
Approved by: jdm
Pushing c6abf4c to master...

@bors-servo bors-servo merged commit 58e8786 into servo:master Dec 24, 2019
3 checks passed
3 checks passed
Travis CI - Pull Request Build Passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
bors-servo added a commit to servo/servo that referenced this pull request Dec 24, 2019
Do not wait for rAF to be requested in render loop

Servo-side of servo/webxr#114

r? @jdm
bors-servo added a commit to servo/servo that referenced this pull request Dec 24, 2019
Do not wait for rAF to be requested in render loop

Servo-side of servo/webxr#114

r? @jdm
bors-servo added a commit to servo/servo that referenced this pull request Dec 24, 2019
Do not wait for rAF to be requested in render loop

Servo-side of servo/webxr#114

r? @jdm
bors-servo added a commit to servo/servo that referenced this pull request Dec 24, 2019
Do not wait for rAF to be requested in render loop

Servo-side of servo/webxr#114

r? @jdm
bors-servo added a commit to servo/servo that referenced this pull request Dec 24, 2019
Do not wait for rAF to be requested in render loop

Servo-side of servo/webxr#114

r? @jdm
bors-servo added a commit to servo/servo that referenced this pull request Dec 24, 2019
Do not wait for rAF to be requested in render loop

Servo-side of servo/webxr#114

r? @jdm
bors-servo added a commit to servo/servo that referenced this pull request Jan 2, 2020
Do not wait for rAF to be requested in render loop

Servo-side of servo/webxr#114

r? @jdm
bors-servo added a commit to servo/servo that referenced this pull request Jan 2, 2020
Do not wait for rAF to be requested in render loop

Servo-side of servo/webxr#114

r? @jdm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.