Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d45b96e2 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[SurfaceFlinger] Add hwc information to winscope:" into rvc-dev

parents 44f05ea6 6b9e9918
Loading
Loading
Loading
Loading
+17 −5
Original line number Diff line number Diff line
@@ -719,9 +719,14 @@ std::vector<compositionengine::LayerFE::LayerSettings> Layer::prepareClientCompo
Hwc2::IComposerClient::Composition Layer::getCompositionType(
        const sp<const DisplayDevice>& display) const {
    const auto outputLayer = findOutputLayerForDisplay(display);
    LOG_FATAL_IF(!outputLayer);
    return outputLayer->getState().hwc ? (*outputLayer->getState().hwc).hwcCompositionType
                                       : Hwc2::IComposerClient::Composition::CLIENT;
    if (outputLayer == nullptr) {
        return Hwc2::IComposerClient::Composition::INVALID;
    }
    if (outputLayer->getState().hwc) {
        return (*outputLayer->getState().hwc).hwcCompositionType;
    } else {
        return Hwc2::IComposerClient::Composition::CLIENT;
    }
}

bool Layer::getClearClientTarget(const sp<const DisplayDevice>& display) const {
@@ -2052,13 +2057,20 @@ void Layer::setInputInfo(const InputWindowInfo& info) {
    setTransactionFlags(eTransactionNeeded);
}

LayerProto* Layer::writeToProto(LayersProto& layersProto, uint32_t traceFlags) const {
LayerProto* Layer::writeToProto(LayersProto& layersProto, uint32_t traceFlags,
                                const sp<const DisplayDevice>& device) const {
    LayerProto* layerProto = layersProto.add_layers();
    writeToProtoDrawingState(layerProto, traceFlags);
    writeToProtoCommonState(layerProto, LayerVector::StateSet::Drawing, traceFlags);

    // Only populate for the primary display.
    if (device) {
        const Hwc2::IComposerClient::Composition compositionType = getCompositionType(device);
        layerProto->set_hwc_composition_type(static_cast<HwcCompositionType>(compositionType));
    }

    for (const sp<Layer>& layer : mDrawingChildren) {
        layer->writeToProto(layersProto, traceFlags);
        layer->writeToProto(layersProto, traceFlags, device);
    }

    return layerProto;
+2 −1
Original line number Diff line number Diff line
@@ -506,7 +506,8 @@ public:
    bool isRemovedFromCurrentState() const;

    LayerProto* writeToProto(LayersProto& layersProto,
                             uint32_t traceFlags = SurfaceTracing::TRACE_ALL) const;
                             uint32_t traceFlags = SurfaceTracing::TRACE_ALL,
                             const sp<const DisplayDevice>& device = nullptr) const;

    // 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
+10 −2
Original line number Diff line number Diff line
@@ -4450,13 +4450,20 @@ void SurfaceFlinger::dumpWideColorInfo(std::string& result) const {
}

LayersProto SurfaceFlinger::dumpDrawingStateProto(uint32_t traceFlags) const {
    Mutex::Autolock _l(mStateLock);
    const auto device = getDefaultDisplayDeviceLocked();
    LayersProto layersProto;
    for (const sp<Layer>& layer : mDrawingState.layersSortedByZ) {
        layer->writeToProto(layersProto, traceFlags);
        layer->writeToProto(layersProto, traceFlags, device);
    }

    return layersProto;
}

void SurfaceFlinger::dumpHwc(std::string& result) const {
    getHwComposer().dump(result);
}

void SurfaceFlinger::dumpOffscreenLayersProto(LayersProto& layersProto, uint32_t traceFlags) const {
    // Add a fake invisible root layer to the proto output and parent all the offscreen layers to
    // it.
@@ -4471,7 +4478,8 @@ void SurfaceFlinger::dumpOffscreenLayersProto(LayersProto& layersProto, uint32_t
        rootProto->add_children(offscreenLayer->sequence);

        // Add layer
        LayerProto* layerProto = offscreenLayer->writeToProto(layersProto, traceFlags);
        LayerProto* layerProto =
                offscreenLayer->writeToProto(layersProto, traceFlags, nullptr /*device*/);
        layerProto->set_parent(offscreenRootLayerId);
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -921,6 +921,8 @@ private:
    LayersProto dumpDrawingStateProto(uint32_t traceFlags = SurfaceTracing::TRACE_ALL) const;
    void dumpOffscreenLayersProto(LayersProto& layersProto,
                                  uint32_t traceFlags = SurfaceTracing::TRACE_ALL) const;
    // Dumps state from HW Composer
    void dumpHwc(std::string& result) const;
    LayersProto dumpProtoFromMainThread(uint32_t traceFlags = SurfaceTracing::TRACE_ALL)
            EXCLUDES(mStateLock);
    void dumpOffscreenLayers(std::string& result) EXCLUDES(mStateLock);
+6 −0
Original line number Diff line number Diff line
@@ -170,6 +170,12 @@ LayersTraceProto SurfaceTracing::traceLayersLocked(const char* where) {
    mFlinger.dumpOffscreenLayersProto(layers);
    entry.mutable_layers()->Swap(&layers);

    if (mTraceFlags & SurfaceTracing::TRACE_HWC) {
        std::string hwcDump;
        mFlinger.dumpHwc(hwcDump);
        entry.set_hwc_blob(hwcDump);
    }

    return entry;
}

Loading