Loading services/surfaceflinger/BufferStateLayer.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -890,7 +890,11 @@ void BufferStateLayer::gatherBufferInfo() { mBufferInfo.mFenceTime = std::make_shared<FenceTime>(s.acquireFence); mBufferInfo.mFence = s.acquireFence; mBufferInfo.mTransform = s.bufferTransform; auto lastDataspace = mBufferInfo.mDataspace; mBufferInfo.mDataspace = translateDataspace(s.dataspace); if (lastDataspace != mBufferInfo.mDataspace) { mFlinger->mSomeDataspaceChanged = true; } mBufferInfo.mCrop = computeBufferCrop(s); mBufferInfo.mScaleMode = NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW; mBufferInfo.mSurfaceDamage = s.surfaceDamageRegion; Loading services/surfaceflinger/SurfaceFlinger.cpp +37 −24 Original line number Diff line number Diff line Loading @@ -1643,6 +1643,9 @@ status_t SurfaceFlinger::addHdrLayerInfoListener(const sp<IBinder>& displayToken hdrInfoReporter = sp<HdrLayerInfoReporter>::make(); } hdrInfoReporter->addListener(listener); mAddingHDRLayerInfoListener = true; return OK; } Loading Loading @@ -2143,6 +2146,8 @@ void SurfaceFlinger::onMessageRefresh() { mTracing.notify("bufferLatched"); } } mVisibleRegionsWereDirtyThisFrame = mVisibleRegionsDirty; // Cache value for use in post-comp mVisibleRegionsDirty = false; if (mCompositionEngine->needsAnotherUpdate()) { Loading Loading @@ -2287,6 +2292,7 @@ void SurfaceFlinger::postComposition() { std::vector<std::pair<std::shared_ptr<compositionengine::Display>, sp<HdrLayerInfoReporter>>> hdrInfoListeners; bool haveNewListeners = false; { Mutex::Autolock lock(mStateLock); if (mFpsReporter) { Loading @@ -2304,8 +2310,11 @@ void SurfaceFlinger::postComposition() { } } } haveNewListeners = mAddingHDRLayerInfoListener; // grab this with state lock mAddingHDRLayerInfoListener = false; } if (haveNewListeners || mSomeDataspaceChanged || mVisibleRegionsWereDirtyThisFrame) { for (auto& [compositionDisplay, listener] : hdrInfoListeners) { HdrLayerInfoReporter::HdrLayerInfo info; int32_t maxArea = 0; Loading @@ -2318,7 +2327,8 @@ void SurfaceFlinger::postComposition() { transfer == Dataspace::TRANSFER_HLG); if (isHdr) { const auto* outputLayer = compositionDisplay->getOutputLayerForLayer(layerFe); const auto* outputLayer = compositionDisplay->getOutputLayerForLayer(layerFe); if (outputLayer) { info.numberOfHdrLayers++; const auto displayFrame = outputLayer->getState().displayFrame; Loading @@ -2334,6 +2344,10 @@ void SurfaceFlinger::postComposition() { }); listener->dispatchHdrLayerInfo(info); } } mSomeDataspaceChanged = false; mVisibleRegionsWereDirtyThisFrame = false; mTransactionCallbackInvoker.addPresentFence(mPreviousPresentFences[0].fence); mTransactionCallbackInvoker.sendCallbacks(); Loading Loading @@ -2481,7 +2495,6 @@ void SurfaceFlinger::handleTransaction(uint32_t transactionFlags) { handleTransactionLocked(transactionFlags); mDebugInTransaction = 0; invalidateHwcGeometry(); // here the transaction has been committed } Loading services/surfaceflinger/SurfaceFlinger.h +8 −0 Original line number Diff line number Diff line Loading @@ -1240,11 +1240,19 @@ private: State mDrawingState{LayerVector::StateSet::Drawing}; bool mVisibleRegionsDirty = false; // VisibleRegions dirty is already cleared by postComp, but we need to track it to prevent // extra work in the HDR layer info listener. bool mVisibleRegionsWereDirtyThisFrame = false; // Used to ensure we omit a callback when HDR layer info listener is newly added but the // scene hasn't changed bool mAddingHDRLayerInfoListener = false; // Set during transaction application stage to track if the input info or children // for a layer has changed. // TODO: Also move visibleRegions over to a boolean system. bool mInputInfoChanged = false; bool mSomeChildrenChanged; bool mSomeDataspaceChanged = false; bool mForceTransactionDisplayChange = false; bool mGeometryInvalid = false; Loading Loading
services/surfaceflinger/BufferStateLayer.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -890,7 +890,11 @@ void BufferStateLayer::gatherBufferInfo() { mBufferInfo.mFenceTime = std::make_shared<FenceTime>(s.acquireFence); mBufferInfo.mFence = s.acquireFence; mBufferInfo.mTransform = s.bufferTransform; auto lastDataspace = mBufferInfo.mDataspace; mBufferInfo.mDataspace = translateDataspace(s.dataspace); if (lastDataspace != mBufferInfo.mDataspace) { mFlinger->mSomeDataspaceChanged = true; } mBufferInfo.mCrop = computeBufferCrop(s); mBufferInfo.mScaleMode = NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW; mBufferInfo.mSurfaceDamage = s.surfaceDamageRegion; Loading
services/surfaceflinger/SurfaceFlinger.cpp +37 −24 Original line number Diff line number Diff line Loading @@ -1643,6 +1643,9 @@ status_t SurfaceFlinger::addHdrLayerInfoListener(const sp<IBinder>& displayToken hdrInfoReporter = sp<HdrLayerInfoReporter>::make(); } hdrInfoReporter->addListener(listener); mAddingHDRLayerInfoListener = true; return OK; } Loading Loading @@ -2143,6 +2146,8 @@ void SurfaceFlinger::onMessageRefresh() { mTracing.notify("bufferLatched"); } } mVisibleRegionsWereDirtyThisFrame = mVisibleRegionsDirty; // Cache value for use in post-comp mVisibleRegionsDirty = false; if (mCompositionEngine->needsAnotherUpdate()) { Loading Loading @@ -2287,6 +2292,7 @@ void SurfaceFlinger::postComposition() { std::vector<std::pair<std::shared_ptr<compositionengine::Display>, sp<HdrLayerInfoReporter>>> hdrInfoListeners; bool haveNewListeners = false; { Mutex::Autolock lock(mStateLock); if (mFpsReporter) { Loading @@ -2304,8 +2310,11 @@ void SurfaceFlinger::postComposition() { } } } haveNewListeners = mAddingHDRLayerInfoListener; // grab this with state lock mAddingHDRLayerInfoListener = false; } if (haveNewListeners || mSomeDataspaceChanged || mVisibleRegionsWereDirtyThisFrame) { for (auto& [compositionDisplay, listener] : hdrInfoListeners) { HdrLayerInfoReporter::HdrLayerInfo info; int32_t maxArea = 0; Loading @@ -2318,7 +2327,8 @@ void SurfaceFlinger::postComposition() { transfer == Dataspace::TRANSFER_HLG); if (isHdr) { const auto* outputLayer = compositionDisplay->getOutputLayerForLayer(layerFe); const auto* outputLayer = compositionDisplay->getOutputLayerForLayer(layerFe); if (outputLayer) { info.numberOfHdrLayers++; const auto displayFrame = outputLayer->getState().displayFrame; Loading @@ -2334,6 +2344,10 @@ void SurfaceFlinger::postComposition() { }); listener->dispatchHdrLayerInfo(info); } } mSomeDataspaceChanged = false; mVisibleRegionsWereDirtyThisFrame = false; mTransactionCallbackInvoker.addPresentFence(mPreviousPresentFences[0].fence); mTransactionCallbackInvoker.sendCallbacks(); Loading Loading @@ -2481,7 +2495,6 @@ void SurfaceFlinger::handleTransaction(uint32_t transactionFlags) { handleTransactionLocked(transactionFlags); mDebugInTransaction = 0; invalidateHwcGeometry(); // here the transaction has been committed } Loading
services/surfaceflinger/SurfaceFlinger.h +8 −0 Original line number Diff line number Diff line Loading @@ -1240,11 +1240,19 @@ private: State mDrawingState{LayerVector::StateSet::Drawing}; bool mVisibleRegionsDirty = false; // VisibleRegions dirty is already cleared by postComp, but we need to track it to prevent // extra work in the HDR layer info listener. bool mVisibleRegionsWereDirtyThisFrame = false; // Used to ensure we omit a callback when HDR layer info listener is newly added but the // scene hasn't changed bool mAddingHDRLayerInfoListener = false; // Set during transaction application stage to track if the input info or children // for a layer has changed. // TODO: Also move visibleRegions over to a boolean system. bool mInputInfoChanged = false; bool mSomeChildrenChanged; bool mSomeDataspaceChanged = false; bool mForceTransactionDisplayChange = false; bool mGeometryInvalid = false; Loading