Loading services/surfaceflinger/FrontEnd/TransactionHandler.cpp +5 −3 Original line number Original line Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <cutils/trace.h> #include <cutils/trace.h> #include <utils/Log.h> #include <utils/Log.h> #include <utils/Trace.h> #include "TransactionHandler.h" #include "TransactionHandler.h" Loading Loading @@ -73,12 +74,13 @@ std::vector<TransactionState> TransactionHandler::flushTransactions() { void TransactionHandler::applyUnsignaledBufferTransaction( void TransactionHandler::applyUnsignaledBufferTransaction( std::vector<TransactionState>& transactions, TransactionFlushState& flushState) { std::vector<TransactionState>& transactions, TransactionFlushState& flushState) { // only apply an unsignaled buffer transaction if it's the first one if (!flushState.queueWithUnsignaledBuffer) { if (!transactions.empty()) { return; return; } } if (!flushState.queueWithUnsignaledBuffer) { // only apply an unsignaled buffer transaction if it's the first one if (!transactions.empty()) { ATRACE_NAME("fence unsignaled"); return; return; } } Loading services/surfaceflinger/SurfaceFlinger.cpp +17 −11 Original line number Original line Diff line number Diff line Loading @@ -4203,20 +4203,20 @@ TransactionHandler::TransactionReadiness SurfaceFlinger::transactionReadyTimelin const TransactionHandler::TransactionFlushState& flushState) { const TransactionHandler::TransactionFlushState& flushState) { using TransactionReadiness = TransactionHandler::TransactionReadiness; using TransactionReadiness = TransactionHandler::TransactionReadiness; const auto& transaction = *flushState.transaction; const auto& transaction = *flushState.transaction; ATRACE_FORMAT("transactionIsReadyToBeApplied vsyncId: %" PRId64, transaction.frameTimelineInfo.vsyncId); TimePoint desiredPresentTime = TimePoint::fromNs(transaction.desiredPresentTime); TimePoint desiredPresentTime = TimePoint::fromNs(transaction.desiredPresentTime); // Do not present if the desiredPresentTime has not passed unless it is more than // Do not present if the desiredPresentTime has not passed unless it is more than // one second in the future. We ignore timestamps more than 1 second in the future // one second in the future. We ignore timestamps more than 1 second in the future // for stability reasons. // for stability reasons. if (!transaction.isAutoTimestamp && desiredPresentTime >= mExpectedPresentTime && if (!transaction.isAutoTimestamp && desiredPresentTime >= mExpectedPresentTime && desiredPresentTime < mExpectedPresentTime + 1s) { desiredPresentTime < mExpectedPresentTime + 1s) { ATRACE_NAME("not current"); ATRACE_FORMAT("not current desiredPresentTime: %" PRId64 " expectedPresentTime: %" PRId64, desiredPresentTime, mExpectedPresentTime); return TransactionReadiness::NotReady; return TransactionReadiness::NotReady; } } if (!mScheduler->isVsyncValid(mExpectedPresentTime, transaction.originUid)) { if (!mScheduler->isVsyncValid(mExpectedPresentTime, transaction.originUid)) { ATRACE_NAME("!isVsyncValid"); ATRACE_FORMAT("!isVsyncValid expectedPresentTime: %" PRId64 " uid: %d", mExpectedPresentTime, transaction.originUid); return TransactionReadiness::NotReady; return TransactionReadiness::NotReady; } } Loading @@ -4224,7 +4224,8 @@ TransactionHandler::TransactionReadiness SurfaceFlinger::transactionReadyTimelin // expected present time of this transaction. // expected present time of this transaction. if (transaction.isAutoTimestamp && if (transaction.isAutoTimestamp && frameIsEarly(mExpectedPresentTime, VsyncId{transaction.frameTimelineInfo.vsyncId})) { frameIsEarly(mExpectedPresentTime, VsyncId{transaction.frameTimelineInfo.vsyncId})) { ATRACE_NAME("frameIsEarly"); ATRACE_FORMAT("frameIsEarly vsyncId: %" PRId64 " expectedPresentTime: %" PRId64, transaction.frameTimelineInfo.vsyncId, mExpectedPresentTime); return TransactionReadiness::NotReady; return TransactionReadiness::NotReady; } } return TransactionReadiness::Ready; return TransactionReadiness::Ready; Loading Loading @@ -4254,7 +4255,9 @@ TransactionHandler::TransactionReadiness SurfaceFlinger::transactionReadyBufferC s.bufferData->acquireFence); s.bufferData->acquireFence); // Delete the entire state at this point and not just release the buffer because // Delete the entire state at this point and not just release the buffer because // everything associated with the Layer in this Transaction is now out of date. // everything associated with the Layer in this Transaction is now out of date. ATRACE_NAME("DeleteStaleBuffer"); ATRACE_FORMAT("DeleteStaleBuffer %s barrierProducerId:%d > %d", layer->getDebugName(), layer->getDrawingState().barrierProducerId, s.bufferData->producerId); return TraverseBuffersReturnValues::DELETE_AND_CONTINUE_TRAVERSAL; return TraverseBuffersReturnValues::DELETE_AND_CONTINUE_TRAVERSAL; } } Loading @@ -4264,7 +4267,10 @@ TransactionHandler::TransactionReadiness SurfaceFlinger::transactionReadyBufferC ((flushState.bufferLayersReadyToPresent.get(s.surface.get()) >= ((flushState.bufferLayersReadyToPresent.get(s.surface.get()) >= s.bufferData->barrierFrameNumber)); s.bufferData->barrierFrameNumber)); if (!willApplyBarrierFrame) { if (!willApplyBarrierFrame) { ATRACE_NAME("NotReadyBarrier"); ATRACE_FORMAT("NotReadyBarrier %s barrierFrameNumber:%" PRId64 " > %" PRId64, layer->getDebugName(), layer->getDrawingState().barrierFrameNumber, s.bufferData->barrierFrameNumber); ready = TransactionReadiness::NotReadyBarrier; ready = TransactionReadiness::NotReadyBarrier; return TraverseBuffersReturnValues::STOP_TRAVERSAL; return TraverseBuffersReturnValues::STOP_TRAVERSAL; } } Loading @@ -4276,7 +4282,7 @@ TransactionHandler::TransactionReadiness SurfaceFlinger::transactionReadyBufferC const bool hasPendingBuffer = const bool hasPendingBuffer = flushState.bufferLayersReadyToPresent.contains(s.surface.get()); flushState.bufferLayersReadyToPresent.contains(s.surface.get()); if (layer->backpressureEnabled() && hasPendingBuffer && transaction.isAutoTimestamp) { if (layer->backpressureEnabled() && hasPendingBuffer && transaction.isAutoTimestamp) { ATRACE_NAME("hasPendingBuffer"); ATRACE_FORMAT("hasPendingBuffer %s", layer->getDebugName()); ready = TransactionReadiness::NotReady; ready = TransactionReadiness::NotReady; return TraverseBuffersReturnValues::STOP_TRAVERSAL; return TraverseBuffersReturnValues::STOP_TRAVERSAL; } } Loading @@ -4293,9 +4299,9 @@ TransactionHandler::TransactionReadiness SurfaceFlinger::transactionReadyBufferC const bool allowLatchUnsignaled = const bool allowLatchUnsignaled = shouldLatchUnsignaled(layer, s, transaction.states.size(), shouldLatchUnsignaled(layer, s, transaction.states.size(), flushState.firstTransaction); flushState.firstTransaction); ATRACE_FORMAT("%s allowLatchUnsignaled=%s", layer->getName().c_str(), allowLatchUnsignaled ? "true" : "false"); if (allowLatchUnsignaled) { if (allowLatchUnsignaled) { ATRACE_FORMAT("fence unsignaled try allowLatchUnsignaled %s", layer->getDebugName()); ready = TransactionReadiness::NotReadyUnsignaled; ready = TransactionReadiness::NotReadyUnsignaled; } else { } else { ready = TransactionReadiness::NotReady; ready = TransactionReadiness::NotReady; Loading @@ -4308,12 +4314,12 @@ TransactionHandler::TransactionReadiness SurfaceFlinger::transactionReadyBufferC "Buffer processing hung up due to stuck " "Buffer processing hung up due to stuck " "fence. Indicates GPU hang"); "fence. Indicates GPU hang"); } } ATRACE_FORMAT("fence unsignaled %s", layer->getDebugName()); return TraverseBuffersReturnValues::STOP_TRAVERSAL; return TraverseBuffersReturnValues::STOP_TRAVERSAL; } } } } return TraverseBuffersReturnValues::CONTINUE_TRAVERSAL; return TraverseBuffersReturnValues::CONTINUE_TRAVERSAL; }); }); ATRACE_INT("TransactionReadiness", static_cast<int>(ready)); return ready; return ready; } } Loading Loading
services/surfaceflinger/FrontEnd/TransactionHandler.cpp +5 −3 Original line number Original line Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <cutils/trace.h> #include <cutils/trace.h> #include <utils/Log.h> #include <utils/Log.h> #include <utils/Trace.h> #include "TransactionHandler.h" #include "TransactionHandler.h" Loading Loading @@ -73,12 +74,13 @@ std::vector<TransactionState> TransactionHandler::flushTransactions() { void TransactionHandler::applyUnsignaledBufferTransaction( void TransactionHandler::applyUnsignaledBufferTransaction( std::vector<TransactionState>& transactions, TransactionFlushState& flushState) { std::vector<TransactionState>& transactions, TransactionFlushState& flushState) { // only apply an unsignaled buffer transaction if it's the first one if (!flushState.queueWithUnsignaledBuffer) { if (!transactions.empty()) { return; return; } } if (!flushState.queueWithUnsignaledBuffer) { // only apply an unsignaled buffer transaction if it's the first one if (!transactions.empty()) { ATRACE_NAME("fence unsignaled"); return; return; } } Loading
services/surfaceflinger/SurfaceFlinger.cpp +17 −11 Original line number Original line Diff line number Diff line Loading @@ -4203,20 +4203,20 @@ TransactionHandler::TransactionReadiness SurfaceFlinger::transactionReadyTimelin const TransactionHandler::TransactionFlushState& flushState) { const TransactionHandler::TransactionFlushState& flushState) { using TransactionReadiness = TransactionHandler::TransactionReadiness; using TransactionReadiness = TransactionHandler::TransactionReadiness; const auto& transaction = *flushState.transaction; const auto& transaction = *flushState.transaction; ATRACE_FORMAT("transactionIsReadyToBeApplied vsyncId: %" PRId64, transaction.frameTimelineInfo.vsyncId); TimePoint desiredPresentTime = TimePoint::fromNs(transaction.desiredPresentTime); TimePoint desiredPresentTime = TimePoint::fromNs(transaction.desiredPresentTime); // Do not present if the desiredPresentTime has not passed unless it is more than // Do not present if the desiredPresentTime has not passed unless it is more than // one second in the future. We ignore timestamps more than 1 second in the future // one second in the future. We ignore timestamps more than 1 second in the future // for stability reasons. // for stability reasons. if (!transaction.isAutoTimestamp && desiredPresentTime >= mExpectedPresentTime && if (!transaction.isAutoTimestamp && desiredPresentTime >= mExpectedPresentTime && desiredPresentTime < mExpectedPresentTime + 1s) { desiredPresentTime < mExpectedPresentTime + 1s) { ATRACE_NAME("not current"); ATRACE_FORMAT("not current desiredPresentTime: %" PRId64 " expectedPresentTime: %" PRId64, desiredPresentTime, mExpectedPresentTime); return TransactionReadiness::NotReady; return TransactionReadiness::NotReady; } } if (!mScheduler->isVsyncValid(mExpectedPresentTime, transaction.originUid)) { if (!mScheduler->isVsyncValid(mExpectedPresentTime, transaction.originUid)) { ATRACE_NAME("!isVsyncValid"); ATRACE_FORMAT("!isVsyncValid expectedPresentTime: %" PRId64 " uid: %d", mExpectedPresentTime, transaction.originUid); return TransactionReadiness::NotReady; return TransactionReadiness::NotReady; } } Loading @@ -4224,7 +4224,8 @@ TransactionHandler::TransactionReadiness SurfaceFlinger::transactionReadyTimelin // expected present time of this transaction. // expected present time of this transaction. if (transaction.isAutoTimestamp && if (transaction.isAutoTimestamp && frameIsEarly(mExpectedPresentTime, VsyncId{transaction.frameTimelineInfo.vsyncId})) { frameIsEarly(mExpectedPresentTime, VsyncId{transaction.frameTimelineInfo.vsyncId})) { ATRACE_NAME("frameIsEarly"); ATRACE_FORMAT("frameIsEarly vsyncId: %" PRId64 " expectedPresentTime: %" PRId64, transaction.frameTimelineInfo.vsyncId, mExpectedPresentTime); return TransactionReadiness::NotReady; return TransactionReadiness::NotReady; } } return TransactionReadiness::Ready; return TransactionReadiness::Ready; Loading Loading @@ -4254,7 +4255,9 @@ TransactionHandler::TransactionReadiness SurfaceFlinger::transactionReadyBufferC s.bufferData->acquireFence); s.bufferData->acquireFence); // Delete the entire state at this point and not just release the buffer because // Delete the entire state at this point and not just release the buffer because // everything associated with the Layer in this Transaction is now out of date. // everything associated with the Layer in this Transaction is now out of date. ATRACE_NAME("DeleteStaleBuffer"); ATRACE_FORMAT("DeleteStaleBuffer %s barrierProducerId:%d > %d", layer->getDebugName(), layer->getDrawingState().barrierProducerId, s.bufferData->producerId); return TraverseBuffersReturnValues::DELETE_AND_CONTINUE_TRAVERSAL; return TraverseBuffersReturnValues::DELETE_AND_CONTINUE_TRAVERSAL; } } Loading @@ -4264,7 +4267,10 @@ TransactionHandler::TransactionReadiness SurfaceFlinger::transactionReadyBufferC ((flushState.bufferLayersReadyToPresent.get(s.surface.get()) >= ((flushState.bufferLayersReadyToPresent.get(s.surface.get()) >= s.bufferData->barrierFrameNumber)); s.bufferData->barrierFrameNumber)); if (!willApplyBarrierFrame) { if (!willApplyBarrierFrame) { ATRACE_NAME("NotReadyBarrier"); ATRACE_FORMAT("NotReadyBarrier %s barrierFrameNumber:%" PRId64 " > %" PRId64, layer->getDebugName(), layer->getDrawingState().barrierFrameNumber, s.bufferData->barrierFrameNumber); ready = TransactionReadiness::NotReadyBarrier; ready = TransactionReadiness::NotReadyBarrier; return TraverseBuffersReturnValues::STOP_TRAVERSAL; return TraverseBuffersReturnValues::STOP_TRAVERSAL; } } Loading @@ -4276,7 +4282,7 @@ TransactionHandler::TransactionReadiness SurfaceFlinger::transactionReadyBufferC const bool hasPendingBuffer = const bool hasPendingBuffer = flushState.bufferLayersReadyToPresent.contains(s.surface.get()); flushState.bufferLayersReadyToPresent.contains(s.surface.get()); if (layer->backpressureEnabled() && hasPendingBuffer && transaction.isAutoTimestamp) { if (layer->backpressureEnabled() && hasPendingBuffer && transaction.isAutoTimestamp) { ATRACE_NAME("hasPendingBuffer"); ATRACE_FORMAT("hasPendingBuffer %s", layer->getDebugName()); ready = TransactionReadiness::NotReady; ready = TransactionReadiness::NotReady; return TraverseBuffersReturnValues::STOP_TRAVERSAL; return TraverseBuffersReturnValues::STOP_TRAVERSAL; } } Loading @@ -4293,9 +4299,9 @@ TransactionHandler::TransactionReadiness SurfaceFlinger::transactionReadyBufferC const bool allowLatchUnsignaled = const bool allowLatchUnsignaled = shouldLatchUnsignaled(layer, s, transaction.states.size(), shouldLatchUnsignaled(layer, s, transaction.states.size(), flushState.firstTransaction); flushState.firstTransaction); ATRACE_FORMAT("%s allowLatchUnsignaled=%s", layer->getName().c_str(), allowLatchUnsignaled ? "true" : "false"); if (allowLatchUnsignaled) { if (allowLatchUnsignaled) { ATRACE_FORMAT("fence unsignaled try allowLatchUnsignaled %s", layer->getDebugName()); ready = TransactionReadiness::NotReadyUnsignaled; ready = TransactionReadiness::NotReadyUnsignaled; } else { } else { ready = TransactionReadiness::NotReady; ready = TransactionReadiness::NotReady; Loading @@ -4308,12 +4314,12 @@ TransactionHandler::TransactionReadiness SurfaceFlinger::transactionReadyBufferC "Buffer processing hung up due to stuck " "Buffer processing hung up due to stuck " "fence. Indicates GPU hang"); "fence. Indicates GPU hang"); } } ATRACE_FORMAT("fence unsignaled %s", layer->getDebugName()); return TraverseBuffersReturnValues::STOP_TRAVERSAL; return TraverseBuffersReturnValues::STOP_TRAVERSAL; } } } } return TraverseBuffersReturnValues::CONTINUE_TRAVERSAL; return TraverseBuffersReturnValues::CONTINUE_TRAVERSAL; }); }); ATRACE_INT("TransactionReadiness", static_cast<int>(ready)); return ready; return ready; } } Loading