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

Commit 5d3ebbfa authored by Peiyong Lin's avatar Peiyong Lin Committed by Android (Google) Code Review
Browse files

Merge "[SurfaceFlinger] Checking nullptr for HWC layer."

parents 3addae6d 91b1df2f
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -613,6 +613,11 @@ void BufferLayer::setPerFrameData(const sp<const DisplayDevice>& display) {
    const auto& viewport = display->getViewport();
    Region visible = tr.transform(visibleRegion.intersect(viewport));
    const auto displayId = display->getId();
    if (!hasHwcLayer(displayId)) {
        ALOGE("[%s] failed to setPerFrameData: no HWC layer found (%d)",
              mName.string(), displayId);
        return;
    }
    auto& hwcInfo = getBE().mHwcLayers[displayId];
    auto& hwcLayer = hwcInfo.layer;
    auto error = hwcLayer->setVisibleRegion(visible);
@@ -667,8 +672,7 @@ void BufferLayer::setPerFrameData(const sp<const DisplayDevice>& display) {

    uint32_t hwcSlot = 0;
    sp<GraphicBuffer> hwcBuffer;
    getBE().mHwcLayers[displayId].bufferCache.getHwcBuffer(mActiveBufferSlot, mActiveBuffer,
                                                           &hwcSlot, &hwcBuffer);
    hwcInfo.bufferCache.getHwcBuffer(mActiveBufferSlot, mActiveBuffer, &hwcSlot, &hwcBuffer);

    auto acquireFence = mConsumer->getCurrentFence();
    error = hwcLayer->setBuffer(hwcSlot, hwcBuffer, acquireFence);
+5 −0
Original line number Diff line number Diff line
@@ -66,6 +66,11 @@ void ColorLayer::setPerFrameData(const sp<const DisplayDevice>& display) {
    const auto& viewport = display->getViewport();
    Region visible = tr.transform(visibleRegion.intersect(viewport));
    const auto displayId = display->getId();
    if (!hasHwcLayer(displayId)) {
        ALOGE("[%s] failed to setPerFrameData: no HWC layer found (%d)",
              mName.string(), displayId);
        return;
    }
    auto& hwcInfo = getBE().mHwcLayers[displayId];
    auto& hwcLayer = hwcInfo.layer;
    auto error = hwcLayer->setVisibleRegion(visible);
+9 −0
Original line number Diff line number Diff line
@@ -482,6 +482,11 @@ FloatRect Layer::computeCrop(const sp<const DisplayDevice>& hw) const {

void Layer::setGeometry(const sp<const DisplayDevice>& display, uint32_t z) {
    const auto displayId = display->getId();
    if (!hasHwcLayer(displayId)) {
        ALOGE("[%s] failed to setGeometry: no HWC layer found (%d)",
              mName.string(), displayId);
        return;
    }
    auto& hwcInfo = getBE().mHwcLayers[displayId];

    // enable this layer
@@ -1980,6 +1985,10 @@ void Layer::writeToProto(LayerProto* layerInfo, LayerVector::StateSet stateSet)
}

void Layer::writeToProto(LayerProto* layerInfo, int32_t displayId) {
    if (!hasHwcLayer(displayId)) {
        return;
    }

    writeToProto(layerInfo, LayerVector::StateSet::Drawing);

    const auto& hwcInfo = getBE().mHwcLayers.at(displayId);