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

Commit 5906db4d authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "SF: prerequisite refactor to remove deprecated HIDL enum" into main

parents 5920fd28 13f48588
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -138,13 +138,13 @@ bool HWComposer::hasDisplayCapability(HalDisplayId displayId, DisplayCapability
}

std::optional<DisplayIdentificationInfo> HWComposer::onHotplug(hal::HWDisplayId hwcDisplayId,
                                                               hal::Connection connection) {
    switch (connection) {
        case hal::Connection::CONNECTED:
                                                               HotplugEvent event) {
    switch (event) {
        case HotplugEvent::Connected:
            return onHotplugConnect(hwcDisplayId);
        case hal::Connection::DISCONNECTED:
        case HotplugEvent::Disconnected:
            return onHotplugDisconnect(hwcDisplayId);
        case hal::Connection::INVALID:
        case HotplugEvent::LinkUnstable:
            return {};
    }
}
+6 −7
Original line number Diff line number Diff line
@@ -231,11 +231,12 @@ public:

    // Events handling ---------------------------------------------------------

    // Returns stable display ID (and display name on connection of new or previously disconnected
    // display), or std::nullopt if hotplug event was ignored.
    enum class HotplugEvent { Connected, Disconnected, LinkUnstable };

    // Returns the stable display ID of the display for which the hotplug event was received, or
    // std::nullopt if hotplug event was ignored.
    // This function is called from SurfaceFlinger.
    virtual std::optional<DisplayIdentificationInfo> onHotplug(hal::HWDisplayId,
                                                               hal::Connection) = 0;
    virtual std::optional<DisplayIdentificationInfo> onHotplug(hal::HWDisplayId, HotplugEvent) = 0;

    // If true we'll update the DeviceProductInfo on subsequent hotplug connected events.
    // TODO(b/157555476): Remove when the framework has proper support for headless mode
@@ -435,9 +436,7 @@ public:

    // Events handling ---------------------------------------------------------

    // Returns PhysicalDisplayId (and display name on connection of new or previously disconnected
    // display), or std::nullopt if hotplug event was ignored.
    std::optional<DisplayIdentificationInfo> onHotplug(hal::HWDisplayId, hal::Connection) override;
    std::optional<DisplayIdentificationInfo> onHotplug(hal::HWDisplayId, HotplugEvent) override;

    bool updatesDeviceProductInfoOnHotplugReconnect() const override;

+7 −8
Original line number Diff line number Diff line
@@ -135,7 +135,6 @@
#include "DisplayDevice.h"
#include "DisplayHardware/ComposerHal.h"
#include "DisplayHardware/FramebufferSurface.h"
#include "DisplayHardware/HWComposer.h"
#include "DisplayHardware/Hal.h"
#include "DisplayHardware/VirtualDisplaySurface.h"
#include "DisplayRenderArea.h"
@@ -2292,12 +2291,12 @@ void SurfaceFlinger::onComposerHalVsync(hal::HWDisplayId hwcDisplayId, int64_t t
void SurfaceFlinger::onComposerHalHotplugEvent(hal::HWDisplayId hwcDisplayId,
                                               DisplayHotplugEvent event) {
    if (event == DisplayHotplugEvent::CONNECTED || event == DisplayHotplugEvent::DISCONNECTED) {
        hal::Connection connection = (event == DisplayHotplugEvent::CONNECTED)
                ? hal::Connection::CONNECTED
                : hal::Connection::DISCONNECTED;
        const HWComposer::HotplugEvent hotplugEvent = event == DisplayHotplugEvent::CONNECTED
                ? HWComposer::HotplugEvent::Connected
                : HWComposer::HotplugEvent::Disconnected;
        {
            std::lock_guard<std::mutex> lock(mHotplugMutex);
            mPendingHotplugEvents.push_back(HotplugEvent{hwcDisplayId, connection});
            mPendingHotplugEvents.push_back(HotplugEvent{hwcDisplayId, hotplugEvent});
        }

        if (mScheduler) {
@@ -3658,13 +3657,13 @@ bool SurfaceFlinger::configureLocked() {
        events = std::move(mPendingHotplugEvents);
    }

    for (const auto [hwcDisplayId, connection] : events) {
        if (auto info = getHwComposer().onHotplug(hwcDisplayId, connection)) {
    for (const auto [hwcDisplayId, event] : events) {
        if (auto info = getHwComposer().onHotplug(hwcDisplayId, event)) {
            const auto displayId = info->id;
            const ftl::Concat displayString("display ", displayId.value, "(HAL ID ", hwcDisplayId,
                                            ')');

            if (connection == hal::Connection::CONNECTED) {
            if (event == HWComposer::HotplugEvent::Connected) {
                const auto activeModeIdOpt =
                        processHotplugConnect(displayId, hwcDisplayId, std::move(*info),
                                              displayString.c_str());
+2 −2
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@
#include "Display/VirtualDisplaySnapshot.h"
#include "DisplayDevice.h"
#include "DisplayHardware/HWC2.h"
#include "DisplayHardware/HWComposer.h"
#include "DisplayIdGenerator.h"
#include "Effects/Daltonizer.h"
#include "FrontEnd/DisplayInfo.h"
@@ -126,7 +127,6 @@ class FlagManager;
class FpsReporter;
class TunnelModeEnabledReporter;
class HdrLayerInfoReporter;
class HWComposer;
class IGraphicBufferProducer;
class Layer;
class MessageBase;
@@ -1279,7 +1279,7 @@ private:

    struct HotplugEvent {
        hal::HWDisplayId hwcDisplayId;
        hal::Connection connection = hal::Connection::INVALID;
        HWComposer::HotplugEvent event;
    };

    bool mIsHdcpViaNegVsync = false;
+2 −1
Original line number Diff line number Diff line
@@ -67,7 +67,8 @@ public:
                    setVsyncEnabled(kHwcDisplayId, hal::IComposerClient::Vsync::DISABLE));
        EXPECT_CALL(*mComposerHal, onHotplugConnect(kHwcDisplayId));

        const auto infoOpt = mComposer->onHotplug(kHwcDisplayId, hal::Connection::CONNECTED);
        const auto infoOpt =
                mComposer->onHotplug(kHwcDisplayId, HWComposer::HotplugEvent::Connected);
        ASSERT_TRUE(infoOpt);

        mDisplayId = infoOpt->id;
Loading