summaryrefslogtreecommitdiff
authorbaocheng sun <baocheng.sun@amlogic.com>2020-03-04 05:47:48 (GMT)
committer sky zhou <sky.zhou@amlogic.com>2020-05-21 11:00:24 (GMT)
commitafecfeacdc2bc835a07b3572b7f9246a033dde34 (patch)
treeca5786590dbcbf081c25c7e877907821558bb5f5
parent602faf39375b35e37140370ff833503424b27884 (diff)
downloadhwcomposer-afecfeacdc2bc835a07b3572b7f9246a033dde34.zip
hwcomposer-afecfeacdc2bc835a07b3572b7f9246a033dde34.tar.gz
hwcomposer-afecfeacdc2bc835a07b3572b7f9246a033dde34.tar.bz2
HWC: release client composer target when blank display [2/2]
PD#SWPL-21798 Problem: messed display after android reboot Solution: release clientComposer target when blank display Verify: verified on franklin Change-Id: I7d9f70fa2f086b75a2a9a7d9933028070990b2ad Signed-off-by: baocheng sun <baocheng.sun@amlogic.com>
Diffstat
-rw-r--r--common/display/OsdPlane.cpp2
-rw-r--r--common/hwc/HwcDisplayPipe.cpp11
-rw-r--r--common/hwc/include/HwcDisplay.h1
-rw-r--r--common/utils/include/systemcontrol.h2
-rw-r--r--common/utils/systemcontrol.cpp16
-rw-r--r--composition/simplestrategy/MultiplanesComposition/MultiplanesComposition.cpp3
-rw-r--r--hwc2/Hwc2Display.cpp31
-rw-r--r--hwc2/Hwc2Display.h1
8 files changed, 66 insertions, 1 deletions
diff --git a/common/display/OsdPlane.cpp b/common/display/OsdPlane.cpp
index f8e3577..0419620 100644
--- a/common/display/OsdPlane.cpp
+++ b/common/display/OsdPlane.cpp
@@ -13,7 +13,7 @@
OsdPlane::OsdPlane(int32_t drvFd, uint32_t id)
: HwDisplayPlane(drvFd, id),
- mBlank(true),
+ mBlank(false),
mPossibleCrtcs(0),
mDrmFb(NULL) {
snprintf(mName, 64, "OSD-%d", id);
diff --git a/common/hwc/HwcDisplayPipe.cpp b/common/hwc/HwcDisplayPipe.cpp
index ffc3294..67732cd 100644
--- a/common/hwc/HwcDisplayPipe.cpp
+++ b/common/hwc/HwcDisplayPipe.cpp
@@ -13,9 +13,12 @@
#include "DualDisplayPipe.h"
#include <HwcConfig.h>
#include <systemcontrol.h>
+#include <misc.h>
#include <HwDisplayManager.h>
+#define HWC_BOOTED_PROP "vendor.sys.hwc.booted"
+
HwcDisplayPipe::PipeStat::PipeStat(uint32_t id) {
hwcId = id;
cfg.hwcCrtcId = cfg.modeCrtcId = 0;
@@ -67,6 +70,14 @@ int32_t HwcDisplayPipe::init(std::map<uint32_t, std::shared_ptr<HwcDisplay>> & h
stat->hwcVsync = std::make_shared<HwcVsync>();
/*init display pipe.*/
updatePipe(stat);
+
+ /* in case of composer servce restart */
+ if (sys_get_bool_prop(HWC_BOOTED_PROP, false)) {
+ MESON_LOGD("composer service has restarted, need blank display");
+ stat->hwcDisplay->blankDisplay();
+ }
+
+ sc_set_property(HWC_BOOTED_PROP, "true");
}
return 0;
diff --git a/common/hwc/include/HwcDisplay.h b/common/hwc/include/HwcDisplay.h
index 776de3a..b5a9ddf 100644
--- a/common/hwc/include/HwcDisplay.h
+++ b/common/hwc/include/HwcDisplay.h
@@ -34,6 +34,7 @@ public:
virtual int32_t setPostProcessor(
std::shared_ptr<HwcPostProcessor> processor) = 0;
virtual int32_t setVsync(std::shared_ptr<HwcVsync> vsync) = 0;
+ virtual int32_t blankDisplay() = 0;
virtual void onHotplug(bool connected) = 0;
virtual void onUpdate(bool bHdcp) = 0;
diff --git a/common/utils/include/systemcontrol.h b/common/utils/include/systemcontrol.h
index 49b9405..067bde4 100644
--- a/common/utils/include/systemcontrol.h
+++ b/common/utils/include/systemcontrol.h
@@ -21,5 +21,7 @@ int32_t sc_write_sysfs(const char * path, std::string & val);
int32_t sc_read_sysfs(const char * path, std::string & val);
int32_t sc_read_bootenv(const char * key, std::string & val);
+int32_t sc_set_property(const char *prop, const char *val);
+
bool sc_get_pref_display_mode(std::string & dispmode);
#endif/*SYSTEM_CONTROL_H*/
diff --git a/common/utils/systemcontrol.cpp b/common/utils/systemcontrol.cpp
index c35b560..4530520 100644
--- a/common/utils/systemcontrol.cpp
+++ b/common/utils/systemcontrol.cpp
@@ -208,6 +208,22 @@ int32_t sc_read_bootenv(const char * key, std::string & val) {
return 0;
}
+int32_t sc_set_property(const char * prop, const char *val ) {
+ CHK_SC_PROXY();
+
+ if (!prop || !val) {
+ return -EINVAL;
+ }
+
+ Result ret = gSC->setProperty(hidl_string(prop), hidl_string(val));
+ if (ret == Result::OK) {
+ return 0;
+ } else {
+ MESON_LOGE("sc_set_property prop:%s val:%s FAIL.", prop, val);
+ return -EFAULT;
+ }
+}
+
bool sc_get_pref_display_mode(std::string & dispmode) {
CHK_SC_PROXY();
diff --git a/composition/simplestrategy/MultiplanesComposition/MultiplanesComposition.cpp b/composition/simplestrategy/MultiplanesComposition/MultiplanesComposition.cpp
index 5f79e9d..e61154c 100644
--- a/composition/simplestrategy/MultiplanesComposition/MultiplanesComposition.cpp
+++ b/composition/simplestrategy/MultiplanesComposition/MultiplanesComposition.cpp
@@ -924,6 +924,9 @@ int MultiplanesComposition::decideComposition() {
int ret = 0;
if (mFramebuffers.empty()) {
MESON_LOGV("No layers to compose, exit.");
+ if (mClientComposer != NULL) {
+ mClientComposer->prepare();
+ }
return ret;
}
diff --git a/hwc2/Hwc2Display.cpp b/hwc2/Hwc2Display.cpp
index a2c4bbc..8e79c22 100644
--- a/hwc2/Hwc2Display.cpp
+++ b/hwc2/Hwc2Display.cpp
@@ -147,6 +147,32 @@ int32_t Hwc2Display::setVsync(std::shared_ptr<HwcVsync> vsync) {
return 0;
}
+/*
+ * Make sure all display planes are blank (since there is no layer)
+ *
+ * If composer service died, surfaceflinger will restart and frameBufferSurface will
+ * be recreated. But one framebuffer will be hold by the osd driver. If cma ion memory
+ * only configed to triple size of FrameBuffer, there will be one non continuous FrameBuffer
+ * and lead to messed display.
+ */
+int32_t Hwc2Display::blankDisplay() {
+ MESON_LOGD("blank all display planes");
+ std::lock_guard<std::mutex> lock(mMutex);
+
+ for (auto it = mPlanes.begin(); it != mPlanes.end(); ++ it) {
+ (*it)->setPlane(NULL, HWC_PLANE_FAKE_ZORDER, BLANK_FOR_NO_CONTENT);
+ }
+
+ int32_t fence = -1;
+ if (mCrtc && mCrtc->pageFlip(fence) == 0) {
+ std::shared_ptr<DrmFence> outfence =
+ std::make_shared<DrmFence>(fence);
+ outfence->wait(3000);
+ }
+
+ return 0;
+}
+
const char * Hwc2Display::getName() {
return mConnector->getName();
}
@@ -643,6 +669,11 @@ hwc2_error_t Hwc2Display::validateDisplay(uint32_t* outNumTypes,
/*collect changed dispplay, layer, compostiion.*/
ret = collectCompositionRequest(outNumTypes, outNumRequests);
+ } else {
+ /* skip Composition */
+ std::shared_ptr<IComposer> clientComposer =
+ mComposers.find(MESON_CLIENT_COMPOSER)->second;
+ clientComposer->prepare();
}
if (mPowerMode->getScreenStatus()) {
diff --git a/hwc2/Hwc2Display.h b/hwc2/Hwc2Display.h
index e2cecdb..f08b020 100644
--- a/hwc2/Hwc2Display.h
+++ b/hwc2/Hwc2Display.h
@@ -109,6 +109,7 @@ public:
virtual int32_t setPostProcessor(
std::shared_ptr<HwcPostProcessor> processor);
virtual int32_t setVsync(std::shared_ptr<HwcVsync> vsync);
+ virtual int32_t blankDisplay();
virtual void onVsync(int64_t timestamp);
virtual void onHotplug(bool connected);