Merge "Call Layer::getLayerDebugInfo from the main thread" into rvc-dev am: 32ca5feb99

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/11760023

Change-Id: Ia0d1652beeecc5d5c60e65fe9f4241b3f5b7a757
This commit is contained in:
Vishnu Nair 2020-06-08 21:36:10 +00:00 committed by Automerger Merge Worker
commit 4225e7f1d5
6 changed files with 12 additions and 16 deletions

View file

@ -691,8 +691,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;
}

View file

@ -354,7 +354,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;
virtual status_t getColorManagement(bool* outGetColorManagement) const = 0;

View file

@ -785,7 +785,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;
}
status_t getCompositionPreference(

View file

@ -1501,7 +1501,7 @@ LayerDebugInfo Layer::getLayerDebugInfo(const DisplayDevice* display) const {
LayerDebugInfo info;
const State& ds = getDrawingState();
info.mName = getName();
sp<Layer> parent = getParent();
sp<Layer> parent = mDrawingParent.promote();
info.mParentName = parent ? parent->getName() : "none"s;
info.mType = getType();
info.mTransparentRegion = ds.activeTransparentRegion_legacy;

View file

@ -1449,17 +1449,14 @@ status_t SurfaceFlinger::injectVSync(nsecs_t when) {
return mScheduler->injectVSync(when, calculateExpectedPresentTime(when)) ? NO_ERROR : BAD_VALUE;
}
status_t SurfaceFlinger::getLayerDebugInfo(std::vector<LayerDebugInfo>* outLayers) const {
TimedLock lock(mStateLock, s2ns(1), __FUNCTION__);
if (!lock.locked()) {
return TIMED_OUT;
}
const auto display = getDefaultDisplayDeviceLocked();
status_t SurfaceFlinger::getLayerDebugInfo(std::vector<LayerDebugInfo>* outLayers) {
outLayers->clear();
mCurrentState.traverseInZOrder(
[&](Layer* layer) { outLayers->push_back(layer->getLayerDebugInfo(display.get())); });
schedule([=] {
const auto display = ON_MAIN_THREAD(getDefaultDisplayDeviceLocked());
mDrawingState.traverseInZOrder([&](Layer* layer) {
outLayers->push_back(layer->getLayerDebugInfo(display.get()));
});
}).wait();
return NO_ERROR;
}

View file

@ -466,7 +466,7 @@ private:
HdrCapabilities* outCapabilities) const override;
status_t enableVSyncInjections(bool enable) override;
status_t injectVSync(nsecs_t when) override;
status_t getLayerDebugInfo(std::vector<LayerDebugInfo>* outLayers) const override;
status_t getLayerDebugInfo(std::vector<LayerDebugInfo>* outLayers) override;
status_t getColorManagement(bool* outGetColorManagement) const override;
status_t getCompositionPreference(ui::Dataspace* outDataspace, ui::PixelFormat* outPixelFormat,
ui::Dataspace* outWideColorGamutDataspace,