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

Commit 398ff6bb authored by Leon Scroggins's avatar Leon Scroggins Committed by Automerger Merge Worker
Browse files

Merge "Move rotation flags to SF" into udc-dev am: f8710d14

parents e67a9118 f8710d14
Loading
Loading
Loading
Loading
+0 −10
Original line number Original line Diff line number Diff line
@@ -50,8 +50,6 @@ namespace android {


namespace hal = hardware::graphics::composer::hal;
namespace hal = hardware::graphics::composer::hal;


ui::Transform::RotationFlags DisplayDevice::sPrimaryDisplayRotationFlags = ui::Transform::ROT_0;

DisplayDeviceCreationArgs::DisplayDeviceCreationArgs(
DisplayDeviceCreationArgs::DisplayDeviceCreationArgs(
        const sp<SurfaceFlinger>& flinger, HWComposer& hwComposer, const wp<IBinder>& displayToken,
        const sp<SurfaceFlinger>& flinger, HWComposer& hwComposer, const wp<IBinder>& displayToken,
        std::shared_ptr<compositionengine::Display> compositionDisplay)
        std::shared_ptr<compositionengine::Display> compositionDisplay)
@@ -282,10 +280,6 @@ void DisplayDevice::setProjection(ui::Rotation orientation, Rect layerStackSpace
                                  Rect orientedDisplaySpaceRect) {
                                  Rect orientedDisplaySpaceRect) {
    mOrientation = orientation;
    mOrientation = orientation;


    if (isPrimary()) {
        sPrimaryDisplayRotationFlags = ui::Transform::toRotationFlags(orientation);
    }

    // We need to take care of display rotation for globalTransform for case if the panel is not
    // We need to take care of display rotation for globalTransform for case if the panel is not
    // installed aligned with device orientation.
    // installed aligned with device orientation.
    const auto transformOrientation = orientation + mPhysicalOrientation;
    const auto transformOrientation = orientation + mPhysicalOrientation;
@@ -326,10 +320,6 @@ std::optional<float> DisplayDevice::getStagedBrightness() const {
    return mStagedBrightness;
    return mStagedBrightness;
}
}


ui::Transform::RotationFlags DisplayDevice::getPrimaryDisplayRotationFlags() {
    return sPrimaryDisplayRotationFlags;
}

void DisplayDevice::dump(utils::Dumper& dumper) const {
void DisplayDevice::dump(utils::Dumper& dumper) const {
    using namespace std::string_view_literals;
    using namespace std::string_view_literals;


+0 −4
Original line number Original line Diff line number Diff line
@@ -109,8 +109,6 @@ public:
    ui::Rotation getPhysicalOrientation() const { return mPhysicalOrientation; }
    ui::Rotation getPhysicalOrientation() const { return mPhysicalOrientation; }
    ui::Rotation getOrientation() const { return mOrientation; }
    ui::Rotation getOrientation() const { return mOrientation; }


    static ui::Transform::RotationFlags getPrimaryDisplayRotationFlags();

    std::optional<float> getStagedBrightness() const REQUIRES(kMainThreadContext);
    std::optional<float> getStagedBrightness() const REQUIRES(kMainThreadContext);
    ui::Transform::RotationFlags getTransformHint() const;
    ui::Transform::RotationFlags getTransformHint() const;
    const ui::Transform& getTransform() const;
    const ui::Transform& getTransform() const;
@@ -274,8 +272,6 @@ private:
    const ui::Rotation mPhysicalOrientation;
    const ui::Rotation mPhysicalOrientation;
    ui::Rotation mOrientation = ui::ROTATION_0;
    ui::Rotation mOrientation = ui::ROTATION_0;


    static ui::Transform::RotationFlags sPrimaryDisplayRotationFlags;

    // Allow nullopt as initial power mode.
    // Allow nullopt as initial power mode.
    using TracedPowerMode = TracedOrdinal<hardware::graphics::composer::hal::PowerMode>;
    using TracedPowerMode = TracedOrdinal<hardware::graphics::composer::hal::PowerMode>;
    std::optional<TracedPowerMode> mPowerMode;
    std::optional<TracedPowerMode> mPowerMode;
+1 −1
Original line number Original line Diff line number Diff line
@@ -28,7 +28,7 @@ struct DisplayInfo {
    ui::Transform transform;
    ui::Transform transform;
    bool receivesInput;
    bool receivesInput;
    bool isSecure;
    bool isSecure;
    // TODO(b/238781169) can eliminate once sPrimaryDisplayRotationFlags is removed.
    // TODO(b/259407931): can eliminate once SurfaceFlinger::sActiveDisplayRotationFlags is removed.
    bool isPrimary;
    bool isPrimary;
    bool isVirtual;
    bool isVirtual;
    ui::Transform::RotationFlags rotationFlags;
    ui::Transform::RotationFlags rotationFlags;
+1 −0
Original line number Original line Diff line number Diff line
@@ -667,6 +667,7 @@ void LayerSnapshotBuilder::resetRelativeState(LayerSnapshot& snapshot) {
    snapshot.relativeLayerMetadata.mMap.clear();
    snapshot.relativeLayerMetadata.mMap.clear();
}
}


// TODO (b/259407931): Remove.
uint32_t getPrimaryDisplayRotationFlags(
uint32_t getPrimaryDisplayRotationFlags(
        const display::DisplayMap<ui::LayerStack, frontend::DisplayInfo>& displays) {
        const display::DisplayMap<ui::LayerStack, frontend::DisplayInfo>& displays) {
    for (auto& [_, display] : displays) {
    for (auto& [_, display] : displays) {
+2 −2
Original line number Original line Diff line number Diff line
@@ -2985,7 +2985,7 @@ bool Layer::updateGeometry() {
    if (mDrawingState.bufferTransform & ui::Transform::ROT_90) {
    if (mDrawingState.bufferTransform & ui::Transform::ROT_90) {
        std::swap(bufferWidth, bufferHeight);
        std::swap(bufferWidth, bufferHeight);
    }
    }
    uint32_t invTransform = DisplayDevice::getPrimaryDisplayRotationFlags();
    uint32_t invTransform = SurfaceFlinger::getActiveDisplayRotationFlags();
    if (mDrawingState.transformToDisplayInverse) {
    if (mDrawingState.transformToDisplayInverse) {
        if (invTransform & ui::Transform::ROT_90) {
        if (invTransform & ui::Transform::ROT_90) {
            std::swap(bufferWidth, bufferHeight);
            std::swap(bufferWidth, bufferHeight);
@@ -3312,7 +3312,7 @@ Rect Layer::getBufferSize(const State& /*s*/) const {
    }
    }


    if (getTransformToDisplayInverse()) {
    if (getTransformToDisplayInverse()) {
        uint32_t invTransform = DisplayDevice::getPrimaryDisplayRotationFlags();
        uint32_t invTransform = SurfaceFlinger::getActiveDisplayRotationFlags();
        if (invTransform & ui::Transform::ROT_90) {
        if (invTransform & ui::Transform::ROT_90) {
            std::swap(bufWidth, bufHeight);
            std::swap(bufWidth, bufHeight);
        }
        }
Loading