Skip to content

Commit

Permalink
hqd: add qservice binder for blocking dpps
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Prabhanjan Kandula authored and Baldev Sahu committed Jan 7, 2019
1 parent ed80787 commit 69684df
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 0 deletions.
22 changes: 22 additions & 0 deletions libqdutils/display_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 2 additions & 0 deletions libqdutils/display_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,6 @@ int getSupportedBitClk(int dpy, std::vector<uint64_t>& bit_rates);

}; //namespace


extern "C" int waitForComposerInit();
#endif
1 change: 1 addition & 0 deletions libqservice/IQService.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class IQService : public android::IInterface
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,
};

Expand Down
9 changes: 9 additions & 0 deletions sdm/libs/hwc2/hwc_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ int HWCSession::Init() {
return status;
}

is_composer_up_ = true;
return 0;
}

Expand Down Expand Up @@ -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;
Expand All @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions sdm/libs/hwc2/hwc_session.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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_;
};

Expand Down

0 comments on commit 69684df

Please sign in to comment.