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

Commit 5ef1fa1b authored by Manasi Navare's avatar Manasi Navare
Browse files

SF: Propagate Display Mode Rejection from SF to DM



Create a new DisplayEventReceiver callback for onModeRejected
to signal mode rejection from SF to DM so that DM can trigger
a retry.
Add the plumbing through DisplayEventReceiver and EventThread

Bug: 374184110
Test: manual
Flag: com.android.graphics.surfaceflinger.flags.display_config_error_hal

Change-Id: I78515d413bdf2e6e07d6649b7b60df8ced199b19
Signed-off-by: default avatarManasi Navare <navaremanasi@google.com>
parent b03dfd3b
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -369,6 +369,10 @@ void Choreographer::dispatchHdcpLevelsChanged(PhysicalDisplayId displayId, int32
          this, to_string(displayId).c_str(), connectedLevel, maxLevel);
}

void Choreographer::dispatchModeRejected(PhysicalDisplayId, int32_t) {
    LOG_ALWAYS_FATAL("dispatchModeRejected was called but was never registered");
}

void Choreographer::handleMessage(const Message& message) {
    switch (message.what) {
        case MSG_SCHEDULE_CALLBACKS:
+3 −0
Original line number Diff line number Diff line
@@ -211,6 +211,9 @@ bool DisplayEventDispatcher::processPendingEvents(nsecs_t* outTimestamp,
                                              ev.hdcpLevelsChange.connectedLevel,
                                              ev.hdcpLevelsChange.maxLevel);
                    break;
                case DisplayEventReceiver::DISPLAY_EVENT_MODE_REJECTION:
                    dispatchModeRejected(ev.header.displayId, ev.modeRejection.modeId);
                    break;
                default:
                    ALOGW("dispatcher %p ~ ignoring unknown event type %#x", this, ev.header.type);
                    break;
+1 −0
Original line number Diff line number Diff line
@@ -127,6 +127,7 @@ private:
                                    std::vector<FrameRateOverride> overrides) override;
    void dispatchHdcpLevelsChanged(PhysicalDisplayId displayId, int32_t connectedLevel,
                                   int32_t maxLevel) override;
    void dispatchModeRejected(PhysicalDisplayId displayId, int32_t modeId) override;

    void scheduleCallbacks();

+2 −0
Original line number Diff line number Diff line
@@ -68,6 +68,8 @@ private:
    virtual void dispatchHdcpLevelsChanged(PhysicalDisplayId displayId, int32_t connectedLevel,
                                           int32_t maxLevel) = 0;

    virtual void dispatchModeRejected(PhysicalDisplayId displayId, int32_t modeId) = 0;

    bool processPendingEvents(nsecs_t* outTimestamp, PhysicalDisplayId* outDisplayId,
                              uint32_t* outCount, VsyncEventData* outVsyncEventData);

+6 −0
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ public:
        DISPLAY_EVENT_VSYNC = fourcc('v', 's', 'y', 'n'),
        DISPLAY_EVENT_HOTPLUG = fourcc('p', 'l', 'u', 'g'),
        DISPLAY_EVENT_MODE_CHANGE = fourcc('m', 'o', 'd', 'e'),
        DISPLAY_EVENT_MODE_REJECTION = fourcc('r', 'e', 'j', 'e'),
        DISPLAY_EVENT_NULL = fourcc('n', 'u', 'l', 'l'),
        DISPLAY_EVENT_FRAME_RATE_OVERRIDE = fourcc('r', 'a', 't', 'e'),
        DISPLAY_EVENT_FRAME_RATE_OVERRIDE_FLUSH = fourcc('f', 'l', 's', 'h'),
@@ -96,6 +97,10 @@ public:
            nsecs_t vsyncPeriod __attribute__((aligned(8)));
        };

        struct ModeRejection {
            int32_t modeId;
        };

        struct FrameRateOverride {
            uid_t uid __attribute__((aligned(8)));
            float frameRateHz __attribute__((aligned(8)));
@@ -117,6 +122,7 @@ public:
            ModeChange modeChange;
            FrameRateOverride frameRateOverride;
            HdcpLevelsChange hdcpLevelsChange;
            ModeRejection modeRejection;
        };
    };
    static_assert(sizeof(Event) == 224);
Loading