@@ -362,7 +362,7 @@ aidl::android::hardware::graphics::composer3::Composition Layer::getCompositionT
362362// transaction
363363// ----------------------------------------------------------------------------
364364
365- void Layer::commitTransaction () {
365+ void Layer::commitTransaction () REQUIRES( mFlinger -> mStateLock ) {
366366 // Set the present state for all bufferlessSurfaceFramesTX to Presented. The
367367 // bufferSurfaceFrameTX will be presented in latchBuffer.
368368 for (auto & [token, surfaceFrame] : mDrawingState .bufferlessSurfaceFramesTX ) {
@@ -394,7 +394,8 @@ bool Layer::isLayerFocusedBasedOnPriority(int32_t priority) {
394394};
395395
396396void Layer::setFrameTimelineVsyncForBufferTransaction (const FrameTimelineInfo& info,
397- nsecs_t postTime, gui::GameMode gameMode) {
397+ nsecs_t postTime, gui::GameMode gameMode)
398+ REQUIRES(mFlinger ->mStateLock ) {
398399 mDrawingState .postTime = postTime;
399400
400401 // Check if one of the bufferlessSurfaceFramesTX contains the same vsyncId. This can happen if
@@ -458,15 +459,16 @@ void Layer::addSurfaceFrameDroppedForBuffer(
458459
459460void Layer::addSurfaceFramePresentedForBuffer (
460461 std::shared_ptr<frametimeline::SurfaceFrame>& surfaceFrame, nsecs_t acquireFenceTime,
461- nsecs_t currentLatchTime) {
462+ nsecs_t currentLatchTime) REQUIRES( mFlinger -> mStateLock ) {
462463 surfaceFrame->setAcquireFenceTime (acquireFenceTime);
463464 surfaceFrame->setPresentState (PresentState::Presented, mLastLatchTime );
464465 mFlinger ->mFrameTimeline ->addSurfaceFrame (surfaceFrame);
465466 updateLastLatchTime (currentLatchTime);
466467}
467468
468469std::shared_ptr<frametimeline::SurfaceFrame> Layer::createSurfaceFrameForTransaction (
469- const FrameTimelineInfo& info, nsecs_t postTime, gui::GameMode gameMode) {
470+ const FrameTimelineInfo& info, nsecs_t postTime, gui::GameMode gameMode)
471+ REQUIRES(mFlinger ->mStateLock ) {
470472 auto surfaceFrame =
471473 mFlinger ->mFrameTimeline ->createSurfaceFrameForToken (info, mOwnerPid , mOwnerUid ,
472474 getSequence (), mName ,
@@ -488,7 +490,7 @@ std::shared_ptr<frametimeline::SurfaceFrame> Layer::createSurfaceFrameForTransac
488490
489491std::shared_ptr<frametimeline::SurfaceFrame> Layer::createSurfaceFrameForBuffer (
490492 const FrameTimelineInfo& info, nsecs_t queueTime, std::string debugName,
491- gui::GameMode gameMode) {
493+ gui::GameMode gameMode) REQUIRES( mFlinger -> mStateLock ) {
492494 auto surfaceFrame =
493495 mFlinger ->mFrameTimeline ->createSurfaceFrameForToken (info, mOwnerPid , mOwnerUid ,
494496 getSequence (), mName , debugName,
@@ -506,7 +508,8 @@ std::shared_ptr<frametimeline::SurfaceFrame> Layer::createSurfaceFrameForBuffer(
506508}
507509
508510void Layer::setFrameTimelineVsyncForSkippedFrames (const FrameTimelineInfo& info, nsecs_t postTime,
509- std::string debugName, gui::GameMode gameMode) {
511+ std::string debugName, gui::GameMode gameMode)
512+ REQUIRES(mFlinger ->mStateLock ) {
510513 if (info.skippedFrameVsyncId == FrameTimelineInfo::INVALID_VSYNC_ID) {
511514 return ;
512515 }
@@ -842,7 +845,7 @@ bool Layer::setTransformToDisplayInverse(bool transformToDisplayInverse) {
842845 return true ;
843846}
844847
845- void Layer::releasePreviousBuffer () {
848+ void Layer::releasePreviousBuffer () REQUIRES( mFlinger -> mStateLock ) {
846849 mReleasePreviousBuffer = true ;
847850 if (!mBufferInfo .mBuffer ||
848851 (!mDrawingState .buffer ->hasSameBuffer (*mBufferInfo .mBuffer ) ||
@@ -884,7 +887,8 @@ void Layer::resetDrawingStateBufferInfo() {
884887
885888bool Layer::setBuffer (std::shared_ptr<renderengine::ExternalTexture>& buffer,
886889 const BufferData& bufferData, nsecs_t postTime, nsecs_t desiredPresentTime,
887- bool isAutoTimestamp, const FrameTimelineInfo& info, gui::GameMode gameMode) {
890+ bool isAutoTimestamp, const FrameTimelineInfo& info, gui::GameMode gameMode)
891+ REQUIRES(mFlinger ->mStateLock ) {
888892 SFTRACE_FORMAT (" setBuffer %s - hasBuffer=%s" , getDebugName (), (buffer ? " true" : " false" ));
889893
890894 const bool frameNumberChanged =
@@ -1074,7 +1078,8 @@ bool Layer::setDesiredHdrHeadroom(float desiredRatio) {
10741078}
10751079
10761080bool Layer::setSidebandStream (const sp<NativeHandle>& sidebandStream, const FrameTimelineInfo& info,
1077- nsecs_t postTime, gui::GameMode gameMode) {
1081+ nsecs_t postTime, gui::GameMode gameMode)
1082+ REQUIRES(mFlinger ->mStateLock ) {
10781083 if (mDrawingState .sidebandStream == sidebandStream) return false ;
10791084
10801085 if (mDrawingState .sidebandStream != nullptr && sidebandStream == nullptr ) {
@@ -1207,7 +1212,7 @@ bool Layer::latchSidebandStream(bool& recomputeVisibleRegions) {
12071212 return false ;
12081213}
12091214
1210- void Layer::updateTexImage (nsecs_t latchTime, bool bgColorOnly) {
1215+ void Layer::updateTexImage (nsecs_t latchTime, bool bgColorOnly) REQUIRES( mFlinger -> mStateLock ) {
12111216 const State& s (getDrawingState ());
12121217
12131218 if (!s.buffer ) {
@@ -1457,7 +1462,8 @@ void Layer::onCompositionPresented(const DisplayDevice* display,
14571462 mBufferInfo .mFrameLatencyNeeded = false ;
14581463}
14591464
1460- bool Layer::latchBufferImpl (bool & recomputeVisibleRegions, nsecs_t latchTime, bool bgColorOnly) {
1465+ bool Layer::latchBufferImpl (bool & recomputeVisibleRegions, nsecs_t latchTime, bool bgColorOnly)
1466+ REQUIRES(mFlinger ->mStateLock ) {
14611467 SFTRACE_FORMAT_INSTANT (" latchBuffer %s - %" PRIu64, getDebugName (),
14621468 getDrawingState ().frameNumber );
14631469
0 commit comments