Loading services/surfaceflinger/Layer.cpp +7 −4 Original line number Original line Diff line number Diff line Loading @@ -2127,7 +2127,9 @@ LayerProto* Layer::writeToProto(LayersProto& layersProto, uint32_t traceFlags) { writeToProtoCommonState(layerProto, LayerVector::StateSet::Drawing, traceFlags); writeToProtoCommonState(layerProto, LayerVector::StateSet::Drawing, traceFlags); if (traceFlags & LayerTracing::TRACE_COMPOSITION) { if (traceFlags & LayerTracing::TRACE_COMPOSITION) { writeCompositionStateToProto(layerProto); ui::LayerStack layerStack = (mSnapshot) ? mSnapshot->outputFilter.layerStack : ui::INVALID_LAYER_STACK; writeCompositionStateToProto(layerProto, layerStack); } } for (const sp<Layer>& layer : mDrawingChildren) { for (const sp<Layer>& layer : mDrawingChildren) { Loading @@ -2137,14 +2139,15 @@ LayerProto* Layer::writeToProto(LayersProto& layersProto, uint32_t traceFlags) { return layerProto; return layerProto; } } void Layer::writeCompositionStateToProto(LayerProto* layerProto) { void Layer::writeCompositionStateToProto(LayerProto* layerProto, ui::LayerStack layerStack) { ftl::FakeGuard guard(mFlinger->mStateLock); // Called from the main thread. ftl::FakeGuard guard(mFlinger->mStateLock); // Called from the main thread. ftl::FakeGuard mainThreadGuard(kMainThreadContext); // Only populate for the primary display. // Only populate for the primary display. if (const auto display = mFlinger->getDefaultDisplayDeviceLocked()) { if (const auto display = mFlinger->getDisplayFromLayerStack(layerStack)) { const auto compositionType = getCompositionType(*display); const auto compositionType = getCompositionType(*display); layerProto->set_hwc_composition_type(static_cast<HwcCompositionType>(compositionType)); layerProto->set_hwc_composition_type(static_cast<HwcCompositionType>(compositionType)); LayerProtoHelper::writeToProto(getVisibleRegion(display.get()), LayerProtoHelper::writeToProto(getVisibleRegion(display), [&]() { return layerProto->mutable_visible_region(); }); [&]() { return layerProto->mutable_visible_region(); }); } } } } Loading services/surfaceflinger/Layer.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -611,7 +611,7 @@ public: bool isRemovedFromCurrentState() const; bool isRemovedFromCurrentState() const; LayerProto* writeToProto(LayersProto& layersProto, uint32_t traceFlags); LayerProto* writeToProto(LayersProto& layersProto, uint32_t traceFlags); void writeCompositionStateToProto(LayerProto* layerProto); void writeCompositionStateToProto(LayerProto* layerProto, ui::LayerStack layerStack); // Write states that are modified by the main thread. This includes drawing // Write states that are modified by the main thread. This includes drawing // state as well as buffer data. This should be called in the main or tracing // state as well as buffer data. This should be called in the main or tracing Loading services/surfaceflinger/LayerProtoHelper.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -332,7 +332,7 @@ void LayerProtoFromSnapshotGenerator::writeHierarchyToProto( if (mTraceFlags & LayerTracing::TRACE_COMPOSITION) { if (mTraceFlags & LayerTracing::TRACE_COMPOSITION) { auto it = mLegacyLayers.find(layer.id); auto it = mLegacyLayers.find(layer.id); if (it != mLegacyLayers.end()) { if (it != mLegacyLayers.end()) { it->second->writeCompositionStateToProto(layerProto); it->second->writeCompositionStateToProto(layerProto, snapshot->outputFilter.layerStack); } } } } Loading services/surfaceflinger/SurfaceFlinger.cpp +9 −0 Original line number Original line Diff line number Diff line Loading @@ -8968,6 +8968,15 @@ void SurfaceFlinger::forceFutureUpdate(int delayInMs) { static_cast<void>(mScheduler->scheduleDelayed([&]() { scheduleRepaint(); }, ms2ns(delayInMs))); static_cast<void>(mScheduler->scheduleDelayed([&]() { scheduleRepaint(); }, ms2ns(delayInMs))); } } const DisplayDevice* SurfaceFlinger::getDisplayFromLayerStack(ui::LayerStack layerStack) { for (const auto& [_, display] : mDisplays) { if (display->getLayerStack() == layerStack) { return display.get(); } } return nullptr; } } // namespace android } // namespace android #if defined(__gl_h_) #if defined(__gl_h_) Loading services/surfaceflinger/SurfaceFlinger.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -328,6 +328,8 @@ public: bool mIgnoreHwcPhysicalDisplayOrientation = false; bool mIgnoreHwcPhysicalDisplayOrientation = false; void forceFutureUpdate(int delayInMs); void forceFutureUpdate(int delayInMs); const DisplayDevice* getDisplayFromLayerStack(ui::LayerStack) REQUIRES(mStateLock, kMainThreadContext); protected: protected: // We're reference counted, never destroy SurfaceFlinger directly // We're reference counted, never destroy SurfaceFlinger directly Loading Loading
services/surfaceflinger/Layer.cpp +7 −4 Original line number Original line Diff line number Diff line Loading @@ -2127,7 +2127,9 @@ LayerProto* Layer::writeToProto(LayersProto& layersProto, uint32_t traceFlags) { writeToProtoCommonState(layerProto, LayerVector::StateSet::Drawing, traceFlags); writeToProtoCommonState(layerProto, LayerVector::StateSet::Drawing, traceFlags); if (traceFlags & LayerTracing::TRACE_COMPOSITION) { if (traceFlags & LayerTracing::TRACE_COMPOSITION) { writeCompositionStateToProto(layerProto); ui::LayerStack layerStack = (mSnapshot) ? mSnapshot->outputFilter.layerStack : ui::INVALID_LAYER_STACK; writeCompositionStateToProto(layerProto, layerStack); } } for (const sp<Layer>& layer : mDrawingChildren) { for (const sp<Layer>& layer : mDrawingChildren) { Loading @@ -2137,14 +2139,15 @@ LayerProto* Layer::writeToProto(LayersProto& layersProto, uint32_t traceFlags) { return layerProto; return layerProto; } } void Layer::writeCompositionStateToProto(LayerProto* layerProto) { void Layer::writeCompositionStateToProto(LayerProto* layerProto, ui::LayerStack layerStack) { ftl::FakeGuard guard(mFlinger->mStateLock); // Called from the main thread. ftl::FakeGuard guard(mFlinger->mStateLock); // Called from the main thread. ftl::FakeGuard mainThreadGuard(kMainThreadContext); // Only populate for the primary display. // Only populate for the primary display. if (const auto display = mFlinger->getDefaultDisplayDeviceLocked()) { if (const auto display = mFlinger->getDisplayFromLayerStack(layerStack)) { const auto compositionType = getCompositionType(*display); const auto compositionType = getCompositionType(*display); layerProto->set_hwc_composition_type(static_cast<HwcCompositionType>(compositionType)); layerProto->set_hwc_composition_type(static_cast<HwcCompositionType>(compositionType)); LayerProtoHelper::writeToProto(getVisibleRegion(display.get()), LayerProtoHelper::writeToProto(getVisibleRegion(display), [&]() { return layerProto->mutable_visible_region(); }); [&]() { return layerProto->mutable_visible_region(); }); } } } } Loading
services/surfaceflinger/Layer.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -611,7 +611,7 @@ public: bool isRemovedFromCurrentState() const; bool isRemovedFromCurrentState() const; LayerProto* writeToProto(LayersProto& layersProto, uint32_t traceFlags); LayerProto* writeToProto(LayersProto& layersProto, uint32_t traceFlags); void writeCompositionStateToProto(LayerProto* layerProto); void writeCompositionStateToProto(LayerProto* layerProto, ui::LayerStack layerStack); // Write states that are modified by the main thread. This includes drawing // Write states that are modified by the main thread. This includes drawing // state as well as buffer data. This should be called in the main or tracing // state as well as buffer data. This should be called in the main or tracing Loading
services/surfaceflinger/LayerProtoHelper.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -332,7 +332,7 @@ void LayerProtoFromSnapshotGenerator::writeHierarchyToProto( if (mTraceFlags & LayerTracing::TRACE_COMPOSITION) { if (mTraceFlags & LayerTracing::TRACE_COMPOSITION) { auto it = mLegacyLayers.find(layer.id); auto it = mLegacyLayers.find(layer.id); if (it != mLegacyLayers.end()) { if (it != mLegacyLayers.end()) { it->second->writeCompositionStateToProto(layerProto); it->second->writeCompositionStateToProto(layerProto, snapshot->outputFilter.layerStack); } } } } Loading
services/surfaceflinger/SurfaceFlinger.cpp +9 −0 Original line number Original line Diff line number Diff line Loading @@ -8968,6 +8968,15 @@ void SurfaceFlinger::forceFutureUpdate(int delayInMs) { static_cast<void>(mScheduler->scheduleDelayed([&]() { scheduleRepaint(); }, ms2ns(delayInMs))); static_cast<void>(mScheduler->scheduleDelayed([&]() { scheduleRepaint(); }, ms2ns(delayInMs))); } } const DisplayDevice* SurfaceFlinger::getDisplayFromLayerStack(ui::LayerStack layerStack) { for (const auto& [_, display] : mDisplays) { if (display->getLayerStack() == layerStack) { return display.get(); } } return nullptr; } } // namespace android } // namespace android #if defined(__gl_h_) #if defined(__gl_h_) Loading
services/surfaceflinger/SurfaceFlinger.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -328,6 +328,8 @@ public: bool mIgnoreHwcPhysicalDisplayOrientation = false; bool mIgnoreHwcPhysicalDisplayOrientation = false; void forceFutureUpdate(int delayInMs); void forceFutureUpdate(int delayInMs); const DisplayDevice* getDisplayFromLayerStack(ui::LayerStack) REQUIRES(mStateLock, kMainThreadContext); protected: protected: // We're reference counted, never destroy SurfaceFlinger directly // We're reference counted, never destroy SurfaceFlinger directly Loading