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

Commit d5d106ae authored by Sally Qi's avatar Sally Qi Committed by Android (Google) Code Review
Browse files

Merge "Plumb getOverlaySupport() into Display Manager for HWUI."

parents 1a787742 02068d5a
Loading
Loading
Loading
Loading
+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;
    }
}
+7 −0
Original line number Diff line number Diff line
@@ -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;
@@ -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;
@@ -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.
     *
+13 −0
Original line number Diff line number Diff line
@@ -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;
@@ -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
+4 −2
Original line number Diff line number Diff line
@@ -1347,7 +1347,8 @@ public class HardwareRenderer {

            nInitDisplayInfo(largestWidth, largestHeight, defaultDisplay.getRefreshRate(),
                    wideColorDataspace, defaultDisplay.getAppVsyncOffsetNanos(),
                    defaultDisplay.getPresentationDeadlineNanos());
                    defaultDisplay.getPresentationDeadlineNanos(),
                    defaultDisplay.getOverlaySupport().supportFp16ForHdr());

            mDisplayInitialized = true;
        }
@@ -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);

+4 −0
Original line number Diff line number Diff line
@@ -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