displayconfig: Add API to query supported refresh rates from HAL
Add HIDL API to query supported refresh rates from Display HAL. The API would return a vector of supported fps in the current config group. Change-Id: I27640114963a97c96738387fe502b802a48837ba CRs-Fixed: 2749264
This commit is contained in:
@@ -296,6 +296,8 @@ class ConfigInterface {
|
|||||||
virtual int ControlQsyncCallback(bool enable) DEFAULT_RET
|
virtual int ControlQsyncCallback(bool enable) DEFAULT_RET
|
||||||
virtual int SendTUIEvent(DisplayType dpy, TUIEventType event_type) DEFAULT_RET
|
virtual int SendTUIEvent(DisplayType dpy, TUIEventType event_type) DEFAULT_RET
|
||||||
virtual int GetDisplayHwId(uint32_t disp_id, uint32_t *display_hw_id) DEFAULT_RET
|
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
|
||||||
|
|
||||||
// deprecated APIs
|
// deprecated APIs
|
||||||
virtual int GetDebugProperty(const std::string prop_name, std::string value) DEFAULT_RET
|
virtual int GetDebugProperty(const std::string prop_name, std::string value) DEFAULT_RET
|
||||||
|
|||||||
@@ -865,6 +865,32 @@ int ClientImpl::GetDisplayHwId(uint32_t disp_id, uint32_t *display_hw_id) {
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ClientImpl::GetSupportedDisplayRefreshRates(DisplayType dpy,
|
||||||
|
std::vector<uint32_t> *supported_refresh_rates) {
|
||||||
|
ByteStream input_params;
|
||||||
|
input_params.setToExternal(reinterpret_cast<uint8_t *>(&dpy), sizeof(DisplayType));
|
||||||
|
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_, kGetSupportedDisplayRefreshRates, input_params, {},
|
||||||
|
hidl_cb);
|
||||||
|
|
||||||
|
if (!error) {
|
||||||
|
const uint8_t *data = output_params.data();
|
||||||
|
const uint32_t *refresh_rates_data = reinterpret_cast<const uint32_t *>(data);
|
||||||
|
int num_refresh_rates = static_cast<int>(output_params.size() / sizeof(uint32_t));
|
||||||
|
for (int i = 0; i < num_refresh_rates; i++) {
|
||||||
|
supported_refresh_rates->push_back(refresh_rates_data[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
void ClientCallback::ParseNotifyCWBBufferDone(const ByteStream &input_params,
|
void ClientCallback::ParseNotifyCWBBufferDone(const ByteStream &input_params,
|
||||||
const HandleStream &input_handles) {
|
const HandleStream &input_handles) {
|
||||||
const int *error;
|
const int *error;
|
||||||
|
|||||||
@@ -116,6 +116,8 @@ class ClientImpl : public ClientInterface {
|
|||||||
virtual int ControlQsyncCallback(bool enable);
|
virtual int ControlQsyncCallback(bool enable);
|
||||||
virtual int SendTUIEvent(DisplayType dpy, TUIEventType event_type);
|
virtual int SendTUIEvent(DisplayType dpy, TUIEventType event_type);
|
||||||
virtual int GetDisplayHwId(uint32_t disp_id, uint32_t *display_hw_id);
|
virtual int GetDisplayHwId(uint32_t disp_id, uint32_t *display_hw_id);
|
||||||
|
virtual int GetSupportedDisplayRefreshRates(DisplayType dpy,
|
||||||
|
std::vector<uint32_t> *supported_refresh_rates);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
android::sp<IDisplayConfig> display_config_ = nullptr;
|
android::sp<IDisplayConfig> display_config_ = nullptr;
|
||||||
|
|||||||
@@ -736,6 +736,25 @@ void DeviceImpl::DeviceClientContext::ParseGetDisplayHwId(const ByteStream &inpu
|
|||||||
_hidl_cb(error, output_params, {});
|
_hidl_cb(error, output_params, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeviceImpl::DeviceClientContext::ParseGetSupportedDisplayRefreshRates(
|
||||||
|
const ByteStream &input_params, perform_cb _hidl_cb) {
|
||||||
|
ByteStream output_params;
|
||||||
|
std::vector<uint32_t> refresh_rates;
|
||||||
|
|
||||||
|
const uint8_t *data = input_params.data();
|
||||||
|
const DisplayType *dpy = reinterpret_cast<const DisplayType *>(data);
|
||||||
|
int32_t error = intf_->GetSupportedDisplayRefreshRates(*dpy, &refresh_rates);
|
||||||
|
|
||||||
|
uint32_t *refresh_rates_data =
|
||||||
|
reinterpret_cast<uint32_t *>(malloc(sizeof(uint32_t) * refresh_rates.size()));
|
||||||
|
for (int i = 0; i < refresh_rates.size(); i++) {
|
||||||
|
refresh_rates_data[i] = refresh_rates[i];
|
||||||
|
}
|
||||||
|
output_params.setToExternal(reinterpret_cast<uint8_t *>(refresh_rates_data),
|
||||||
|
sizeof(uint32_t) * refresh_rates.size());
|
||||||
|
_hidl_cb(error, output_params, {});
|
||||||
|
}
|
||||||
|
|
||||||
Return<void> DeviceImpl::perform(uint64_t client_handle, uint32_t op_code,
|
Return<void> DeviceImpl::perform(uint64_t client_handle, uint32_t op_code,
|
||||||
const ByteStream &input_params, const HandleStream &input_handles,
|
const ByteStream &input_params, const HandleStream &input_handles,
|
||||||
perform_cb _hidl_cb) {
|
perform_cb _hidl_cb) {
|
||||||
@@ -889,6 +908,9 @@ Return<void> DeviceImpl::perform(uint64_t client_handle, uint32_t op_code,
|
|||||||
case kGetDisplayHwId:
|
case kGetDisplayHwId:
|
||||||
client->ParseGetDisplayHwId(input_params, _hidl_cb);
|
client->ParseGetDisplayHwId(input_params, _hidl_cb);
|
||||||
break;
|
break;
|
||||||
|
case kGetSupportedDisplayRefreshRates:
|
||||||
|
client->ParseGetSupportedDisplayRefreshRates(input_params, _hidl_cb);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ class DeviceImpl : public IDisplayConfig, public android::hardware::hidl_death_r
|
|||||||
perform_cb _hidl_cb);
|
perform_cb _hidl_cb);
|
||||||
void ParseSendTUIEvent(const ByteStream &input_params, perform_cb _hidl_cb);
|
void ParseSendTUIEvent(const ByteStream &input_params, perform_cb _hidl_cb);
|
||||||
void ParseGetDisplayHwId(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);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ConfigInterface *intf_ = nullptr;
|
ConfigInterface *intf_ = nullptr;
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ enum OpCode {
|
|||||||
kControlQsyncCallback = 41,
|
kControlQsyncCallback = 41,
|
||||||
kSendTUIEvent = 42,
|
kSendTUIEvent = 42,
|
||||||
kGetDisplayHwId = 43,
|
kGetDisplayHwId = 43,
|
||||||
|
kGetSupportedDisplayRefreshRates = 44,
|
||||||
|
|
||||||
kDestroy = 0xFFFF, // Destroy sequence execution
|
kDestroy = 0xFFFF, // Destroy sequence execution
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user