diff options
-rw-r--r-- | libs/gui/ISurfaceComposer.cpp | 2 | ||||
-rw-r--r-- | libs/gui/include/gui/ISurfaceComposer.h | 2 | ||||
-rw-r--r-- | libs/gui/tests/Surface_test.cpp | 2 | ||||
-rw-r--r-- | services/surfaceflinger/Layer.cpp | 2 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 19 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.h | 2 |
6 files changed, 11 insertions, 18 deletions
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp index 81c7f9c57c..ce71d3cd21 100644 --- a/libs/gui/ISurfaceComposer.cpp +++ b/libs/gui/ISurfaceComposer.cpp @@ -509,7 +509,7 @@ public: return result; } - virtual status_t getLayerDebugInfo(std::vector<LayerDebugInfo>* outLayers) const + virtual status_t getLayerDebugInfo(std::vector<LayerDebugInfo>* outLayers) { if (!outLayers) { return UNEXPECTED_NULL; diff --git a/libs/gui/include/gui/ISurfaceComposer.h b/libs/gui/include/gui/ISurfaceComposer.h index a672ce4ed8..2ab0d99597 100644 --- a/libs/gui/include/gui/ISurfaceComposer.h +++ b/libs/gui/include/gui/ISurfaceComposer.h @@ -225,7 +225,7 @@ public: * * Requires the ACCESS_SURFACE_FLINGER permission. */ - virtual status_t getLayerDebugInfo(std::vector<LayerDebugInfo>* outLayers) const = 0; + virtual status_t getLayerDebugInfo(std::vector<LayerDebugInfo>* outLayers) = 0; }; // ---------------------------------------------------------------------------- diff --git a/libs/gui/tests/Surface_test.cpp b/libs/gui/tests/Surface_test.cpp index 4effd653b8..a0ecb4c149 100644 --- a/libs/gui/tests/Surface_test.cpp +++ b/libs/gui/tests/Surface_test.cpp @@ -622,7 +622,7 @@ public: return NO_ERROR; } status_t injectVSync(nsecs_t /*when*/) override { return NO_ERROR; } - status_t getLayerDebugInfo(std::vector<LayerDebugInfo>* /*layers*/) const override { + status_t getLayerDebugInfo(std::vector<LayerDebugInfo>* /*layers*/) override { return NO_ERROR; } diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 220da1d40e..edd946db0f 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -1402,7 +1402,7 @@ LayerDebugInfo Layer::getLayerDebugInfo() const { LayerDebugInfo info; const Layer::State& ds = getDrawingState(); info.mName = getName(); - sp<Layer> parent = getParent(); + sp<Layer> parent = mDrawingParent.promote(); info.mParentName = (parent == nullptr ? std::string("none") : parent->getName().string()); info.mType = String8(getTypeId()); info.mTransparentRegion = ds.activeTransparentRegion; diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 7360306d12..ba203bd176 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -1184,7 +1184,7 @@ status_t SurfaceFlinger::injectVSync(nsecs_t when) { return NO_ERROR; } -status_t SurfaceFlinger::getLayerDebugInfo(std::vector<LayerDebugInfo>* outLayers) const +status_t SurfaceFlinger::getLayerDebugInfo(std::vector<LayerDebugInfo>* outLayers) NO_THREAD_SAFETY_ANALYSIS { IPCThreadState* ipc = IPCThreadState::self(); const int pid = ipc->getCallingPid(); @@ -1195,20 +1195,13 @@ status_t SurfaceFlinger::getLayerDebugInfo(std::vector<LayerDebugInfo>* outLayer return PERMISSION_DENIED; } - // Try to acquire a lock for 1s, fail gracefully - const status_t err = mStateLock.timedLock(s2ns(1)); - const bool locked = (err == NO_ERROR); - if (!locked) { - ALOGE("LayerDebugInfo: SurfaceFlinger unresponsive (%s [%d]) - exit", strerror(-err), err); - return TIMED_OUT; - } - outLayers->clear(); - mCurrentState.traverseInZOrder([&](Layer* layer) { - outLayers->push_back(layer->getLayerDebugInfo()); - }); + postMessageSync(new LambdaMessage([&]() { + mDrawingState.traverseInZOrder([&](Layer* layer) { + outLayers->push_back(layer->getLayerDebugInfo()); + }); - mStateLock.unlock(); + })); return NO_ERROR; } diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index c7555c31d2..3fbc1e7da8 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -447,7 +447,7 @@ private: HdrCapabilities* outCapabilities) const; virtual status_t enableVSyncInjections(bool enable); virtual status_t injectVSync(nsecs_t when); - virtual status_t getLayerDebugInfo(std::vector<LayerDebugInfo>* outLayers) const; + virtual status_t getLayerDebugInfo(std::vector<LayerDebugInfo>* outLayers); /* ------------------------------------------------------------------------ |