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

Commit 384ba005 authored by Rajulu Ponnada's avatar Rajulu Ponnada Committed by Giulio Cervera
Browse files

frameworks/base: capping live wallpapper fps

CRs-Fixed: 343813
(cherry picked from commit a3343a04940bcd31d1a9992336ab178777fd0ff9)

Change-Id: I46b805f8cf74995a744eb6c9e0cd0d593d3af3b9
parent 00826183
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -263,8 +263,16 @@ void * Context::threadProc(void *vrsc) {
        mDraw &= (rsc->mRootScript.get() != NULL);
        mDraw &= rsc->mHasSurface;

#ifdef QCOM_HARDWARE
        int32_t scripttime = 0;
#endif
        if (mDraw && rsc->mIsGraphicsContext) {
#ifdef QCOM_HARDWARE
            scripttime = rsc->runRootScript();
            uint64_t delay = scripttime * 1000000;
#else
            uint64_t delay = rsc->runRootScript() * 1000000;
#endif
            targetTime = rsc->getTime() + delay;
            doWait = (delay == 0);

@@ -282,6 +290,14 @@ void * Context::threadProc(void *vrsc) {
        } else {
            doWait = true;
        }
#ifdef QCOM_HARDWARE
        if (scripttime > 1) {
            int32_t t = (scripttime - (int32_t)(rsc->mTimeMSLastScript + rsc->mTimeMSLastSwap)) * 1000;
            if (t > 0) {
                usleep(t);
            }
        }
#endif
    }

    LOGV("%p RS Thread exiting", rsc);