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

Commit 0c4bbe4f authored by Sanjeev Jakkilinki's avatar Sanjeev Jakkilinki
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 bcb854ee
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}
@@ -108,6 +108,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;

@@ -177,6 +184,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;
        mInterpolator = interpolator;
        mPpi = context.getResources().getDisplayMetrics().density * 160.0f;
@@ -184,6 +192,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();
        }

    }

    /**
@@ -407,6 +422,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, 0x20B, 0x30B,0x1C00);
        }
    }

    /**
+3 −0
Original line number Diff line number Diff line
@@ -1330,6 +1330,9 @@
    <!-- 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>

    <!-- User display names for app ops codes -->
    <string-array name="app_ops_labels">
        <item>Trying to access location</item>
+3 −0
Original line number Diff line number Diff line
@@ -1809,6 +1809,9 @@
  <java-symbol type="bool" name="use_motion_accel" />
  <java-symbol type="bool" name="config_setup_mms_data" />

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

  <!-- Configuration to play sms ringtone during MO/MT call -->
  <java-symbol type="bool" name="config_sms_ringtone_incall" />
  <java-symbol type="string" name="config_partial_segment_expire_age" />