【问题标题】:What Does "FrameTimeNanos" mean in "Choreographer.FrameCallback"? HW_VSYNC time or APP_VSYNC time?“Choreographer.FrameCallback”中的“FrameTimeNanos”是什么意思? HW_VSYNC 时间还是 APP_VSYNC 时间?
【发布时间】:2017-08-16 09:34:30
【问题描述】:
DispSync之类的源码我看过,但是太复杂了。
我了解到“FrameCallback”是由 APP_VSYNC 事件触发的,它可能与 HW_VSYNC 有时间偏移。那么,我怎么知道 HW_VSYNC 的准确时间呢?
如果 FrameCallback 的时间参数告诉 APP_VSYNC 时间,我在哪里可以得到 HW_VSYNC 和 APP_VSYNC 之间的偏移值,以便我可以计算硬件 vsync 时间?
【问题讨论】:
标签:
android
vsync
surfaceflinger
【解决方案1】:
IIRC,Choreographer 报告的时间戳是APP_VSYNC 次。正如 Grafika 的 ScheduledSwapActivity 中的 cmets 所述:
* We coordinate with the display refresh using Choreographer. The SurfaceFlinger DispSync
* enhancements may cause the Choreographer-reported vsync time to be offset from the
* actual-reported vsync time (which may itself be slightly offset from the actual-actual
* vsync time). None of this is terribly important unless you care about A/V sync.
如果 A/V 同步是您的目标,您可能应该使用 setPresentationTime() 功能。有关其他说明,请参阅comment above doFrame()。