Plumbing through GPU context priority
If the SF's RE priority is set to REALTIME, then SysUI set's it's ThreadedRendererCompat priority to EGL_CONTEXT_PRIORITY_HIGH_IMG. Test: Compile and observe logcat. Bug: 168740533 Change-Id: Ib2fdac90c22b357d8b9f5c80c03a3d9c4e1a515d
This commit is contained in:
@@ -232,6 +232,7 @@ public final class SurfaceControl implements Parcelable {
|
||||
long nativeSurfaceControl);
|
||||
private static native void nativeRemoveJankDataListener(long nativeListener);
|
||||
private static native long nativeCreateJankDataListenerWrapper(OnJankDataListener listener);
|
||||
private static native int nativeGetGPUContextPriority();
|
||||
|
||||
@Nullable
|
||||
@GuardedBy("mLock")
|
||||
@@ -2438,7 +2439,15 @@ public final class SurfaceControl implements Parcelable {
|
||||
nativeRemoveJankDataListener(listener.mNativePtr.get());
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Return GPU Context priority that is set in SurfaceFlinger's Render Engine.
|
||||
* @hide
|
||||
*/
|
||||
public static int getGPUContextPriority() {
|
||||
return nativeGetGPUContextPriority();
|
||||
}
|
||||
|
||||
/**
|
||||
* An atomic set of changes to a set of SurfaceControl.
|
||||
*/
|
||||
public static class Transaction implements Closeable, Parcelable {
|
||||
|
||||
@@ -1679,6 +1679,10 @@ static jlong nativeCreateJankDataListenerWrapper(JNIEnv* env, jclass clazz,
|
||||
return reinterpret_cast<jlong>(new JankDataListenerWrapper(env, jankDataListenerObject));
|
||||
}
|
||||
|
||||
static jint nativeGetGPUContextPriority(JNIEnv* env, jclass clazz) {
|
||||
return static_cast<jint>(SurfaceComposerClient::getGPUContextPriority());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
static const JNINativeMethod sSurfaceControlMethods[] = {
|
||||
@@ -1869,6 +1873,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
|
||||
(void*)nativeRemoveJankDataListener },
|
||||
{"nativeCreateJankDataListenerWrapper", "(Landroid/view/SurfaceControl$OnJankDataListener;)J",
|
||||
(void*)nativeCreateJankDataListenerWrapper },
|
||||
{"nativeGetGPUContextPriority", "()I",
|
||||
(void*)nativeGetGPUContextPriority },
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import android.view.ThreadedRenderer;
|
||||
*/
|
||||
public class ThreadedRendererCompat {
|
||||
|
||||
public static int EGL_CONTEXT_PRIORITY_REALTIME_NV = 0x3357;
|
||||
public static int EGL_CONTEXT_PRIORITY_HIGH_IMG = 0x3101;
|
||||
public static int EGL_CONTEXT_PRIORITY_MEDIUM_IMG = 0x3102;
|
||||
public static int EGL_CONTEXT_PRIORITY_LOW_IMG = 0x3103;
|
||||
|
||||
@@ -33,6 +33,7 @@ import android.os.UserHandle;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.util.TimingsTraceLog;
|
||||
import android.view.SurfaceControl;
|
||||
|
||||
import com.android.internal.protolog.common.ProtoLog;
|
||||
import com.android.systemui.dagger.ContextComponentHelper;
|
||||
@@ -41,6 +42,7 @@ import com.android.systemui.dagger.SysUIComponent;
|
||||
import com.android.systemui.dump.DumpManager;
|
||||
import com.android.systemui.people.PeopleSpaceActivity;
|
||||
import com.android.systemui.people.widget.PeopleSpaceWidgetProvider;
|
||||
import com.android.systemui.shared.system.ThreadedRendererCompat;
|
||||
import com.android.systemui.util.NotificationChannels;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
@@ -98,6 +100,18 @@ public class SystemUIApplication extends Application implements
|
||||
if (Process.myUserHandle().equals(UserHandle.SYSTEM)) {
|
||||
IntentFilter bootCompletedFilter = new IntentFilter(Intent.ACTION_BOOT_COMPLETED);
|
||||
bootCompletedFilter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
|
||||
|
||||
// If SF GPU context priority is set to realtime, then SysUI should run at high.
|
||||
// The priority is defaulted at medium.
|
||||
int sfPriority = SurfaceControl.getGPUContextPriority();
|
||||
Log.i(TAG, "Found SurfaceFlinger's GPU Priority: " + sfPriority);
|
||||
if (sfPriority == ThreadedRendererCompat.EGL_CONTEXT_PRIORITY_REALTIME_NV) {
|
||||
Log.i(TAG, "Setting SysUI's GPU Context priority to: "
|
||||
+ ThreadedRendererCompat.EGL_CONTEXT_PRIORITY_HIGH_IMG);
|
||||
ThreadedRendererCompat.setContextPriority(
|
||||
ThreadedRendererCompat.EGL_CONTEXT_PRIORITY_HIGH_IMG);
|
||||
}
|
||||
|
||||
registerReceiver(new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
|
||||
Reference in New Issue
Block a user