From 69684df0e4a86e1599d76ea453107f2836e68569 Mon Sep 17 00:00:00 2001 From: Prabhanjan Kandula Date: Thu, 14 Sep 2017 19:29:46 -0700 Subject: [PATCH] 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 --- libqdutils/display_config.cpp | 22 ++++++++++++++++++++++ libqdutils/display_config.h | 2 ++ libqservice/IQService.h | 1 + sdm/libs/hwc2/hwc_session.cpp | 9 +++++++++ sdm/libs/hwc2/hwc_session.h | 2 ++ 5 files changed, 36 insertions(+) diff --git a/libqdutils/display_config.cpp b/libqdutils/display_config.cpp index a5d63126..1c71a19b 100644 --- a/libqdutils/display_config.cpp +++ b/libqdutils/display_config.cpp @@ -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 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; +} diff --git a/libqdutils/display_config.h b/libqdutils/display_config.h index eb943f96..430a946b 100644 --- a/libqdutils/display_config.h +++ b/libqdutils/display_config.h @@ -171,4 +171,6 @@ int getSupportedBitClk(int dpy, std::vector& bit_rates); }; //namespace + +extern "C" int waitForComposerInit(); #endif diff --git a/libqservice/IQService.h b/libqservice/IQService.h index 1f6ea91f..630e5690 100644 --- a/libqservice/IQService.h +++ b/libqservice/IQService.h @@ -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, }; diff --git a/sdm/libs/hwc2/hwc_session.cpp b/sdm/libs/hwc2/hwc_session.cpp index 8a7620ef..544b94b5 100644 --- a/sdm/libs/hwc2/hwc_session.cpp +++ b/sdm/libs/hwc2/hwc_session.cpp @@ -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) { diff --git a/sdm/libs/hwc2/hwc_session.h b/sdm/libs/hwc2/hwc_session.h index 5b3cc8f0..8aaf22d8 100644 --- a/sdm/libs/hwc2/hwc_session.h +++ b/sdm/libs/hwc2/hwc_session.h @@ -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_; };