mirror of
https://github.com/servo/servo.git
synced 2025-07-18 21:03:45 +01:00
Auto merge of #22044 - asajeffrey:magicleap-less-egl-buffer-swapping, r=jdm
Reduce the amount of EGL buffer swapping the ML port is doing <!-- Please describe your changes on the following line: --> At the moment, we're swapping the EGL buffers every heartbeat, which produces a lot of flickering. We should only swap the buffers when needed. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes do not require tests because we have no way to test on ML <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22044) <!-- Reviewable:end -->
This commit is contained in:
commit
4ead81717a
2 changed files with 23 additions and 35 deletions
|
@ -116,8 +116,6 @@ int Servo2D::init() {
|
|||
EGLContext ctx = plane_->getEGLContext();
|
||||
EGLSurface surf = plane_->getEGLSurface();
|
||||
EGLDisplay dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||
eglMakeCurrent(dpy, surf, surf, ctx);
|
||||
glViewport(0, 0, VIEWPORT_W, VIEWPORT_H);
|
||||
|
||||
// Hook into servo
|
||||
servo_ = init_servo(ctx, surf, dpy, logger, "https://servo.org/", VIEWPORT_H, VIEWPORT_W, HIDPI);
|
||||
|
@ -127,9 +125,6 @@ int Servo2D::init() {
|
|||
return 1;
|
||||
}
|
||||
|
||||
// Flush GL
|
||||
glFlush();
|
||||
eglSwapBuffers(dpy, surf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -176,20 +171,9 @@ void Servo2D::instanceInitialScenes() {
|
|||
}
|
||||
|
||||
bool Servo2D::updateLoop(float fDelta) {
|
||||
// Get the EGL context, surface and display.
|
||||
EGLContext ctx = plane_->getEGLContext();
|
||||
EGLSurface surf = plane_->getEGLSurface();
|
||||
EGLDisplay dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||
eglMakeCurrent(dpy, surf, surf, ctx);
|
||||
glViewport(0, 0, VIEWPORT_W, VIEWPORT_H);
|
||||
|
||||
// Hook into servo
|
||||
heartbeat_servo(servo_);
|
||||
|
||||
// Flush GL
|
||||
glFlush();
|
||||
eglSwapBuffers(dpy, surf);
|
||||
|
||||
// Return true for your app to continue running, false to terminate the app.
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue