Add extended range brightness APIs
SurfaceControl & Display APIs to enable arbitrary RANGE_EXTENDED HDR handling Bug: 241001465 Test: make && silkfx demo Change-Id: I1002910bc020f7177e82b3d77559103c1c2732cc
This commit is contained in:
@@ -49805,6 +49805,7 @@ package android.view {
|
||||
method public int getDisplayId();
|
||||
method public int getFlags();
|
||||
method public android.view.Display.HdrCapabilities getHdrCapabilities();
|
||||
method public float getHdrSdrRatio();
|
||||
method @Deprecated public int getHeight();
|
||||
method @Deprecated public void getMetrics(android.util.DisplayMetrics);
|
||||
method public android.view.Display.Mode getMode();
|
||||
@@ -49826,9 +49827,12 @@ package android.view {
|
||||
method @Deprecated public float[] getSupportedRefreshRates();
|
||||
method @Deprecated public int getWidth();
|
||||
method public boolean isHdr();
|
||||
method public boolean isHdrSdrRatioAvailable();
|
||||
method public boolean isMinimalPostProcessingSupported();
|
||||
method public boolean isValid();
|
||||
method public boolean isWideColorGamut();
|
||||
method public void registerHdrSdrRatioChangedListener(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<android.view.Display>);
|
||||
method public void unregisterHdrSdrRatioChangedListener(@NonNull java.util.function.Consumer<android.view.Display>);
|
||||
field public static final int DEFAULT_DISPLAY = 0; // 0x0
|
||||
field public static final int FLAG_PRESENTATION = 8; // 0x8
|
||||
field public static final int FLAG_PRIVATE = 4; // 0x4
|
||||
@@ -51357,6 +51361,7 @@ package android.view {
|
||||
method @NonNull public android.view.SurfaceControl.Transaction setCrop(@NonNull android.view.SurfaceControl, @Nullable android.graphics.Rect);
|
||||
method @NonNull public android.view.SurfaceControl.Transaction setDamageRegion(@NonNull android.view.SurfaceControl, @Nullable android.graphics.Region);
|
||||
method @NonNull public android.view.SurfaceControl.Transaction setDataSpace(@NonNull android.view.SurfaceControl, int);
|
||||
method @NonNull public android.view.SurfaceControl.Transaction setExtendedRangeBrightness(@NonNull android.view.SurfaceControl, float, float);
|
||||
method @NonNull public android.view.SurfaceControl.Transaction setFrameRate(@NonNull android.view.SurfaceControl, @FloatRange(from=0.0) float, int);
|
||||
method @NonNull public android.view.SurfaceControl.Transaction setFrameRate(@NonNull android.view.SurfaceControl, @FloatRange(from=0.0) float, int, int);
|
||||
method @Deprecated @NonNull public android.view.SurfaceControl.Transaction setGeometry(@NonNull android.view.SurfaceControl, @Nullable android.graphics.Rect, @Nullable android.graphics.Rect, int);
|
||||
|
||||
@@ -1298,8 +1298,6 @@ public final class Display {
|
||||
/**
|
||||
* @return Whether the display supports reporting an hdr/sdr ratio. If this is false,
|
||||
* {@link #getHdrSdrRatio()} will always be 1.0f
|
||||
* @hide
|
||||
* TODO: make public
|
||||
*/
|
||||
public boolean isHdrSdrRatioAvailable() {
|
||||
synchronized (mLock) {
|
||||
@@ -1312,9 +1310,6 @@ public final class Display {
|
||||
* @return The current hdr/sdr ratio expressed as the ratio of targetHdrPeakBrightnessInNits /
|
||||
* targetSdrWhitePointInNits. If {@link #isHdrSdrRatioAvailable()} is false, this
|
||||
* always returns 1.0f.
|
||||
*
|
||||
* @hide
|
||||
* TODO: make public
|
||||
*/
|
||||
public float getHdrSdrRatio() {
|
||||
synchronized (mLock) {
|
||||
@@ -1344,8 +1339,6 @@ public final class Display {
|
||||
* @param executor The executor to invoke the listener on
|
||||
* @param listener The listener to invoke when the HDR/SDR ratio changes
|
||||
* @throws IllegalStateException if {@link #isHdrSdrRatioAvailable()} is false
|
||||
* @hide
|
||||
* TODO: Make public
|
||||
*/
|
||||
public void registerHdrSdrRatioChangedListener(@NonNull Executor executor,
|
||||
@NonNull Consumer<Display> listener) {
|
||||
@@ -1375,10 +1368,8 @@ public final class Display {
|
||||
* hdr/sdr ratio listener to remove.
|
||||
*
|
||||
* @see #registerHdrSdrRatioChangedListener(Executor, Consumer)
|
||||
* @hide
|
||||
* TODO: Make public
|
||||
*/
|
||||
public void unregisterHdrSdrRatioChangedListener(Consumer<Display> listener) {
|
||||
public void unregisterHdrSdrRatioChangedListener(@NonNull Consumer<Display> listener) {
|
||||
HdrSdrRatioListenerWrapper toRemove = null;
|
||||
synchronized (mLock) {
|
||||
int index = findHdrSdrRatioListenerLocked(listener);
|
||||
|
||||
@@ -3789,7 +3789,7 @@ public final class SurfaceControl implements Parcelable {
|
||||
* whose dataspace has RANGE_EXTENDED.
|
||||
*
|
||||
* @param sc The layer whose extended range brightness is being specified
|
||||
* @param currentBufferRatio The current sdr/hdr ratio of the current buffer. For example
|
||||
* @param currentBufferRatio The current hdr/sdr ratio of the current buffer. For example
|
||||
* if the buffer was rendered with a target SDR whitepoint of
|
||||
* 100 nits and a max display brightness of 200 nits, this should
|
||||
* be set to 2.0f.
|
||||
@@ -3801,7 +3801,9 @@ public final class SurfaceControl implements Parcelable {
|
||||
* communicate extended content brightness information via
|
||||
* metadata such as CTA861_3 or SMPTE2086.
|
||||
*
|
||||
* @param desiredRatio The desired sdr/hdr ratio. This can be used to communicate the max
|
||||
* Must be finite && >= 1.0f
|
||||
*
|
||||
* @param desiredRatio The desired hdr/sdr ratio. This can be used to communicate the max
|
||||
* desired brightness range. This is similar to the "max luminance"
|
||||
* value in other HDR metadata formats, but represented as a ratio of
|
||||
* the target SDR whitepoint to the max display brightness. The system
|
||||
@@ -3813,12 +3815,19 @@ public final class SurfaceControl implements Parcelable {
|
||||
* voluntarily reducing the requested range can help improve battery
|
||||
* life as well as can improve quality by ensuring greater bit depth
|
||||
* is allocated to the luminance range in use.
|
||||
*
|
||||
* Must be finite && >= 1.0f
|
||||
* @return this
|
||||
* @hide
|
||||
**/
|
||||
public @NonNull Transaction setExtendedRangeBrightness(@NonNull SurfaceControl sc,
|
||||
float currentBufferRatio, float desiredRatio) {
|
||||
checkPreconditions(sc);
|
||||
if (!Float.isFinite(currentBufferRatio) || currentBufferRatio < 1.0f) {
|
||||
throw new IllegalArgumentException("currentBufferRatio must be finite && >= 1.0f");
|
||||
}
|
||||
if (!Float.isFinite(desiredRatio) || desiredRatio < 1.0f) {
|
||||
throw new IllegalArgumentException("desiredRatio must be finite && >= 1.0f");
|
||||
}
|
||||
nativeSetExtendedRangeBrightness(mNativeObject, sc.mNativeObject, currentBufferRatio,
|
||||
desiredRatio);
|
||||
return this;
|
||||
|
||||
@@ -275,6 +275,7 @@ LIBANDROID {
|
||||
ASurfaceTransaction_setGeometry; # introduced=29
|
||||
ASurfaceTransaction_setHdrMetadata_cta861_3; # introduced=29
|
||||
ASurfaceTransaction_setHdrMetadata_smpte2086; # introduced=29
|
||||
ASurfaceTransaction_setExtendedRangeBrightness; # introduced=UpsideDownCake
|
||||
ASurfaceTransaction_setOnComplete; # introduced=29
|
||||
ASurfaceTransaction_setOnCommit; # introduced=31
|
||||
ASurfaceTransaction_setPosition; # introduced=31
|
||||
|
||||
@@ -609,6 +609,30 @@ void ASurfaceTransaction_setHdrMetadata_cta861_3(ASurfaceTransaction* aSurfaceTr
|
||||
transaction->setHdrMetadata(surfaceControl, hdrMetadata);
|
||||
}
|
||||
|
||||
void ASurfaceTransaction_setExtendedRangeBrightness(ASurfaceTransaction* aSurfaceTransaction,
|
||||
ASurfaceControl* aSurfaceControl,
|
||||
float currentBufferRatio, float desiredRatio) {
|
||||
CHECK_NOT_NULL(aSurfaceTransaction);
|
||||
CHECK_NOT_NULL(aSurfaceControl);
|
||||
|
||||
if (!isfinite(currentBufferRatio) || currentBufferRatio < 1.0f) {
|
||||
ALOGE("Ignore setExtendedRangeBrightness, currentBufferRatio %f isn't finite or >= 1.0f",
|
||||
currentBufferRatio);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isfinite(desiredRatio) || desiredRatio < 1.0f) {
|
||||
ALOGE("Ignore setExtendedRangeBrightness, desiredRatio %f isn't finite or >= 1.0f",
|
||||
desiredRatio);
|
||||
return;
|
||||
}
|
||||
|
||||
sp<SurfaceControl> surfaceControl = ASurfaceControl_to_SurfaceControl(aSurfaceControl);
|
||||
Transaction* transaction = ASurfaceTransaction_to_Transaction(aSurfaceTransaction);
|
||||
|
||||
transaction->setExtendedRangeBrightness(surfaceControl, currentBufferRatio, desiredRatio);
|
||||
}
|
||||
|
||||
void ASurfaceTransaction_setColor(ASurfaceTransaction* aSurfaceTransaction,
|
||||
ASurfaceControl* aSurfaceControl,
|
||||
float r, float g, float b, float alpha,
|
||||
|
||||
Reference in New Issue
Block a user