From 28ffe198bfab3761f97ce2f74ef479bafc5bbd99 Mon Sep 17 00:00:00 2001 From: Dan Stoza Date: Fri, 9 Sep 2016 13:50:19 -0700 Subject: Update default DispSync offsets Updates the default DispSync offsets to 1ms/1ms to avoid SurfaceFlinger racing against hardware vsync on untuned video-mode panels, which can result in a significant number of dropped frames. Also moves and updates the documentation of the offsets, which used to live in build/target/board/generic/BoardConfig.mk. Bug: 30801895 Change-Id: I4cb09d840e2f16fb3d05df4d7abf58d9ba36f83b --- services/surfaceflinger/Android.mk | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/services/surfaceflinger/Android.mk b/services/surfaceflinger/Android.mk index dc5e97b324..ffda035a9a 100644 --- a/services/surfaceflinger/Android.mk +++ b/services/surfaceflinger/Android.mk @@ -79,18 +79,36 @@ ifeq ($(TARGET_RUNNING_WITHOUT_SYNC_FRAMEWORK),true) LOCAL_CFLAGS += -DRUNNING_WITHOUT_SYNC_FRAMEWORK endif -# See build/target/board/generic/BoardConfig.mk for a description of this setting. +# The following two BoardConfig variables define (respectively): +# +# - The phase offset between hardware vsync and when apps are woken up by the +# Choreographer callback +# - The phase offset between hardware vsync and when SurfaceFlinger wakes up +# to consume input +# +# Their values can be tuned to trade off between display pipeline latency (both +# overall latency and the lengths of the app --> SF and SF --> display phases) +# and frame delivery jitter (which typically manifests as "jank" or "jerkiness" +# while interacting with the device). The default values should produce a +# relatively low amount of jitter at the expense of roughly two frames of +# app --> display latency, and unless significant testing is performed to avoid +# increased display jitter (both manual investigation using systrace [1] and +# automated testing using dumpsys gfxinfo [2] are recommended), they should not +# be modified. +# +# [1] https://developer.android.com/studio/profile/systrace.html +# [2] https://developer.android.com/training/testing/performance.html + ifneq ($(VSYNC_EVENT_PHASE_OFFSET_NS),) LOCAL_CFLAGS += -DVSYNC_EVENT_PHASE_OFFSET_NS=$(VSYNC_EVENT_PHASE_OFFSET_NS) else - LOCAL_CFLAGS += -DVSYNC_EVENT_PHASE_OFFSET_NS=0 + LOCAL_CFLAGS += -DVSYNC_EVENT_PHASE_OFFSET_NS=1000000 endif -# See build/target/board/generic/BoardConfig.mk for a description of this setting. ifneq ($(SF_VSYNC_EVENT_PHASE_OFFSET_NS),) LOCAL_CFLAGS += -DSF_VSYNC_EVENT_PHASE_OFFSET_NS=$(SF_VSYNC_EVENT_PHASE_OFFSET_NS) else - LOCAL_CFLAGS += -DSF_VSYNC_EVENT_PHASE_OFFSET_NS=0 + LOCAL_CFLAGS += -DSF_VSYNC_EVENT_PHASE_OFFSET_NS=1000000 endif ifneq ($(PRESENT_TIME_OFFSET_FROM_VSYNC_NS),) -- cgit v1.2.3-59-g8ed1b