Loading services/surfaceflinger/CompositionEngine/src/Display.cpp +7 −3 Original line number Diff line number Diff line Loading @@ -59,9 +59,13 @@ void Display::setConfiguration(const compositionengine::DisplayCreationArgs& arg setName(args.name); bool isBootModeSupported = getCompositionEngine().getHwComposer().getBootDisplayModeSupport(); const auto physicalId = PhysicalDisplayId::tryCast(mId); if (physicalId && isBootModeSupported) { mPreferredBootDisplayModeId = static_cast<int32_t>( getCompositionEngine().getHwComposer().getPreferredBootDisplayMode(*physicalId)); if (!physicalId || !isBootModeSupported) { return; } std::optional<hal::HWConfigId> preferredBootModeId = getCompositionEngine().getHwComposer().getPreferredBootDisplayMode(*physicalId); if (preferredBootModeId.has_value()) { mPreferredBootDisplayModeId = static_cast<int32_t>(preferredBootModeId.value()); } } Loading services/surfaceflinger/CompositionEngine/tests/MockHWComposer.h +1 −1 Original line number Diff line number Diff line Loading @@ -108,7 +108,7 @@ public: hal::VsyncPeriodChangeTimeline*)); MOCK_METHOD2(setBootDisplayMode, status_t(PhysicalDisplayId, hal::HWConfigId)); MOCK_METHOD1(clearBootDisplayMode, status_t(PhysicalDisplayId)); MOCK_METHOD1(getPreferredBootDisplayMode, hal::HWConfigId(PhysicalDisplayId)); MOCK_METHOD1(getPreferredBootDisplayMode, std::optional<hal::HWConfigId>(PhysicalDisplayId)); MOCK_METHOD0(getBootDisplayModeSupport, bool()); MOCK_METHOD2(setAutoLowLatencyMode, status_t(PhysicalDisplayId, bool)); MOCK_METHOD2(getSupportedContentTypes, Loading services/surfaceflinger/DisplayHardware/HWComposer.cpp +7 −9 Original line number Diff line number Diff line Loading @@ -772,18 +772,16 @@ status_t HWComposer::clearBootDisplayMode(PhysicalDisplayId displayId) { return NO_ERROR; } hal::HWConfigId HWComposer::getPreferredBootDisplayMode(PhysicalDisplayId displayId) { RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX); hal::HWConfigId displayModeId = -1; std::optional<hal::HWConfigId> HWComposer::getPreferredBootDisplayMode( PhysicalDisplayId displayId) { RETURN_IF_INVALID_DISPLAY(displayId, std::nullopt); hal::HWConfigId displayModeId; const auto error = mDisplayData[displayId].hwcDisplay->getPreferredBootDisplayConfig(&displayModeId); if (error == hal::Error::UNSUPPORTED) { RETURN_IF_HWC_ERROR(error, displayId, INVALID_OPERATION); } if (error == hal::Error::BAD_PARAMETER) { RETURN_IF_HWC_ERROR(error, displayId, BAD_VALUE); if (error != hal::Error::NONE) { LOG_DISPLAY_ERROR(displayId, to_string(error).c_str()); return std::nullopt; } RETURN_IF_HWC_ERROR(error, displayId, UNKNOWN_ERROR); return displayModeId; } Loading services/surfaceflinger/DisplayHardware/HWComposer.h +2 −2 Original line number Diff line number Diff line Loading @@ -260,7 +260,7 @@ public: virtual bool getBootDisplayModeSupport() = 0; virtual status_t setBootDisplayMode(PhysicalDisplayId, hal::HWConfigId) = 0; virtual status_t clearBootDisplayMode(PhysicalDisplayId) = 0; virtual hal::HWConfigId getPreferredBootDisplayMode(PhysicalDisplayId) = 0; virtual std::optional<hal::HWConfigId> getPreferredBootDisplayMode(PhysicalDisplayId) = 0; }; namespace impl { Loading Loading @@ -391,7 +391,7 @@ public: bool getBootDisplayModeSupport() override; status_t setBootDisplayMode(PhysicalDisplayId, hal::HWConfigId) override; status_t clearBootDisplayMode(PhysicalDisplayId) override; hal::HWConfigId getPreferredBootDisplayMode(PhysicalDisplayId) override; std::optional<hal::HWConfigId> getPreferredBootDisplayMode(PhysicalDisplayId) override; // for debugging ---------------------------------------------------------- void dump(std::string& out) const override; Loading Loading
services/surfaceflinger/CompositionEngine/src/Display.cpp +7 −3 Original line number Diff line number Diff line Loading @@ -59,9 +59,13 @@ void Display::setConfiguration(const compositionengine::DisplayCreationArgs& arg setName(args.name); bool isBootModeSupported = getCompositionEngine().getHwComposer().getBootDisplayModeSupport(); const auto physicalId = PhysicalDisplayId::tryCast(mId); if (physicalId && isBootModeSupported) { mPreferredBootDisplayModeId = static_cast<int32_t>( getCompositionEngine().getHwComposer().getPreferredBootDisplayMode(*physicalId)); if (!physicalId || !isBootModeSupported) { return; } std::optional<hal::HWConfigId> preferredBootModeId = getCompositionEngine().getHwComposer().getPreferredBootDisplayMode(*physicalId); if (preferredBootModeId.has_value()) { mPreferredBootDisplayModeId = static_cast<int32_t>(preferredBootModeId.value()); } } Loading
services/surfaceflinger/CompositionEngine/tests/MockHWComposer.h +1 −1 Original line number Diff line number Diff line Loading @@ -108,7 +108,7 @@ public: hal::VsyncPeriodChangeTimeline*)); MOCK_METHOD2(setBootDisplayMode, status_t(PhysicalDisplayId, hal::HWConfigId)); MOCK_METHOD1(clearBootDisplayMode, status_t(PhysicalDisplayId)); MOCK_METHOD1(getPreferredBootDisplayMode, hal::HWConfigId(PhysicalDisplayId)); MOCK_METHOD1(getPreferredBootDisplayMode, std::optional<hal::HWConfigId>(PhysicalDisplayId)); MOCK_METHOD0(getBootDisplayModeSupport, bool()); MOCK_METHOD2(setAutoLowLatencyMode, status_t(PhysicalDisplayId, bool)); MOCK_METHOD2(getSupportedContentTypes, Loading
services/surfaceflinger/DisplayHardware/HWComposer.cpp +7 −9 Original line number Diff line number Diff line Loading @@ -772,18 +772,16 @@ status_t HWComposer::clearBootDisplayMode(PhysicalDisplayId displayId) { return NO_ERROR; } hal::HWConfigId HWComposer::getPreferredBootDisplayMode(PhysicalDisplayId displayId) { RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX); hal::HWConfigId displayModeId = -1; std::optional<hal::HWConfigId> HWComposer::getPreferredBootDisplayMode( PhysicalDisplayId displayId) { RETURN_IF_INVALID_DISPLAY(displayId, std::nullopt); hal::HWConfigId displayModeId; const auto error = mDisplayData[displayId].hwcDisplay->getPreferredBootDisplayConfig(&displayModeId); if (error == hal::Error::UNSUPPORTED) { RETURN_IF_HWC_ERROR(error, displayId, INVALID_OPERATION); } if (error == hal::Error::BAD_PARAMETER) { RETURN_IF_HWC_ERROR(error, displayId, BAD_VALUE); if (error != hal::Error::NONE) { LOG_DISPLAY_ERROR(displayId, to_string(error).c_str()); return std::nullopt; } RETURN_IF_HWC_ERROR(error, displayId, UNKNOWN_ERROR); return displayModeId; } Loading
services/surfaceflinger/DisplayHardware/HWComposer.h +2 −2 Original line number Diff line number Diff line Loading @@ -260,7 +260,7 @@ public: virtual bool getBootDisplayModeSupport() = 0; virtual status_t setBootDisplayMode(PhysicalDisplayId, hal::HWConfigId) = 0; virtual status_t clearBootDisplayMode(PhysicalDisplayId) = 0; virtual hal::HWConfigId getPreferredBootDisplayMode(PhysicalDisplayId) = 0; virtual std::optional<hal::HWConfigId> getPreferredBootDisplayMode(PhysicalDisplayId) = 0; }; namespace impl { Loading Loading @@ -391,7 +391,7 @@ public: bool getBootDisplayModeSupport() override; status_t setBootDisplayMode(PhysicalDisplayId, hal::HWConfigId) override; status_t clearBootDisplayMode(PhysicalDisplayId) override; hal::HWConfigId getPreferredBootDisplayMode(PhysicalDisplayId) override; std::optional<hal::HWConfigId> getPreferredBootDisplayMode(PhysicalDisplayId) override; // for debugging ---------------------------------------------------------- void dump(std::string& out) const override; Loading