diff options
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); |