Merge "displayconfig: Add RC Feature query support"
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
commit
cb4a416e2d
@@ -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<uint32_t> *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
|
||||
|
||||
@@ -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<uint8_t*>(&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<const bool*>(data);
|
||||
*supported = *output;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
void ClientCallback::ParseNotifyCWBBufferDone(const ByteStream &input_params,
|
||||
const HandleStream &input_handles) {
|
||||
const int *error;
|
||||
|
||||
@@ -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<uint32_t> *supported_refresh_rates);
|
||||
virtual int IsRCSupported(uint32_t disp_id, bool *supported);
|
||||
|
||||
private:
|
||||
android::sp<IDisplayConfig> display_config_ = nullptr;
|
||||
|
||||
@@ -765,6 +765,18 @@ void DeviceImpl::DeviceClientContext::ParseGetSupportedDisplayRefreshRates(
|
||||
}
|
||||
}
|
||||
|
||||
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<const uint32_t*>(data);
|
||||
bool supported = false;
|
||||
int32_t error = intf_->IsRCSupported(*disp_id, &supported);
|
||||
ByteStream output_params;
|
||||
output_params.setToExternal(reinterpret_cast<uint8_t*>(&supported), sizeof(bool));
|
||||
|
||||
_hidl_cb(error, output_params, {});
|
||||
}
|
||||
|
||||
Return<void> DeviceImpl::perform(uint64_t client_handle, uint32_t op_code,
|
||||
const ByteStream &input_params, const HandleStream &input_handles,
|
||||
perform_cb _hidl_cb) {
|
||||
@@ -921,6 +933,9 @@ Return<void> 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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -78,6 +78,7 @@ enum OpCode {
|
||||
kSendTUIEvent = 42,
|
||||
kGetDisplayHwId = 43,
|
||||
kGetSupportedDisplayRefreshRates = 44,
|
||||
kIsRCSupported = 45,
|
||||
|
||||
kDestroy = 0xFFFF, // Destroy sequence execution
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user