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

Commit d489802b authored by Ram Indani's avatar Ram Indani Committed by Android (Google) Code Review
Browse files

Merge "SF: Unify onModeChanged and frameRateOverride callbacks into single callback" into main

parents 602de16c ef1290ea
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -349,6 +349,13 @@ void Choreographer::dispatchHotplugConnectionError(nsecs_t, int32_t connectionEr
          this, connectionError);
}

void Choreographer::dispatchModeChangedWithFrameRateOverrides(nsecs_t, PhysicalDisplayId, int32_t,
                                                              nsecs_t, nsecs_t, nsecs_t,
                                                              std::vector<FrameRateOverride>) {
    LOG_ALWAYS_FATAL(
            "dispatchModeChangedWithFrameRateOverrides was called but was never registered");
}

void Choreographer::dispatchModeChanged(nsecs_t, PhysicalDisplayId, int32_t, nsecs_t, nsecs_t,
                                        nsecs_t) {
    LOG_ALWAYS_FATAL("dispatchModeChanged was called but was never registered");
+17 −2
Original line number Diff line number Diff line
@@ -27,10 +27,10 @@
#include <utils/Timers.h>
#include <utils/Trace.h>

#include <com_android_graphics_libgui_flags.h>
#include <com_android_graphics_surfaceflinger_flags.h>

namespace android {
using namespace com::android::graphics::libgui;
using namespace com::android::graphics::surfaceflinger;

// Number of events to read at a time from the DisplayEventDispatcher pipe.
// The value should be large enough that we can quickly drain the pipe
@@ -193,11 +193,23 @@ bool DisplayEventDispatcher::processPendingEvents(nsecs_t* outTimestamp,
                    }
                    break;
                case DisplayEventType::DISPLAY_EVENT_MODE_CHANGE:
                    LOG_ALWAYS_FATAL_IF(flags::unify_refresh_rate_callbacks(),
                                        "dispatchModeChanged should not be sent when"
                                        " refresh rate callbacks are unified");
                    dispatchModeChanged(ev.header.timestamp, ev.header.displayId,
                                        ev.modeChange.modeId, ev.modeChange.vsyncPeriod,
                                        ev.modeChange.appVsyncOffset,
                                        ev.modeChange.presentationDeadline);
                    break;
                case DisplayEventType::DISPLAY_EVENT_MODE_AND_FRAME_RATE_CHANGE:
                    dispatchModeChangedWithFrameRateOverrides(ev.header.timestamp,
                                                              ev.header.displayId,
                                                              ev.modeChange.modeId,
                                                              ev.modeChange.vsyncPeriod,
                                                              ev.modeChange.appVsyncOffset,
                                                              ev.modeChange.presentationDeadline,
                                                              std::move(mFrameRateOverrides));
                    break;
                case DisplayEventType::DISPLAY_EVENT_NULL:
                    dispatchNullEvent(ev.header.timestamp, ev.header.displayId);
                    break;
@@ -205,6 +217,9 @@ bool DisplayEventDispatcher::processPendingEvents(nsecs_t* outTimestamp,
                    mFrameRateOverrides.emplace_back(ev.frameRateOverride);
                    break;
                case DisplayEventType::DISPLAY_EVENT_FRAME_RATE_OVERRIDE_FLUSH:
                    LOG_ALWAYS_FATAL_IF(flags::unify_refresh_rate_callbacks(),
                                        "dispatchFrameRateOverrides should not be sent when"
                                        " refresh rate callbacks are unified");
                    dispatchFrameRateOverrides(ev.header.timestamp, ev.header.displayId,
                                               std::move(mFrameRateOverrides));
                    break;
+4 −0
Original line number Diff line number Diff line
@@ -121,6 +121,10 @@ private:
                           nsecs_t timestamp);
    void dispatchHotplug(nsecs_t timestamp, PhysicalDisplayId displayId, bool connected) override;
    void dispatchHotplugConnectionError(nsecs_t timestamp, int32_t connectionError) override;
    void dispatchModeChangedWithFrameRateOverrides(
            nsecs_t timestamp, PhysicalDisplayId displayId, int32_t modeId, nsecs_t vsyncPeriod,
            nsecs_t appVsyncOffset, nsecs_t presentationDeadline,
            std::vector<FrameRateOverride> overrides) override;
    void dispatchModeChanged(nsecs_t timestamp, PhysicalDisplayId displayId, int32_t modeId,
                             nsecs_t vsyncPeriod, nsecs_t appVsyncOffset,
                             nsecs_t presentationDeadline) override;
+4 −0
Original line number Diff line number Diff line
@@ -58,6 +58,10 @@ private:

    virtual void dispatchHotplugConnectionError(nsecs_t timestamp, int32_t connectionError) = 0;

    virtual void dispatchModeChangedWithFrameRateOverrides(
            nsecs_t timestamp, PhysicalDisplayId displayId, int32_t modeId, nsecs_t renderPeriod,
            nsecs_t appVsyncOffset, nsecs_t presentationDeadline,
            std::vector<FrameRateOverride> overrides) = 0;
    virtual void dispatchModeChanged(nsecs_t timestamp, PhysicalDisplayId displayId, int32_t modeId,
                                     nsecs_t vsyncPeriod, nsecs_t appVsyncOffset,
                                     nsecs_t presentationDeadline) = 0;
+5 −0
Original line number Diff line number Diff line
@@ -58,10 +58,15 @@ static inline constexpr uint32_t fourcc(char c1, char c2, char c3, char c4) {
enum class DisplayEventType : uint32_t {
    DISPLAY_EVENT_VSYNC = fourcc('v', 's', 'y', 'n'),
    DISPLAY_EVENT_HOTPLUG = fourcc('p', 'l', 'u', 'g'),
    // TODO(b/399482301) Cleanup the DISPLAY_EVENT_MODE_CHANGE event
    // with flag cleanup.
    DISPLAY_EVENT_MODE_CHANGE = fourcc('m', 'o', 'd', 'e'),
    DISPLAY_EVENT_MODE_AND_FRAME_RATE_CHANGE = fourcc('m', 'o', 'f', 'r'),
    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'),
    // TODO(b/399482301) Cleanup the DISPLAY_EVENT_FRAME_RATE_OVERRIDE_FLUSH event
    // with the flag cleanup.
    DISPLAY_EVENT_FRAME_RATE_OVERRIDE_FLUSH = fourcc('f', 'l', 's', 'h'),
    DISPLAY_EVENT_HDCP_LEVELS_CHANGE = fourcc('h', 'd', 'c', 'p'),
};
Loading