Loading services/surfaceflinger/Android.mk +0 −6 Original line number Original line Diff line number Diff line Loading @@ -77,12 +77,6 @@ ifeq ($(TARGET_RUNNING_WITHOUT_SYNC_FRAMEWORK),true) LOCAL_CFLAGS += -DRUNNING_WITHOUT_SYNC_FRAMEWORK LOCAL_CFLAGS += -DRUNNING_WITHOUT_SYNC_FRAMEWORK endif endif ifneq ($(PRESENT_TIME_OFFSET_FROM_VSYNC_NS),) LOCAL_CFLAGS += -DPRESENT_TIME_OFFSET_FROM_VSYNC_NS=$(PRESENT_TIME_OFFSET_FROM_VSYNC_NS) else LOCAL_CFLAGS += -DPRESENT_TIME_OFFSET_FROM_VSYNC_NS=0 endif ifneq ($(MAX_VIRTUAL_DISPLAY_DIMENSION),) ifneq ($(MAX_VIRTUAL_DISPLAY_DIMENSION),) LOCAL_CFLAGS += -DMAX_VIRTUAL_DISPLAY_DIMENSION=$(MAX_VIRTUAL_DISPLAY_DIMENSION) LOCAL_CFLAGS += -DMAX_VIRTUAL_DISPLAY_DIMENSION=$(MAX_VIRTUAL_DISPLAY_DIMENSION) else else Loading services/surfaceflinger/DispSync.cpp +3 −5 Original line number Original line Diff line number Diff line Loading @@ -33,6 +33,7 @@ #include <ui/Fence.h> #include <ui/Fence.h> #include "DispSync.h" #include "DispSync.h" #include "SurfaceFlinger.h" #include "EventLog/EventLog.h" #include "EventLog/EventLog.h" using std::max; using std::max; Loading @@ -54,10 +55,6 @@ static const bool kEnableZeroPhaseTracer = false; // present time and the nearest software-predicted vsync. // present time and the nearest software-predicted vsync. static const nsecs_t kErrorThreshold = 160000000000; // 400 usec squared static const nsecs_t kErrorThreshold = 160000000000; // 400 usec squared // This is the offset from the present fence timestamps to the corresponding // vsync event. static const int64_t kPresentTimeOffset = PRESENT_TIME_OFFSET_FROM_VSYNC_NS; #undef LOG_TAG #undef LOG_TAG #define LOG_TAG "DispSyncThread" #define LOG_TAG "DispSyncThread" class DispSyncThread: public Thread { class DispSyncThread: public Thread { Loading Loading @@ -381,6 +378,7 @@ DispSync::DispSync(const char* name) : mRefreshSkipCount(0), mRefreshSkipCount(0), mThread(new DispSyncThread(name)) { mThread(new DispSyncThread(name)) { mPresentTimeOffset = SurfaceFlinger::dispSyncPresentTimeOffset; mThread->run("DispSync", PRIORITY_URGENT_DISPLAY + PRIORITY_MORE_FAVORABLE); mThread->run("DispSync", PRIORITY_URGENT_DISPLAY + PRIORITY_MORE_FAVORABLE); // set DispSync to SCHED_FIFO to minimize jitter // set DispSync to SCHED_FIFO to minimize jitter struct sched_param param = {0}; struct sched_param param = {0}; Loading Loading @@ -433,7 +431,7 @@ bool DispSync::addPresentFence(const sp<Fence>& fence) { nsecs_t t = f->getSignalTime(); nsecs_t t = f->getSignalTime(); if (t < INT64_MAX) { if (t < INT64_MAX) { mPresentFences[i].clear(); mPresentFences[i].clear(); mPresentTimes[i] = t + kPresentTimeOffset; mPresentTimes[i] = t + mPresentTimeOffset; } } } } } } Loading services/surfaceflinger/DispSync.h +4 −0 Original line number Original line Diff line number Diff line Loading @@ -182,6 +182,10 @@ private: // mMutex is used to protect access to all member variables. // mMutex is used to protect access to all member variables. mutable Mutex mMutex; mutable Mutex mMutex; // This is the offset from the present fence timestamps to the corresponding // vsync event. int64_t mPresentTimeOffset; }; }; } } Loading services/surfaceflinger/SurfaceFlinger.cpp +8 −2 Original line number Original line Diff line number Diff line Loading @@ -113,6 +113,7 @@ const String16 sDump("android.permission.DUMP"); int64_t SurfaceFlinger::vsyncPhaseOffsetNs; int64_t SurfaceFlinger::vsyncPhaseOffsetNs; int64_t SurfaceFlinger::sfVsyncPhaseOffsetNs; int64_t SurfaceFlinger::sfVsyncPhaseOffsetNs; bool SurfaceFlinger::useContextPriority; bool SurfaceFlinger::useContextPriority; int64_t SurfaceFlinger::dispSyncPresentTimeOffset; SurfaceFlinger::SurfaceFlinger() SurfaceFlinger::SurfaceFlinger() : BnSurfaceComposer(), : BnSurfaceComposer(), Loading Loading @@ -168,6 +169,9 @@ SurfaceFlinger::SurfaceFlinger() useContextPriority = getBool< ISurfaceFlingerConfigs, useContextPriority = getBool< ISurfaceFlingerConfigs, &ISurfaceFlingerConfigs::useContextPriority>(false); &ISurfaceFlingerConfigs::useContextPriority>(false); dispSyncPresentTimeOffset = getInt64< ISurfaceFlingerConfigs, &ISurfaceFlingerConfigs::presentTimeOffsetFromVSyncNs>(0); // debugging stuff... // debugging stuff... char value[PROPERTY_VALUE_MAX]; char value[PROPERTY_VALUE_MAX]; Loading Loading @@ -3232,6 +3236,8 @@ void SurfaceFlinger::appendSfConfigString(String8& result) const if (isLayerTripleBufferingDisabled()) if (isLayerTripleBufferingDisabled()) result.append(" DISABLE_TRIPLE_BUFFERING"); result.append(" DISABLE_TRIPLE_BUFFERING"); result.appendFormat(" PRESENT_TIME_OFFSET=%" PRId64 , dispSyncPresentTimeOffset); result.append("]"); result.append("]"); } } Loading Loading @@ -3358,9 +3364,9 @@ void SurfaceFlinger::dumpAllLocked(const Vector<String16>& args, size_t& index, result.append("DispSync configuration: "); result.append("DispSync configuration: "); colorizer.reset(result); colorizer.reset(result); result.appendFormat("app phase %" PRId64 " ns, sf phase %" PRId64 " ns, " result.appendFormat("app phase %" PRId64 " ns, sf phase %" PRId64 " ns, " "present offset %d ns (refresh %" PRId64 " ns)", "present offset %" PRId64 " ns (refresh %" PRId64 " ns)", vsyncPhaseOffsetNs, sfVsyncPhaseOffsetNs, vsyncPhaseOffsetNs, sfVsyncPhaseOffsetNs, PRESENT_TIME_OFFSET_FROM_VSYNC_NS, activeConfig->getVsyncPeriod()); dispSyncPresentTimeOffset, activeConfig->getVsyncPeriod()); result.append("\n"); result.append("\n"); // Dump static screen stats // Dump static screen stats Loading services/surfaceflinger/SurfaceFlinger.h +4 −0 Original line number Original line Diff line number Diff line Loading @@ -132,6 +132,10 @@ public: // Instruct the Render Engine to use EGL_IMG_context_priority is available. // Instruct the Render Engine to use EGL_IMG_context_priority is available. static bool useContextPriority; static bool useContextPriority; // The offset in nanoseconds to use when DispSync timestamps present fence // signaling time. static int64_t dispSyncPresentTimeOffset; static char const* getServiceName() ANDROID_API { static char const* getServiceName() ANDROID_API { return "SurfaceFlinger"; return "SurfaceFlinger"; } } Loading Loading
services/surfaceflinger/Android.mk +0 −6 Original line number Original line Diff line number Diff line Loading @@ -77,12 +77,6 @@ ifeq ($(TARGET_RUNNING_WITHOUT_SYNC_FRAMEWORK),true) LOCAL_CFLAGS += -DRUNNING_WITHOUT_SYNC_FRAMEWORK LOCAL_CFLAGS += -DRUNNING_WITHOUT_SYNC_FRAMEWORK endif endif ifneq ($(PRESENT_TIME_OFFSET_FROM_VSYNC_NS),) LOCAL_CFLAGS += -DPRESENT_TIME_OFFSET_FROM_VSYNC_NS=$(PRESENT_TIME_OFFSET_FROM_VSYNC_NS) else LOCAL_CFLAGS += -DPRESENT_TIME_OFFSET_FROM_VSYNC_NS=0 endif ifneq ($(MAX_VIRTUAL_DISPLAY_DIMENSION),) ifneq ($(MAX_VIRTUAL_DISPLAY_DIMENSION),) LOCAL_CFLAGS += -DMAX_VIRTUAL_DISPLAY_DIMENSION=$(MAX_VIRTUAL_DISPLAY_DIMENSION) LOCAL_CFLAGS += -DMAX_VIRTUAL_DISPLAY_DIMENSION=$(MAX_VIRTUAL_DISPLAY_DIMENSION) else else Loading
services/surfaceflinger/DispSync.cpp +3 −5 Original line number Original line Diff line number Diff line Loading @@ -33,6 +33,7 @@ #include <ui/Fence.h> #include <ui/Fence.h> #include "DispSync.h" #include "DispSync.h" #include "SurfaceFlinger.h" #include "EventLog/EventLog.h" #include "EventLog/EventLog.h" using std::max; using std::max; Loading @@ -54,10 +55,6 @@ static const bool kEnableZeroPhaseTracer = false; // present time and the nearest software-predicted vsync. // present time and the nearest software-predicted vsync. static const nsecs_t kErrorThreshold = 160000000000; // 400 usec squared static const nsecs_t kErrorThreshold = 160000000000; // 400 usec squared // This is the offset from the present fence timestamps to the corresponding // vsync event. static const int64_t kPresentTimeOffset = PRESENT_TIME_OFFSET_FROM_VSYNC_NS; #undef LOG_TAG #undef LOG_TAG #define LOG_TAG "DispSyncThread" #define LOG_TAG "DispSyncThread" class DispSyncThread: public Thread { class DispSyncThread: public Thread { Loading Loading @@ -381,6 +378,7 @@ DispSync::DispSync(const char* name) : mRefreshSkipCount(0), mRefreshSkipCount(0), mThread(new DispSyncThread(name)) { mThread(new DispSyncThread(name)) { mPresentTimeOffset = SurfaceFlinger::dispSyncPresentTimeOffset; mThread->run("DispSync", PRIORITY_URGENT_DISPLAY + PRIORITY_MORE_FAVORABLE); mThread->run("DispSync", PRIORITY_URGENT_DISPLAY + PRIORITY_MORE_FAVORABLE); // set DispSync to SCHED_FIFO to minimize jitter // set DispSync to SCHED_FIFO to minimize jitter struct sched_param param = {0}; struct sched_param param = {0}; Loading Loading @@ -433,7 +431,7 @@ bool DispSync::addPresentFence(const sp<Fence>& fence) { nsecs_t t = f->getSignalTime(); nsecs_t t = f->getSignalTime(); if (t < INT64_MAX) { if (t < INT64_MAX) { mPresentFences[i].clear(); mPresentFences[i].clear(); mPresentTimes[i] = t + kPresentTimeOffset; mPresentTimes[i] = t + mPresentTimeOffset; } } } } } } Loading
services/surfaceflinger/DispSync.h +4 −0 Original line number Original line Diff line number Diff line Loading @@ -182,6 +182,10 @@ private: // mMutex is used to protect access to all member variables. // mMutex is used to protect access to all member variables. mutable Mutex mMutex; mutable Mutex mMutex; // This is the offset from the present fence timestamps to the corresponding // vsync event. int64_t mPresentTimeOffset; }; }; } } Loading
services/surfaceflinger/SurfaceFlinger.cpp +8 −2 Original line number Original line Diff line number Diff line Loading @@ -113,6 +113,7 @@ const String16 sDump("android.permission.DUMP"); int64_t SurfaceFlinger::vsyncPhaseOffsetNs; int64_t SurfaceFlinger::vsyncPhaseOffsetNs; int64_t SurfaceFlinger::sfVsyncPhaseOffsetNs; int64_t SurfaceFlinger::sfVsyncPhaseOffsetNs; bool SurfaceFlinger::useContextPriority; bool SurfaceFlinger::useContextPriority; int64_t SurfaceFlinger::dispSyncPresentTimeOffset; SurfaceFlinger::SurfaceFlinger() SurfaceFlinger::SurfaceFlinger() : BnSurfaceComposer(), : BnSurfaceComposer(), Loading Loading @@ -168,6 +169,9 @@ SurfaceFlinger::SurfaceFlinger() useContextPriority = getBool< ISurfaceFlingerConfigs, useContextPriority = getBool< ISurfaceFlingerConfigs, &ISurfaceFlingerConfigs::useContextPriority>(false); &ISurfaceFlingerConfigs::useContextPriority>(false); dispSyncPresentTimeOffset = getInt64< ISurfaceFlingerConfigs, &ISurfaceFlingerConfigs::presentTimeOffsetFromVSyncNs>(0); // debugging stuff... // debugging stuff... char value[PROPERTY_VALUE_MAX]; char value[PROPERTY_VALUE_MAX]; Loading Loading @@ -3232,6 +3236,8 @@ void SurfaceFlinger::appendSfConfigString(String8& result) const if (isLayerTripleBufferingDisabled()) if (isLayerTripleBufferingDisabled()) result.append(" DISABLE_TRIPLE_BUFFERING"); result.append(" DISABLE_TRIPLE_BUFFERING"); result.appendFormat(" PRESENT_TIME_OFFSET=%" PRId64 , dispSyncPresentTimeOffset); result.append("]"); result.append("]"); } } Loading Loading @@ -3358,9 +3364,9 @@ void SurfaceFlinger::dumpAllLocked(const Vector<String16>& args, size_t& index, result.append("DispSync configuration: "); result.append("DispSync configuration: "); colorizer.reset(result); colorizer.reset(result); result.appendFormat("app phase %" PRId64 " ns, sf phase %" PRId64 " ns, " result.appendFormat("app phase %" PRId64 " ns, sf phase %" PRId64 " ns, " "present offset %d ns (refresh %" PRId64 " ns)", "present offset %" PRId64 " ns (refresh %" PRId64 " ns)", vsyncPhaseOffsetNs, sfVsyncPhaseOffsetNs, vsyncPhaseOffsetNs, sfVsyncPhaseOffsetNs, PRESENT_TIME_OFFSET_FROM_VSYNC_NS, activeConfig->getVsyncPeriod()); dispSyncPresentTimeOffset, activeConfig->getVsyncPeriod()); result.append("\n"); result.append("\n"); // Dump static screen stats // Dump static screen stats Loading
services/surfaceflinger/SurfaceFlinger.h +4 −0 Original line number Original line Diff line number Diff line Loading @@ -132,6 +132,10 @@ public: // Instruct the Render Engine to use EGL_IMG_context_priority is available. // Instruct the Render Engine to use EGL_IMG_context_priority is available. static bool useContextPriority; static bool useContextPriority; // The offset in nanoseconds to use when DispSync timestamps present fence // signaling time. static int64_t dispSyncPresentTimeOffset; static char const* getServiceName() ANDROID_API { static char const* getServiceName() ANDROID_API { return "SurfaceFlinger"; return "SurfaceFlinger"; } } Loading