Loading services/surfaceflinger/BufferLayer.cpp +6 −4 Original line number Diff line number Diff line Loading @@ -70,6 +70,8 @@ BufferLayer::~BufferLayer() { mName.string()); destroyAllHwcLayers(); } mTimeStats.onDestroy(getSequence()); } void BufferLayer::useSurfaceDamage() { Loading Loading @@ -335,8 +337,8 @@ bool BufferLayer::onPostComposition(const std::shared_ptr<FenceTime>& glDoneFenc nsecs_t desiredPresentTime = getDesiredPresentTime(); mFrameTracker.setDesiredPresentTime(desiredPresentTime); const std::string layerName(getName().c_str()); mTimeStats.setDesiredTime(layerName, mCurrentFrameNumber, desiredPresentTime); const int32_t layerID = getSequence(); mTimeStats.setDesiredTime(layerID, mCurrentFrameNumber, desiredPresentTime); std::shared_ptr<FenceTime> frameReadyFence = getCurrentFenceTime(); if (frameReadyFence->isValid()) { Loading @@ -348,14 +350,14 @@ bool BufferLayer::onPostComposition(const std::shared_ptr<FenceTime>& glDoneFenc } if (presentFence->isValid()) { mTimeStats.setPresentFence(layerName, mCurrentFrameNumber, presentFence); mTimeStats.setPresentFence(layerID, mCurrentFrameNumber, presentFence); mFrameTracker.setActualPresentFence(std::shared_ptr<FenceTime>(presentFence)); } else if (mFlinger->getHwComposer().isConnected(HWC_DISPLAY_PRIMARY)) { // The HWC doesn't support present fences, so use the refresh // timestamp instead. const nsecs_t actualPresentTime = mFlinger->getHwComposer().getRefreshTimestamp(HWC_DISPLAY_PRIMARY); mTimeStats.setPresentTime(layerName, mCurrentFrameNumber, actualPresentTime); mTimeStats.setPresentTime(layerID, mCurrentFrameNumber, actualPresentTime); mFrameTracker.setActualPresentTime(actualPresentTime); } Loading services/surfaceflinger/BufferQueueLayer.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -227,6 +227,7 @@ status_t BufferQueueLayer::updateTexImage(bool& recomputeVisibleRegions, nsecs_t // BufferItem's that weren't actually queued. This can happen in shared // buffer mode. bool queuedBuffer = false; const int32_t layerID = getSequence(); LayerRejecter r(mDrawingState, getCurrentState(), recomputeVisibleRegions, getProducerStickyTransform() != 0, mName.string(), mOverrideScalingMode, getTransformToDisplayInverse(), mFreezeGeometryUpdates); Loading @@ -247,7 +248,7 @@ status_t BufferQueueLayer::updateTexImage(bool& recomputeVisibleRegions, nsecs_t // and return early if (queuedBuffer) { Mutex::Autolock lock(mQueueItemLock); mTimeStats.removeTimeRecord(getName().c_str(), mQueueItems[0].mFrameNumber); mTimeStats.removeTimeRecord(layerID, mQueueItems[0].mFrameNumber); mQueueItems.removeAt(0); mQueuedFrames--; } Loading @@ -261,7 +262,7 @@ status_t BufferQueueLayer::updateTexImage(bool& recomputeVisibleRegions, nsecs_t Mutex::Autolock lock(mQueueItemLock); mQueueItems.clear(); mQueuedFrames = 0; mTimeStats.clearLayerRecord(getName().c_str()); mTimeStats.clearLayerRecord(layerID); } // Once we have hit this state, the shadow queue may no longer Loading @@ -282,14 +283,13 @@ status_t BufferQueueLayer::updateTexImage(bool& recomputeVisibleRegions, nsecs_t // Remove any stale buffers that have been dropped during // updateTexImage while (mQueueItems[0].mFrameNumber != currentFrameNumber) { mTimeStats.removeTimeRecord(getName().c_str(), mQueueItems[0].mFrameNumber); mTimeStats.removeTimeRecord(layerID, mQueueItems[0].mFrameNumber); mQueueItems.removeAt(0); mQueuedFrames--; } const std::string layerName(getName().c_str()); mTimeStats.setAcquireFence(layerName, currentFrameNumber, mQueueItems[0].mFenceTime); mTimeStats.setLatchTime(layerName, currentFrameNumber, latchTime); mTimeStats.setAcquireFence(layerID, currentFrameNumber, mQueueItems[0].mFenceTime); mTimeStats.setLatchTime(layerID, currentFrameNumber, latchTime); mQueueItems.removeAt(0); } Loading services/surfaceflinger/BufferStateLayer.cpp +12 −10 Original line number Diff line number Diff line Loading @@ -377,6 +377,8 @@ status_t BufferStateLayer::updateTexImage(bool& /*recomputeVisibleRegions*/, nse return NO_ERROR; } const int32_t layerID = getSequence(); // Reject if the layer is invalid uint32_t bufferWidth = s.buffer->width; uint32_t bufferHeight = s.buffer->height; Loading @@ -397,7 +399,7 @@ status_t BufferStateLayer::updateTexImage(bool& /*recomputeVisibleRegions*/, nse ALOGE("[%s] rejecting buffer: " "bufferWidth=%d, bufferHeight=%d, front.active.{w=%d, h=%d}", mName.string(), bufferWidth, bufferHeight, s.active.w, s.active.h); mTimeStats.removeTimeRecord(getName().c_str(), getFrameNumber()); mTimeStats.removeTimeRecord(layerID, getFrameNumber()); return BAD_VALUE; } Loading @@ -405,7 +407,7 @@ status_t BufferStateLayer::updateTexImage(bool& /*recomputeVisibleRegions*/, nse if (SyncFeatures::getInstance().useNativeFenceSync() && releaseFence != Fence::NO_FENCE) { // TODO(alecmouri): Fail somewhere upstream if the fence is invalid. if (!releaseFence->isValid()) { mTimeStats.clearLayerRecord(getName().c_str()); mTimeStats.clearLayerRecord(layerID); return UNKNOWN_ERROR; } Loading @@ -415,7 +417,7 @@ status_t BufferStateLayer::updateTexImage(bool& /*recomputeVisibleRegions*/, nse auto currentStatus = s.acquireFence->getStatus(); if (currentStatus == Fence::Status::Invalid) { ALOGE("Existing fence has invalid state"); mTimeStats.clearLayerRecord(getName().c_str()); mTimeStats.clearLayerRecord(layerID); return BAD_VALUE; } Loading @@ -423,7 +425,7 @@ status_t BufferStateLayer::updateTexImage(bool& /*recomputeVisibleRegions*/, nse if (incomingStatus == Fence::Status::Invalid) { ALOGE("New fence has invalid state"); mDrawingState.acquireFence = releaseFence; mTimeStats.clearLayerRecord(getName().c_str()); mTimeStats.clearLayerRecord(layerID); return BAD_VALUE; } Loading @@ -439,7 +441,7 @@ status_t BufferStateLayer::updateTexImage(bool& /*recomputeVisibleRegions*/, nse // synchronization is broken, the best we can do is hope fences // signal in order so the new fence will act like a union mDrawingState.acquireFence = releaseFence; mTimeStats.clearLayerRecord(getName().c_str()); mTimeStats.clearLayerRecord(layerID); return BAD_VALUE; } mDrawingState.acquireFence = mergedFence; Loading @@ -462,16 +464,16 @@ status_t BufferStateLayer::updateTexImage(bool& /*recomputeVisibleRegions*/, nse // a GL-composited layer) not at all. status_t err = bindTextureImage(); if (err != NO_ERROR) { mTimeStats.clearLayerRecord(getName().c_str()); mTimeStats.clearLayerRecord(layerID); return BAD_VALUE; } } // TODO(marissaw): properly support mTimeStats const std::string layerName(getName().c_str()); mTimeStats.setPostTime(getName().c_str(), getFrameNumber(), latchTime); mTimeStats.setAcquireFence(layerName, getFrameNumber(), getCurrentFenceTime()); mTimeStats.setLatchTime(layerName, getFrameNumber(), latchTime); mTimeStats.setLayerName(layerID, getName().c_str()); mTimeStats.setPostTime(layerID, getFrameNumber(), latchTime); mTimeStats.setAcquireFence(layerID, getFrameNumber(), getCurrentFenceTime()); mTimeStats.setLatchTime(layerID, getFrameNumber(), latchTime); return NO_ERROR; } Loading services/surfaceflinger/Layer.cpp +22 −32 Original line number Diff line number Diff line Loading @@ -119,20 +119,13 @@ Layer::~Layer() { c->detachLayer(this); } mFrameTracker.logAndResetStats(mName); // The remote sync points are cleared out when we are // removed from current state. Mutex::Autolock lock(mLocalSyncPointMutex); for (auto& point : mRemoteSyncPoints) { point->setTransactionApplied(); } for (auto& point : mLocalSyncPoints) { point->setFrameAvailable(); } abandon(); destroyAllHwcLayers(); mFlinger->onLayerDestroyed(); mFrameTracker.logAndResetStats(mName); } // --------------------------------------------------------------------------- Loading @@ -147,9 +140,10 @@ Layer::~Layer() { void Layer::onLayerDisplayed(const sp<Fence>& /*releaseFence*/) {} void Layer::onRemovedFromCurrentState() { mRemovedFromCurrentState = true; // the layer is removed from SF mCurrentState to mLayersPendingRemoval mPendingRemoval = true; if (mCurrentState.zOrderRelativeOf != nullptr) { sp<Layer> strongRelative = mCurrentState.zOrderRelativeOf.promote(); if (strongRelative != nullptr) { Loading @@ -159,18 +153,19 @@ void Layer::onRemovedFromCurrentState() { mCurrentState.zOrderRelativeOf = nullptr; } // Since we are no longer reachable from CurrentState SurfaceFlinger // will no longer invoke doTransaction for us, and so we will // never finish applying transactions. We signal the sync point // now so that another layer will not become indefinitely // blocked. for (auto& point: mRemoteSyncPoints) { point->setTransactionApplied(); for (const auto& child : mCurrentChildren) { child->onRemovedFromCurrentState(); } } mRemoteSyncPoints.clear(); void Layer::onRemoved() { // the layer is removed from SF mLayersPendingRemoval abandon(); destroyAllHwcLayers(); for (const auto& child : mCurrentChildren) { child->onRemovedFromCurrentState(); child->onRemoved(); } } Loading Loading @@ -233,10 +228,6 @@ void Layer::destroyAllHwcLayers() { } LOG_ALWAYS_FATAL_IF(!getBE().mHwcLayers.empty(), "All hardware composer layers should have been destroyed"); for (const sp<Layer>& child : mDrawingChildren) { child->destroyAllHwcLayers(); } } Rect Layer::getContentCrop() const { Loading Loading @@ -834,9 +825,7 @@ void Layer::pushPendingState() { // If this transaction is waiting on the receipt of a frame, generate a sync // point and send it to the remote layer. // We don't allow installing sync points after we are removed from the current state // as we won't be able to signal our end. if (mCurrentState.barrierLayer_legacy != nullptr && !mRemovedFromCurrentState) { if (mCurrentState.barrierLayer_legacy != nullptr) { sp<Layer> barrierLayer = mCurrentState.barrierLayer_legacy.promote(); if (barrierLayer == nullptr) { ALOGE("[%s] Unable to promote barrier Layer.", mName.string()); Loading Loading @@ -1481,14 +1470,15 @@ void Layer::dumpFrameEvents(String8& result) { void Layer::onDisconnect() { Mutex::Autolock lock(mFrameEventHistoryMutex); mFrameEventHistory.onDisconnect(); mTimeStats.onDisconnect(getName().c_str()); mTimeStats.onDisconnect(getSequence()); } void Layer::addAndGetFrameTimestamps(const NewFrameEventsEntry* newTimestamps, FrameEventHistoryDelta* outDelta) { if (newTimestamps) { mTimeStats.setPostTime(getName().c_str(), newTimestamps->frameNumber, newTimestamps->postedTime); const int32_t layerID = getSequence(); mTimeStats.setLayerName(layerID, getName().c_str()); mTimeStats.setPostTime(layerID, newTimestamps->frameNumber, newTimestamps->postedTime); } Mutex::Autolock lock(mFrameEventHistoryMutex); Loading services/surfaceflinger/Layer.h +10 −6 Original line number Diff line number Diff line Loading @@ -346,7 +346,7 @@ public: virtual bool isCreatedFromMainThread() const { return false; } bool isRemovedFromCurrentState() const { return mRemovedFromCurrentState; } bool isPendingRemoval() const { return mPendingRemoval; } void writeToProto(LayerProto* layerInfo, LayerVector::StateSet stateSet = LayerVector::StateSet::Drawing); Loading Loading @@ -475,6 +475,12 @@ public: */ void onRemovedFromCurrentState(); /* * called with the state lock from the main thread when the layer is * removed from the pending removal list */ void onRemoved(); // Updates the transform hint in our SurfaceFlingerConsumer to match // the current orientation of the display device. void updateTransformHint(const sp<const DisplayDevice>& display) const; Loading Loading @@ -589,12 +595,12 @@ protected: */ class LayerCleaner { sp<SurfaceFlinger> mFlinger; sp<Layer> mLayer; wp<Layer> mLayer; protected: ~LayerCleaner() { // destroy client resources mFlinger->onHandleDestroyed(mLayer); mFlinger->onLayerDestroyed(mLayer); } public: Loading Loading @@ -696,8 +702,6 @@ public: virtual PixelFormat getPixelFormat() const { return PIXEL_FORMAT_NONE; } bool getPremultipledAlpha() const; bool mPendingHWCDestroy{false}; protected: // ----------------------------------------------------------------------- bool usingRelativeZ(LayerVector::StateSet stateSet); Loading Loading @@ -741,7 +745,7 @@ protected: // Whether filtering is needed b/c of the drawingstate bool mNeedsFiltering{false}; bool mRemovedFromCurrentState{false}; bool mPendingRemoval{false}; // page-flip thread (currently main thread) bool mProtectedByApp{false}; // application requires protected path to external sink Loading Loading
services/surfaceflinger/BufferLayer.cpp +6 −4 Original line number Diff line number Diff line Loading @@ -70,6 +70,8 @@ BufferLayer::~BufferLayer() { mName.string()); destroyAllHwcLayers(); } mTimeStats.onDestroy(getSequence()); } void BufferLayer::useSurfaceDamage() { Loading Loading @@ -335,8 +337,8 @@ bool BufferLayer::onPostComposition(const std::shared_ptr<FenceTime>& glDoneFenc nsecs_t desiredPresentTime = getDesiredPresentTime(); mFrameTracker.setDesiredPresentTime(desiredPresentTime); const std::string layerName(getName().c_str()); mTimeStats.setDesiredTime(layerName, mCurrentFrameNumber, desiredPresentTime); const int32_t layerID = getSequence(); mTimeStats.setDesiredTime(layerID, mCurrentFrameNumber, desiredPresentTime); std::shared_ptr<FenceTime> frameReadyFence = getCurrentFenceTime(); if (frameReadyFence->isValid()) { Loading @@ -348,14 +350,14 @@ bool BufferLayer::onPostComposition(const std::shared_ptr<FenceTime>& glDoneFenc } if (presentFence->isValid()) { mTimeStats.setPresentFence(layerName, mCurrentFrameNumber, presentFence); mTimeStats.setPresentFence(layerID, mCurrentFrameNumber, presentFence); mFrameTracker.setActualPresentFence(std::shared_ptr<FenceTime>(presentFence)); } else if (mFlinger->getHwComposer().isConnected(HWC_DISPLAY_PRIMARY)) { // The HWC doesn't support present fences, so use the refresh // timestamp instead. const nsecs_t actualPresentTime = mFlinger->getHwComposer().getRefreshTimestamp(HWC_DISPLAY_PRIMARY); mTimeStats.setPresentTime(layerName, mCurrentFrameNumber, actualPresentTime); mTimeStats.setPresentTime(layerID, mCurrentFrameNumber, actualPresentTime); mFrameTracker.setActualPresentTime(actualPresentTime); } Loading
services/surfaceflinger/BufferQueueLayer.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -227,6 +227,7 @@ status_t BufferQueueLayer::updateTexImage(bool& recomputeVisibleRegions, nsecs_t // BufferItem's that weren't actually queued. This can happen in shared // buffer mode. bool queuedBuffer = false; const int32_t layerID = getSequence(); LayerRejecter r(mDrawingState, getCurrentState(), recomputeVisibleRegions, getProducerStickyTransform() != 0, mName.string(), mOverrideScalingMode, getTransformToDisplayInverse(), mFreezeGeometryUpdates); Loading @@ -247,7 +248,7 @@ status_t BufferQueueLayer::updateTexImage(bool& recomputeVisibleRegions, nsecs_t // and return early if (queuedBuffer) { Mutex::Autolock lock(mQueueItemLock); mTimeStats.removeTimeRecord(getName().c_str(), mQueueItems[0].mFrameNumber); mTimeStats.removeTimeRecord(layerID, mQueueItems[0].mFrameNumber); mQueueItems.removeAt(0); mQueuedFrames--; } Loading @@ -261,7 +262,7 @@ status_t BufferQueueLayer::updateTexImage(bool& recomputeVisibleRegions, nsecs_t Mutex::Autolock lock(mQueueItemLock); mQueueItems.clear(); mQueuedFrames = 0; mTimeStats.clearLayerRecord(getName().c_str()); mTimeStats.clearLayerRecord(layerID); } // Once we have hit this state, the shadow queue may no longer Loading @@ -282,14 +283,13 @@ status_t BufferQueueLayer::updateTexImage(bool& recomputeVisibleRegions, nsecs_t // Remove any stale buffers that have been dropped during // updateTexImage while (mQueueItems[0].mFrameNumber != currentFrameNumber) { mTimeStats.removeTimeRecord(getName().c_str(), mQueueItems[0].mFrameNumber); mTimeStats.removeTimeRecord(layerID, mQueueItems[0].mFrameNumber); mQueueItems.removeAt(0); mQueuedFrames--; } const std::string layerName(getName().c_str()); mTimeStats.setAcquireFence(layerName, currentFrameNumber, mQueueItems[0].mFenceTime); mTimeStats.setLatchTime(layerName, currentFrameNumber, latchTime); mTimeStats.setAcquireFence(layerID, currentFrameNumber, mQueueItems[0].mFenceTime); mTimeStats.setLatchTime(layerID, currentFrameNumber, latchTime); mQueueItems.removeAt(0); } Loading
services/surfaceflinger/BufferStateLayer.cpp +12 −10 Original line number Diff line number Diff line Loading @@ -377,6 +377,8 @@ status_t BufferStateLayer::updateTexImage(bool& /*recomputeVisibleRegions*/, nse return NO_ERROR; } const int32_t layerID = getSequence(); // Reject if the layer is invalid uint32_t bufferWidth = s.buffer->width; uint32_t bufferHeight = s.buffer->height; Loading @@ -397,7 +399,7 @@ status_t BufferStateLayer::updateTexImage(bool& /*recomputeVisibleRegions*/, nse ALOGE("[%s] rejecting buffer: " "bufferWidth=%d, bufferHeight=%d, front.active.{w=%d, h=%d}", mName.string(), bufferWidth, bufferHeight, s.active.w, s.active.h); mTimeStats.removeTimeRecord(getName().c_str(), getFrameNumber()); mTimeStats.removeTimeRecord(layerID, getFrameNumber()); return BAD_VALUE; } Loading @@ -405,7 +407,7 @@ status_t BufferStateLayer::updateTexImage(bool& /*recomputeVisibleRegions*/, nse if (SyncFeatures::getInstance().useNativeFenceSync() && releaseFence != Fence::NO_FENCE) { // TODO(alecmouri): Fail somewhere upstream if the fence is invalid. if (!releaseFence->isValid()) { mTimeStats.clearLayerRecord(getName().c_str()); mTimeStats.clearLayerRecord(layerID); return UNKNOWN_ERROR; } Loading @@ -415,7 +417,7 @@ status_t BufferStateLayer::updateTexImage(bool& /*recomputeVisibleRegions*/, nse auto currentStatus = s.acquireFence->getStatus(); if (currentStatus == Fence::Status::Invalid) { ALOGE("Existing fence has invalid state"); mTimeStats.clearLayerRecord(getName().c_str()); mTimeStats.clearLayerRecord(layerID); return BAD_VALUE; } Loading @@ -423,7 +425,7 @@ status_t BufferStateLayer::updateTexImage(bool& /*recomputeVisibleRegions*/, nse if (incomingStatus == Fence::Status::Invalid) { ALOGE("New fence has invalid state"); mDrawingState.acquireFence = releaseFence; mTimeStats.clearLayerRecord(getName().c_str()); mTimeStats.clearLayerRecord(layerID); return BAD_VALUE; } Loading @@ -439,7 +441,7 @@ status_t BufferStateLayer::updateTexImage(bool& /*recomputeVisibleRegions*/, nse // synchronization is broken, the best we can do is hope fences // signal in order so the new fence will act like a union mDrawingState.acquireFence = releaseFence; mTimeStats.clearLayerRecord(getName().c_str()); mTimeStats.clearLayerRecord(layerID); return BAD_VALUE; } mDrawingState.acquireFence = mergedFence; Loading @@ -462,16 +464,16 @@ status_t BufferStateLayer::updateTexImage(bool& /*recomputeVisibleRegions*/, nse // a GL-composited layer) not at all. status_t err = bindTextureImage(); if (err != NO_ERROR) { mTimeStats.clearLayerRecord(getName().c_str()); mTimeStats.clearLayerRecord(layerID); return BAD_VALUE; } } // TODO(marissaw): properly support mTimeStats const std::string layerName(getName().c_str()); mTimeStats.setPostTime(getName().c_str(), getFrameNumber(), latchTime); mTimeStats.setAcquireFence(layerName, getFrameNumber(), getCurrentFenceTime()); mTimeStats.setLatchTime(layerName, getFrameNumber(), latchTime); mTimeStats.setLayerName(layerID, getName().c_str()); mTimeStats.setPostTime(layerID, getFrameNumber(), latchTime); mTimeStats.setAcquireFence(layerID, getFrameNumber(), getCurrentFenceTime()); mTimeStats.setLatchTime(layerID, getFrameNumber(), latchTime); return NO_ERROR; } Loading
services/surfaceflinger/Layer.cpp +22 −32 Original line number Diff line number Diff line Loading @@ -119,20 +119,13 @@ Layer::~Layer() { c->detachLayer(this); } mFrameTracker.logAndResetStats(mName); // The remote sync points are cleared out when we are // removed from current state. Mutex::Autolock lock(mLocalSyncPointMutex); for (auto& point : mRemoteSyncPoints) { point->setTransactionApplied(); } for (auto& point : mLocalSyncPoints) { point->setFrameAvailable(); } abandon(); destroyAllHwcLayers(); mFlinger->onLayerDestroyed(); mFrameTracker.logAndResetStats(mName); } // --------------------------------------------------------------------------- Loading @@ -147,9 +140,10 @@ Layer::~Layer() { void Layer::onLayerDisplayed(const sp<Fence>& /*releaseFence*/) {} void Layer::onRemovedFromCurrentState() { mRemovedFromCurrentState = true; // the layer is removed from SF mCurrentState to mLayersPendingRemoval mPendingRemoval = true; if (mCurrentState.zOrderRelativeOf != nullptr) { sp<Layer> strongRelative = mCurrentState.zOrderRelativeOf.promote(); if (strongRelative != nullptr) { Loading @@ -159,18 +153,19 @@ void Layer::onRemovedFromCurrentState() { mCurrentState.zOrderRelativeOf = nullptr; } // Since we are no longer reachable from CurrentState SurfaceFlinger // will no longer invoke doTransaction for us, and so we will // never finish applying transactions. We signal the sync point // now so that another layer will not become indefinitely // blocked. for (auto& point: mRemoteSyncPoints) { point->setTransactionApplied(); for (const auto& child : mCurrentChildren) { child->onRemovedFromCurrentState(); } } mRemoteSyncPoints.clear(); void Layer::onRemoved() { // the layer is removed from SF mLayersPendingRemoval abandon(); destroyAllHwcLayers(); for (const auto& child : mCurrentChildren) { child->onRemovedFromCurrentState(); child->onRemoved(); } } Loading Loading @@ -233,10 +228,6 @@ void Layer::destroyAllHwcLayers() { } LOG_ALWAYS_FATAL_IF(!getBE().mHwcLayers.empty(), "All hardware composer layers should have been destroyed"); for (const sp<Layer>& child : mDrawingChildren) { child->destroyAllHwcLayers(); } } Rect Layer::getContentCrop() const { Loading Loading @@ -834,9 +825,7 @@ void Layer::pushPendingState() { // If this transaction is waiting on the receipt of a frame, generate a sync // point and send it to the remote layer. // We don't allow installing sync points after we are removed from the current state // as we won't be able to signal our end. if (mCurrentState.barrierLayer_legacy != nullptr && !mRemovedFromCurrentState) { if (mCurrentState.barrierLayer_legacy != nullptr) { sp<Layer> barrierLayer = mCurrentState.barrierLayer_legacy.promote(); if (barrierLayer == nullptr) { ALOGE("[%s] Unable to promote barrier Layer.", mName.string()); Loading Loading @@ -1481,14 +1470,15 @@ void Layer::dumpFrameEvents(String8& result) { void Layer::onDisconnect() { Mutex::Autolock lock(mFrameEventHistoryMutex); mFrameEventHistory.onDisconnect(); mTimeStats.onDisconnect(getName().c_str()); mTimeStats.onDisconnect(getSequence()); } void Layer::addAndGetFrameTimestamps(const NewFrameEventsEntry* newTimestamps, FrameEventHistoryDelta* outDelta) { if (newTimestamps) { mTimeStats.setPostTime(getName().c_str(), newTimestamps->frameNumber, newTimestamps->postedTime); const int32_t layerID = getSequence(); mTimeStats.setLayerName(layerID, getName().c_str()); mTimeStats.setPostTime(layerID, newTimestamps->frameNumber, newTimestamps->postedTime); } Mutex::Autolock lock(mFrameEventHistoryMutex); Loading
services/surfaceflinger/Layer.h +10 −6 Original line number Diff line number Diff line Loading @@ -346,7 +346,7 @@ public: virtual bool isCreatedFromMainThread() const { return false; } bool isRemovedFromCurrentState() const { return mRemovedFromCurrentState; } bool isPendingRemoval() const { return mPendingRemoval; } void writeToProto(LayerProto* layerInfo, LayerVector::StateSet stateSet = LayerVector::StateSet::Drawing); Loading Loading @@ -475,6 +475,12 @@ public: */ void onRemovedFromCurrentState(); /* * called with the state lock from the main thread when the layer is * removed from the pending removal list */ void onRemoved(); // Updates the transform hint in our SurfaceFlingerConsumer to match // the current orientation of the display device. void updateTransformHint(const sp<const DisplayDevice>& display) const; Loading Loading @@ -589,12 +595,12 @@ protected: */ class LayerCleaner { sp<SurfaceFlinger> mFlinger; sp<Layer> mLayer; wp<Layer> mLayer; protected: ~LayerCleaner() { // destroy client resources mFlinger->onHandleDestroyed(mLayer); mFlinger->onLayerDestroyed(mLayer); } public: Loading Loading @@ -696,8 +702,6 @@ public: virtual PixelFormat getPixelFormat() const { return PIXEL_FORMAT_NONE; } bool getPremultipledAlpha() const; bool mPendingHWCDestroy{false}; protected: // ----------------------------------------------------------------------- bool usingRelativeZ(LayerVector::StateSet stateSet); Loading Loading @@ -741,7 +745,7 @@ protected: // Whether filtering is needed b/c of the drawingstate bool mNeedsFiltering{false}; bool mRemovedFromCurrentState{false}; bool mPendingRemoval{false}; // page-flip thread (currently main thread) bool mProtectedByApp{false}; // application requires protected path to external sink Loading