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

Commit 4ec5b29d authored by Brian Johnson's avatar Brian Johnson Committed by Huihong Luo
Browse files

SF: Remove the vsync method of communicating hotplug errors and enable the hal api path

Flag: com.android.graphics.surfaceflinger.flags.hotplug2
Bug: 303461103
Test: Artificially generated a hotplug error, and manually verified it went through the hal path, and showed the notification
Change-Id: If222f4e81273518d84cdf2bda12602eb4e713ca7
parent 570c5f55
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -532,9 +532,6 @@ SurfaceFlinger::SurfaceFlinger(Factory& factory) : SurfaceFlinger(factory, SkipI
    mIgnoreHdrCameraLayers = ignore_hdr_camera_layers(false);

    // These are set by the HWC implementation to indicate that they will use the workarounds.
    mIsHotplugErrViaNegVsync =
            base::GetBoolProperty("debug.sf.hwc_hotplug_error_via_neg_vsync"s, false);

    mIsHdcpViaNegVsync = base::GetBoolProperty("debug.sf.hwc_hdcp_via_neg_vsync"s, false);
}

@@ -2172,15 +2169,6 @@ void SurfaceFlinger::onComposerHalVsync(hal::HWDisplayId hwcDisplayId, int64_t t
                                        std::optional<hal::VsyncPeriodNanos> vsyncPeriod) {
    if (FlagManager::getInstance().connected_display() && timestamp < 0 &&
        vsyncPeriod.has_value()) {
        // use ~0 instead of -1 as AidlComposerHal.cpp passes the param as unsigned int32
        if (mIsHotplugErrViaNegVsync && vsyncPeriod.value() == ~0) {
            const auto errorCode = static_cast<int32_t>(-timestamp);
            ALOGD("%s: Hotplug error %d for hwcDisplayId %" PRIu64, __func__, errorCode,
                  hwcDisplayId);
            mScheduler->dispatchHotplugError(errorCode);
            return;
        }

        if (mIsHdcpViaNegVsync && vsyncPeriod.value() == ~1) {
            const int32_t value = static_cast<int32_t>(-timestamp);
            // one byte is good enough to encode android.hardware.drm.HdcpLevel
+0 −1
Original line number Diff line number Diff line
@@ -1261,7 +1261,6 @@ private:
    };

    bool mIsHdcpViaNegVsync = false;
    bool mIsHotplugErrViaNegVsync = false;

    std::mutex mHotplugMutex;
    std::vector<HotplugEvent> mPendingHotplugEvents GUARDED_BY(mHotplugMutex);