hwc: more error checks
-- numHwLayers==1 means that there is only the FB_TARGET which HWC shouldn't draw. Also check for blank in set. Checking for this in prepare prevents us from acquiring pipes. -- add null check for private handle -- print out vsync timestamp data on error bug: 7274417 related-to-bug: 7288769 Change-Id: I8dae0d0748c5226fdc33ed8f5cc5259835dec2de Signed-off-by: Iliyan Malchev <malchev@google.com>
This commit is contained in:
committed by
Iliyan Malchev
parent
6d9d168b0a
commit
ae823e7735
@@ -113,7 +113,7 @@ static int fb_post(struct framebuffer_device_t* dev, buffer_handle_t buffer)
|
||||
m->info.yoffset = hnd->offset / m->finfo.line_length;
|
||||
m->commit.var = m->info;
|
||||
if (ioctl(m->framebuffer->fd, MSMFB_DISPLAY_COMMIT, &m->commit) == -1) {
|
||||
ALOGE("%s: FBIOPUT_VSCREENINFO failed for external, err: %s", __FUNCTION__,
|
||||
ALOGE("%s: MSMFB_DISPLAY_COMMIT ioctl failed, err: %s", __FUNCTION__,
|
||||
strerror(errno));
|
||||
return -errno;
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ static int hwc_prepare_primary(hwc_composer_device_1 *dev,
|
||||
hwc_display_contents_1_t *list) {
|
||||
hwc_context_t* ctx = (hwc_context_t*)(dev);
|
||||
ctx->overlayInUse[HWC_DISPLAY_PRIMARY] = false;
|
||||
if (LIKELY(list && list->numHwLayers)) {
|
||||
if (LIKELY(list && list->numHwLayers > 1)) {
|
||||
uint32_t last = list->numHwLayers - 1;
|
||||
hwc_layer_1_t *fblayer = &list->hwLayers[last];
|
||||
setListStats(ctx, list, HWC_DISPLAY_PRIMARY);
|
||||
@@ -108,7 +108,7 @@ static int hwc_prepare_external(hwc_composer_device_1 *dev,
|
||||
hwc_context_t* ctx = (hwc_context_t*)(dev);
|
||||
ctx->overlayInUse[HWC_DISPLAY_EXTERNAL] = false;
|
||||
|
||||
if (LIKELY(list && list->numHwLayers) &&
|
||||
if (LIKELY(list && list->numHwLayers > 1) &&
|
||||
ctx->dpyAttr[HWC_DISPLAY_EXTERNAL].isActive &&
|
||||
ctx->dpyAttr[HWC_DISPLAY_EXTERNAL].connected) {
|
||||
|
||||
@@ -256,7 +256,8 @@ static int hwc_set_primary(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
|
||||
if(!ctx->overlayInUse[HWC_DISPLAY_PRIMARY])
|
||||
ctx->mOverlay[HWC_DISPLAY_PRIMARY]->setState(ovutils::OV_CLOSED);
|
||||
|
||||
if (LIKELY(list && list->numHwLayers)) {
|
||||
if (LIKELY(list && list->numHwLayers > 1) &&
|
||||
ctx->dpyAttr[HWC_DISPLAY_PRIMARY].isActive) {
|
||||
uint32_t last = list->numHwLayers - 1;
|
||||
hwc_layer_1_t *fbLayer = &list->hwLayers[last];
|
||||
|
||||
@@ -280,7 +281,7 @@ static int hwc_set_external(hwc_context_t *ctx,
|
||||
if(!ctx->overlayInUse[HWC_DISPLAY_EXTERNAL])
|
||||
ctx->mOverlay[HWC_DISPLAY_EXTERNAL]->setState(ovutils::OV_CLOSED);
|
||||
|
||||
if (LIKELY(list && list->numHwLayers) &&
|
||||
if (LIKELY(list && list->numHwLayers > 1) &&
|
||||
ctx->dpyAttr[HWC_DISPLAY_EXTERNAL].isActive &&
|
||||
ctx->dpyAttr[HWC_DISPLAY_EXTERNAL].connected) {
|
||||
uint32_t last = list->numHwLayers - 1;
|
||||
|
||||
@@ -63,6 +63,10 @@ bool UIMirrorOverlay::configure(hwc_context_t *ctx, hwc_layer_1_t *layer)
|
||||
// Set overlay state
|
||||
ov.setState(sState);
|
||||
private_handle_t *hnd = (private_handle_t *)layer->handle;
|
||||
if (!hnd) {
|
||||
ALOGE("%s:NULL private handle for layer!", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
ovutils::Whf info(hnd->width, hnd->height, hnd->format, hnd->size);
|
||||
// Determine the RGB pipe for UI depending on the state
|
||||
ovutils::eDest dest = ovutils::OV_PIPE0;
|
||||
|
||||
@@ -109,8 +109,9 @@ static void *vsync_loop(void *param)
|
||||
if (!strncmp(str, "VSYNC=", strlen("VSYNC="))) {
|
||||
cur_timestamp = strtoull(str + strlen("VSYNC="), NULL, 0);
|
||||
} else {
|
||||
ALOGE ("FATAL:%s:timestamp data not in correct format",
|
||||
__FUNCTION__);
|
||||
ALOGE ("FATAL: %s: vsync timestamp not in correct format: [%s]",
|
||||
__FUNCTION__,
|
||||
str);
|
||||
}
|
||||
// send timestamp to HAL
|
||||
ALOGD_IF (VSYNC_DEBUG, "%s: timestamp %llu sent to HWC for %s",
|
||||
|
||||
Reference in New Issue
Block a user