hwc: Fix dumpsys crash
In extreme cases, when all pipes are used, the buffer is insufficient.
Reduce logging by striping off unnecessary bytes.
Change-Id: I5a6ffb9ff288e389eea4e9ca4ac850ed59d539ff
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp
index 4f26191..3bf1504 100644
--- a/libhwcomposer/hwc.cpp
+++ b/libhwcomposer/hwc.cpp
@@ -570,7 +570,7 @@
ctx->mOverlay->getDump(ovDump, 2048);
dumpsys_log(aBuf, ovDump);
ovDump[0] = '\0';
- ctx->mRotMgr->getDump(ovDump, 2048);
+ ctx->mRotMgr->getDump(ovDump, 1024);
dumpsys_log(aBuf, ovDump);
strlcpy(buff, aBuf.string(), buff_len);
}
diff --git a/liboverlay/overlay.cpp b/liboverlay/overlay.cpp
index 43b6589..3563cbc 100644
--- a/liboverlay/overlay.cpp
+++ b/liboverlay/overlay.cpp
@@ -285,19 +285,19 @@
void Overlay::getDump(char *buf, size_t len) {
int totalPipes = 0;
- const char *str = "\nOverlay State\n==========================\n";
+ const char *str = "\nOverlay State\n\n";
strncat(buf, str, strlen(str));
for(int i = 0; i < PipeBook::NUM_PIPES; i++) {
if(mPipeBook[i].valid()) {
mPipeBook[i].mPipe->getDump(buf, len);
char str[64] = {'\0'};
- snprintf(str, 64, "Attached to dpy=%d\n\n", mPipeBook[i].mDisplay);
+ snprintf(str, 64, "Display=%d\n\n", mPipeBook[i].mDisplay);
strncat(buf, str, strlen(str));
totalPipes++;
}
}
char str_pipes[64] = {'\0'};
- snprintf(str_pipes, 64, "Pipes used=%d\n\n", totalPipes);
+ snprintf(str_pipes, 64, "Pipes=%d\n\n", totalPipes);
strncat(buf, str_pipes, strlen(str_pipes));
}
diff --git a/liboverlay/overlayMdp.cpp b/liboverlay/overlayMdp.cpp
index d70ab64..4578115 100644
--- a/liboverlay/overlayMdp.cpp
+++ b/liboverlay/overlayMdp.cpp
@@ -238,7 +238,7 @@
}
void MdpCtrl::getDump(char *buf, size_t len) {
- ovutils::getDump(buf, len, "Ctrl(mdp_overlay)", mOVInfo);
+ ovutils::getDump(buf, len, "Ctrl", mOVInfo);
}
void MdpData::dump() const {
@@ -249,7 +249,7 @@
}
void MdpData::getDump(char *buf, size_t len) {
- ovutils::getDump(buf, len, "Data(msmfb_overlay_data)", mOvData);
+ ovutils::getDump(buf, len, "Data", mOvData);
}
void MdpCtrl3D::dump() const {
diff --git a/liboverlay/overlayMdpRot.cpp b/liboverlay/overlayMdpRot.cpp
index ecf31fa..81a3f44 100755
--- a/liboverlay/overlayMdpRot.cpp
+++ b/liboverlay/overlayMdpRot.cpp
@@ -254,8 +254,8 @@
}
void MdpRot::getDump(char *buf, size_t len) const {
- ovutils::getDump(buf, len, "MdpRotCtrl(msm_rotator_img_info)", mRotImgInfo);
- ovutils::getDump(buf, len, "MdpRotData(msm_rotator_data_info)", mRotDataInfo);
+ ovutils::getDump(buf, len, "MdpRotCtrl", mRotImgInfo);
+ ovutils::getDump(buf, len, "MdpRotData", mRotDataInfo);
}
} // namespace overlay
diff --git a/liboverlay/overlayMdssRot.cpp b/liboverlay/overlayMdssRot.cpp
index b9a22a9..58790fc 100644
--- a/liboverlay/overlayMdssRot.cpp
+++ b/liboverlay/overlayMdssRot.cpp
@@ -255,8 +255,8 @@
}
void MdssRot::getDump(char *buf, size_t len) const {
- ovutils::getDump(buf, len, "MdssRotCtrl(mdp_overlay)", mRotInfo);
- ovutils::getDump(buf, len, "MdssRotData(msmfb_overlay_data)", mRotData);
+ ovutils::getDump(buf, len, "MdssRotCtrl", mRotInfo);
+ ovutils::getDump(buf, len, "MdssRotData", mRotData);
}
} // namespace overlay
diff --git a/liboverlay/overlayUtils.cpp b/liboverlay/overlayUtils.cpp
index 8849984..e595cef 100644
--- a/liboverlay/overlayUtils.cpp
+++ b/liboverlay/overlayUtils.cpp
@@ -361,9 +361,9 @@
prefix, ov.id, ov.z_order, ov.is_fg, ov.alpha,
ov.transp_mask, ov.flags, ov.horz_deci, ov.vert_deci);
strncat(buf, str, strlen(str));
- getDump(buf, len, "\tsrc(msmfb_img)", ov.src);
- getDump(buf, len, "\tsrc_rect(mdp_rect)", ov.src_rect);
- getDump(buf, len, "\tdst_rect(mdp_rect)", ov.dst_rect);
+ getDump(buf, len, "\tsrc", ov.src);
+ getDump(buf, len, "\tsrc_rect", ov.src_rect);
+ getDump(buf, len, "\tdst_rect", ov.dst_rect);
}
void getDump(char *buf, size_t len, const char *prefix,
@@ -392,7 +392,7 @@
"%s id=%d\n",
prefix, ov.id);
strncat(buf, str, strlen(str));
- getDump(buf, len, "\tdata(msmfb_data)", ov.data);
+ getDump(buf, len, "\tdata", ov.data);
}
void getDump(char *buf, size_t len, const char *prefix,
@@ -421,13 +421,11 @@
const msm_rotator_data_info& rot) {
char str[256] = {'\0'};
snprintf(str, 256,
- "%s sessid=%u verkey=%d\n",
- prefix, rot.session_id, rot.version_key);
+ "%s sessid=%u\n",
+ prefix, rot.session_id);
strncat(buf, str, strlen(str));
getDump(buf, len, "\tsrc", rot.src);
getDump(buf, len, "\tdst", rot.dst);
- getDump(buf, len, "\tsrc_chroma", rot.src_chroma);
- getDump(buf, len, "\tdst_chroma", rot.dst_chroma);
}
} // utils