drm_hwcomposer: Support multiple AIDL versions
As far as I know, there's no way for Soong to support multiple versions that will change dependencies based on the Android API version. However, we can still do that if we build with the aospext project, making it possible for Android-13 and Android-14 to use the latest drm_hwcomposer. Change-Id: Ifeee42d3af64ff873b1a149231dc542ee2aee1df Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
This commit is contained in:
parent
6e5c82eae6
commit
71a8f02e98
3 changed files with 46 additions and 0 deletions
|
|
@ -190,6 +190,28 @@ std::optional<HWC2::Composition> 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> 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<DisplayConfiguration>* 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);
|
||||
|
|
|
|||
|
|
@ -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<DisplayConfiguration>* 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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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<int32_t>(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<int64_t>(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<uint64_t>(display_id), connected);
|
||||
composer_callback_->onHotplug(static_cast<int64_t>(display_id), connected);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void DrmHwcThree::CleanDisplayResources(uint64_t display_id) {
|
||||
DEBUG_FUNC();
|
||||
HwcDisplay* display = GetDisplay(display_id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue