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

Commit b80c1c37 authored by Sanjeev Jakkilinki's avatar Sanjeev Jakkilinki Committed by Linux Build Service Account
Browse files

Perf: Add boost for scroller(horizontal scroll use cases)

Use perflock api's to add cpu boost for
start scroller. 2 Cores are made online
with minumum 1.1GHz nominal cpu freq for the
duration of the scroll.
Cpu boost will be controlled by
config_enableCpuBoostForScroller.
Default value of config is false and to turn
on use device specific overlay files.
Disabled KSM during scroll

Change-Id: I2dc61f1385878ba2da6544d2f1cfc6a356fb41ba
parent 9791a5a7
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ import android.util.FloatMath;
import android.view.ViewConfiguration;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;

import org.codeaurora.Performance;

/**
 * <p>This class encapsulates scrolling. You can use scrollers ({@link Scroller}
@@ -109,6 +109,13 @@ public class Scroller {
    private float mDeceleration;
    private final float mPpi;

    /*
    * Perf boost related variables
    * Enabled/Disabled using config_enableCpuBoostForScroller
    * true value turns it on, by default will be turned off
    */
    private Performance mPerf = null;

    // A context-specific coefficient adjusted to physical values.
    private float mPhysicalCoeff;

@@ -168,6 +175,7 @@ public class Scroller {
     * not to support progressive "flywheel" behavior in flinging.
     */
    public Scroller(Context context, Interpolator interpolator, boolean flywheel) {
        boolean bIsPerfBoostEnabled = false;
        mFinished = true;
        if (interpolator == null) {
            mInterpolator = new ViscousFluidInterpolator();
@@ -179,6 +187,13 @@ public class Scroller {
        mFlywheel = flywheel;

        mPhysicalCoeff = computeDeceleration(0.84f); // look and feel tuning
        bIsPerfBoostEnabled = context.getResources().getBoolean(
             com.android.internal.R.bool.config_enableCpuBoostForScroller);

        if (mPerf == null && bIsPerfBoostEnabled) {
            mPerf = new Performance();
        }

    }

    /**
@@ -396,6 +411,10 @@ public class Scroller {
        mDeltaX = dx;
        mDeltaY = dy;
        mDurationReciprocal = 1.0f / (float) mDuration;

        if ((mPerf != null) && (duration != 0)) {
            mPerf.perfLockAcquire(mDuration, mPerf.CPUS_ON_2, 0x1E01, 0x20B, 0x30B, 0x1C00);
        }
    }

    /**
+3 −0
Original line number Diff line number Diff line
@@ -1972,4 +1972,7 @@
    <!-- Whether cpu boost is enabled for overscroller fling. -->
    <bool name="config_enableCpuBoostForOverScrollerFling">false</bool>

    <!-- Whether cpu boost is enabled for horizontal scroll. -->
    <bool name="config_enableCpuBoostForScroller">false</bool>

</resources>
+3 −0
Original line number Diff line number Diff line
@@ -2126,4 +2126,7 @@
  <!-- cpu boost for overscroller fling -->
  <java-symbol type="bool" name="config_enableCpuBoostForOverScrollerFling" />

  <!-- cpu boost for horizontal scroll -->
  <java-symbol type="bool" name="config_enableCpuBoostForScroller" />

</resources>