Pass the max desired hdr/sdr ratio to DisplayManager
SurfaceFlinger already computes this, but DisplayManager needs to use
this for apps that don't want as large of a ratio than the system
supports.
Bug: 267350616
Test: SilkFX test app
Change-Id: I03b6b458e220a9fdc30eb137a7455101d5a8f51a
diff --git a/services/surfaceflinger/HdrLayerInfoReporter.h b/services/surfaceflinger/HdrLayerInfoReporter.h
index 9b70c16..bf7c775 100644
--- a/services/surfaceflinger/HdrLayerInfoReporter.h
+++ b/services/surfaceflinger/HdrLayerInfoReporter.h
@@ -43,27 +43,18 @@
// 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);
}
};