From 1b0d4e16530a4feb99eafbfdfce2aeb39c5e23e3 Mon Sep 17 00:00:00 2001 From: Alec Mouri Date: Mon, 12 Feb 2024 22:27:19 +0000 Subject: Add support for restricting HDR headroom for video This is needed for allowing apps to vote for HDR headroom restrictions for SurfaceView and SurfaceControl Bug: 323964760 Test: manually poking at test app Test: SurfaceViewTests Test: SurfaceControlTest Test: ASurfaceControlTest Change-Id: Ie886e67879525462d49fdedc535aea659d69321a --- libs/gui/SurfaceComposerClient.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'libs/gui/SurfaceComposerClient.cpp') diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index 8d18551b69..3a02c644bf 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -1807,6 +1807,20 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setExten return *this; } +SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setDesiredHdrHeadroom( + const sp& sc, float desiredRatio) { + layer_state_t* s = getLayerState(sc); + if (!s) { + mStatus = BAD_INDEX; + return *this; + } + s->what |= layer_state_t::eDesiredHdrHeadroomChanged; + s->desiredHdrSdrRatio = desiredRatio; + + registerSurfaceControlForCallback(sc); + return *this; +} + SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setCachingHint( const sp& sc, gui::CachingHint cachingHint) { layer_state_t* s = getLayerState(sc); -- cgit v1.2.3-59-g8ed1b