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

Commit 2239b374 authored by Evan Rosky's avatar Evan Rosky
Browse files

Inform SurfaceFlinger about displays which receive input

Right now, multiple display devices can share a layerstack.
This means that when constructing InputWindowInfo, its
impossible to know which display transform matches the
display viewport that inputflinger dispatches against. To
remedy this, have displaymanager inform surfaceflinger
which displays "receiveInput" using the same logic that
controls which display viewport it sends to inputflinger.

Bug: 179274888
Test: atest SetDisplayStateLockedTest
Change-Id: If0ffb1b5405f7e7dcdf8ea2f12c109d661a540fe
parent b5f57fc5
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -100,6 +100,10 @@ message LayerStackChange {
    required uint32 layer_stack = 1;
}

message DisplayFlagsChange {
    required uint32 flags = 1;
}

message HiddenFlagChange {
    required bool hidden_flag = 1;
}
@@ -120,6 +124,7 @@ message DisplayChange {
        LayerStackChange  layer_stack = 3;
        SizeChange        size        = 4;
        ProjectionChange  projection  = 5;
        DisplayFlagsChange flags      = 6;
    }
}

+7 −0
Original line number Diff line number Diff line
@@ -315,6 +315,7 @@ status_t ComposerState::read(const Parcel& input) {
DisplayState::DisplayState()
      : what(0),
        layerStack(0),
        flags(0),
        layerStackSpaceRect(Rect::EMPTY_RECT),
        orientedDisplaySpaceRect(Rect::EMPTY_RECT),
        width(0),
@@ -325,6 +326,7 @@ status_t DisplayState::write(Parcel& output) const {
    SAFE_PARCEL(output.writeStrongBinder, IInterface::asBinder(surface));
    SAFE_PARCEL(output.writeUint32, what);
    SAFE_PARCEL(output.writeUint32, layerStack);
    SAFE_PARCEL(output.writeUint32, flags);
    SAFE_PARCEL(output.writeUint32, toRotationInt(orientation));
    SAFE_PARCEL(output.write, layerStackSpaceRect);
    SAFE_PARCEL(output.write, orientedDisplaySpaceRect);
@@ -341,6 +343,7 @@ status_t DisplayState::read(const Parcel& input) {

    SAFE_PARCEL(input.readUint32, &what);
    SAFE_PARCEL(input.readUint32, &layerStack);
    SAFE_PARCEL(input.readUint32, &flags);
    uint32_t tmpUint = 0;
    SAFE_PARCEL(input.readUint32, &tmpUint);
    orientation = ui::toRotation(tmpUint);
@@ -361,6 +364,10 @@ void DisplayState::merge(const DisplayState& other) {
        what |= eLayerStackChanged;
        layerStack = other.layerStack;
    }
    if (other.what & eFlagsChanged) {
        what |= eFlagsChanged;
        flags = other.flags;
    }
    if (other.what & eDisplayProjectionChanged) {
        what |= eDisplayProjectionChanged;
        orientation = other.orientation;
+6 −0
Original line number Diff line number Diff line
@@ -1730,6 +1730,12 @@ void SurfaceComposerClient::Transaction::setDisplayLayerStack(const sp<IBinder>&
    s.what |= DisplayState::eLayerStackChanged;
}

void SurfaceComposerClient::Transaction::setDisplayFlags(const sp<IBinder>& token, uint32_t flags) {
    DisplayState& s(getDisplayState(token));
    s.flags = flags;
    s.what |= DisplayState::eFlagsChanged;
}

void SurfaceComposerClient::Transaction::setDisplayProjection(const sp<IBinder>& token,
                                                              ui::Rotation orientation,
                                                              const Rect& layerStackRect,
+3 −1
Original line number Diff line number Diff line
@@ -247,7 +247,8 @@ struct DisplayState {
        eSurfaceChanged = 0x01,
        eLayerStackChanged = 0x02,
        eDisplayProjectionChanged = 0x04,
        eDisplaySizeChanged = 0x08
        eDisplaySizeChanged = 0x08,
        eFlagsChanged = 0x10
    };

    DisplayState();
@@ -257,6 +258,7 @@ struct DisplayState {
    sp<IBinder> token;
    sp<IGraphicBufferProducer> surface;
    uint32_t layerStack;
    uint32_t flags;

    // These states define how layers are projected onto the physical display.
    //
+2 −0
Original line number Diff line number Diff line
@@ -562,6 +562,8 @@ public:

        void setDisplayLayerStack(const sp<IBinder>& token, uint32_t layerStack);

        void setDisplayFlags(const sp<IBinder>& token, uint32_t flags);

        /* setDisplayProjection() defines the projection of layer stacks
         * to a given display.
         *
Loading