displayconfig: Add support for AllowIdleFallback interface

Change-Id: Ibe07e550faa33bf68bc12bcd0ae5ffc1ffdf4a20
CRs-Fixed: 2928557
This commit is contained in:
Devanshi Bansal
2020-12-06 21:33:53 +05:30
committed by Gerrit - the friendly Code Review server
parent bf1eb9996d
commit 5b6eff8fb6
6 changed files with 26 additions and 2 deletions

View File

@@ -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

View File

@@ -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;

View File

@@ -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:

View File

@@ -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<void> 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<void> 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;

View File

@@ -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;

View File

@@ -82,7 +82,8 @@ enum OpCode {
kControlIdleStatusCallback = 46,
kIsSupportedConfigSwitch = 47,
kGetDisplayType = 48,
kDummyOpcode = 49,
kAllowIdleFallback = 49,
kDummyOpcode = 50,
kDestroy = 0xFFFF, // Destroy sequence execution
};