Loading libs/gui/aidl/android/gui/IHdrLayerInfoListener.aidl +4 −2 Original line number Diff line number Diff line Loading @@ -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 services/surfaceflinger/HdrLayerInfoReporter.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -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); } } Loading services/surfaceflinger/HdrLayerInfoReporter.h +4 −13 Original line number Diff line number Diff line Loading @@ -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); } }; Loading services/surfaceflinger/SurfaceFlinger.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -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(); Loading Loading
libs/gui/aidl/android/gui/IHdrLayerInfoListener.aidl +4 −2 Original line number Diff line number Diff line Loading @@ -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
services/surfaceflinger/HdrLayerInfoReporter.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -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); } } Loading
services/surfaceflinger/HdrLayerInfoReporter.h +4 −13 Original line number Diff line number Diff line Loading @@ -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); } }; Loading
services/surfaceflinger/SurfaceFlinger.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -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(); Loading