diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2018-10-03 05:00:48 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-03 05:00:48 -0400 |
commit | 7fa2b2c879923a8b1f05be59ec9511ba8d5928c8 (patch) | |
tree | 8883ece7978cd9b19b03c7c2700b9cd23aef473b /support/android/apk | |
parent | bbef6712767d43c2432ff749db888ceb1e6e74ef (diff) | |
parent | de8fae14b71ccf11e864c5cdbab52696d1c86666 (diff) | |
download | servo-7fa2b2c879923a8b1f05be59ec9511ba8d5928c8.tar.gz servo-7fa2b2c879923a8b1f05be59ec9511ba8d5928c8.zip |
Auto merge of #21842 - jdm:android-extra-frame, r=paulrouget
Fix flickering on Android
This is particularly noticeable in debug builds on WebGL pages, but also appears during startup when loading normal pages. requestRender() causes Android to swap buffers under the assumption that the buffer contains a fully rendered frame, but when calling it from `doFrame` there are no guarantees that Servo has finished compositing yet. This causes stale buffers to be composited instead, leading to flickering at startup when there is no content, or general jerkiness on pages using animation callbacks as previous frames replace current frames.
---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #21796
- [x] These changes do not require tests because no android integration tests.
<!-- 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/21842)
<!-- Reviewable:end -->
Diffstat (limited to 'support/android/apk')
-rw-r--r-- | support/android/apk/servoview/src/main/java/org/mozilla/servoview/Servo.java | 4 | ||||
-rw-r--r-- | support/android/apk/servoview/src/main/java/org/mozilla/servoview/ServoView.java | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/support/android/apk/servoview/src/main/java/org/mozilla/servoview/Servo.java b/support/android/apk/servoview/src/main/java/org/mozilla/servoview/Servo.java index f93c5105f14..a4b3f6b651f 100644 --- a/support/android/apk/servoview/src/main/java/org/mozilla/servoview/Servo.java +++ b/support/android/apk/servoview/src/main/java/org/mozilla/servoview/Servo.java @@ -54,6 +54,10 @@ public class Servo { return mJNI.version(); } + public void performUpdates() { + mRunCallback.inGLThread(() -> mJNI.performUpdates()); + } + public void setBatchMode(boolean mode) { mRunCallback.inGLThread(() -> mJNI.setBatchMode(mode)); } diff --git a/support/android/apk/servoview/src/main/java/org/mozilla/servoview/ServoView.java b/support/android/apk/servoview/src/main/java/org/mozilla/servoview/ServoView.java index ac5f41f0d3f..8a3a82bba5d 100644 --- a/support/android/apk/servoview/src/main/java/org/mozilla/servoview/ServoView.java +++ b/support/android/apk/servoview/src/main/java/org/mozilla/servoview/ServoView.java @@ -197,7 +197,7 @@ public class ServoView extends GLSurfaceView } if (!zoomNecessary && !scrollNecessary && mAnimating) { - requestRender(); + mServo.performUpdates(); } if (mZooming || mScrolling || mAnimating) { |