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

Commit fb95bcca authored by David Sodman's avatar David Sodman
Browse files

SF: Use compositionInfo after HWC changedTypes

Bug: 112259502
Test: cts -m CtsViewTestCases
      SurfaceFlinger_test
      vrflinger_test

Change-Id: I908f439eedfab9ee8241f8ac594465527f93408a
parent 04c1e67e
Loading
Loading
Loading
Loading
+1 −20
Original line number Diff line number Diff line
@@ -138,8 +138,6 @@ void BufferLayer::onDraw(const RenderArea& renderArea, const Region& clip,
                         bool useIdentityTransform) {
    ATRACE_CALL();

    CompositionInfo& compositionInfo = getBE().compositionInfo;

    if (CC_UNLIKELY(mActiveBuffer == 0)) {
        // the texture has not been created yet, this Layer has
        // in fact never been drawn into. This happens frequently with
@@ -221,7 +219,6 @@ void BufferLayer::onDraw(const RenderArea& renderArea, const Region& clip,
        mTexture.setDimensions(mActiveBuffer->getWidth(), mActiveBuffer->getHeight());
        mTexture.setFiltering(useFiltering);
        mTexture.setMatrix(textureMatrix);
        compositionInfo.re.texture = mTexture;

        engine.setupLayerTexturing(mTexture);
    } else {
@@ -231,23 +228,6 @@ void BufferLayer::onDraw(const RenderArea& renderArea, const Region& clip,
    engine.disableTexturing();
}

void BufferLayer::drawNow(const RenderArea& renderArea, bool useIdentityTransform) {
    CompositionInfo& compositionInfo = getBE().compositionInfo;
    auto& engine(mFlinger->getRenderEngine());

    draw(renderArea, useIdentityTransform);

    engine.setupLayerTexturing(compositionInfo.re.texture);
    engine.setupLayerBlending(compositionInfo.re.preMultipliedAlpha, compositionInfo.re.opaque,
            false, compositionInfo.re.color);
    engine.setSourceDataSpace(compositionInfo.hwc.dataspace);
    engine.setSourceY410BT2020(compositionInfo.re.Y410BT2020);
    engine.drawMesh(getBE().getMesh());
    engine.disableBlending();
    engine.disableTexturing();
    engine.setSourceY410BT2020(false);
}

bool BufferLayer::isHdrY410() const {
    // pixel format is HDR Y410 masquerading as RGBA_1010102
    return (mCurrentDataSpace == ui::Dataspace::BT2020_ITU_PQ &&
@@ -340,6 +320,7 @@ bool BufferLayer::onPreComposition(nsecs_t refreshStartTime) {
bool BufferLayer::onPostComposition(const std::shared_ptr<FenceTime>& glDoneFence,
                                    const std::shared_ptr<FenceTime>& presentFence,
                                    const CompositorTiming& compositorTiming) {

    // mFrameLatencyNeeded is true when a new frame was latched for the
    // composition.
    if (!mFrameLatencyNeeded) return false;
+0 −1
Original line number Diff line number Diff line
@@ -77,7 +77,6 @@ public:
    // onDraw - draws the surface.
    void onDraw(const RenderArea& renderArea, const Region& clip,
                bool useIdentityTransform) override;
    void drawNow(const RenderArea& renderArea, bool useIdentityTransform);

    bool isHdrY410() const override;

+8 −18
Original line number Diff line number Diff line
@@ -45,26 +45,16 @@ void ColorLayer::onDraw(const RenderArea& renderArea, const Region& /* clip */,
                        bool useIdentityTransform) {
    half4 color = getColor();
    if (color.a > 0) {
        computeGeometry(renderArea, getBE().mMesh, useIdentityTransform);
        getBE().compositionInfo.re.preMultipliedAlpha = getPremultipledAlpha();
        getBE().compositionInfo.re.opaque = false;
        getBE().compositionInfo.re.disableTexture = true;
        getBE().compositionInfo.re.color = color;
    }
}

void ColorLayer::drawNow(const RenderArea& renderArea, bool useIdentityTransform) {
    CompositionInfo& compositionInfo = getBE().compositionInfo;
        Mesh mesh(Mesh::TRIANGLE_FAN, 4, 2);
        computeGeometry(renderArea, mesh, useIdentityTransform);
        auto& engine(mFlinger->getRenderEngine());

    draw(renderArea, useIdentityTransform);

    engine.setupLayerBlending(compositionInfo.re.preMultipliedAlpha, compositionInfo.re.opaque,
            compositionInfo.re.disableTexture, compositionInfo.re.color);
    engine.setSourceDataSpace(compositionInfo.hwc.dataspace);
    engine.drawMesh(getBE().getMesh());
        engine.setupLayerBlending(getPremultipledAlpha(), false /* opaque */,
                                  true /* disableTexture */, color);
        engine.setSourceDataSpace(mCurrentDataSpace);
        engine.drawMesh(mesh);
        engine.disableBlending();
    }
}

bool ColorLayer::isVisible() const {
    return !isHiddenByPolicy() && getAlpha() > 0.0f;
+0 −1
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ public:
    virtual const char* getTypeId() const { return "ColorLayer"; }
    virtual void onDraw(const RenderArea& renderArea, const Region& clip,
                        bool useIdentityTransform);
    void drawNow(const RenderArea&, bool);
    bool isVisible() const override;

    void setPerFrameData(const sp<const DisplayDevice>& display) override;
+0 −2
Original line number Diff line number Diff line
@@ -30,8 +30,6 @@ ContainerLayer::ContainerLayer(SurfaceFlinger* flinger, const sp<Client>& client

void ContainerLayer::onDraw(const RenderArea&, const Region& /* clip */, bool) {}

void ContainerLayer::drawNow(const RenderArea&, bool) {}

bool ContainerLayer::isVisible() const {
    return !isHiddenByPolicy();
}
Loading