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

Commit 5dcd75d4 authored by Brian Johnson's avatar Brian Johnson Committed by Huihong Luo
Browse files

SF: Propagate display hotplug errors

Add support for SurfaceFlinger to handle display connection
errors and propagate any error code on hotplug event up the
stack.

Bug: 241286153
Test: manual
Change-Id: I88afeb4f61b13714a81138180db0762cf3ae4ab0
parent c79a756a
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -324,6 +324,12 @@ void Choreographer::dispatchHotplug(nsecs_t, PhysicalDisplayId displayId, bool c
          to_string(displayId).c_str(), toString(connected));
}

void Choreographer::dispatchHotplugConnectionError(nsecs_t, int32_t connectionError) {
    ALOGV("choreographer %p ~ received hotplug connection error event (connectionError=%d), "
          "ignoring.",
          this, connectionError);
}

void Choreographer::dispatchModeChanged(nsecs_t, PhysicalDisplayId, int32_t, nsecs_t) {
    LOG_ALWAYS_FATAL("dispatchModeChanged was called but was never registered");
}
+7 −1
Original line number Diff line number Diff line
@@ -173,7 +173,13 @@ bool DisplayEventDispatcher::processPendingEvents(nsecs_t* outTimestamp,
                    *outVsyncEventData = ev.vsync.vsyncData;
                    break;
                case DisplayEventReceiver::DISPLAY_EVENT_HOTPLUG:
                    dispatchHotplug(ev.header.timestamp, ev.header.displayId, ev.hotplug.connected);
                    if (ev.hotplug.connectionError == 0) {
                        dispatchHotplug(ev.header.timestamp, ev.header.displayId,
                                        ev.hotplug.connected);
                    } else {
                        dispatchHotplugConnectionError(ev.header.timestamp,
                                                       ev.hotplug.connectionError);
                    }
                    break;
                case DisplayEventReceiver::DISPLAY_EVENT_MODE_CHANGE:
                    dispatchModeChanged(ev.header.timestamp, ev.header.displayId,
+4 −1
Original line number Diff line number Diff line
@@ -62,7 +62,10 @@ DisplayEventReceiver::Event buildDisplayEvent(FuzzedDataProvider* fdp, uint32_t

        }
        case DisplayEventReceiver::DISPLAY_EVENT_HOTPLUG: {
            event.hotplug = DisplayEventReceiver::Event::Hotplug{fdp->ConsumeBool() /*connected*/};
            event.hotplug =
                    DisplayEventReceiver::Event::Hotplug{fdp->ConsumeBool() /*connected*/,
                                                         fdp->ConsumeIntegral<
                                                                 int32_t>() /*connectionError*/};
            break;
        }
        case DisplayEventReceiver::DISPLAY_EVENT_MODE_CHANGE: {
+1 −0
Original line number Diff line number Diff line
@@ -197,6 +197,7 @@ public:

    MOCK_METHOD4(dispatchVsync, void(nsecs_t, PhysicalDisplayId, uint32_t, VsyncEventData));
    MOCK_METHOD3(dispatchHotplug, void(nsecs_t, PhysicalDisplayId, bool));
    MOCK_METHOD2(dispatchHotplugConnectionError, void(nsecs_t, int32_t));
    MOCK_METHOD4(dispatchModeChanged, void(nsecs_t, PhysicalDisplayId, int32_t, nsecs_t));
    MOCK_METHOD2(dispatchNullEvent, void(nsecs_t, PhysicalDisplayId));
    MOCK_METHOD3(dispatchFrameRateOverrides,
+2 −1
Original line number Diff line number Diff line
@@ -110,6 +110,7 @@ private:
    void dispatchVsync(nsecs_t timestamp, PhysicalDisplayId displayId, uint32_t count,
                       VsyncEventData vsyncEventData) override;
    void dispatchHotplug(nsecs_t timestamp, PhysicalDisplayId displayId, bool connected) override;
    void dispatchHotplugConnectionError(nsecs_t timestamp, int32_t connectionError) override;
    void dispatchModeChanged(nsecs_t timestamp, PhysicalDisplayId displayId, int32_t modeId,
                             nsecs_t vsyncPeriod) override;
    void dispatchNullEvent(nsecs_t, PhysicalDisplayId) override;
Loading