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

Commit b5183f21 authored by Huihong Luo's avatar Huihong Luo Committed by Android (Google) Code Review
Browse files

Merge "Apply additional CachedSet rendering fixes" into sc-dev

parents a7e6c7c5 7be6c0af
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -16,10 +16,7 @@

#pragma once

#include <cstdint>
#include <optional>
#include <string>

#include <compositionengine/ProjectionSpace.h>
#include <compositionengine/impl/HwcBufferCache.h>
#include <renderengine/Mesh.h>
#include <ui/FloatRect.h>
@@ -27,6 +24,10 @@
#include <ui/Rect.h>
#include <ui/Region.h>

#include <cstdint>
#include <optional>
#include <string>

// TODO(b/129481165): remove the #pragma below and fix conversion issues
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wconversion"
@@ -90,6 +91,7 @@ struct OutputLayerCompositionState {
        sp<Fence> acquireFence = nullptr;
        Rect displayFrame = {};
        ui::Dataspace dataspace{ui::Dataspace::UNKNOWN};
        ProjectionSpace displaySpace;
    } overrideInfo;

    /*
+2 −0
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ public:
    size_t getAge() const { return mAge; }
    const sp<GraphicBuffer>& getBuffer() const { return mTexture.getBuffer(); }
    const sp<Fence>& getDrawFence() const { return mDrawFence; }
    const ProjectionSpace& getOutputSpace() const { return mOutputSpace; }
    ui::Dataspace getOutputDataspace() const { return mOutputDataspace; }

    NonBufferHash getNonBufferHash() const;
@@ -134,6 +135,7 @@ private:

    Texture mTexture;
    sp<Fence> mDrawFence;
    ProjectionSpace mOutputSpace;
    ui::Dataspace mOutputDataspace;
    ui::Transform::RotationFlags mOrientation = ui::Transform::ROT_0;

+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

#pragma once

#include <compositionengine/Output.h>
#include <compositionengine/impl/planner/CachedSet.h>
#include <compositionengine/impl/planner/LayerState.h>

+19 −8
Original line number Diff line number Diff line
@@ -381,8 +381,9 @@ void OutputLayer::writeOutputDependentGeometryStateToHWC(
              outputDependentState.z, to_string(error).c_str(), static_cast<int32_t>(error));
    }

    // Solid-color layers should always use an identity transform.
    const auto bufferTransform = requestedCompositionType != hal::Composition::SOLID_COLOR
    // Solid-color layers and overridden buffers should always use an identity transform.
    const auto bufferTransform = (requestedCompositionType != hal::Composition::SOLID_COLOR &&
                                  getState().overrideInfo.buffer == nullptr)
            ? outputDependentState.bufferTransform
            : static_cast<hal::Transform>(0);
    if (auto error = hwcLayer->setTransform(static_cast<hal::Transform>(bufferTransform));
@@ -674,15 +675,25 @@ std::vector<LayerFE::LayerSettings> OutputLayer::getOverrideCompositionList() co
        return {};
    }

    // Compute the geometry boundaries in layer stack space: we need to transform from the
    // framebuffer space of the override buffer to layer space.
    const ProjectionSpace& layerSpace = getOutput().getState().layerStackSpace;
    const ui::Transform transform = getState().overrideInfo.displaySpace.getTransform(layerSpace);
    const Rect boundaries = transform.transform(getState().overrideInfo.displayFrame);

    LayerFE::LayerSettings settings;
    settings.geometry = renderengine::Geometry{
            .boundaries = getState().overrideInfo.displayFrame.toFloatRect(),
            .boundaries = boundaries.toFloatRect(),
    };
    settings.bufferId = getState().overrideInfo.buffer->getId();
    settings.source =
            renderengine::PixelSource{.buffer = renderengine::Buffer{
    settings.source = renderengine::PixelSource{
            .buffer = renderengine::Buffer{
                    .buffer = getState().overrideInfo.buffer,
                    .fence = getState().overrideInfo.acquireFence,
                    // If the transform from layer space to display space contains a rotation, we
                    // need to undo the rotation in the texture transform
                    .textureTransform =
                            ui::Transform(transform.inverse().getOrientation(), 1, 1).asMatrix4(),
            }};
    settings.sourceDataspace = getState().overrideInfo.dataspace;
    settings.alpha = 1.0f;
+1 −0
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ void OutputLayerCompositionState::dump(std::string& out) const {
    dumpVal(out, "override acquire fence", overrideInfo.acquireFence.get());
    dumpVal(out, "override display frame", overrideInfo.displayFrame);
    dumpVal(out, "override dataspace", toString(overrideInfo.dataspace), overrideInfo.dataspace);
    dumpVal(out, "override display space", to_string(overrideInfo.displaySpace));

    if (hwc) {
        dumpHwc(*hwc, out);
Loading