diff options
author | 2023-03-23 14:06:21 -0700 | |
---|---|---|
committer | 2023-03-23 21:40:40 -0700 | |
commit | 963049b5ff733bc35933d5c565a35f2f7af09f88 (patch) | |
tree | cd6abde355a730bacb77bc881a6f334d1d25a28d | |
parent | bb9ff7f5b943214c6946af113c9d55b28ccb15ce (diff) |
Rename Sdr/Hdr to Hdr/Sdr internally to get avoid of confusion.
Bug: 267350616
Test: builds
Change-Id: I75bb485f01ae2358c77133767f01cb63f8eda6f1
13 files changed, 45 insertions, 47 deletions
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp index b391337d1d..196949682d 100644 --- a/libs/gui/LayerState.cpp +++ b/libs/gui/LayerState.cpp @@ -190,8 +190,8 @@ status_t layer_state_t::write(Parcel& output) const } SAFE_PARCEL(output.writeParcelable, trustedPresentationThresholds); SAFE_PARCEL(output.writeParcelable, trustedPresentationListener); - SAFE_PARCEL(output.writeFloat, currentSdrHdrRatio); - SAFE_PARCEL(output.writeFloat, desiredSdrHdrRatio); + SAFE_PARCEL(output.writeFloat, currentHdrSdrRatio); + SAFE_PARCEL(output.writeFloat, desiredHdrSdrRatio); SAFE_PARCEL(output.writeInt32, static_cast<int32_t>(cachingHint)) return NO_ERROR; } @@ -335,9 +335,9 @@ status_t layer_state_t::read(const Parcel& input) SAFE_PARCEL(input.readParcelable, &trustedPresentationListener); SAFE_PARCEL(input.readFloat, &tmpFloat); - currentSdrHdrRatio = tmpFloat; + currentHdrSdrRatio = tmpFloat; SAFE_PARCEL(input.readFloat, &tmpFloat); - desiredSdrHdrRatio = tmpFloat; + desiredHdrSdrRatio = tmpFloat; int32_t tmpInt32; SAFE_PARCEL(input.readInt32, &tmpInt32); @@ -592,8 +592,8 @@ void layer_state_t::merge(const layer_state_t& other) { } if (other.what & eExtendedRangeBrightnessChanged) { what |= eExtendedRangeBrightnessChanged; - desiredSdrHdrRatio = other.desiredSdrHdrRatio; - currentSdrHdrRatio = other.currentSdrHdrRatio; + desiredHdrSdrRatio = other.desiredHdrSdrRatio; + currentHdrSdrRatio = other.currentHdrSdrRatio; } if (other.what & eCachingHintChanged) { what |= eCachingHintChanged; @@ -747,8 +747,8 @@ uint64_t layer_state_t::diff(const layer_state_t& other) const { CHECK_DIFF(diff, eCropChanged, other, crop); if (other.what & eBufferChanged) diff |= eBufferChanged; CHECK_DIFF(diff, eDataspaceChanged, other, dataspace); - CHECK_DIFF2(diff, eExtendedRangeBrightnessChanged, other, currentSdrHdrRatio, - desiredSdrHdrRatio); + CHECK_DIFF2(diff, eExtendedRangeBrightnessChanged, other, currentHdrSdrRatio, + desiredHdrSdrRatio); CHECK_DIFF(diff, eCachingHintChanged, other, cachingHint); CHECK_DIFF(diff, eHdrMetadataChanged, other, hdrMetadata); if (other.what & eSurfaceDamageRegionChanged && diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index 2f5830d362..7700aa4044 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -1723,8 +1723,8 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setExten return *this; } s->what |= layer_state_t::eExtendedRangeBrightnessChanged; - s->currentSdrHdrRatio = currentBufferRatio; - s->desiredSdrHdrRatio = desiredRatio; + s->currentHdrSdrRatio = currentBufferRatio; + s->desiredHdrSdrRatio = desiredRatio; registerSurfaceControlForCallback(sc); return *this; diff --git a/libs/gui/include/gui/LayerState.h b/libs/gui/include/gui/LayerState.h index 6e3be5cef8..5c88a07ba8 100644 --- a/libs/gui/include/gui/LayerState.h +++ b/libs/gui/include/gui/LayerState.h @@ -389,8 +389,8 @@ struct layer_state_t { gui::DropInputMode dropInputMode; bool dimmingEnabled; - float currentSdrHdrRatio = 1.f; - float desiredSdrHdrRatio = 1.f; + float currentHdrSdrRatio = 1.f; + float desiredHdrSdrRatio = 1.f; gui::CachingHint cachingHint = gui::CachingHint::Enabled; diff --git a/services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFECompositionState.h b/services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFECompositionState.h index eae5871477..35ca3a58d9 100644 --- a/services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFECompositionState.h +++ b/services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFECompositionState.h @@ -210,8 +210,8 @@ struct LayerFECompositionState { // The dimming flag bool dimmingEnabled{true}; - float currentSdrHdrRatio = 1.f; - float desiredSdrHdrRatio = 1.f; + float currentHdrSdrRatio = 1.f; + float desiredHdrSdrRatio = 1.f; gui::CachingHint cachingHint = gui::CachingHint::Enabled; virtual ~LayerFECompositionState(); diff --git a/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/planner/LayerState.h b/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/planner/LayerState.h index ee9e646c1f..ce2b96fc2b 100644 --- a/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/planner/LayerState.h +++ b/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/planner/LayerState.h @@ -248,7 +248,7 @@ public: ui::Dataspace getDataspace() const { return mOutputDataspace.get(); } float getHdrSdrRatio() const { - return getOutputLayer()->getLayerFE().getCompositionState()->currentSdrHdrRatio; + return getOutputLayer()->getLayerFE().getCompositionState()->currentHdrSdrRatio; }; wp<GraphicBuffer> getBuffer() const { return mBuffer.get(); } diff --git a/services/surfaceflinger/CompositionEngine/src/LayerFECompositionState.cpp b/services/surfaceflinger/CompositionEngine/src/LayerFECompositionState.cpp index 615d04b460..426cc57db8 100644 --- a/services/surfaceflinger/CompositionEngine/src/LayerFECompositionState.cpp +++ b/services/surfaceflinger/CompositionEngine/src/LayerFECompositionState.cpp @@ -121,9 +121,9 @@ void LayerFECompositionState::dump(std::string& out) const { dumpVal(out, "dataspace", toString(dataspace), dataspace); dumpVal(out, "hdr metadata types", hdrMetadata.validTypes); dumpVal(out, "dimming enabled", dimmingEnabled); - if (currentSdrHdrRatio > 1.01f || desiredSdrHdrRatio > 1.01f) { - dumpVal(out, "current sdr/hdr ratio", currentSdrHdrRatio); - dumpVal(out, "desired sdr/hdr ratio", desiredSdrHdrRatio); + if (currentHdrSdrRatio > 1.01f || desiredHdrSdrRatio > 1.01f) { + dumpVal(out, "current hdr/sdr ratio", currentHdrSdrRatio); + dumpVal(out, "desired hdr/sdr ratio", desiredHdrSdrRatio); } dumpVal(out, "colorTransform", colorTransform); dumpVal(out, "caching hint", toString(cachingHint)); diff --git a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp index 1b86cd376a..0ac0ecb727 100644 --- a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp +++ b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp @@ -344,8 +344,8 @@ void OutputLayer::updateCompositionState( // RANGE_EXTENDED can "self-promote" to HDR, but is still rendered for a particular // range that we may need to re-adjust to the current display conditions if ((state.dataspace & HAL_DATASPACE_RANGE_MASK) == HAL_DATASPACE_RANGE_EXTENDED && - layerFEState->currentSdrHdrRatio > 1.01f) { - layerBrightnessNits *= layerFEState->currentSdrHdrRatio; + layerFEState->currentHdrSdrRatio > 1.01f) { + layerBrightnessNits *= layerFEState->currentHdrSdrRatio; } state.dimmingRatio = std::clamp(layerBrightnessNits / getOutput().getState().displayBrightnessNits, 0.f, diff --git a/services/surfaceflinger/CompositionEngine/tests/planner/CachedSetTest.cpp b/services/surfaceflinger/CompositionEngine/tests/planner/CachedSetTest.cpp index 1f7fb93c6b..bd030d090f 100644 --- a/services/surfaceflinger/CompositionEngine/tests/planner/CachedSetTest.cpp +++ b/services/surfaceflinger/CompositionEngine/tests/planner/CachedSetTest.cpp @@ -667,7 +667,7 @@ TEST_F(CachedSetTest, holePunch_requiresNonHdrWithExtendedBrightness) { ui::Dataspace::TRANSFER_SRGB | ui::Dataspace::RANGE_EXTENDED); mTestLayers[0]->outputLayerCompositionState.dataspace = dataspace; - mTestLayers[0]->layerFECompositionState.currentSdrHdrRatio = 5.f; + mTestLayers[0]->layerFECompositionState.currentHdrSdrRatio = 5.f; mTestLayers[0]->layerState->update(&mTestLayers[0]->outputLayer); CachedSet::Layer& layer = *mTestLayers[0]->cachedSetLayer.get(); diff --git a/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp b/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp index a16de1bcfb..70670dd022 100644 --- a/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp +++ b/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp @@ -707,8 +707,8 @@ void LayerSnapshotBuilder::updateSnapshot(LayerSnapshot& snapshot, const Args& a snapshot.sidebandStream = requested.sidebandStream; snapshot.transparentRegionHint = requested.transparentRegion; snapshot.color.rgb = requested.getColor().rgb; - snapshot.currentSdrHdrRatio = requested.currentSdrHdrRatio; - snapshot.desiredSdrHdrRatio = requested.desiredSdrHdrRatio; + snapshot.currentHdrSdrRatio = requested.currentHdrSdrRatio; + snapshot.desiredHdrSdrRatio = requested.desiredHdrSdrRatio; } if (snapshot.isHiddenByPolicyFromParent && diff --git a/services/surfaceflinger/FrontEnd/RequestedLayerState.cpp b/services/surfaceflinger/FrontEnd/RequestedLayerState.cpp index a5fdaf4fe3..1f670c81df 100644 --- a/services/surfaceflinger/FrontEnd/RequestedLayerState.cpp +++ b/services/surfaceflinger/FrontEnd/RequestedLayerState.cpp @@ -100,8 +100,8 @@ RequestedLayerState::RequestedLayerState(const LayerCreationArgs& args) layerStack = ui::DEFAULT_LAYER_STACK; transformToDisplayInverse = false; dataspace = ui::Dataspace::UNKNOWN; - desiredSdrHdrRatio = 1.f; - currentSdrHdrRatio = 1.f; + desiredHdrSdrRatio = 1.f; + currentHdrSdrRatio = 1.f; dataspaceRequested = false; hdrMetadata.validTypes = 0; surfaceDamageRegion = Region::INVALID_REGION; diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 95213718e5..be021510df 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -639,8 +639,8 @@ void Layer::preparePerFrameCompositionState() { snapshot->surfaceDamage = surfaceDamageRegion; snapshot->hasProtectedContent = isProtected(); snapshot->dimmingEnabled = isDimmingEnabled(); - snapshot->currentSdrHdrRatio = getCurrentSdrHdrRatio(); - snapshot->desiredSdrHdrRatio = getDesiredSdrHdrRatio(); + snapshot->currentHdrSdrRatio = getCurrentHdrSdrRatio(); + snapshot->desiredHdrSdrRatio = getDesiredHdrSdrRatio(); snapshot->cachingHint = getCachingHint(); const bool usesRoundedCorners = hasRoundedCorners(); @@ -3141,11 +3141,11 @@ bool Layer::setDataspace(ui::Dataspace dataspace) { } bool Layer::setExtendedRangeBrightness(float currentBufferRatio, float desiredRatio) { - if (mDrawingState.currentSdrHdrRatio == currentBufferRatio && - mDrawingState.desiredSdrHdrRatio == desiredRatio) + if (mDrawingState.currentHdrSdrRatio == currentBufferRatio && + mDrawingState.desiredHdrSdrRatio == desiredRatio) return false; - mDrawingState.currentSdrHdrRatio = currentBufferRatio; - mDrawingState.desiredSdrHdrRatio = desiredRatio; + mDrawingState.currentHdrSdrRatio = currentBufferRatio; + mDrawingState.desiredHdrSdrRatio = desiredRatio; mDrawingState.modified = true; setTransactionFlags(eTransactionNeeded); return true; @@ -3400,8 +3400,8 @@ void Layer::gatherBufferInfo() { if (lastDataspace != mBufferInfo.mDataspace) { mFlinger->mHdrLayerInfoChanged = true; } - if (mBufferInfo.mDesiredSdrHdrRatio != mDrawingState.desiredSdrHdrRatio) { - mBufferInfo.mDesiredSdrHdrRatio = mDrawingState.desiredSdrHdrRatio; + if (mBufferInfo.mDesiredHdrSdrRatio != mDrawingState.desiredHdrSdrRatio) { + mBufferInfo.mDesiredHdrSdrRatio = mDrawingState.desiredHdrSdrRatio; mFlinger->mHdrLayerInfoChanged = true; } mBufferInfo.mCrop = computeBufferCrop(mDrawingState); @@ -3661,9 +3661,9 @@ bool Layer::simpleBufferUpdate(const layer_state_t& s) const { } if (s.what & layer_state_t::eExtendedRangeBrightnessChanged) { - if (mDrawingState.currentSdrHdrRatio != s.currentSdrHdrRatio || - mDrawingState.desiredSdrHdrRatio != s.desiredSdrHdrRatio) { - ALOGV("%s: false [eDimmingEnabledChanged changed]", __func__); + if (mDrawingState.currentHdrSdrRatio != s.currentHdrSdrRatio || + mDrawingState.desiredHdrSdrRatio != s.desiredHdrSdrRatio) { + ALOGV("%s: false [eExtendedRangeBrightnessChanged changed]", __func__); return false; } } diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h index f7e1969ec0..ade3e20dec 100644 --- a/services/surfaceflinger/Layer.h +++ b/services/surfaceflinger/Layer.h @@ -225,8 +225,8 @@ public: gui::DropInputMode dropInputMode; bool autoRefresh = false; bool dimmingEnabled = true; - float currentSdrHdrRatio = 1.f; - float desiredSdrHdrRatio = 1.f; + float currentHdrSdrRatio = 1.f; + float desiredHdrSdrRatio = 1.f; gui::CachingHint cachingHint = gui::CachingHint::Enabled; int64_t latchedVsyncId = 0; }; @@ -296,8 +296,8 @@ public: virtual bool hasColorTransform() const; virtual bool isColorSpaceAgnostic() const { return mDrawingState.colorSpaceAgnostic; } virtual bool isDimmingEnabled() const { return getDrawingState().dimmingEnabled; } - float getDesiredSdrHdrRatio() const { return getDrawingState().desiredSdrHdrRatio; } - float getCurrentSdrHdrRatio() const { return getDrawingState().currentSdrHdrRatio; } + float getDesiredHdrSdrRatio() const { return getDrawingState().desiredHdrSdrRatio; } + float getCurrentHdrSdrRatio() const { return getDrawingState().currentHdrSdrRatio; } gui::CachingHint getCachingHint() const { return getDrawingState().cachingHint; } bool setTransform(uint32_t /*transform*/); @@ -519,7 +519,7 @@ public: uint64_t mFrameNumber; bool mFrameLatencyNeeded{false}; - float mDesiredSdrHdrRatio = 1.f; + float mDesiredHdrSdrRatio = 1.f; }; BufferInfo mBufferInfo; diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 639ea27adc..309b90a04d 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -2763,7 +2763,7 @@ bool SurfaceFlinger::isHdrLayer(const frontend::LayerSnapshot& snapshot) const { // RANGE_EXTENDED layers may identify themselves as being "HDR" via a desired sdr/hdr ratio if ((snapshot.dataspace & (int32_t)Dataspace::RANGE_MASK) == (int32_t)Dataspace::RANGE_EXTENDED && - snapshot.desiredSdrHdrRatio > 1.01f) { + snapshot.desiredHdrSdrRatio > 1.01f) { return true; } return false; @@ -2900,11 +2900,9 @@ void SurfaceFlinger::postComposition(nsecs_t callTime) { const auto* outputLayer = compositionDisplay->getOutputLayerForLayer(layerFe); if (outputLayer) { - // TODO(b/267350616): Rename SdrHdrRatio -> HdrSdrRatio - // everywhere - const float desiredHdrSdrRatio = snapshot.desiredSdrHdrRatio <= 1.f + const float desiredHdrSdrRatio = snapshot.desiredHdrSdrRatio <= 1.f ? std::numeric_limits<float>::infinity() - : snapshot.desiredSdrHdrRatio; + : snapshot.desiredHdrSdrRatio; info.mergeDesiredRatio(desiredHdrSdrRatio); info.numberOfHdrLayers++; const auto displayFrame = outputLayer->getState().displayFrame; @@ -4931,7 +4929,7 @@ uint32_t SurfaceFlinger::setClientStateLocked(const FrameTimelineInfo& frameTime if (layer->setDimmingEnabled(s.dimmingEnabled)) flags |= eTraversalNeeded; } if (what & layer_state_t::eExtendedRangeBrightnessChanged) { - if (layer->setExtendedRangeBrightness(s.currentSdrHdrRatio, s.desiredSdrHdrRatio)) { + if (layer->setExtendedRangeBrightness(s.currentHdrSdrRatio, s.desiredHdrSdrRatio)) { flags |= eTraversalNeeded; } } |