Loading core/java/android/hardware/OverlayProperties.java 0 → 100644 +47 −0 Original line number Diff line number Diff line /** * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.hardware; import java.util.List; /** * // TODO(b/242588489): Continue work, the class needs a jni-specific constructor and DisplayInfo * // side constructs the object. * * @hide */ public final class OverlayProperties { private final SupportedBufferCombinations[] mCombinations = null; private final boolean mSupportFp16ForHdr = false; static class SupportedBufferCombinations { @HardwareBuffer.Format List<Integer> mHardwareBufferFormats; @DataSpace.NamedDataSpace List<Integer> mDataSpaces; SupportedBufferCombinations(@HardwareBuffer.Format List<Integer> hardwareBufferFormats, @DataSpace.NamedDataSpace List<Integer> dataSpaces) { mHardwareBufferFormats = hardwareBufferFormats; mDataSpaces = dataSpaces; } } /*** * @return if the device can support fp16. */ public boolean supportFp16ForHdr() { return mSupportFp16ForHdr; } } core/java/android/hardware/display/DisplayManagerGlobal.java +7 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.content.pm.ParceledListSlice; import android.content.res.Resources; import android.graphics.ColorSpace; import android.graphics.Point; import android.hardware.OverlayProperties; import android.hardware.display.DisplayManager.DisplayListener; import android.hardware.graphics.common.DisplayDecorationSupport; import android.media.projection.IMediaProjection; Loading Loading @@ -112,6 +113,7 @@ public final class DisplayManagerGlobal { private final SparseArray<DisplayInfo> mDisplayInfoCache = new SparseArray<>(); private final ColorSpace mWideColorSpace; private final OverlayProperties mOverlayProperties = new OverlayProperties(); private int[] mDisplayIdCache; private int mWifiDisplayScanNestCount; Loading Loading @@ -726,6 +728,11 @@ public final class DisplayManagerGlobal { return mWideColorSpace; } /** @hide */ public OverlayProperties getOverlaySupport() { return mOverlayProperties; } /** * Sets the global brightness configuration for a given user. * Loading core/java/android/view/Display.java +13 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.graphics.ColorSpace; import android.graphics.PixelFormat; import android.graphics.Point; import android.graphics.Rect; import android.hardware.OverlayProperties; import android.hardware.display.BrightnessInfo; import android.hardware.display.DeviceProductInfo; import android.hardware.display.DisplayManager; Loading Loading @@ -1290,6 +1291,18 @@ public final class Display { } } /** @hide */ @Nullable public OverlayProperties getOverlaySupport() { synchronized (mLock) { updateDisplayInfoLocked(); if (mDisplayInfo.type != TYPE_VIRTUAL) { return mGlobal.getOverlaySupport(); } return new OverlayProperties(); } } /** * Gets the supported color modes of this device. * @hide Loading graphics/java/android/graphics/HardwareRenderer.java +4 −2 Original line number Diff line number Diff line Loading @@ -1347,7 +1347,8 @@ public class HardwareRenderer { nInitDisplayInfo(largestWidth, largestHeight, defaultDisplay.getRefreshRate(), wideColorDataspace, defaultDisplay.getAppVsyncOffsetNanos(), defaultDisplay.getPresentationDeadlineNanos()); defaultDisplay.getPresentationDeadlineNanos(), defaultDisplay.getOverlaySupport().supportFp16ForHdr()); mDisplayInitialized = true; } Loading Loading @@ -1527,7 +1528,8 @@ public class HardwareRenderer { private static native void nSetDisplayDensityDpi(int densityDpi); private static native void nInitDisplayInfo(int width, int height, float refreshRate, int wideColorDataspace, long appVsyncOffsetNanos, long presentationDeadlineNanos); int wideColorDataspace, long appVsyncOffsetNanos, long presentationDeadlineNanos, boolean supportsFp16ForHdr); private static native void nSetDrawingEnabled(boolean drawingEnabled); Loading libs/hwui/DeviceInfo.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -104,6 +104,10 @@ void DeviceInfo::setWideColorDataspace(ADataSpace dataspace) { } } void DeviceInfo::setSupportFp16ForHdr(bool supportFp16ForHdr) { get()->mSupportFp16ForHdr = supportFp16ForHdr; } void DeviceInfo::onRefreshRateChanged(int64_t vsyncPeriod) { mVsyncPeriod = vsyncPeriod; } Loading Loading
core/java/android/hardware/OverlayProperties.java 0 → 100644 +47 −0 Original line number Diff line number Diff line /** * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.hardware; import java.util.List; /** * // TODO(b/242588489): Continue work, the class needs a jni-specific constructor and DisplayInfo * // side constructs the object. * * @hide */ public final class OverlayProperties { private final SupportedBufferCombinations[] mCombinations = null; private final boolean mSupportFp16ForHdr = false; static class SupportedBufferCombinations { @HardwareBuffer.Format List<Integer> mHardwareBufferFormats; @DataSpace.NamedDataSpace List<Integer> mDataSpaces; SupportedBufferCombinations(@HardwareBuffer.Format List<Integer> hardwareBufferFormats, @DataSpace.NamedDataSpace List<Integer> dataSpaces) { mHardwareBufferFormats = hardwareBufferFormats; mDataSpaces = dataSpaces; } } /*** * @return if the device can support fp16. */ public boolean supportFp16ForHdr() { return mSupportFp16ForHdr; } }
core/java/android/hardware/display/DisplayManagerGlobal.java +7 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.content.pm.ParceledListSlice; import android.content.res.Resources; import android.graphics.ColorSpace; import android.graphics.Point; import android.hardware.OverlayProperties; import android.hardware.display.DisplayManager.DisplayListener; import android.hardware.graphics.common.DisplayDecorationSupport; import android.media.projection.IMediaProjection; Loading Loading @@ -112,6 +113,7 @@ public final class DisplayManagerGlobal { private final SparseArray<DisplayInfo> mDisplayInfoCache = new SparseArray<>(); private final ColorSpace mWideColorSpace; private final OverlayProperties mOverlayProperties = new OverlayProperties(); private int[] mDisplayIdCache; private int mWifiDisplayScanNestCount; Loading Loading @@ -726,6 +728,11 @@ public final class DisplayManagerGlobal { return mWideColorSpace; } /** @hide */ public OverlayProperties getOverlaySupport() { return mOverlayProperties; } /** * Sets the global brightness configuration for a given user. * Loading
core/java/android/view/Display.java +13 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.graphics.ColorSpace; import android.graphics.PixelFormat; import android.graphics.Point; import android.graphics.Rect; import android.hardware.OverlayProperties; import android.hardware.display.BrightnessInfo; import android.hardware.display.DeviceProductInfo; import android.hardware.display.DisplayManager; Loading Loading @@ -1290,6 +1291,18 @@ public final class Display { } } /** @hide */ @Nullable public OverlayProperties getOverlaySupport() { synchronized (mLock) { updateDisplayInfoLocked(); if (mDisplayInfo.type != TYPE_VIRTUAL) { return mGlobal.getOverlaySupport(); } return new OverlayProperties(); } } /** * Gets the supported color modes of this device. * @hide Loading
graphics/java/android/graphics/HardwareRenderer.java +4 −2 Original line number Diff line number Diff line Loading @@ -1347,7 +1347,8 @@ public class HardwareRenderer { nInitDisplayInfo(largestWidth, largestHeight, defaultDisplay.getRefreshRate(), wideColorDataspace, defaultDisplay.getAppVsyncOffsetNanos(), defaultDisplay.getPresentationDeadlineNanos()); defaultDisplay.getPresentationDeadlineNanos(), defaultDisplay.getOverlaySupport().supportFp16ForHdr()); mDisplayInitialized = true; } Loading Loading @@ -1527,7 +1528,8 @@ public class HardwareRenderer { private static native void nSetDisplayDensityDpi(int densityDpi); private static native void nInitDisplayInfo(int width, int height, float refreshRate, int wideColorDataspace, long appVsyncOffsetNanos, long presentationDeadlineNanos); int wideColorDataspace, long appVsyncOffsetNanos, long presentationDeadlineNanos, boolean supportsFp16ForHdr); private static native void nSetDrawingEnabled(boolean drawingEnabled); Loading
libs/hwui/DeviceInfo.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -104,6 +104,10 @@ void DeviceInfo::setWideColorDataspace(ADataSpace dataspace) { } } void DeviceInfo::setSupportFp16ForHdr(bool supportFp16ForHdr) { get()->mSupportFp16ForHdr = supportFp16ForHdr; } void DeviceInfo::onRefreshRateChanged(int64_t vsyncPeriod) { mVsyncPeriod = vsyncPeriod; } Loading