Improve SurfaceFlinger PTS estimation
Get the next refresh time from DispSync instead of guessing based
on the current time.
Change-Id: I8dc72a3217bfd4e9b4c905034194d1a298cad69a
diff --git a/services/surfaceflinger/SurfaceFlingerConsumer.h b/services/surfaceflinger/SurfaceFlingerConsumer.h
index 0f1bf35..ed307c2 100644
--- a/services/surfaceflinger/SurfaceFlingerConsumer.h
+++ b/services/surfaceflinger/SurfaceFlingerConsumer.h
@@ -17,6 +17,7 @@
#ifndef ANDROID_SURFACEFLINGERCONSUMER_H
#define ANDROID_SURFACEFLINGERCONSUMER_H
+#include "DispSync.h"
#include <gui/GLConsumer.h>
namespace android {
@@ -33,7 +34,8 @@
SurfaceFlingerConsumer(const sp<IGraphicBufferConsumer>& consumer,
uint32_t tex)
- : GLConsumer(consumer, tex, GLConsumer::TEXTURE_EXTERNAL, false)
+ : GLConsumer(consumer, tex, GLConsumer::TEXTURE_EXTERNAL, false),
+ mTransformToDisplayInverse(false)
{}
class BufferRejecter {
@@ -51,7 +53,7 @@
// reject the newly acquired buffer. Unlike the GLConsumer version,
// this does not guarantee that the buffer has been bound to the GL
// texture.
- status_t updateTexImage(BufferRejecter* rejecter);
+ status_t updateTexImage(BufferRejecter* rejecter, const DispSync& dispSync);
// See GLConsumer::bindTextureImageLocked().
status_t bindTextureImage();
@@ -66,7 +68,7 @@
sp<NativeHandle> getSidebandStream() const;
private:
- nsecs_t computeExpectedPresent();
+ nsecs_t computeExpectedPresent(const DispSync& dispSync);
virtual void onSidebandStreamChanged();