summaryrefslogtreecommitdiff
authorbaocheng sun <baocheng.sun@amlogic.com>2020-02-14 10:48:55 (GMT)
committer sky zhou <sky.zhou@amlogic.com>2020-05-21 12:08:36 (GMT)
commit9b72eba7e9a1791d34f9f3f20eaa951d23c5d2cd (patch)
treee848a2774695b3ff14e568fc7296d22811c0ad02
parent02a3087e3263b662f46ce328c343502d6c151166 (diff)
downloadhwcomposer-9b72eba7e9a1791d34f9f3f20eaa951d23c5d2cd.zip
hwcomposer-9b72eba7e9a1791d34f9f3f20eaa951d23c5d2cd.tar.gz
hwcomposer-9b72eba7e9a1791d34f9f3f20eaa951d23c5d2cd.tar.bz2
hwc: fix mExit state error of hwcVsync thread [1/1]
PD#SWPL-20190 Problem: STB UI response and playback became super sluggish after NTS automation batch run. Vsync state disordered Solution: fix mExit state error of hwcVsync thread and add vsync debug code Verify: franklin Change-Id: I551cb3cc141c65501a2408c567f741c7771095a1 Signed-off-by: baocheng sun <baocheng.sun@amlogic.com>
Diffstat
-rw-r--r--common/debug/DebugHelper.cpp15
-rw-r--r--common/debug/include/DebugHelper.h2
-rw-r--r--common/hwc/Android.mk1
-rw-r--r--common/hwc/HwcVsync.cpp13
-rw-r--r--hwc2/Hwc2Display.cpp2
5 files changed, 26 insertions, 7 deletions
diff --git a/common/debug/DebugHelper.cpp b/common/debug/DebugHelper.cpp
index 9a4b2e2..44a3c5f 100644
--- a/common/debug/DebugHelper.cpp
+++ b/common/debug/DebugHelper.cpp
@@ -21,6 +21,7 @@ ANDROID_SINGLETON_STATIC_INSTANCE(DebugHelper)
#define COMMAND_CLEAR "--clear"
#define COMMAND_NOHWC "--nohwc"
#define COMMAND_DUMP_DETAIL "--detail"
+#define COMMAND_ENABLE_VSYNC_DETAIL "--vsync-detail"
#define COMMAND_LOG_COMPOSITION_DETAIL "--composition-detail"
#define COMMAND_LOG_FPS "--fps"
#define COMMAND_SAVE_LAYER "--save-layer"
@@ -58,7 +59,8 @@ void DebugHelper::clearOnePassCmd() {
void DebugHelper::clearPersistCmd() {
mDisableUiHwc = false;
- mDumpDetail = false;
+ mDumpDetail = true;
+ mEnableVsyncDetail = false;
mLogFps = false;
mLogCompositionDetail = false;
@@ -130,7 +132,7 @@ void DebugHelper::resolveCmd() {
return;
#else
clearOnePassCmd();
- mEnabled = sys_get_bool_prop(DEBUG_HELPER_ENABLE_PROP, false);
+ mEnabled = sys_get_bool_prop(DEBUG_HELPER_ENABLE_PROP, true);
if (mEnabled) {
char debugCmd[128] = {0};
@@ -173,6 +175,13 @@ void DebugHelper::resolveCmd() {
continue;
}
+ if (strcmp(paramArray[i], COMMAND_ENABLE_VSYNC_DETAIL) == 0) {
+ i++;
+ CHECK_CMD_INT_PARAMETER();
+ mEnableVsyncDetail = INT_PARAMERTER_TO_BOOL(paramArray[i]);
+ continue;
+ }
+
if (strcmp(paramArray[i], COMMAND_LOG_FPS) == 0) {
i++;
CHECK_CMD_INT_PARAMETER();
@@ -329,6 +338,7 @@ void DebugHelper::dump(String8 & dumpstr) {
"\t " COMMAND_DUMP_DETAIL " 0|1: enable/dislabe dump detail internal info.\n"
"\t " COMMAND_IN_FENCE " 0 | 1: pass in fence to display, or handle it in hwc.\n"
"\t " COMMAND_OUT_FENCE " 0 | 1: return display out fence, or handle it in hwc.\n"
+ "\t " COMMAND_ENABLE_VSYNC_DETAIL " 0 | 1: enable/disable hwcVsync thread detail log.\n"
"\t " COMMAND_LOG_COMPOSITION_DETAIL " 0|1: enable/disable composition detail info.\n"
"\t " COMMAND_HIDE_LAYER "/" COMMAND_SHOW_LAYER " [layerId]: hide/unhide specific layers by zorder. \n"
"\t " COMMAND_HIDE_PLANE "/" COMMAND_SHOW_PLANE " [planeId]: hide/unhide specific plane by plane id. \n"
@@ -345,6 +355,7 @@ void DebugHelper::dump(String8 & dumpstr) {
dumpstr.append("Debug Command:\n");
dumpstr.appendFormat(COMMAND_NOHWC " (%d)\n", mDisableUiHwc);
dumpstr.appendFormat(COMMAND_DUMP_DETAIL " (%d)\n", mDumpDetail);
+ dumpstr.appendFormat(COMMAND_ENABLE_VSYNC_DETAIL " (%d)\n", mEnableVsyncDetail);
dumpstr.appendFormat(COMMAND_IN_FENCE " (%d)\n", mDiscardInFence);
dumpstr.appendFormat(COMMAND_OUT_FENCE " (%d)\n", mDiscardOutFence);
dumpstr.appendFormat(COMMAND_LOG_COMPOSITION_DETAIL " (%d)\n", mLogCompositionDetail);
diff --git a/common/debug/include/DebugHelper.h b/common/debug/include/DebugHelper.h
index f95b6f0..a08da22 100644
--- a/common/debug/include/DebugHelper.h
+++ b/common/debug/include/DebugHelper.h
@@ -23,6 +23,7 @@ public:
/*dump internal info in hal dumpsys.*/
inline bool dumpDetailInfo() {return mDumpDetail;}
+ inline bool enableVsyncDetail() {return mEnableVsyncDetail;}
/*log informations.*/
inline bool logCompositionDetail() {return mLogCompositionDetail;}
@@ -66,6 +67,7 @@ protected:
bool mDumpUsage;
bool mDisableUiHwc;
bool mDumpDetail;
+ bool mEnableVsyncDetail;
bool mLogCompositionDetail;
bool mLogFps;
diff --git a/common/hwc/Android.mk b/common/hwc/Android.mk
index 71958e4..c6910d5 100644
--- a/common/hwc/Android.mk
+++ b/common/hwc/Android.mk
@@ -141,6 +141,7 @@ LOCAL_STATIC_LIBRARIES := \
hwc.utils_static \
hwc.base_static \
hwc.display_static \
+ hwc.debug_static \
hwc.postprocessor_static
LOCAL_EXPORT_C_INCLUDE_DIRS := \
diff --git a/common/hwc/HwcVsync.cpp b/common/hwc/HwcVsync.cpp
index b3f758b..ce50877 100644
--- a/common/hwc/HwcVsync.cpp
+++ b/common/hwc/HwcVsync.cpp
@@ -10,6 +10,7 @@
#include <MesonLog.h>
#include <HwcVsync.h>
#include <HwDisplayCrtc.h>
+#include <DebugHelper.h>
#define SF_VSYNC_DFT_PERIOD 60
@@ -19,6 +20,8 @@ HwcVsync::HwcVsync() {
mPreTimeStamp = 0;
mReqPeriod = 0;
mVsyncTime = 0;
+ mExit = false;
+ mObserver = NULL;
int ret;
ret = pthread_create(&hw_vsync_thread, NULL, vsyncThread, this);
@@ -100,8 +103,7 @@ void * HwcVsync::vsyncThread(void * data) {
} else {
ret = pThis->waitHwVsync(timestamp);
}
- bool debug = true;
- if (debug) {
+ if (DebugHelper::getInstance().enableVsyncDetail()) {
nsecs_t period = timestamp - pThis->mPreTimeStamp;
UNUSED(period);
if (pThis->mPreTimeStamp != 0)
@@ -182,8 +184,11 @@ int32_t HwcVsync::waitSoftwareVsync(nsecs_t& vsync_timestamp) {
return err;
}
-void HwcVsync::dump(String8 & dumpstr) {
+void HwcVsync::dump(String8 &dumpstr) {
dumpstr.appendFormat("HwcVsync mode(%s) period(%lld) \n",
mSoftVsync ? "soft":"hw", mReqPeriod);
-}
+ dumpstr.appendFormat(" mEnabled:%d, mExit:%d\n", mEnabled, mExit);
+ if (mObserver)
+ dumpstr.appendFormat(" mObserver:%p\n", mObserver);
+}
diff --git a/hwc2/Hwc2Display.cpp b/hwc2/Hwc2Display.cpp
index 25d8841..65f5c07 100644
--- a/hwc2/Hwc2Display.cpp
+++ b/hwc2/Hwc2Display.cpp
@@ -221,7 +221,7 @@ hwc2_error_t Hwc2Display::setVsyncEnable(hwc2_vsync_t enabled) {
MESON_LOGE("[%s]: set vsync state invalid %d.", __func__, enabled);
return HWC2_ERROR_BAD_PARAMETER;
}
-
+ MESON_LOGD("setVsyncEnable: %s", state ? "true" : "false");
mVsyncState = state;
if (mVsync.get())
mVsync->setEnabled(mVsyncState);