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

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

Merge changes I9b7de789,I02845405

* changes:
  SF: Update CompositionInfo during calculation
  SF: Make message refresh loop over displays
parents 3b80b4f1 ba34049d
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -275,6 +275,7 @@ void BufferLayer::setPerFrameData(const sp<const DisplayDevice>& display) {
              to_string(error).c_str(), static_cast<int32_t>(error));
        visible.dump(LOG_TAG);
    }
    getBE().compositionInfo.hwc.visibleRegion = visible;

    error = hwcLayer->setSurfaceDamage(surfaceDamageRegion);
    if (error != HWC2::Error::None) {
@@ -282,6 +283,7 @@ void BufferLayer::setPerFrameData(const sp<const DisplayDevice>& display) {
              to_string(error).c_str(), static_cast<int32_t>(error));
        surfaceDamageRegion.dump(LOG_TAG);
    }
    getBE().compositionInfo.hwc.surfaceDamage = surfaceDamageRegion;

    // Sideband layers
    if (getBE().compositionInfo.hwc.sidebandStream.get()) {
@@ -293,6 +295,7 @@ void BufferLayer::setPerFrameData(const sp<const DisplayDevice>& display) {
                  getBE().compositionInfo.hwc.sidebandStream->handle(), to_string(error).c_str(),
                  static_cast<int32_t>(error));
        }
        getBE().compositionInfo.compositionType = HWC2::Composition::Sideband;
        return;
    }

@@ -318,6 +321,9 @@ void BufferLayer::setPerFrameData(const sp<const DisplayDevice>& display) {
        ALOGE("[%s] Failed to set hdrMetadata: %s (%d)", mName.string(),
              to_string(error).c_str(), static_cast<int32_t>(error));
    }
    getBE().compositionInfo.hwc.dataspace = mCurrentDataSpace;
    getBE().compositionInfo.hwc.hdrMetadata = getDrawingHdrMetadata();
    getBE().compositionInfo.hwc.supportedPerFrameMetadata = display->getSupportedPerFrameMetadata();

    setHwcLayerBuffer(display);
}
+3 −0
Original line number Diff line number Diff line
@@ -353,6 +353,9 @@ void BufferQueueLayer::setHwcLayerBuffer(const sp<const DisplayDevice>& display)
              getBE().compositionInfo.mBuffer->handle, to_string(error).c_str(),
              static_cast<int32_t>(error));
    }
    getBE().compositionInfo.mBufferSlot = mActiveBufferSlot;
    getBE().compositionInfo.mBuffer = mActiveBuffer;
    getBE().compositionInfo.hwc.fence = acquireFence;
}

// -----------------------------------------------------------------------
+6 −0
Original line number Diff line number Diff line
@@ -89,6 +89,7 @@ void ColorLayer::setPerFrameData(const sp<const DisplayDevice>& display) {
              to_string(error).c_str(), static_cast<int32_t>(error));
        visible.dump(LOG_TAG);
    }
    getBE().compositionInfo.hwc.visibleRegion = visible;

    setCompositionType(displayId, HWC2::Composition::SolidColor);

@@ -97,6 +98,7 @@ void ColorLayer::setPerFrameData(const sp<const DisplayDevice>& display) {
        ALOGE("[%s] Failed to set dataspace %d: %s (%d)", mName.string(), mCurrentDataSpace,
              to_string(error).c_str(), static_cast<int32_t>(error));
    }
    getBE().compositionInfo.hwc.dataspace = mCurrentDataSpace;

    half4 color = getColor();
    error = hwcLayer->setColor({static_cast<uint8_t>(std::round(255.0f * color.r)),
@@ -106,6 +108,9 @@ void ColorLayer::setPerFrameData(const sp<const DisplayDevice>& display) {
        ALOGE("[%s] Failed to set color: %s (%d)", mName.string(), to_string(error).c_str(),
              static_cast<int32_t>(error));
    }
    getBE().compositionInfo.hwc.color = { static_cast<uint8_t>(std::round(255.0f * color.r)),
                                      static_cast<uint8_t>(std::round(255.0f * color.g)),
                                      static_cast<uint8_t>(std::round(255.0f * color.b)), 255 };

    // Clear out the transform, because it doesn't make sense absent a source buffer
    error = hwcLayer->setTransform(HWC2::Transform::None);
@@ -113,6 +118,7 @@ void ColorLayer::setPerFrameData(const sp<const DisplayDevice>& display) {
        ALOGE("[%s] Failed to clear transform: %s (%d)", mName.string(), to_string(error).c_str(),
              static_cast<int32_t>(error));
    }
    getBE().compositionInfo.hwc.transform = HWC2::Transform::None;
}

// ---------------------------------------------------------------------------
+10 −0
Original line number Diff line number Diff line
@@ -516,6 +516,7 @@ void Layer::setGeometry(const sp<const DisplayDevice>& display, uint32_t z) {
             " %s (%d)",
             mName.string(), to_string(blendMode).c_str(), to_string(error).c_str(),
             static_cast<int32_t>(error));
    getBE().compositionInfo.hwc.blendMode = blendMode;

    // apply the layer's transform, followed by the display's global transform
    // here we're guaranteed that the layer's transform preserves rects
@@ -568,6 +569,7 @@ void Layer::setGeometry(const sp<const DisplayDevice>& display, uint32_t z) {
    } else {
        hwcInfo.displayFrame = transformedFrame;
    }
    getBE().compositionInfo.hwc.displayFrame = transformedFrame;

    FloatRect sourceCrop = computeCrop(display);
    error = hwcLayer->setSourceCrop(sourceCrop);
@@ -579,6 +581,7 @@ void Layer::setGeometry(const sp<const DisplayDevice>& display, uint32_t z) {
    } else {
        hwcInfo.sourceCrop = sourceCrop;
    }
    getBE().compositionInfo.hwc.sourceCrop = sourceCrop;

    float alpha = static_cast<float>(getAlpha());
    error = hwcLayer->setPlaneAlpha(alpha);
@@ -586,10 +589,12 @@ void Layer::setGeometry(const sp<const DisplayDevice>& display, uint32_t z) {
             "[%s] Failed to set plane alpha %.3f: "
             "%s (%d)",
             mName.string(), alpha, to_string(error).c_str(), static_cast<int32_t>(error));
    getBE().compositionInfo.hwc.alpha = alpha;

    error = hwcLayer->setZOrder(z);
    ALOGE_IF(error != HWC2::Error::None, "[%s] Failed to set Z %u: %s (%d)", mName.string(), z,
             to_string(error).c_str(), static_cast<int32_t>(error));
    getBE().compositionInfo.hwc.z = z;

    int type = s.type;
    int appId = s.appId;
@@ -606,6 +611,9 @@ void Layer::setGeometry(const sp<const DisplayDevice>& display, uint32_t z) {
    ALOGE_IF(error != HWC2::Error::None, "[%s] Failed to set info (%d)", mName.string(),
             static_cast<int32_t>(error));

    getBE().compositionInfo.hwc.type = type;
    getBE().compositionInfo.hwc.appId = appId;

    /*
     * Transformations are applied in this order:
     * 1) buffer orientation/flip/mirror
@@ -642,6 +650,7 @@ void Layer::setGeometry(const sp<const DisplayDevice>& display, uint32_t z) {
    if (orientation & ui::Transform::ROT_INVALID) {
        // we can only handle simple transformation
        hwcInfo.forceClientComposition = true;
        getBE().mHwcLayers[displayId].compositionType = HWC2::Composition::Client;
    } else {
        auto transform = static_cast<HWC2::Transform>(orientation);
        hwcInfo.transform = transform;
@@ -651,6 +660,7 @@ void Layer::setGeometry(const sp<const DisplayDevice>& display, uint32_t z) {
                 "%s (%d)",
                 mName.string(), to_string(transform).c_str(), to_string(error).c_str(),
                 static_cast<int32_t>(error));
        getBE().compositionInfo.hwc.transform = transform;
    }
}

+8 −0
Original line number Diff line number Diff line
@@ -513,6 +513,14 @@ public:
        return getBE().mHwcLayers[displayId].layer.get();
    }

    bool setHwcLayer(int32_t hwcId) {
        if (getBE().mHwcLayers.count(hwcId) == 0) {
            return false;
        }
        getBE().compositionInfo.hwc.hwcLayer = getBE().mHwcLayers[hwcId].layer;
        return true;
    }

    // -----------------------------------------------------------------------

    void clearWithOpenGL(const RenderArea& renderArea) const;
Loading