diff --git a/hwc3/ComposerClient.cpp b/hwc3/ComposerClient.cpp index 2aed2bc..0597712 100644 --- a/hwc3/ComposerClient.cpp +++ b/hwc3/ComposerClient.cpp @@ -190,6 +190,28 @@ std::optional AidlToCompositionType( } } +#if __ANDROID_API__ < 35 + +class DisplayConfiguration { + public: + class Dpi { + public: + float x = 0.000000F; + float y = 0.000000F; + }; + // NOLINTNEXTLINE(readability-identifier-naming) + int32_t configId = 0; + int32_t width = 0; + int32_t height = 0; + std::optional dpi; + // NOLINTNEXTLINE(readability-identifier-naming) + int32_t configGroup = 0; + // NOLINTNEXTLINE(readability-identifier-naming) + int32_t vsyncPeriod = 0; +}; + +#endif + DisplayConfiguration HwcDisplayConfigToAidlConfiguration( const HwcDisplayConfigs& configs, const HwcDisplayConfig& config) { DisplayConfiguration aidl_configuration = @@ -1173,6 +1195,8 @@ ndk::ScopedAStatus ComposerClient::setRefreshRateChangedCallbackDebugEnabled( return ToBinderStatus(hwc3::Error::kUnsupported); } +#if __ANDROID_API__ >= 35 + ndk::ScopedAStatus ComposerClient::getDisplayConfigurations( int64_t display_id, int32_t /*max_frame_interval_ns*/, std::vector* configurations) { @@ -1197,6 +1221,8 @@ ndk::ScopedAStatus ComposerClient::notifyExpectedPresent( return ToBinderStatus(hwc3::Error::kUnsupported); } +#endif + std::string ComposerClient::Dump() { uint32_t size = 0; hwc_->Dump(&size, nullptr); diff --git a/hwc3/ComposerClient.h b/hwc3/ComposerClient.h index 5e4949e..b8ab715 100644 --- a/hwc3/ComposerClient.h +++ b/hwc3/ComposerClient.h @@ -145,6 +145,9 @@ class ComposerClient : public BnComposerClient { common::Hdr* out_hdr) override; ndk::ScopedAStatus setRefreshRateChangedCallbackDebugEnabled( int64_t display, bool enabled) override; + +#if __ANDROID_API__ >= 35 + ndk::ScopedAStatus getDisplayConfigurations( int64_t display, int32_t max_frame_interval_ns, std::vector* configurations) override; @@ -152,6 +155,8 @@ class ComposerClient : public BnComposerClient { int64_t display, const ClockMonotonicTimestamp& expected_present_time, int32_t frame_interval_ns) override; +#endif + protected: ::ndk::SpAIBinder createBinder() override; diff --git a/hwc3/DrmHwcThree.cpp b/hwc3/DrmHwcThree.cpp index 2ac307c..fb14bc9 100644 --- a/hwc3/DrmHwcThree.cpp +++ b/hwc3/DrmHwcThree.cpp @@ -22,7 +22,9 @@ #include "Utils.h" #include "aidl/android/hardware/graphics/common/Dataspace.h" +#if __ANDROID_API__ >= 35 #include "aidl/android/hardware/graphics/common/DisplayHotplugEvent.h" +#endif namespace aidl::android::hardware::graphics::composer3::impl { @@ -61,6 +63,8 @@ void DrmHwcThree::SendVsyncEventToClient(uint64_t display_id, int64_t timestamp, static_cast(vsync_period)); } +#if __ANDROID_API__ >= 35 + void DrmHwcThree::SendHotplugEventToClient( hwc2_display_t display_id, DrmHwc::DisplayStatus display_status) { common::DisplayHotplugEvent event = common::DisplayHotplugEvent::DISCONNECTED; @@ -80,6 +84,17 @@ void DrmHwcThree::SendHotplugEventToClient( composer_callback_->onHotplugEvent(static_cast(display_id), event); } +#else + +void DrmHwcThree::SendHotplugEventToClient( + hwc2_display_t display_id, DrmHwc::DisplayStatus display_status) { + bool connected = display_status != DrmHwc::kDisconnected; + HandleDisplayHotplugEvent(static_cast(display_id), connected); + composer_callback_->onHotplug(static_cast(display_id), connected); +} + +#endif + void DrmHwcThree::CleanDisplayResources(uint64_t display_id) { DEBUG_FUNC(); HwcDisplay* display = GetDisplay(display_id);