From fe080b5bce6df489512ae3264cce043706b4e32c Mon Sep 17 00:00:00 2001 From: Mathew Joseph Karimpanal Date: Wed, 2 Sep 2020 00:43:11 +0530 Subject: [PATCH] displayconfig: Add RC Feature query support Add support to query if RC Feature is available. CRs-Fixed: 2758787 Change-Id: I463382fba34cbfbddef13e976bb055a0a362eb14 --- services/config/config_defs.h | 1 + services/config/src/client_impl.cpp | 22 ++++++++++++++++++++++ services/config/src/client_impl.h | 1 + services/config/src/device_impl.cpp | 15 +++++++++++++++ services/config/src/device_impl.h | 1 + services/config/src/opcode_types.h | 1 + 6 files changed, 41 insertions(+) diff --git a/services/config/config_defs.h b/services/config/config_defs.h index 0009ac83..f25013b0 100644 --- a/services/config/config_defs.h +++ b/services/config/config_defs.h @@ -298,6 +298,7 @@ class ConfigInterface { virtual int GetDisplayHwId(uint32_t disp_id, uint32_t *display_hw_id) DEFAULT_RET virtual int GetSupportedDisplayRefreshRates( DisplayType dpy, std::vector *supported_refresh_rates) DEFAULT_RET + virtual int IsRCSupported(uint32_t disp_id, bool *supported) DEFAULT_RET // deprecated APIs virtual int GetDebugProperty(const std::string prop_name, std::string value) DEFAULT_RET diff --git a/services/config/src/client_impl.cpp b/services/config/src/client_impl.cpp index 9790f213..e6bc6129 100644 --- a/services/config/src/client_impl.cpp +++ b/services/config/src/client_impl.cpp @@ -891,6 +891,28 @@ int ClientImpl::GetSupportedDisplayRefreshRates(DisplayType dpy, return error; } +int ClientImpl::IsRCSupported(uint32_t disp_id, bool *supported) { + ByteStream input_params; + input_params.setToExternal(reinterpret_cast(&disp_id), sizeof(uint32_t)); + const bool *output; + ByteStream output_params; + int error = 0; + auto hidl_cb = [&error, &output_params] (int32_t err, ByteStream params, HandleStream handles) { + error = err; + output_params = params; + }; + + display_config_->perform(client_handle_, kIsRCSupported, input_params, {}, hidl_cb); + + if (!error) { + const uint8_t *data = output_params.data(); + output = reinterpret_cast(data); + *supported = *output; + } + + 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 737ea19d..b944bb13 100644 --- a/services/config/src/client_impl.h +++ b/services/config/src/client_impl.h @@ -118,6 +118,7 @@ class ClientImpl : public ClientInterface { virtual int GetDisplayHwId(uint32_t disp_id, uint32_t *display_hw_id); virtual int GetSupportedDisplayRefreshRates(DisplayType dpy, std::vector *supported_refresh_rates); + virtual int IsRCSupported(uint32_t disp_id, bool *supported); private: android::sp display_config_ = nullptr; diff --git a/services/config/src/device_impl.cpp b/services/config/src/device_impl.cpp index b88e1c5e..2a9ddf73 100644 --- a/services/config/src/device_impl.cpp +++ b/services/config/src/device_impl.cpp @@ -761,6 +761,18 @@ void DeviceImpl::DeviceClientContext::ParseGetSupportedDisplayRefreshRates( _hidl_cb(error, output_params, {}); } +void DeviceImpl::DeviceClientContext::ParseIsRCSupported(const ByteStream &input_params, + perform_cb _hidl_cb) { + const uint8_t *data = input_params.data(); + const uint32_t *disp_id = reinterpret_cast(data); + bool supported = false; + int32_t error = intf_->IsRCSupported(*disp_id, &supported); + ByteStream output_params; + output_params.setToExternal(reinterpret_cast(&supported), sizeof(bool)); + + _hidl_cb(error, output_params, {}); +} + Return DeviceImpl::perform(uint64_t client_handle, uint32_t op_code, const ByteStream &input_params, const HandleStream &input_handles, perform_cb _hidl_cb) { @@ -917,6 +929,9 @@ Return DeviceImpl::perform(uint64_t client_handle, uint32_t op_code, case kGetSupportedDisplayRefreshRates: client->ParseGetSupportedDisplayRefreshRates(input_params, _hidl_cb); break; + case kIsRCSupported: + client->ParseIsRCSupported(input_params, _hidl_cb); + break; default: break; } diff --git a/services/config/src/device_impl.h b/services/config/src/device_impl.h index a116f301..a2435995 100644 --- a/services/config/src/device_impl.h +++ b/services/config/src/device_impl.h @@ -119,6 +119,7 @@ class DeviceImpl : public IDisplayConfig, public android::hardware::hidl_death_r void ParseSendTUIEvent(const ByteStream &input_params, perform_cb _hidl_cb); void ParseGetDisplayHwId(const ByteStream &input_params, perform_cb _hidl_cb); void ParseGetSupportedDisplayRefreshRates(const ByteStream &input_params, perform_cb _hidl_cb); + void ParseIsRCSupported(const ByteStream &input_params, 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 6386cae9..84f9747a 100644 --- a/services/config/src/opcode_types.h +++ b/services/config/src/opcode_types.h @@ -78,6 +78,7 @@ enum OpCode { kSendTUIEvent = 42, kGetDisplayHwId = 43, kGetSupportedDisplayRefreshRates = 44, + kIsRCSupported = 45, kDestroy = 0xFFFF, // Destroy sequence execution };