Add support for render-ahead
For periods of time during which latency is less important
allow a client to request a deeper render-ahead pipeline.
The latency tradeoff results in less overall visual jank
Test: none, only used by macrobench
Change-Id: I516203b70bdc75b6415fa08bf9c4fb1b598b0102
diff --git a/libs/hwui/renderthread/EglManager.cpp b/libs/hwui/renderthread/EglManager.cpp
index 6e239e3..3a49beb 100644
--- a/libs/hwui/renderthread/EglManager.cpp
+++ b/libs/hwui/renderthread/EglManager.cpp
@@ -83,6 +83,7 @@
bool glColorSpace = false;
bool scRGB = false;
bool contextPriority = false;
+ bool presentTime = false;
} EglExtensions;
EglManager::EglManager(RenderThread& thread)
@@ -170,6 +171,7 @@
EglExtensions.scRGB = extensions.has("EGL_EXT_gl_colorspace_scrgb");
#endif
EglExtensions.contextPriority = extensions.has("EGL_IMG_context_priority");
+ EglExtensions.presentTime = extensions.has("EGL_ANDROID_presentation_time");
}
bool EglManager::hasEglContext() {
@@ -242,7 +244,7 @@
&numConfigs) ||
numConfigs != 1) {
ALOGE("Device claims wide gamut support, cannot find matching config, error = %s",
- eglErrorString());
+ eglErrorString());
EglExtensions.pixelFormatFloat = false;
}
}
@@ -437,6 +439,13 @@
fence();
}
+ if (EglExtensions.presentTime && Properties::usePresentTime) {
+ if (!eglPresentationTimeANDROID(mEglDisplay, frame.mSurface, frame.mPresentTime)) {
+ LOG_ALWAYS_FATAL("Failed to set presentation time on surface %p, error=%s",
+ (void*)frame.mSurface, eglErrorString());
+ }
+ }
+
EGLint rects[4];
frame.map(screenDirty, rects);
eglSwapBuffersWithDamageKHR(mEglDisplay, frame.mSurface, rects, screenDirty.isEmpty() ? 0 : 1);