Loading include/android/surface_control.h +47 −3 Original line number Diff line number Diff line Loading @@ -528,9 +528,8 @@ void ASurfaceTransaction_setHdrMetadata_cta861_3(ASurfaceTransaction* transactio /** * Sets the desired extended range brightness for the layer. This only applies for layers whose * dataspace has RANGE_EXTENDED set on it. * * Available since API level 34. * dataspace has RANGE_EXTENDED set on it. See: ASurfaceTransaction_setDesiredHdrHeadroom, prefer * using this API for formats that encode an HDR/SDR ratio as part of generating the buffer. * * @param surface_control The layer whose extended range brightness is being specified * @param currentBufferRatio The current hdr/sdr ratio of the current buffer as represented as Loading Loading @@ -564,6 +563,12 @@ void ASurfaceTransaction_setHdrMetadata_cta861_3(ASurfaceTransaction* transactio * determined entirely by the dataspace being used (ie, typically SDR * however PQ or HLG transfer functions will still result in HDR) * * When called after ASurfaceTransaction_setDesiredHdrHeadroom, the * desiredRatio will override the desiredHeadroom provided by * ASurfaceTransaction_setDesiredHdrHeadroom. Conversely, when called before * ASurfaceTransaction_setDesiredHdrHeadroom, the desiredHeadroom provided by *. ASurfaceTransaction_setDesiredHdrHeadroom will override the desiredRatio. * * Must be finite && >= 1.0f * * Available since API level 34. Loading @@ -573,6 +578,45 @@ void ASurfaceTransaction_setExtendedRangeBrightness(ASurfaceTransaction* transac float currentBufferRatio, float desiredRatio) __INTRODUCED_IN(__ANDROID_API_U__); /** * Sets the desired hdr headroom for the layer. See: ASurfaceTransaction_setExtendedRangeBrightness, * prefer using this API for formats that conform to HDR standards like HLG or HDR10, that do not * communicate a HDR/SDR ratio as part of generating the buffer. * * @param surface_control The layer whose desired hdr headroom is being specified * * @param desiredHeadroom The desired hdr/sdr ratio as represented as peakHdrBrightnessInNits / * targetSdrWhitePointInNits. This can be used to communicate the max * desired brightness range of the panel. The system may not be able to, or * may choose not to, deliver the requested range. * * While requesting a large desired ratio will result in the most * dynamic range, voluntarily reducing the requested range can help * improve battery life as well as can improve quality by ensuring * greater bit depth is allocated to the luminance range in use. * * Default value is 0.0f and indicates that the system will choose the best * headroom for this surface control's content. Typically, this means that * HLG/PQ encoded content will be displayed with some HDR headroom greater * than 1.0. * * When called after ASurfaceTransaction_setExtendedRangeBrightness, the * desiredHeadroom will override the desiredRatio provided by * ASurfaceTransaction_setExtendedRangeBrightness. Conversely, when called * before ASurfaceTransaction_setExtendedRangeBrightness, the desiredRatio * provided by ASurfaceTransaction_setExtendedRangeBrightness will override * the desiredHeadroom. * * Must be finite && >= 1.0f or 0.0f to indicate there is no desired * headroom. * * Available since API level 35. */ void ASurfaceTransaction_setDesiredHdrHeadroom(ASurfaceTransaction* transaction, ASurfaceControl* surface_control, float desiredHeadroom) __INTRODUCED_IN(__ANDROID_API_V__); /** * Same as ASurfaceTransaction_setFrameRateWithChangeStrategy(transaction, surface_control, * frameRate, compatibility, ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS). Loading libs/gui/LayerState.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -611,6 +611,10 @@ void layer_state_t::merge(const layer_state_t& other) { desiredHdrSdrRatio = other.desiredHdrSdrRatio; currentHdrSdrRatio = other.currentHdrSdrRatio; } if (other.what & eDesiredHdrHeadroomChanged) { what |= eDesiredHdrHeadroomChanged; desiredHdrSdrRatio = other.desiredHdrSdrRatio; } if (other.what & eCachingHintChanged) { what |= eCachingHintChanged; cachingHint = other.cachingHint; Loading Loading @@ -774,6 +778,7 @@ uint64_t layer_state_t::diff(const layer_state_t& other) const { CHECK_DIFF(diff, eDataspaceChanged, other, dataspace); CHECK_DIFF2(diff, eExtendedRangeBrightnessChanged, other, currentHdrSdrRatio, desiredHdrSdrRatio); CHECK_DIFF(diff, eDesiredHdrHeadroomChanged, other, desiredHdrSdrRatio); CHECK_DIFF(diff, eCachingHintChanged, other, cachingHint); CHECK_DIFF(diff, eHdrMetadataChanged, other, hdrMetadata); if (other.what & eSurfaceDamageRegionChanged && Loading libs/gui/SurfaceComposerClient.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -1808,6 +1808,20 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setExten return *this; } SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setDesiredHdrHeadroom( const sp<SurfaceControl>& 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<SurfaceControl>& sc, gui::CachingHint cachingHint) { layer_state_t* s = getLayerState(sc); Loading libs/gui/include/gui/LayerState.h +3 −2 Original line number Diff line number Diff line Loading @@ -209,7 +209,7 @@ struct layer_state_t { eBackgroundBlurRadiusChanged = 0x80'00000000, eProducerDisconnect = 0x100'00000000, eFixedTransformHintChanged = 0x200'00000000, /* unused 0x400'00000000, */ eDesiredHdrHeadroomChanged = 0x400'00000000, eBlurRegionsChanged = 0x800'00000000, eAutoRefreshChanged = 0x1000'00000000, eStretchChanged = 0x2000'00000000, Loading Loading @@ -248,7 +248,8 @@ struct layer_state_t { layer_state_t::eSidebandStreamChanged | layer_state_t::eSurfaceDamageRegionChanged | layer_state_t::eTransformToDisplayInverseChanged | layer_state_t::eTransparentRegionChanged | layer_state_t::eExtendedRangeBrightnessChanged; layer_state_t::eExtendedRangeBrightnessChanged | layer_state_t::eDesiredHdrHeadroomChanged; // Content updates. static constexpr uint64_t CONTENT_CHANGES = layer_state_t::BUFFER_CHANGES | Loading libs/gui/include/gui/SurfaceComposerClient.h +1 −0 Original line number Diff line number Diff line Loading @@ -594,6 +594,7 @@ public: Transaction& setDataspace(const sp<SurfaceControl>& sc, ui::Dataspace dataspace); Transaction& setExtendedRangeBrightness(const sp<SurfaceControl>& sc, float currentBufferRatio, float desiredRatio); Transaction& setDesiredHdrHeadroom(const sp<SurfaceControl>& sc, float desiredRatio); Transaction& setCachingHint(const sp<SurfaceControl>& sc, gui::CachingHint cachingHint); Transaction& setHdrMetadata(const sp<SurfaceControl>& sc, const HdrMetadata& hdrMetadata); Transaction& setSurfaceDamageRegion(const sp<SurfaceControl>& sc, Loading Loading
include/android/surface_control.h +47 −3 Original line number Diff line number Diff line Loading @@ -528,9 +528,8 @@ void ASurfaceTransaction_setHdrMetadata_cta861_3(ASurfaceTransaction* transactio /** * Sets the desired extended range brightness for the layer. This only applies for layers whose * dataspace has RANGE_EXTENDED set on it. * * Available since API level 34. * dataspace has RANGE_EXTENDED set on it. See: ASurfaceTransaction_setDesiredHdrHeadroom, prefer * using this API for formats that encode an HDR/SDR ratio as part of generating the buffer. * * @param surface_control The layer whose extended range brightness is being specified * @param currentBufferRatio The current hdr/sdr ratio of the current buffer as represented as Loading Loading @@ -564,6 +563,12 @@ void ASurfaceTransaction_setHdrMetadata_cta861_3(ASurfaceTransaction* transactio * determined entirely by the dataspace being used (ie, typically SDR * however PQ or HLG transfer functions will still result in HDR) * * When called after ASurfaceTransaction_setDesiredHdrHeadroom, the * desiredRatio will override the desiredHeadroom provided by * ASurfaceTransaction_setDesiredHdrHeadroom. Conversely, when called before * ASurfaceTransaction_setDesiredHdrHeadroom, the desiredHeadroom provided by *. ASurfaceTransaction_setDesiredHdrHeadroom will override the desiredRatio. * * Must be finite && >= 1.0f * * Available since API level 34. Loading @@ -573,6 +578,45 @@ void ASurfaceTransaction_setExtendedRangeBrightness(ASurfaceTransaction* transac float currentBufferRatio, float desiredRatio) __INTRODUCED_IN(__ANDROID_API_U__); /** * Sets the desired hdr headroom for the layer. See: ASurfaceTransaction_setExtendedRangeBrightness, * prefer using this API for formats that conform to HDR standards like HLG or HDR10, that do not * communicate a HDR/SDR ratio as part of generating the buffer. * * @param surface_control The layer whose desired hdr headroom is being specified * * @param desiredHeadroom The desired hdr/sdr ratio as represented as peakHdrBrightnessInNits / * targetSdrWhitePointInNits. This can be used to communicate the max * desired brightness range of the panel. The system may not be able to, or * may choose not to, deliver the requested range. * * While requesting a large desired ratio will result in the most * dynamic range, voluntarily reducing the requested range can help * improve battery life as well as can improve quality by ensuring * greater bit depth is allocated to the luminance range in use. * * Default value is 0.0f and indicates that the system will choose the best * headroom for this surface control's content. Typically, this means that * HLG/PQ encoded content will be displayed with some HDR headroom greater * than 1.0. * * When called after ASurfaceTransaction_setExtendedRangeBrightness, the * desiredHeadroom will override the desiredRatio provided by * ASurfaceTransaction_setExtendedRangeBrightness. Conversely, when called * before ASurfaceTransaction_setExtendedRangeBrightness, the desiredRatio * provided by ASurfaceTransaction_setExtendedRangeBrightness will override * the desiredHeadroom. * * Must be finite && >= 1.0f or 0.0f to indicate there is no desired * headroom. * * Available since API level 35. */ void ASurfaceTransaction_setDesiredHdrHeadroom(ASurfaceTransaction* transaction, ASurfaceControl* surface_control, float desiredHeadroom) __INTRODUCED_IN(__ANDROID_API_V__); /** * Same as ASurfaceTransaction_setFrameRateWithChangeStrategy(transaction, surface_control, * frameRate, compatibility, ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS). Loading
libs/gui/LayerState.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -611,6 +611,10 @@ void layer_state_t::merge(const layer_state_t& other) { desiredHdrSdrRatio = other.desiredHdrSdrRatio; currentHdrSdrRatio = other.currentHdrSdrRatio; } if (other.what & eDesiredHdrHeadroomChanged) { what |= eDesiredHdrHeadroomChanged; desiredHdrSdrRatio = other.desiredHdrSdrRatio; } if (other.what & eCachingHintChanged) { what |= eCachingHintChanged; cachingHint = other.cachingHint; Loading Loading @@ -774,6 +778,7 @@ uint64_t layer_state_t::diff(const layer_state_t& other) const { CHECK_DIFF(diff, eDataspaceChanged, other, dataspace); CHECK_DIFF2(diff, eExtendedRangeBrightnessChanged, other, currentHdrSdrRatio, desiredHdrSdrRatio); CHECK_DIFF(diff, eDesiredHdrHeadroomChanged, other, desiredHdrSdrRatio); CHECK_DIFF(diff, eCachingHintChanged, other, cachingHint); CHECK_DIFF(diff, eHdrMetadataChanged, other, hdrMetadata); if (other.what & eSurfaceDamageRegionChanged && Loading
libs/gui/SurfaceComposerClient.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -1808,6 +1808,20 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setExten return *this; } SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setDesiredHdrHeadroom( const sp<SurfaceControl>& 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<SurfaceControl>& sc, gui::CachingHint cachingHint) { layer_state_t* s = getLayerState(sc); Loading
libs/gui/include/gui/LayerState.h +3 −2 Original line number Diff line number Diff line Loading @@ -209,7 +209,7 @@ struct layer_state_t { eBackgroundBlurRadiusChanged = 0x80'00000000, eProducerDisconnect = 0x100'00000000, eFixedTransformHintChanged = 0x200'00000000, /* unused 0x400'00000000, */ eDesiredHdrHeadroomChanged = 0x400'00000000, eBlurRegionsChanged = 0x800'00000000, eAutoRefreshChanged = 0x1000'00000000, eStretchChanged = 0x2000'00000000, Loading Loading @@ -248,7 +248,8 @@ struct layer_state_t { layer_state_t::eSidebandStreamChanged | layer_state_t::eSurfaceDamageRegionChanged | layer_state_t::eTransformToDisplayInverseChanged | layer_state_t::eTransparentRegionChanged | layer_state_t::eExtendedRangeBrightnessChanged; layer_state_t::eExtendedRangeBrightnessChanged | layer_state_t::eDesiredHdrHeadroomChanged; // Content updates. static constexpr uint64_t CONTENT_CHANGES = layer_state_t::BUFFER_CHANGES | Loading
libs/gui/include/gui/SurfaceComposerClient.h +1 −0 Original line number Diff line number Diff line Loading @@ -594,6 +594,7 @@ public: Transaction& setDataspace(const sp<SurfaceControl>& sc, ui::Dataspace dataspace); Transaction& setExtendedRangeBrightness(const sp<SurfaceControl>& sc, float currentBufferRatio, float desiredRatio); Transaction& setDesiredHdrHeadroom(const sp<SurfaceControl>& sc, float desiredRatio); Transaction& setCachingHint(const sp<SurfaceControl>& sc, gui::CachingHint cachingHint); Transaction& setHdrMetadata(const sp<SurfaceControl>& sc, const HdrMetadata& hdrMetadata); Transaction& setSurfaceDamageRegion(const sp<SurfaceControl>& sc, Loading