From 5b6eff8fb6d79dc3e8aed57e71a55ca48bbb540e Mon Sep 17 00:00:00 2001 From: Devanshi Bansal Date: Sun, 6 Dec 2020 21:33:53 +0530 Subject: [PATCH] displayconfig: Add support for AllowIdleFallback interface Change-Id: Ibe07e550faa33bf68bc12bcd0ae5ffc1ffdf4a20 CRs-Fixed: 2928557 --- services/config/config_defs.h | 2 ++ services/config/src/client_impl.cpp | 11 +++++++++++ services/config/src/client_impl.h | 1 + services/config/src/device_impl.cpp | 8 ++++++++ services/config/src/device_impl.h | 3 ++- services/config/src/opcode_types.h | 3 ++- 6 files changed, 26 insertions(+), 2 deletions(-) diff --git a/services/config/config_defs.h b/services/config/config_defs.h index ab51a0e9..56434c01 100644 --- a/services/config/config_defs.h +++ b/services/config/config_defs.h @@ -42,6 +42,7 @@ // client code will automatically get compiled. #define DISPLAY_CONFIG_API_LEVEL_0 #define DISPLAY_CONFIG_API_LEVEL_1 +#define DISPLAY_CONFIG_API_LEVEL_2 namespace DisplayConfig { @@ -324,6 +325,7 @@ class ConfigInterface { bool* /* supported */) DEFAULT_RET virtual int GetDisplayType(uint64_t /* physical_disp_id */, DisplayType* /* disp_type */) DEFAULT_RET + virtual int AllowIdleFallback() DEFAULT_RET virtual int DummyDisplayConfigAPI() DEFAULT_RET // deprecated APIs diff --git a/services/config/src/client_impl.cpp b/services/config/src/client_impl.cpp index 38dca8c8..ad0b1fb7 100644 --- a/services/config/src/client_impl.cpp +++ b/services/config/src/client_impl.cpp @@ -995,6 +995,17 @@ int ClientImpl::GetDisplayType(uint64_t physical_disp_id, DisplayType *disp_type return error; } +int ClientImpl::AllowIdleFallback() { + int error = 0; + auto hidl_cb = [&error] (int32_t err, ByteStream params, HandleStream handles) { + error = err; + }; + if (display_config_) { + display_config_->perform(client_handle_, kAllowIdleFallback, {}, {}, hidl_cb); + } + return error; +} + void ClientCallback::ParseNotifyCWBBufferDone(const ByteStream &input_params, const HandleStream &input_handles) { const int *error; diff --git a/services/config/src/client_impl.h b/services/config/src/client_impl.h index b21bc4d3..48b543af 100644 --- a/services/config/src/client_impl.h +++ b/services/config/src/client_impl.h @@ -126,6 +126,7 @@ class ClientImpl : public ClientInterface { virtual int ControlIdleStatusCallback(bool enable); virtual int IsSupportedConfigSwitch(uint32_t disp_id, uint32_t config, bool *supported); virtual int GetDisplayType(uint64_t physical_disp_id, DisplayType *disp_type); + virtual int AllowIdleFallback(); virtual int DummyDisplayConfigAPI(); private: diff --git a/services/config/src/device_impl.cpp b/services/config/src/device_impl.cpp index 72f7a3f3..df4731fb 100644 --- a/services/config/src/device_impl.cpp +++ b/services/config/src/device_impl.cpp @@ -851,6 +851,11 @@ void DeviceImpl::DeviceClientContext::ParseGetDisplayType(const ByteStream &inpu _hidl_cb(error, output_params, {}); } +void DeviceImpl::DeviceClientContext::ParseAllowIdleFallback(perform_cb _hidl_cb) { + int32_t error = intf_->AllowIdleFallback(); + _hidl_cb(error, {}, {}); +} + Return DeviceImpl::perform(uint64_t client_handle, uint32_t op_code, const ByteStream &input_params, const HandleStream &input_handles, perform_cb _hidl_cb) { @@ -1019,6 +1024,9 @@ Return DeviceImpl::perform(uint64_t client_handle, uint32_t op_code, case kGetDisplayType: client->ParseGetDisplayType(input_params, _hidl_cb); break; + case kAllowIdleFallback: + client->ParseAllowIdleFallback(_hidl_cb); + break; case kDummyOpcode: _hidl_cb(-EINVAL, {}, {}); break; diff --git a/services/config/src/device_impl.h b/services/config/src/device_impl.h index a1d26eb2..4c22a47d 100644 --- a/services/config/src/device_impl.h +++ b/services/config/src/device_impl.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2020 The Linux Foundation. All rights reserved. +* Copyright (c) 2021 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -125,6 +125,7 @@ class DeviceImpl : public IDisplayConfig, public android::hardware::hidl_death_r perform_cb _hidl_cb); void ParseIsSupportedConfigSwitch(const ByteStream &input_params, perform_cb _hidl_cb); void ParseGetDisplayType(const ByteStream &input_params, perform_cb _hidl_cb); + void ParseAllowIdleFallback(perform_cb _hidl_cb); private: ConfigInterface *intf_ = nullptr; diff --git a/services/config/src/opcode_types.h b/services/config/src/opcode_types.h index 2a881fd3..4813e47d 100644 --- a/services/config/src/opcode_types.h +++ b/services/config/src/opcode_types.h @@ -82,7 +82,8 @@ enum OpCode { kControlIdleStatusCallback = 46, kIsSupportedConfigSwitch = 47, kGetDisplayType = 48, - kDummyOpcode = 49, + kAllowIdleFallback = 49, + kDummyOpcode = 50, kDestroy = 0xFFFF, // Destroy sequence execution };