Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 5502a0a

Browse files
MxSouldnfield
andauthored
Fix eglPresentationTimeANDROID is no effective (#30182)
* Fix eglPresentationTimeANDROID is no effective * Update android_environment_gl.cc Co-authored-by: Dan Field <dfield@gmail.com>
1 parent 59c6f28 commit 5502a0a

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

shell/platform/android/android_environment_gl.cc

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,24 @@ AndroidEnvironmentGL::AndroidEnvironmentGL()
2020
return;
2121
}
2222

23+
// See if we can use the EGL_ANDROID_presentation_time extension. This
24+
// extension may be available from API18 onward.
25+
// If this extension is available, it will be invoked with the target vsync
26+
// for the current frame before calling eglSwapBuffers. This helps when the
27+
// engine over-stuffs the buffer queue. This can happen when a frame goes over
28+
// budget into the next vsync period, and a subsequent frame is quickly
29+
// submitted in the same vsync period. Dequeuing buffers will then be slow
30+
// until the engine stops submitting frames and lets the GPU catch up.
31+
// However, using this extension means the SurfaceFlinger will only use the
32+
// newest buffer for the current vsync, and the GPU and CPU will stay more
33+
// in sync.
34+
// See https://developer.android.com/games/sdk/frame-pacing for more
35+
// details and diagrams.
2336
auto* extensions = eglQueryString(display_, EGL_EXTENSIONS);
2437
if (strstr(extensions, "EGL_ANDROID_presentation_time")) {
2538
presentation_time_proc_ =
2639
reinterpret_cast<PFNEGLPRESENTATIONTIMEANDROIDPROC>(
27-
eglGetProcAddress("sEGL_ANDROID_presentation_time"));
40+
eglGetProcAddress("eglPresentationTimeANDROID"));
2841
}
2942

3043
valid_ = true;

0 commit comments

Comments
 (0)