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

Commit 52b4710c authored by Alec Mouri's avatar Alec Mouri Committed by Automerger Merge Worker
Browse files

Merge "Pass the max desired hdr/sdr ratio to DisplayManager" into udc-dev am:...

Merge "Pass the max desired hdr/sdr ratio to DisplayManager" into udc-dev am: 3325f3e2 am: 422af68e

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/21480554



Change-Id: Ia583190377e9992c4b1cf4feb5135f03f5a8976c
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 460c7f93 422af68e
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -19,7 +19,9 @@ package android.gui;
/** @hide */
oneway interface IHdrLayerInfoListener {
    // Callback with the total number of HDR layers, the dimensions of the largest layer,
    // and a placeholder flags
    // a placeholder flags, and the max desired HDR/SDR ratio. The max desired HDR/SDR
    // ratio may be positive infinity to indicate an unbounded ratio.
    // TODO (b/182312559): Define the flags (likely need an indicator that a UDFPS layer is present)
    void onHdrLayerInfoChanged(int numberOfHdrLayers, int maxW, int maxH, int flags);
    void onHdrLayerInfoChanged(int numberOfHdrLayers, int maxW, int maxH,
            int flags, float maxDesiredHdrSdrRatio);
}
 No newline at end of file
+2 −1
Original line number Diff line number Diff line
@@ -40,7 +40,8 @@ void HdrLayerInfoReporter::dispatchHdrLayerInfo(const HdrLayerInfo& info) {

    for (const auto& listener : toInvoke) {
        ATRACE_NAME("invoking onHdrLayerInfoChanged");
        listener->onHdrLayerInfoChanged(info.numberOfHdrLayers, info.maxW, info.maxH, info.flags);
        listener->onHdrLayerInfoChanged(info.numberOfHdrLayers, info.maxW, info.maxH, info.flags,
                                        info.maxDesiredHdrSdrRatio);
    }
}

+4 −13
Original line number Diff line number Diff line
@@ -43,27 +43,18 @@ public:
        // With peak display brightnesses exceeding 1,000 nits currently, HLG's request could
        // actually be satisfied in some ambient conditions such that limiting that max for that
        // content in theory makes sense
        float maxDesiredSdrHdrRatio = 0.f;
        float maxDesiredHdrSdrRatio = 0.f;

        bool operator==(const HdrLayerInfo& other) const {
            return numberOfHdrLayers == other.numberOfHdrLayers && maxW == other.maxW &&
                    maxH == other.maxH && flags == other.flags;
                    maxH == other.maxH && flags == other.flags &&
                    maxDesiredHdrSdrRatio == other.maxDesiredHdrSdrRatio;
        }

        bool operator!=(const HdrLayerInfo& other) const { return !(*this == other); }

        void mergeDesiredRatio(float update) {
            if (maxDesiredSdrHdrRatio == 0.f) {
                // If nothing is set, take the incoming value
                maxDesiredSdrHdrRatio = update;
            } else if (update == 1.f) {
                // If the request is to "go to max", then take it regardless
                maxDesiredSdrHdrRatio = 1.f;
            } else if (maxDesiredSdrHdrRatio != 1.f) {
                // If we're not currently asked to "go to max", then take the max
                // of the incoming requests
                maxDesiredSdrHdrRatio = std::max(maxDesiredSdrHdrRatio, update);
            }
            maxDesiredHdrSdrRatio = std::max(maxDesiredHdrSdrRatio, update);
        }
    };

+6 −1
Original line number Diff line number Diff line
@@ -2890,7 +2890,12 @@ void SurfaceFlinger::postComposition(nsecs_t callTime) {
                        const auto* outputLayer =
                            compositionDisplay->getOutputLayerForLayer(layerFe);
                        if (outputLayer) {
                            info.mergeDesiredRatio(snapshot.desiredSdrHdrRatio);
                            // TODO(b/267350616): Rename SdrHdrRatio -> HdrSdrRatio
                            // everywhere
                            const float desiredHdrSdrRatio = snapshot.desiredSdrHdrRatio <= 1.f
                                    ? std::numeric_limits<float>::infinity()
                                    : snapshot.desiredSdrHdrRatio;
                            info.mergeDesiredRatio(desiredHdrSdrRatio);
                            info.numberOfHdrLayers++;
                            const auto displayFrame = outputLayer->getState().displayFrame;
                            const int32_t area = displayFrame.width() * displayFrame.height();