hqd: add qservice binder for blocking dpps

Dpps should wait opening driver before composer comes up.
Add a wservice binder call to query composer init status.
Add util function to block dpps until composer is up.

Change-Id: I82c025011e23a0b159ef2449b00b868a365d681a
CRs-fixed: 2102579
This commit is contained in:
Prabhanjan Kandula 2017-09-14 19:29:46 -07:00 committed by Baldev Sahu
parent ed807875a8
commit 69684df0e4
5 changed files with 36 additions and 0 deletions

View File

@ -420,3 +420,25 @@ extern "C" int controlPartialUpdate(int dpy, int mode) {
return err;
}
// returns 0 if composer is up
extern "C" int waitForComposerInit() {
int status = false;
sp<IQService> binder = getBinder();
if (binder == NULL) {
sleep(2);
binder = getBinder();
}
if (binder != NULL) {
Parcel inParcel, outParcel;
binder->dispatch(IQService::GET_COMPOSER_STATUS, &inParcel, &outParcel);
status = !!outParcel.readInt32();
if (!status) {
sleep(2);
binder->dispatch(IQService::GET_COMPOSER_STATUS, &inParcel, &outParcel);
status = !!outParcel.readInt32();
}
}
return !status;
}

View File

@ -171,4 +171,6 @@ int getSupportedBitClk(int dpy, std::vector<uint64_t>& bit_rates);
}; //namespace
extern "C" int waitForComposerInit();
#endif

View File

@ -78,6 +78,7 @@ public:
SET_DSI_CLK = 36, // Set DSI Clk.
GET_DSI_CLK = 37, // Get DSI Clk.
GET_SUPPORTED_DSI_CLK = 38, // Get supported DSI Clk.
GET_COMPOSER_STATUS = 39, // Get composer init status-true if primary display init is done
COMMAND_LIST_END = 400,
};

View File

@ -212,6 +212,7 @@ int HWCSession::Init() {
return status;
}
is_composer_up_ = true;
return 0;
}
@ -1092,6 +1093,10 @@ android::status_t HWCSession::notifyCallback(uint32_t command, const android::Pa
status = GetSupportedDsiClk(input_parcel, output_parcel);
break;
case qService::IQService::GET_COMPOSER_STATUS:
output_parcel->writeInt32(getComposerStatus());
break;
default:
DLOGW("QService command = %d is not supported", command);
return -EINVAL;
@ -1100,6 +1105,10 @@ android::status_t HWCSession::notifyCallback(uint32_t command, const android::Pa
return status;
}
android::status_t HWCSession::getComposerStatus() {
return is_composer_up_;
}
android::status_t HWCSession::HandleGetDisplayAttributesForConfig(const android::Parcel
*input_parcel,
android::Parcel *output_parcel) {

View File

@ -240,6 +240,7 @@ class HWCSession : hwc2_device_t, HWCUEventListener, IDisplayConfig, public qCli
android::status_t GetDsiClk(const android::Parcel *input_parcel, android::Parcel *output_parcel);
android::status_t GetSupportedDsiClk(const android::Parcel *input_parcel,
android::Parcel *output_parcel);
android::status_t getComposerStatus();
void Refresh(hwc2_display_t display);
void HotPlug(hwc2_display_t display, HWC2::Connection state);
@ -262,6 +263,7 @@ class HWCSession : hwc2_device_t, HWCUEventListener, IDisplayConfig, public qCli
qService::QService *qservice_ = nullptr;
HWCSocketHandler socket_handler_;
bool hdmi_is_primary_ = false;
bool is_composer_up_ = false;
Locker callbacks_lock_;
};