Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 03c73d0f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Use hasSyncFramework value from configStore"

parents c7b35adf cbf153be
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -69,10 +69,6 @@ ifneq ($(NUM_FRAMEBUFFER_SURFACE_BUFFERS),)
    LOCAL_CFLAGS += -DNUM_FRAMEBUFFER_SURFACE_BUFFERS=$(NUM_FRAMEBUFFER_SURFACE_BUFFERS)
endif

ifeq ($(TARGET_RUNNING_WITHOUT_SYNC_FRAMEWORK),true)
    LOCAL_CFLAGS += -DRUNNING_WITHOUT_SYNC_FRAMEWORK
endif

LOCAL_CFLAGS += -fvisibility=hidden -Werror=format

LOCAL_HEADER_LIBRARIES := \
+7 −5
Original line number Diff line number Diff line
@@ -216,7 +216,8 @@ public:
        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() {
        if (kTraceDetailedInfo) ATRACE_CALL();
        Mutex::Autolock lock(mMutex);
@@ -376,7 +377,8 @@ private:
DispSync::DispSync(const char* name) :
        mName(name),
        mRefreshSkipCount(0),
        mThread(new DispSyncThread(name)) {
        mThread(new DispSyncThread(name)),
        mIgnorePresentFences(!SurfaceFlinger::hasSyncFramework){

    mPresentTimeOffset = SurfaceFlinger::dispSyncPresentTimeOffset;
    mThread->run("DispSync", PRIORITY_URGENT_DISPLAY + PRIORITY_MORE_FAVORABLE);
@@ -397,7 +399,7 @@ DispSync::DispSync(const char* name) :
        // 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
        // turn on the HW vsync events.
        if (!kIgnorePresentFences && kEnableZeroPhaseTracer) {
        if (!mIgnorePresentFences && kEnableZeroPhaseTracer) {
            addEventListener("ZeroPhaseTracer", 0, new ZeroPhaseTracer());
        }
    }
@@ -476,7 +478,7 @@ bool DispSync::addResyncSample(nsecs_t timestamp) {
        resetErrorLocked();
    }

    if (kIgnorePresentFences) {
    if (mIgnorePresentFences) {
        // If we don't have the sync framework we will never have
        // addPresentFence called.  This means we have no way to know whether
        // or not we're synchronized with the HW vsyncs, so we just request
@@ -641,7 +643,7 @@ nsecs_t DispSync::computeNextRefresh(int periodOffset) const {
void DispSync::dump(String8& result) const {
    Mutex::Autolock lock(mMutex);
    result.appendFormat("present fences are %s\n",
            kIgnorePresentFences ? "ignored" : "used");
            mIgnorePresentFences ? "ignored" : "used");
    result.appendFormat("mPeriod: %" PRId64 " ns (%.3f fps; skipCount=%d)\n",
            mPeriod, 1000000000.0 / mPeriod, mRefreshSkipCount);
    result.appendFormat("mPhase: %" PRId64 " ns\n", mPhase);
+4 −9
Original line number Diff line number Diff line
@@ -25,15 +25,6 @@

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 Fence;
class DispSyncThread;
@@ -186,6 +177,10 @@ private:
    // This is the offset from the present fence timestamps to the corresponding
    // vsync event.
    int64_t mPresentTimeOffset;

    // Ignore present (retire) fences if the device doesn't have support for the
    // sync framework
    bool mIgnorePresentFences;
};

}
+6 −2
Original line number Diff line number Diff line
@@ -117,6 +117,7 @@ bool SurfaceFlinger::useContextPriority;
int64_t SurfaceFlinger::dispSyncPresentTimeOffset;
bool SurfaceFlinger::useHwcForRgbToYuv;
uint64_t SurfaceFlinger::maxVirtualDisplaySize;
bool SurfaceFlinger::hasSyncFramework;

SurfaceFlinger::SurfaceFlinger()
    :   BnSurfaceComposer(),
@@ -160,6 +161,7 @@ SurfaceFlinger::SurfaceFlinger()
        ,mEnterVrMode(false)
#endif
{
    ALOGI("SurfaceFlinger is starting");

    vsyncPhaseOffsetNs = getInt64< ISurfaceFlingerConfigs,
            &ISurfaceFlingerConfigs::vsyncEventPhaseOffsetNs>(1000000);
@@ -167,7 +169,8 @@ SurfaceFlinger::SurfaceFlinger()
    sfVsyncPhaseOffsetNs = getInt64< ISurfaceFlingerConfigs,
            &ISurfaceFlingerConfigs::vsyncSfEventPhaseOffsetNs>(1000000);

    ALOGI("SurfaceFlinger is starting");
    hasSyncFramework = getBool< ISurfaceFlingerConfigs,
            &ISurfaceFlingerConfigs::hasSyncFramework>(true);

    useContextPriority = getBool< ISurfaceFlingerConfigs,
            &ISurfaceFlingerConfigs::useContextPriority>(false);
@@ -1515,7 +1518,7 @@ void SurfaceFlinger::postComposition(nsecs_t refreshStartTime)
        }
    }

    if (kIgnorePresentFences) {
    if (!hasSyncFramework) {
        if (hw->isDisplayOn()) {
            enableHardwareVsync();
        }
@@ -3249,6 +3252,7 @@ void SurfaceFlinger::appendSfConfigString(String8& result) const
    result.appendFormat(" PRESENT_TIME_OFFSET=%" PRId64 , dispSyncPresentTimeOffset);
    result.appendFormat(" FORCE_HWC_FOR_RBG_TO_YUV=%d", useHwcForRgbToYuv);
    result.appendFormat(" MAX_VIRT_DISPLAY_DIM=%" PRIu64, maxVirtualDisplaySize);
    result.appendFormat(" RUNNING_WITHOUT_SYNC_FRAMEWORK=%d", !hasSyncFramework);
    result.append("]");
}

+3 −0
Original line number Diff line number Diff line
@@ -128,6 +128,9 @@ public:
    static int64_t vsyncPhaseOffsetNs;
    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.
    static bool useContextPriority;

Loading