Loading services/surfaceflinger/Android.mk +0 −4 Original line number Original line Diff line number Diff line Loading @@ -69,10 +69,6 @@ ifneq ($(NUM_FRAMEBUFFER_SURFACE_BUFFERS),) LOCAL_CFLAGS += -DNUM_FRAMEBUFFER_SURFACE_BUFFERS=$(NUM_FRAMEBUFFER_SURFACE_BUFFERS) LOCAL_CFLAGS += -DNUM_FRAMEBUFFER_SURFACE_BUFFERS=$(NUM_FRAMEBUFFER_SURFACE_BUFFERS) endif endif ifeq ($(TARGET_RUNNING_WITHOUT_SYNC_FRAMEWORK),true) LOCAL_CFLAGS += -DRUNNING_WITHOUT_SYNC_FRAMEWORK endif LOCAL_CFLAGS += -fvisibility=hidden -Werror=format LOCAL_CFLAGS += -fvisibility=hidden -Werror=format LOCAL_HEADER_LIBRARIES := \ LOCAL_HEADER_LIBRARIES := \ Loading services/surfaceflinger/DispSync.cpp +7 −5 Original line number Original line Diff line number Diff line Loading @@ -216,7 +216,8 @@ public: return BAD_VALUE; return BAD_VALUE; } } // This method is only here to handle the kIgnorePresentFences case. // This method is only here to handle the !SurfaceFlinger::hasSyncFramework // case. bool hasAnyEventListeners() { bool hasAnyEventListeners() { if (kTraceDetailedInfo) ATRACE_CALL(); if (kTraceDetailedInfo) ATRACE_CALL(); Mutex::Autolock lock(mMutex); Mutex::Autolock lock(mMutex); Loading Loading @@ -376,7 +377,8 @@ private: DispSync::DispSync(const char* name) : DispSync::DispSync(const char* name) : mName(name), mName(name), mRefreshSkipCount(0), mRefreshSkipCount(0), mThread(new DispSyncThread(name)) { mThread(new DispSyncThread(name)), mIgnorePresentFences(!SurfaceFlinger::hasSyncFramework){ mPresentTimeOffset = SurfaceFlinger::dispSyncPresentTimeOffset; mPresentTimeOffset = SurfaceFlinger::dispSyncPresentTimeOffset; mThread->run("DispSync", PRIORITY_URGENT_DISPLAY + PRIORITY_MORE_FAVORABLE); mThread->run("DispSync", PRIORITY_URGENT_DISPLAY + PRIORITY_MORE_FAVORABLE); Loading @@ -397,7 +399,7 @@ DispSync::DispSync(const char* name) : // Even if we're just ignoring the fences, the zero-phase tracing is // Even if we're just ignoring the fences, the zero-phase tracing is // not needed because any time there is an event registered we will // not needed because any time there is an event registered we will // turn on the HW vsync events. // turn on the HW vsync events. if (!kIgnorePresentFences && kEnableZeroPhaseTracer) { if (!mIgnorePresentFences && kEnableZeroPhaseTracer) { addEventListener("ZeroPhaseTracer", 0, new ZeroPhaseTracer()); addEventListener("ZeroPhaseTracer", 0, new ZeroPhaseTracer()); } } } } Loading Loading @@ -476,7 +478,7 @@ bool DispSync::addResyncSample(nsecs_t timestamp) { resetErrorLocked(); resetErrorLocked(); } } if (kIgnorePresentFences) { if (mIgnorePresentFences) { // If we don't have the sync framework we will never have // If we don't have the sync framework we will never have // addPresentFence called. This means we have no way to know whether // addPresentFence called. This means we have no way to know whether // or not we're synchronized with the HW vsyncs, so we just request // or not we're synchronized with the HW vsyncs, so we just request Loading Loading @@ -641,7 +643,7 @@ nsecs_t DispSync::computeNextRefresh(int periodOffset) const { void DispSync::dump(String8& result) const { void DispSync::dump(String8& result) const { Mutex::Autolock lock(mMutex); Mutex::Autolock lock(mMutex); result.appendFormat("present fences are %s\n", result.appendFormat("present fences are %s\n", kIgnorePresentFences ? "ignored" : "used"); mIgnorePresentFences ? "ignored" : "used"); result.appendFormat("mPeriod: %" PRId64 " ns (%.3f fps; skipCount=%d)\n", result.appendFormat("mPeriod: %" PRId64 " ns (%.3f fps; skipCount=%d)\n", mPeriod, 1000000000.0 / mPeriod, mRefreshSkipCount); mPeriod, 1000000000.0 / mPeriod, mRefreshSkipCount); result.appendFormat("mPhase: %" PRId64 " ns\n", mPhase); result.appendFormat("mPhase: %" PRId64 " ns\n", mPhase); Loading services/surfaceflinger/DispSync.h +4 −9 Original line number Original line Diff line number Diff line Loading @@ -25,15 +25,6 @@ namespace android { namespace android { // Ignore present (retire) fences if the device doesn't have support for the // sync framework #if defined(RUNNING_WITHOUT_SYNC_FRAMEWORK) static const bool kIgnorePresentFences = true; #else static const bool kIgnorePresentFences = false; #endif class String8; class String8; class Fence; class Fence; class DispSyncThread; class DispSyncThread; Loading Loading @@ -186,6 +177,10 @@ private: // This is the offset from the present fence timestamps to the corresponding // This is the offset from the present fence timestamps to the corresponding // vsync event. // vsync event. int64_t mPresentTimeOffset; int64_t mPresentTimeOffset; // Ignore present (retire) fences if the device doesn't have support for the // sync framework bool mIgnorePresentFences; }; }; } } Loading services/surfaceflinger/SurfaceFlinger.cpp +6 −2 Original line number Original line Diff line number Diff line Loading @@ -117,6 +117,7 @@ bool SurfaceFlinger::useContextPriority; int64_t SurfaceFlinger::dispSyncPresentTimeOffset; int64_t SurfaceFlinger::dispSyncPresentTimeOffset; bool SurfaceFlinger::useHwcForRgbToYuv; bool SurfaceFlinger::useHwcForRgbToYuv; uint64_t SurfaceFlinger::maxVirtualDisplaySize; uint64_t SurfaceFlinger::maxVirtualDisplaySize; bool SurfaceFlinger::hasSyncFramework; SurfaceFlinger::SurfaceFlinger() SurfaceFlinger::SurfaceFlinger() : BnSurfaceComposer(), : BnSurfaceComposer(), Loading Loading @@ -160,6 +161,7 @@ SurfaceFlinger::SurfaceFlinger() ,mEnterVrMode(false) ,mEnterVrMode(false) #endif #endif { { ALOGI("SurfaceFlinger is starting"); vsyncPhaseOffsetNs = getInt64< ISurfaceFlingerConfigs, vsyncPhaseOffsetNs = getInt64< ISurfaceFlingerConfigs, &ISurfaceFlingerConfigs::vsyncEventPhaseOffsetNs>(1000000); &ISurfaceFlingerConfigs::vsyncEventPhaseOffsetNs>(1000000); Loading @@ -167,7 +169,8 @@ SurfaceFlinger::SurfaceFlinger() sfVsyncPhaseOffsetNs = getInt64< ISurfaceFlingerConfigs, sfVsyncPhaseOffsetNs = getInt64< ISurfaceFlingerConfigs, &ISurfaceFlingerConfigs::vsyncSfEventPhaseOffsetNs>(1000000); &ISurfaceFlingerConfigs::vsyncSfEventPhaseOffsetNs>(1000000); ALOGI("SurfaceFlinger is starting"); hasSyncFramework = getBool< ISurfaceFlingerConfigs, &ISurfaceFlingerConfigs::hasSyncFramework>(true); useContextPriority = getBool< ISurfaceFlingerConfigs, useContextPriority = getBool< ISurfaceFlingerConfigs, &ISurfaceFlingerConfigs::useContextPriority>(false); &ISurfaceFlingerConfigs::useContextPriority>(false); Loading Loading @@ -1515,7 +1518,7 @@ void SurfaceFlinger::postComposition(nsecs_t refreshStartTime) } } } } if (kIgnorePresentFences) { if (!hasSyncFramework) { if (hw->isDisplayOn()) { if (hw->isDisplayOn()) { enableHardwareVsync(); enableHardwareVsync(); } } Loading Loading @@ -3249,6 +3252,7 @@ void SurfaceFlinger::appendSfConfigString(String8& result) const result.appendFormat(" PRESENT_TIME_OFFSET=%" PRId64 , dispSyncPresentTimeOffset); result.appendFormat(" PRESENT_TIME_OFFSET=%" PRId64 , dispSyncPresentTimeOffset); result.appendFormat(" FORCE_HWC_FOR_RBG_TO_YUV=%d", useHwcForRgbToYuv); result.appendFormat(" FORCE_HWC_FOR_RBG_TO_YUV=%d", useHwcForRgbToYuv); result.appendFormat(" MAX_VIRT_DISPLAY_DIM=%" PRIu64, maxVirtualDisplaySize); result.appendFormat(" MAX_VIRT_DISPLAY_DIM=%" PRIu64, maxVirtualDisplaySize); result.appendFormat(" RUNNING_WITHOUT_SYNC_FRAMEWORK=%d", !hasSyncFramework); result.append("]"); result.append("]"); } } Loading services/surfaceflinger/SurfaceFlinger.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -128,6 +128,9 @@ public: static int64_t vsyncPhaseOffsetNs; static int64_t vsyncPhaseOffsetNs; static int64_t sfVsyncPhaseOffsetNs; static int64_t sfVsyncPhaseOffsetNs; // If fences from sync Framework are supported. static bool hasSyncFramework; // 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; Loading Loading
services/surfaceflinger/Android.mk +0 −4 Original line number Original line Diff line number Diff line Loading @@ -69,10 +69,6 @@ ifneq ($(NUM_FRAMEBUFFER_SURFACE_BUFFERS),) LOCAL_CFLAGS += -DNUM_FRAMEBUFFER_SURFACE_BUFFERS=$(NUM_FRAMEBUFFER_SURFACE_BUFFERS) LOCAL_CFLAGS += -DNUM_FRAMEBUFFER_SURFACE_BUFFERS=$(NUM_FRAMEBUFFER_SURFACE_BUFFERS) endif endif ifeq ($(TARGET_RUNNING_WITHOUT_SYNC_FRAMEWORK),true) LOCAL_CFLAGS += -DRUNNING_WITHOUT_SYNC_FRAMEWORK endif LOCAL_CFLAGS += -fvisibility=hidden -Werror=format LOCAL_CFLAGS += -fvisibility=hidden -Werror=format LOCAL_HEADER_LIBRARIES := \ LOCAL_HEADER_LIBRARIES := \ Loading
services/surfaceflinger/DispSync.cpp +7 −5 Original line number Original line Diff line number Diff line Loading @@ -216,7 +216,8 @@ public: return BAD_VALUE; return BAD_VALUE; } } // This method is only here to handle the kIgnorePresentFences case. // This method is only here to handle the !SurfaceFlinger::hasSyncFramework // case. bool hasAnyEventListeners() { bool hasAnyEventListeners() { if (kTraceDetailedInfo) ATRACE_CALL(); if (kTraceDetailedInfo) ATRACE_CALL(); Mutex::Autolock lock(mMutex); Mutex::Autolock lock(mMutex); Loading Loading @@ -376,7 +377,8 @@ private: DispSync::DispSync(const char* name) : DispSync::DispSync(const char* name) : mName(name), mName(name), mRefreshSkipCount(0), mRefreshSkipCount(0), mThread(new DispSyncThread(name)) { mThread(new DispSyncThread(name)), mIgnorePresentFences(!SurfaceFlinger::hasSyncFramework){ mPresentTimeOffset = SurfaceFlinger::dispSyncPresentTimeOffset; mPresentTimeOffset = SurfaceFlinger::dispSyncPresentTimeOffset; mThread->run("DispSync", PRIORITY_URGENT_DISPLAY + PRIORITY_MORE_FAVORABLE); mThread->run("DispSync", PRIORITY_URGENT_DISPLAY + PRIORITY_MORE_FAVORABLE); Loading @@ -397,7 +399,7 @@ DispSync::DispSync(const char* name) : // Even if we're just ignoring the fences, the zero-phase tracing is // Even if we're just ignoring the fences, the zero-phase tracing is // not needed because any time there is an event registered we will // not needed because any time there is an event registered we will // turn on the HW vsync events. // turn on the HW vsync events. if (!kIgnorePresentFences && kEnableZeroPhaseTracer) { if (!mIgnorePresentFences && kEnableZeroPhaseTracer) { addEventListener("ZeroPhaseTracer", 0, new ZeroPhaseTracer()); addEventListener("ZeroPhaseTracer", 0, new ZeroPhaseTracer()); } } } } Loading Loading @@ -476,7 +478,7 @@ bool DispSync::addResyncSample(nsecs_t timestamp) { resetErrorLocked(); resetErrorLocked(); } } if (kIgnorePresentFences) { if (mIgnorePresentFences) { // If we don't have the sync framework we will never have // If we don't have the sync framework we will never have // addPresentFence called. This means we have no way to know whether // addPresentFence called. This means we have no way to know whether // or not we're synchronized with the HW vsyncs, so we just request // or not we're synchronized with the HW vsyncs, so we just request Loading Loading @@ -641,7 +643,7 @@ nsecs_t DispSync::computeNextRefresh(int periodOffset) const { void DispSync::dump(String8& result) const { void DispSync::dump(String8& result) const { Mutex::Autolock lock(mMutex); Mutex::Autolock lock(mMutex); result.appendFormat("present fences are %s\n", result.appendFormat("present fences are %s\n", kIgnorePresentFences ? "ignored" : "used"); mIgnorePresentFences ? "ignored" : "used"); result.appendFormat("mPeriod: %" PRId64 " ns (%.3f fps; skipCount=%d)\n", result.appendFormat("mPeriod: %" PRId64 " ns (%.3f fps; skipCount=%d)\n", mPeriod, 1000000000.0 / mPeriod, mRefreshSkipCount); mPeriod, 1000000000.0 / mPeriod, mRefreshSkipCount); result.appendFormat("mPhase: %" PRId64 " ns\n", mPhase); result.appendFormat("mPhase: %" PRId64 " ns\n", mPhase); Loading
services/surfaceflinger/DispSync.h +4 −9 Original line number Original line Diff line number Diff line Loading @@ -25,15 +25,6 @@ namespace android { namespace android { // Ignore present (retire) fences if the device doesn't have support for the // sync framework #if defined(RUNNING_WITHOUT_SYNC_FRAMEWORK) static const bool kIgnorePresentFences = true; #else static const bool kIgnorePresentFences = false; #endif class String8; class String8; class Fence; class Fence; class DispSyncThread; class DispSyncThread; Loading Loading @@ -186,6 +177,10 @@ private: // This is the offset from the present fence timestamps to the corresponding // This is the offset from the present fence timestamps to the corresponding // vsync event. // vsync event. int64_t mPresentTimeOffset; int64_t mPresentTimeOffset; // Ignore present (retire) fences if the device doesn't have support for the // sync framework bool mIgnorePresentFences; }; }; } } Loading
services/surfaceflinger/SurfaceFlinger.cpp +6 −2 Original line number Original line Diff line number Diff line Loading @@ -117,6 +117,7 @@ bool SurfaceFlinger::useContextPriority; int64_t SurfaceFlinger::dispSyncPresentTimeOffset; int64_t SurfaceFlinger::dispSyncPresentTimeOffset; bool SurfaceFlinger::useHwcForRgbToYuv; bool SurfaceFlinger::useHwcForRgbToYuv; uint64_t SurfaceFlinger::maxVirtualDisplaySize; uint64_t SurfaceFlinger::maxVirtualDisplaySize; bool SurfaceFlinger::hasSyncFramework; SurfaceFlinger::SurfaceFlinger() SurfaceFlinger::SurfaceFlinger() : BnSurfaceComposer(), : BnSurfaceComposer(), Loading Loading @@ -160,6 +161,7 @@ SurfaceFlinger::SurfaceFlinger() ,mEnterVrMode(false) ,mEnterVrMode(false) #endif #endif { { ALOGI("SurfaceFlinger is starting"); vsyncPhaseOffsetNs = getInt64< ISurfaceFlingerConfigs, vsyncPhaseOffsetNs = getInt64< ISurfaceFlingerConfigs, &ISurfaceFlingerConfigs::vsyncEventPhaseOffsetNs>(1000000); &ISurfaceFlingerConfigs::vsyncEventPhaseOffsetNs>(1000000); Loading @@ -167,7 +169,8 @@ SurfaceFlinger::SurfaceFlinger() sfVsyncPhaseOffsetNs = getInt64< ISurfaceFlingerConfigs, sfVsyncPhaseOffsetNs = getInt64< ISurfaceFlingerConfigs, &ISurfaceFlingerConfigs::vsyncSfEventPhaseOffsetNs>(1000000); &ISurfaceFlingerConfigs::vsyncSfEventPhaseOffsetNs>(1000000); ALOGI("SurfaceFlinger is starting"); hasSyncFramework = getBool< ISurfaceFlingerConfigs, &ISurfaceFlingerConfigs::hasSyncFramework>(true); useContextPriority = getBool< ISurfaceFlingerConfigs, useContextPriority = getBool< ISurfaceFlingerConfigs, &ISurfaceFlingerConfigs::useContextPriority>(false); &ISurfaceFlingerConfigs::useContextPriority>(false); Loading Loading @@ -1515,7 +1518,7 @@ void SurfaceFlinger::postComposition(nsecs_t refreshStartTime) } } } } if (kIgnorePresentFences) { if (!hasSyncFramework) { if (hw->isDisplayOn()) { if (hw->isDisplayOn()) { enableHardwareVsync(); enableHardwareVsync(); } } Loading Loading @@ -3249,6 +3252,7 @@ void SurfaceFlinger::appendSfConfigString(String8& result) const result.appendFormat(" PRESENT_TIME_OFFSET=%" PRId64 , dispSyncPresentTimeOffset); result.appendFormat(" PRESENT_TIME_OFFSET=%" PRId64 , dispSyncPresentTimeOffset); result.appendFormat(" FORCE_HWC_FOR_RBG_TO_YUV=%d", useHwcForRgbToYuv); result.appendFormat(" FORCE_HWC_FOR_RBG_TO_YUV=%d", useHwcForRgbToYuv); result.appendFormat(" MAX_VIRT_DISPLAY_DIM=%" PRIu64, maxVirtualDisplaySize); result.appendFormat(" MAX_VIRT_DISPLAY_DIM=%" PRIu64, maxVirtualDisplaySize); result.appendFormat(" RUNNING_WITHOUT_SYNC_FRAMEWORK=%d", !hasSyncFramework); result.append("]"); result.append("]"); } } Loading
services/surfaceflinger/SurfaceFlinger.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -128,6 +128,9 @@ public: static int64_t vsyncPhaseOffsetNs; static int64_t vsyncPhaseOffsetNs; static int64_t sfVsyncPhaseOffsetNs; static int64_t sfVsyncPhaseOffsetNs; // If fences from sync Framework are supported. static bool hasSyncFramework; // 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; Loading