diff options
| author | TreeHugger Robot <treehugger-gerrit@google.com> | 2021-02-08 21:56:15 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2021-02-08 21:56:15 +0000 |
| commit | 989bc8cd010dde59a900afab97558e3b54a33427 (patch) | |
| tree | b9570152727830e84f4b24fcdf06ddbba60d3547 /core/java | |
| parent | e859f1c0e44b74dfecb165ac52b86ab268157918 (diff) | |
| parent | cb783ca6d936ad2198fff6b9d8c0444223f0386e (diff) | |
Merge changes from topic "display-mode-rename" into sc-dev
* changes:
Tracking changes to renaming DisplayConfig to DisplayMode
Extend the comment for setFrameRate(..., shouldBeSeamless)
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/view/DisplayEventReceiver.java | 14 | ||||
| -rw-r--r-- | core/java/android/view/Surface.java | 4 | ||||
| -rw-r--r-- | core/java/android/view/SurfaceControl.java | 79 |
3 files changed, 54 insertions, 43 deletions
diff --git a/core/java/android/view/DisplayEventReceiver.java b/core/java/android/view/DisplayEventReceiver.java index 5d4a4e52975a..e6cd25275ca2 100644 --- a/core/java/android/view/DisplayEventReceiver.java +++ b/core/java/android/view/DisplayEventReceiver.java @@ -58,11 +58,11 @@ public abstract class DisplayEventReceiver { public static final int VSYNC_SOURCE_SURFACE_FLINGER = 1; /** - * Specifies to generate config changed events from Surface Flinger. + * Specifies to generate mode changed events from Surface Flinger. * <p> * Needs to be kept in sync with frameworks/native/include/gui/ISurfaceComposer.h */ - public static final int EVENT_REGISTRATION_CONFIG_CHANGED_FLAG = 0x1; + public static final int EVENT_REGISTRATION_MODE_CHANGED_FLAG = 0x1; /** * Specifies to generate frame rate override events from Surface Flinger. @@ -197,14 +197,14 @@ public abstract class DisplayEventReceiver { } /** - * Called when a display config changed event is received. + * Called when a display mode changed event is received. * * @param timestampNanos The timestamp of the event, in the {@link System#nanoTime()} * timebase. * @param physicalDisplayId Stable display ID that uniquely describes a (display, port) pair. - * @param configId The new config Id + * @param modeId The new mode Id */ - public void onConfigChanged(long timestampNanos, long physicalDisplayId, int configId) { + public void onModeChanged(long timestampNanos, long physicalDisplayId, int modeId) { } /** @@ -273,8 +273,8 @@ public abstract class DisplayEventReceiver { // Called from native code. @SuppressWarnings("unused") - private void dispatchConfigChanged(long timestampNanos, long physicalDisplayId, int configId) { - onConfigChanged(timestampNanos, physicalDisplayId, configId); + private void dispatchModeChanged(long timestampNanos, long physicalDisplayId, int modeId) { + onModeChanged(timestampNanos, physicalDisplayId, modeId); } // Called from native code. diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java index 24bc30874318..f8c4d1587f22 100644 --- a/core/java/android/view/Surface.java +++ b/core/java/android/view/Surface.java @@ -928,7 +928,9 @@ public class Surface implements Parcelable { * seamless transition is one that doesn't have any visual interruptions, such as a black * screen for a second or two. True indicates that any frame rate changes caused by this * request should be seamless. False indicates that non-seamless refresh rates are also - * acceptable. + * acceptable. Non-seamless switches might be used when the benefit of matching the content's + * frame rate outweighs the cost of the transition, for example when displaying + * long-running video content. * * @throws IllegalArgumentException If frameRate or compatibility are invalid. */ diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java index 98b4acd302cb..6a629ca4e462 100644 --- a/core/java/android/view/SurfaceControl.java +++ b/core/java/android/view/SurfaceControl.java @@ -161,8 +161,8 @@ public final class SurfaceControl implements Parcelable { int L, int T, int R, int B); private static native void nativeSetDisplaySize(long transactionObj, IBinder displayToken, int width, int height); - private static native SurfaceControl.DisplayInfo nativeGetDisplayInfo(IBinder displayToken); - private static native SurfaceControl.DisplayConfig[] nativeGetDisplayConfigs( + private static native DisplayInfo nativeGetDisplayInfo(IBinder displayToken); + private static native DisplayMode[] nativeGetDisplayModes( IBinder displayToken); private static native DisplayedContentSamplingAttributes nativeGetDisplayedContentSamplingAttributes(IBinder displayToken); @@ -170,13 +170,13 @@ public final class SurfaceControl implements Parcelable { boolean enable, int componentMask, int maxFrames); private static native DisplayedContentSample nativeGetDisplayedContentSample( IBinder displayToken, long numFrames, long timestamp); - private static native int nativeGetActiveConfig(IBinder displayToken); - private static native boolean nativeSetDesiredDisplayConfigSpecs(IBinder displayToken, - SurfaceControl.DesiredDisplayConfigSpecs desiredDisplayConfigSpecs); - private static native SurfaceControl.DesiredDisplayConfigSpecs - nativeGetDesiredDisplayConfigSpecs(IBinder displayToken); + private static native int nativeGetActiveDisplayMode(IBinder displayToken); + private static native boolean nativeSetDesiredDisplayModeSpecs(IBinder displayToken, + DesiredDisplayModeSpecs desiredDisplayModeSpecs); + private static native DesiredDisplayModeSpecs + nativeGetDesiredDisplayModeSpecs(IBinder displayToken); private static native int[] nativeGetDisplayColorModes(IBinder displayToken); - private static native SurfaceControl.DisplayPrimaries nativeGetDisplayNativePrimaries( + private static native DisplayPrimaries nativeGetDisplayNativePrimaries( IBinder displayToken); private static native int[] nativeGetCompositionDataspaces(); private static native int nativeGetActiveColorMode(IBinder displayToken); @@ -1743,11 +1743,11 @@ public final class SurfaceControl implements Parcelable { * * @hide */ - public static final class DisplayConfig { + public static final class DisplayMode { /** * Invalid display config id. */ - public static final int INVALID_DISPLAY_CONFIG_ID = -1; + public static final int INVALID_DISPLAY_MODE_ID = -1; public int width; public int height; @@ -1764,7 +1764,7 @@ public final class SurfaceControl implements Parcelable { * configs within the same group can be done seamlessly in most cases. * @see: android.hardware.graphics.composer@2.4::IComposerClient::Attribute::CONFIG_GROUP */ - public int configGroup; + public int group; @Override public String toString() { @@ -1775,7 +1775,7 @@ public final class SurfaceControl implements Parcelable { + ", refreshRate=" + refreshRate + ", appVsyncOffsetNanos=" + appVsyncOffsetNanos + ", presentationDeadlineNanos=" + presentationDeadlineNanos - + ", configGroup=" + configGroup + "}"; + + ", group=" + group + "}"; } } @@ -1802,21 +1802,21 @@ public final class SurfaceControl implements Parcelable { /** * @hide */ - public static SurfaceControl.DisplayConfig[] getDisplayConfigs(IBinder displayToken) { + public static DisplayMode[] getDisplayModes(IBinder displayToken) { if (displayToken == null) { throw new IllegalArgumentException("displayToken must not be null"); } - return nativeGetDisplayConfigs(displayToken); + return nativeGetDisplayModes(displayToken); } /** * @hide */ - public static int getActiveConfig(IBinder displayToken) { + public static int getActiveDisplayMode(IBinder displayToken) { if (displayToken == null) { throw new IllegalArgumentException("displayToken must not be null"); } - return nativeGetActiveConfig(displayToken); + return nativeGetActiveDisplayMode(displayToken); } /** @@ -1863,8 +1863,8 @@ public final class SurfaceControl implements Parcelable { * * @hide */ - public static final class DesiredDisplayConfigSpecs { - public int defaultConfig; + public static final class DesiredDisplayModeSpecs { + public int defaultMode; /** * The primary refresh rate range represents display manager's general guidance on the * display configs surface flinger will consider when switching refresh rates. Unless @@ -1889,16 +1889,16 @@ public final class SurfaceControl implements Parcelable { */ public boolean allowGroupSwitching; - public DesiredDisplayConfigSpecs() {} + public DesiredDisplayModeSpecs() {} - public DesiredDisplayConfigSpecs(DesiredDisplayConfigSpecs other) { + public DesiredDisplayModeSpecs(DesiredDisplayModeSpecs other) { copyFrom(other); } - public DesiredDisplayConfigSpecs(int defaultConfig, boolean allowGroupSwitching, + public DesiredDisplayModeSpecs(int defaultMode, boolean allowGroupSwitching, float primaryRefreshRateMin, float primaryRefreshRateMax, float appRequestRefreshRateMin, float appRequestRefreshRateMax) { - this.defaultConfig = defaultConfig; + this.defaultMode = defaultMode; this.allowGroupSwitching = allowGroupSwitching; this.primaryRefreshRateMin = primaryRefreshRateMin; this.primaryRefreshRateMax = primaryRefreshRateMax; @@ -1908,14 +1908,14 @@ public final class SurfaceControl implements Parcelable { @Override public boolean equals(@Nullable Object o) { - return o instanceof DesiredDisplayConfigSpecs && equals((DesiredDisplayConfigSpecs) o); + return o instanceof DesiredDisplayModeSpecs && equals((DesiredDisplayModeSpecs) o); } /** * Tests for equality. */ - public boolean equals(DesiredDisplayConfigSpecs other) { - return other != null && defaultConfig == other.defaultConfig + public boolean equals(DesiredDisplayModeSpecs other) { + return other != null && defaultMode == other.defaultMode && primaryRefreshRateMin == other.primaryRefreshRateMin && primaryRefreshRateMax == other.primaryRefreshRateMax && appRequestRefreshRateMin == other.appRequestRefreshRateMin @@ -1930,8 +1930,8 @@ public final class SurfaceControl implements Parcelable { /** * Copies the supplied object's values to this object. */ - public void copyFrom(DesiredDisplayConfigSpecs other) { - defaultConfig = other.defaultConfig; + public void copyFrom(DesiredDisplayModeSpecs other) { + defaultMode = other.defaultMode; primaryRefreshRateMin = other.primaryRefreshRateMin; primaryRefreshRateMax = other.primaryRefreshRateMax; appRequestRefreshRateMin = other.appRequestRefreshRateMin; @@ -1942,7 +1942,7 @@ public final class SurfaceControl implements Parcelable { public String toString() { return String.format("defaultConfig=%d primaryRefreshRateRange=[%.0f %.0f]" + " appRequestRefreshRateRange=[%.0f %.0f]", - defaultConfig, primaryRefreshRateMin, primaryRefreshRateMax, + defaultMode, primaryRefreshRateMin, primaryRefreshRateMax, appRequestRefreshRateMin, appRequestRefreshRateMax); } } @@ -1950,25 +1950,31 @@ public final class SurfaceControl implements Parcelable { /** * @hide */ - public static boolean setDesiredDisplayConfigSpecs(IBinder displayToken, - SurfaceControl.DesiredDisplayConfigSpecs desiredDisplayConfigSpecs) { + public static boolean setDesiredDisplayModeSpecs(IBinder displayToken, + DesiredDisplayModeSpecs desiredDisplayModeSpecs) { if (displayToken == null) { throw new IllegalArgumentException("displayToken must not be null"); } + if (desiredDisplayModeSpecs == null) { + throw new IllegalArgumentException("desiredDisplayModeSpecs must not be null"); + } + if (desiredDisplayModeSpecs.defaultMode < 0) { + throw new IllegalArgumentException("defaultMode must be non-negative"); + } - return nativeSetDesiredDisplayConfigSpecs(displayToken, desiredDisplayConfigSpecs); + return nativeSetDesiredDisplayModeSpecs(displayToken, desiredDisplayModeSpecs); } /** * @hide */ - public static SurfaceControl.DesiredDisplayConfigSpecs getDesiredDisplayConfigSpecs( + public static DesiredDisplayModeSpecs getDesiredDisplayModeSpecs( IBinder displayToken) { if (displayToken == null) { throw new IllegalArgumentException("displayToken must not be null"); } - return nativeGetDesiredDisplayConfigSpecs(displayToken); + return nativeGetDesiredDisplayModeSpecs(displayToken); } /** @@ -2039,7 +2045,7 @@ public final class SurfaceControl implements Parcelable { /** * @hide */ - public static SurfaceControl.DisplayPrimaries getDisplayNativePrimaries( + public static DisplayPrimaries getDisplayNativePrimaries( IBinder displayToken) { if (displayToken == null) { throw new IllegalArgumentException("displayToken must not be null"); @@ -3241,7 +3247,10 @@ public final class SurfaceControl implements Parcelable { * interruptions, such as a black screen for a second or two. True * indicates that any frame rate changes caused by this request * should be seamless. False indicates that non-seamless refresh - * rates are also acceptable. + * rates are also acceptable. Non-seamless switches might be + * used when the benefit of matching the content's frame rate + * outweighs the cost of the transition, for example when + * displaying long-running video content. * @return This transaction object. */ @NonNull |
