diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index 69766f2a51..e73eeb0247 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -204,7 +204,7 @@ android.hardware.graphics.composer - 2.1-3 + 2.1-4 IComposer default diff --git a/graphics/composer/2.4/IComposer.hal b/graphics/composer/2.4/IComposer.hal index 34801daa27..d3b3cb60a7 100644 --- a/graphics/composer/2.4/IComposer.hal +++ b/graphics/composer/2.4/IComposer.hal @@ -17,12 +17,10 @@ package android.hardware.graphics.composer@2.4; import IComposerClient; - import @2.1::Error; import @2.3::IComposer; interface IComposer extends @2.3::IComposer { - /** * Creates a v2.4 client of the composer. Supersedes @2.3::createClient. * diff --git a/graphics/composer/2.4/IComposerClient.hal b/graphics/composer/2.4/IComposerClient.hal index 8fe0976781..60445f5327 100644 --- a/graphics/composer/2.4/IComposerClient.hal +++ b/graphics/composer/2.4/IComposerClient.hal @@ -21,13 +21,12 @@ import @2.1::Error; import @2.3::IComposerClient; interface IComposerClient extends @2.3::IComposerClient { - /** * Required capabilities which are supported by the display. The * particular set of supported capabilities for a given display may be * retrieved using getDisplayCapabilities. */ - enum DisplayCapability : uint32_t { + enum DisplayCapability : @2.3::IComposerClient.DisplayCapability { /** * Indicates that the display supports protected contents. * When returned, hardware composer must be able to accept client target @@ -36,6 +35,20 @@ interface IComposerClient extends @2.3::IComposerClient { PROTECTED_CONTENTS = 4, }; + /** + * Supersedes {@link @2.1::IComposerClient.DisplayType}. + */ + enum DisplayConnectionType : uint32_t { + /** + * Display is connected through internal port, e.g. DSI, eDP. + */ + INTERNAL = 0, + /** + * Display is connected through external port, e.g. HDMI, DisplayPort. + */ + EXTERNAL = 1, + }; + /** * Provides a list of supported capabilities (as described in the * definition of DisplayCapability above). This list must not change after @@ -46,6 +59,14 @@ interface IComposerClient extends @2.3::IComposerClient { * @return capabilities is a list of supported capabilities. */ getDisplayCapabilities_2_4(Display display) - generates (Error error, - vec capabilities); + generates (Error error, vec capabilities); + + /** + * Returns whether the given physical display is internal or external. + * + * @return error is NONE upon success. Otherwise, + * BAD_DISPLAY when the given display is invalid or virtual. + * @return type is the connection type of the display. + */ + getDisplayConnectionType(Display display) generates (Error error, DisplayConnectionType type); }; diff --git a/graphics/composer/2.4/utils/hal/include/composer-hal/2.4/ComposerClient.h b/graphics/composer/2.4/utils/hal/include/composer-hal/2.4/ComposerClient.h index 7110c80db0..c810186665 100644 --- a/graphics/composer/2.4/utils/hal/include/composer-hal/2.4/ComposerClient.h +++ b/graphics/composer/2.4/utils/hal/include/composer-hal/2.4/ComposerClient.h @@ -46,6 +46,14 @@ class ComposerClientImpl : public V2_3::hal::detail::ComposerClientImpl getDisplayConnectionType( + Display display, IComposerClient::getDisplayConnectionType_cb hidl_cb) override { + IComposerClient::DisplayConnectionType type; + Error error = mHal->getDisplayConnectionType(display, &type); + hidl_cb(error, type); + return Void(); + } + static std::unique_ptr create(Hal* hal) { auto client = std::make_unique(hal); return client->init() ? std::move(client) : nullptr; diff --git a/graphics/composer/2.4/utils/hal/include/composer-hal/2.4/ComposerHal.h b/graphics/composer/2.4/utils/hal/include/composer-hal/2.4/ComposerHal.h index 0074808309..c3bb535360 100644 --- a/graphics/composer/2.4/utils/hal/include/composer-hal/2.4/ComposerHal.h +++ b/graphics/composer/2.4/utils/hal/include/composer-hal/2.4/ComposerHal.h @@ -38,6 +38,8 @@ class ComposerHal : public V2_3::hal::ComposerHal { public: virtual Error getDisplayCapabilities_2_4( Display display, std::vector* outCapabilities) = 0; + virtual Error getDisplayConnectionType(Display display, + IComposerClient::DisplayConnectionType* outType) = 0; }; } // namespace hal diff --git a/graphics/composer/2.4/utils/passthrough/include/composer-passthrough/2.4/HwcHal.h b/graphics/composer/2.4/utils/passthrough/include/composer-passthrough/2.4/HwcHal.h index 65d47d781d..fd05f6630b 100644 --- a/graphics/composer/2.4/utils/passthrough/include/composer-passthrough/2.4/HwcHal.h +++ b/graphics/composer/2.4/utils/passthrough/include/composer-passthrough/2.4/HwcHal.h @@ -62,15 +62,34 @@ class HwcHalImpl : public V2_3::passthrough::detail::HwcHalImpl { return Error::NONE; } + Error getDisplayConnectionType(Display display, + IComposerClient::DisplayConnectionType* outType) override { + if (!mDispatch.getDisplayConnectionType) { + return Error::UNSUPPORTED; + } + + uint32_t type = HWC2_DISPLAY_CONNECTION_TYPE_INTERNAL; + int32_t error = mDispatch.getDisplayConnectionType(mDevice, display, &type); + *outType = static_cast(type); + return static_cast(error); + } + protected: bool initDispatch() override { if (!BaseType2_3::initDispatch()) { return false; } + + this->initOptionalDispatch(HWC2_FUNCTION_GET_DISPLAY_CONNECTION_TYPE, + &mDispatch.getDisplayConnectionType); return true; } private: + struct { + HWC2_PFN_GET_DISPLAY_CONNECTION_TYPE getDisplayConnectionType; + } mDispatch = {}; + using BaseType2_1 = V2_1::passthrough::detail::HwcHalImpl; using BaseType2_3 = V2_3::passthrough::detail::HwcHalImpl; using BaseType2_1::mDevice; diff --git a/graphics/composer/2.4/utils/vts/ComposerVts.cpp b/graphics/composer/2.4/utils/vts/ComposerVts.cpp index ee4f3a3959..937b50efb4 100644 --- a/graphics/composer/2.4/utils/vts/ComposerVts.cpp +++ b/graphics/composer/2.4/utils/vts/ComposerVts.cpp @@ -51,7 +51,6 @@ sp ComposerClient::getRaw() const { Error ComposerClient::getDisplayCapabilities( Display display, std::vector* outCapabilities) { - std::vector capabilities; Error error = Error::NONE; mClient->getDisplayCapabilities_2_4(display, [&](const auto& tmpError, const auto& tmpCapabilities) { @@ -61,6 +60,16 @@ Error ComposerClient::getDisplayCapabilities( return error; } +Error ComposerClient::getDisplayConnectionType(Display display, + IComposerClient::DisplayConnectionType* outType) { + Error error = Error::NONE; + mClient->getDisplayConnectionType(display, [&](const auto& tmpError, const auto& tmpType) { + error = tmpError; + *outType = tmpType; + }); + return error; +} + } // namespace vts } // namespace V2_4 } // namespace composer diff --git a/graphics/composer/2.4/utils/vts/include/composer-vts/2.4/ComposerVts.h b/graphics/composer/2.4/utils/vts/include/composer-vts/2.4/ComposerVts.h index 0a301c6ca7..a7d7f8644f 100644 --- a/graphics/composer/2.4/utils/vts/include/composer-vts/2.4/ComposerVts.h +++ b/graphics/composer/2.4/utils/vts/include/composer-vts/2.4/ComposerVts.h @@ -71,6 +71,9 @@ class ComposerClient : public V2_3::vts::ComposerClient { Display display, std::vector* outDisplayCapabilities); + Error getDisplayConnectionType(Display display, + IComposerClient::DisplayConnectionType* outType); + private: const sp mClient; }; diff --git a/graphics/composer/2.4/vts/functional/VtsHalGraphicsComposerV2_4TargetTest.cpp b/graphics/composer/2.4/vts/functional/VtsHalGraphicsComposerV2_4TargetTest.cpp index 0fccc58637..76c0039cf2 100644 --- a/graphics/composer/2.4/vts/functional/VtsHalGraphicsComposerV2_4TargetTest.cpp +++ b/graphics/composer/2.4/vts/functional/VtsHalGraphicsComposerV2_4TargetTest.cpp @@ -179,6 +179,16 @@ TEST_F(GraphicsComposerHidlTest, getDisplayCapabilitiesBadDisplay) { EXPECT_EQ(Error::BAD_DISPLAY, error); } +TEST_F(GraphicsComposerHidlTest, getDisplayConnectionType) { + IComposerClient::DisplayConnectionType type; + EXPECT_EQ(Error::BAD_DISPLAY, + mComposerClient->getDisplayConnectionType(mInvalidDisplayId, &type)); + + for (Display display : mComposerCallback->getDisplays()) { + EXPECT_EQ(Error::NONE, mComposerClient->getDisplayConnectionType(display, &type)); + } +} + } // namespace } // namespace vts } // namespace V2_4