Merge "DisplayConfig: Add support to notify idling."
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
commit
1e64e1f122
@@ -39,6 +39,7 @@
|
|||||||
// implementation being present. When this ifdef gets enabled in this header, the
|
// implementation being present. When this ifdef gets enabled in this header, the
|
||||||
// client code will automatically get compiled.
|
// client code will automatically get compiled.
|
||||||
#define DISPLAY_CONFIG_API_LEVEL_0
|
#define DISPLAY_CONFIG_API_LEVEL_0
|
||||||
|
#define DISPLAY_CONFIG_API_LEVEL_1
|
||||||
|
|
||||||
namespace DisplayConfig {
|
namespace DisplayConfig {
|
||||||
|
|
||||||
@@ -237,6 +238,7 @@ class ConfigCallback {
|
|||||||
public:
|
public:
|
||||||
virtual void NotifyCWBBufferDone(int error, const native_handle_t *buffer) { }
|
virtual void NotifyCWBBufferDone(int error, const native_handle_t *buffer) { }
|
||||||
virtual void NotifyQsyncChange(bool qsync_enabled, int refresh_rate, int qsync_refresh_rate) { }
|
virtual void NotifyQsyncChange(bool qsync_enabled, int refresh_rate, int qsync_refresh_rate) { }
|
||||||
|
virtual void NotifyIdleStatus(bool is_idle) { }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~ConfigCallback() { }
|
virtual ~ConfigCallback() { }
|
||||||
@@ -299,6 +301,7 @@ class ConfigInterface {
|
|||||||
virtual int GetSupportedDisplayRefreshRates(
|
virtual int GetSupportedDisplayRefreshRates(
|
||||||
DisplayType dpy, std::vector<uint32_t> *supported_refresh_rates) DEFAULT_RET
|
DisplayType dpy, std::vector<uint32_t> *supported_refresh_rates) DEFAULT_RET
|
||||||
virtual int IsRCSupported(uint32_t disp_id, bool *supported) DEFAULT_RET
|
virtual int IsRCSupported(uint32_t disp_id, bool *supported) DEFAULT_RET
|
||||||
|
virtual int ControlIdleStatusCallback(bool enable) 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
|
||||||
|
|||||||
@@ -828,6 +828,19 @@ int ClientImpl::ControlQsyncCallback(bool enable) {
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ClientImpl::ControlIdleStatusCallback(bool enable) {
|
||||||
|
ByteStream input_params;
|
||||||
|
input_params.setToExternal(reinterpret_cast<uint8_t*>(&enable), sizeof(bool));
|
||||||
|
int32_t error = 0;
|
||||||
|
auto hidl_cb = [&error] (int32_t err, ByteStream params, HandleStream handles) {
|
||||||
|
error = err;
|
||||||
|
};
|
||||||
|
|
||||||
|
display_config_->perform(client_handle_, kControlIdleStatusCallback, input_params, {}, hidl_cb);
|
||||||
|
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
int ClientImpl::SendTUIEvent(DisplayType dpy, TUIEventType event_type) {
|
int ClientImpl::SendTUIEvent(DisplayType dpy, TUIEventType event_type) {
|
||||||
struct TUIEventParams input = {dpy, event_type};
|
struct TUIEventParams input = {dpy, event_type};
|
||||||
ByteStream input_params;
|
ByteStream input_params;
|
||||||
@@ -940,6 +953,17 @@ void ClientCallback::ParseNotifyQsyncChange(const ByteStream &input_params) {
|
|||||||
qsync_data->qsync_refresh_rate);
|
qsync_data->qsync_refresh_rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClientCallback::ParseNotifyIdleStatus(const ByteStream &input_params) {
|
||||||
|
const bool *is_idle;
|
||||||
|
if (callback_ == nullptr || input_params.size() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const uint8_t *data = input_params.data();
|
||||||
|
is_idle = reinterpret_cast<const bool*>(data);
|
||||||
|
callback_->NotifyIdleStatus(*is_idle);
|
||||||
|
}
|
||||||
|
|
||||||
Return<void> ClientCallback::perform(uint32_t op_code, const ByteStream &input_params,
|
Return<void> ClientCallback::perform(uint32_t op_code, const ByteStream &input_params,
|
||||||
const HandleStream &input_handles) {
|
const HandleStream &input_handles) {
|
||||||
switch (op_code) {
|
switch (op_code) {
|
||||||
@@ -949,6 +973,9 @@ Return<void> ClientCallback::perform(uint32_t op_code, const ByteStream &input_p
|
|||||||
case kControlQsyncCallback:
|
case kControlQsyncCallback:
|
||||||
ParseNotifyQsyncChange(input_params);
|
ParseNotifyQsyncChange(input_params);
|
||||||
break;
|
break;
|
||||||
|
case kControlIdleStatusCallback:
|
||||||
|
ParseNotifyIdleStatus(input_params);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ class ClientCallback: public IDisplayConfigCallback {
|
|||||||
const HandleStream &input_handles);
|
const HandleStream &input_handles);
|
||||||
void ParseNotifyCWBBufferDone(const ByteStream &input_params, const HandleStream &input_handles);
|
void ParseNotifyCWBBufferDone(const ByteStream &input_params, const HandleStream &input_handles);
|
||||||
void ParseNotifyQsyncChange(const ByteStream &input_params);
|
void ParseNotifyQsyncChange(const ByteStream &input_params);
|
||||||
|
void ParseNotifyIdleStatus(const ByteStream &input_params);
|
||||||
ConfigCallback *callback_ = nullptr;
|
ConfigCallback *callback_ = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -120,6 +121,7 @@ class ClientImpl : public ClientInterface {
|
|||||||
virtual int GetSupportedDisplayRefreshRates(DisplayType dpy,
|
virtual int GetSupportedDisplayRefreshRates(DisplayType dpy,
|
||||||
std::vector<uint32_t> *supported_refresh_rates);
|
std::vector<uint32_t> *supported_refresh_rates);
|
||||||
virtual int IsRCSupported(uint32_t disp_id, bool *supported);
|
virtual int IsRCSupported(uint32_t disp_id, bool *supported);
|
||||||
|
virtual int ControlIdleStatusCallback(bool enable);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
android::sp<IDisplayConfig> display_config_ = nullptr;
|
android::sp<IDisplayConfig> display_config_ = nullptr;
|
||||||
|
|||||||
@@ -163,6 +163,18 @@ void DeviceImpl::DeviceClientContext::NotifyQsyncChange(bool qsync_enabled, int3
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeviceImpl::DeviceClientContext::NotifyIdleStatus(bool is_idle) {
|
||||||
|
bool data = {is_idle};
|
||||||
|
ByteStream output_params;
|
||||||
|
|
||||||
|
output_params.setToExternal(reinterpret_cast<uint8_t*>(&data), sizeof(data));
|
||||||
|
|
||||||
|
auto status = callback_->perform(kControlIdleStatusCallback, output_params, {});
|
||||||
|
if (status.isDeadObject()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DeviceImpl::DeviceClientContext::ParseIsDisplayConnected(const ByteStream &input_params,
|
void DeviceImpl::DeviceClientContext::ParseIsDisplayConnected(const ByteStream &input_params,
|
||||||
perform_cb _hidl_cb) {
|
perform_cb _hidl_cb) {
|
||||||
const DisplayType *dpy;
|
const DisplayType *dpy;
|
||||||
@@ -716,6 +728,19 @@ void DeviceImpl::DeviceClientContext::ParseControlQsyncCallback(uint64_t client_
|
|||||||
_hidl_cb(error, {}, {});
|
_hidl_cb(error, {}, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeviceImpl::DeviceClientContext::ParseControlIdleStatusCallback(uint64_t client_handle,
|
||||||
|
const ByteStream &input_params,
|
||||||
|
perform_cb _hidl_cb) {
|
||||||
|
const bool *enable;
|
||||||
|
|
||||||
|
const uint8_t *data = input_params.data();
|
||||||
|
enable = reinterpret_cast<const bool*>(data);
|
||||||
|
|
||||||
|
int32_t error = intf_->ControlIdleStatusCallback(*enable);
|
||||||
|
|
||||||
|
_hidl_cb(error, {}, {});
|
||||||
|
}
|
||||||
|
|
||||||
void DeviceImpl::DeviceClientContext::ParseSendTUIEvent(const ByteStream &input_params,
|
void DeviceImpl::DeviceClientContext::ParseSendTUIEvent(const ByteStream &input_params,
|
||||||
perform_cb _hidl_cb) {
|
perform_cb _hidl_cb) {
|
||||||
const struct TUIEventParams *input_data =
|
const struct TUIEventParams *input_data =
|
||||||
@@ -938,6 +963,9 @@ Return<void> DeviceImpl::perform(uint64_t client_handle, uint32_t op_code,
|
|||||||
case kControlQsyncCallback:
|
case kControlQsyncCallback:
|
||||||
client->ParseControlQsyncCallback(client_handle, input_params, _hidl_cb);
|
client->ParseControlQsyncCallback(client_handle, input_params, _hidl_cb);
|
||||||
break;
|
break;
|
||||||
|
case kControlIdleStatusCallback:
|
||||||
|
client->ParseControlIdleStatusCallback(client_handle, input_params, _hidl_cb);
|
||||||
|
break;
|
||||||
case kSendTUIEvent:
|
case kSendTUIEvent:
|
||||||
client->ParseSendTUIEvent(input_params, _hidl_cb);
|
client->ParseSendTUIEvent(input_params, _hidl_cb);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ class DeviceImpl : public IDisplayConfig, public android::hardware::hidl_death_r
|
|||||||
virtual void NotifyCWBBufferDone(int32_t error, const native_handle_t *buffer);
|
virtual void NotifyCWBBufferDone(int32_t error, const native_handle_t *buffer);
|
||||||
virtual void NotifyQsyncChange(bool qsync_enabled, int32_t refresh_rate,
|
virtual void NotifyQsyncChange(bool qsync_enabled, int32_t refresh_rate,
|
||||||
int32_t qsync_refresh_rate);
|
int32_t qsync_refresh_rate);
|
||||||
|
virtual void NotifyIdleStatus(bool is_idle);
|
||||||
|
|
||||||
void ParseIsDisplayConnected(const ByteStream &input_params, perform_cb _hidl_cb);
|
void ParseIsDisplayConnected(const ByteStream &input_params, perform_cb _hidl_cb);
|
||||||
void ParseSetDisplayStatus(const ByteStream &input_params, perform_cb _hidl_cb);
|
void ParseSetDisplayStatus(const ByteStream &input_params, perform_cb _hidl_cb);
|
||||||
@@ -120,6 +121,8 @@ class DeviceImpl : public IDisplayConfig, public android::hardware::hidl_death_r
|
|||||||
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);
|
void ParseGetSupportedDisplayRefreshRates(const ByteStream &input_params, perform_cb _hidl_cb);
|
||||||
void ParseIsRCSupported(const ByteStream &input_params, perform_cb _hidl_cb);
|
void ParseIsRCSupported(const ByteStream &input_params, perform_cb _hidl_cb);
|
||||||
|
void ParseControlIdleStatusCallback(uint64_t client_handle, const ByteStream &input_params,
|
||||||
|
perform_cb _hidl_cb);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ConfigInterface *intf_ = nullptr;
|
ConfigInterface *intf_ = nullptr;
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ enum OpCode {
|
|||||||
kGetDisplayHwId = 43,
|
kGetDisplayHwId = 43,
|
||||||
kGetSupportedDisplayRefreshRates = 44,
|
kGetSupportedDisplayRefreshRates = 44,
|
||||||
kIsRCSupported = 45,
|
kIsRCSupported = 45,
|
||||||
|
kControlIdleStatusCallback = 46,
|
||||||
|
|
||||||
kDestroy = 0xFFFF, // Destroy sequence execution
|
kDestroy = 0xFFFF, // Destroy sequence execution
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user