diff options
author | John Reck <jreck@google.com> | 2018-04-05 16:41:41 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2018-04-09 10:58:15 -0700 |
commit | ec100976e0655acaa204c8800dfb83dadae20cc8 (patch) | |
tree | d7bd2d10c7be8ea0ccec63e85c8365efb87edfe4 /libs/hwui/renderthread/EglManager.cpp | |
parent | 413293ff626301e1ee9837f247c4d7321c59f472 (diff) |
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
Diffstat (limited to 'libs/hwui/renderthread/EglManager.cpp')
-rw-r--r-- | libs/hwui/renderthread/EglManager.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libs/hwui/renderthread/EglManager.cpp b/libs/hwui/renderthread/EglManager.cpp index 6e239e357cf6..3a49bebe7936 100644 --- a/libs/hwui/renderthread/EglManager.cpp +++ b/libs/hwui/renderthread/EglManager.cpp @@ -83,6 +83,7 @@ static struct { bool glColorSpace = false; bool scRGB = false; bool contextPriority = false; + bool presentTime = false; } EglExtensions; EglManager::EglManager(RenderThread& thread) @@ -170,6 +171,7 @@ void EglManager::initExtensions() { 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 @@ void EglManager::loadConfigs() { &numConfigs) || numConfigs != 1) { ALOGE("Device claims wide gamut support, cannot find matching config, error = %s", - eglErrorString()); + eglErrorString()); EglExtensions.pixelFormatFloat = false; } } @@ -437,6 +439,13 @@ bool EglManager::swapBuffers(const Frame& frame, const SkRect& screenDirty) { 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); |