// Configure bool FBUpdateHighRes::configure(hwc_context_t *ctx, hwc_display_contents_1 *list, int fbZorder) { bool ret = false; hwc_layer_1_t *layer = &list->hwLayers[list->numHwLayers - 1]; if (LIKELY(ctx->mOverlay)) { int extOnlyLayerIndex = ctx->listStats[mDpy].extOnlyLayerIndex; // ext only layer present.. if(extOnlyLayerIndex != -1) { layer = &list->hwLayers[extOnlyLayerIndex]; layer->compositionType = HWC_OVERLAY; } overlay::Overlay& ov = *(ctx->mOverlay); ovutils::Whf info(mAlignedFBWidth, mAlignedFBHeight, ovutils::getMdpFormat(HAL_PIXEL_FORMAT_RGBA_8888)); //Request left pipe ovutils::eDest destL = getPipeForFb(ctx, mDpy); if(destL == ovutils::OV_INVALID) { //None available ALOGE("%s: No pipes available to configure fb for dpy %d's left" " mixer", __FUNCTION__, mDpy); return false; } //Request right pipe ovutils::eDest destR = getPipeForFb(ctx, mDpy); if(destR == ovutils::OV_INVALID) { //None available ALOGE("%s: No pipes available to configure fb for dpy %d's right" " mixer", __FUNCTION__, mDpy); return false; } mDestLeft = destL; mDestRight = destR; ovutils::eMdpFlags mdpFlagsL = ovutils::OV_MDP_BLEND_FG_PREMULT; ovutils::eZorder zOrder = static_cast<ovutils::eZorder>(fbZorder); //XXX: FB layer plane alpha is currently sent as zero from //surfaceflinger ovutils::PipeArgs pargL(mdpFlagsL, info, zOrder, ovutils::IS_FG_OFF, ovutils::ROT_FLAGS_NONE, ovutils::DEFAULT_PLANE_ALPHA, (ovutils::eBlending) getBlending(layer->blending)); ov.setSource(pargL, destL); ovutils::eMdpFlags mdpFlagsR = mdpFlagsL; ovutils::setMdpFlags(mdpFlagsR, ovutils::OV_MDSS_MDP_RIGHT_MIXER); ovutils::PipeArgs pargR(mdpFlagsR, info, zOrder, ovutils::IS_FG_OFF, ovutils::ROT_FLAGS_NONE, ovutils::DEFAULT_PLANE_ALPHA, (ovutils::eBlending) getBlending(layer->blending)); ov.setSource(pargR, destR); hwc_rect_t sourceCrop = integerizeSourceCrop(layer->sourceCropf); hwc_rect_t displayFrame = layer->displayFrame; // Do not use getNonWormholeRegion() function to calculate the // sourceCrop during animation on external display. if(ctx->listStats[mDpy].isDisplayAnimating && mDpy) { sourceCrop = layer->displayFrame; displayFrame = sourceCrop; } else if(extOnlyLayerIndex == -1) { getNonWormholeRegion(list, sourceCrop); displayFrame = sourceCrop; } ovutils::Dim dcropL(sourceCrop.left, sourceCrop.top, (sourceCrop.right - sourceCrop.left) / 2, sourceCrop.bottom - sourceCrop.top); ovutils::Dim dcropR( sourceCrop.left + (sourceCrop.right - sourceCrop.left) / 2, sourceCrop.top, (sourceCrop.right - sourceCrop.left) / 2, sourceCrop.bottom - sourceCrop.top); ov.setCrop(dcropL, destL); ov.setCrop(dcropR, destR); int transform = layer->transform; ovutils::eTransform orient = static_cast<ovutils::eTransform>(transform); ov.setTransform(orient, destL); ov.setTransform(orient, destR); //For FB left, top will always be 0 //That should also be the case if using 2 mixers for single display ovutils::Dim dposL(displayFrame.left, displayFrame.top, (displayFrame.right - displayFrame.left) / 2, displayFrame.bottom - displayFrame.top); ov.setPosition(dposL, destL); ovutils::Dim dposR(0, displayFrame.top, (displayFrame.right - displayFrame.left) / 2, displayFrame.bottom - displayFrame.top); ov.setPosition(dposR, destR); ret = true; if (!ov.commit(destL)) { ALOGE("%s: commit fails for left", __FUNCTION__); ret = false; } if (!ov.commit(destR)) { ALOGE("%s: commit fails for right", __FUNCTION__); ret = false; } if(ret == false) { ctx->mLayerRotMap[mDpy]->clear(); } } return ret; }
// Configure bool FBUpdateHighRes::configure(hwc_context_t *ctx, hwc_display_contents_1 *list, int fbZorder) { bool ret = false; hwc_layer_1_t *layer = &list->hwLayers[list->numHwLayers - 1]; if (LIKELY(ctx->mOverlay)) { int extOnlyLayerIndex = ctx->listStats[mDpy].extOnlyLayerIndex; // ext only layer present.. if(extOnlyLayerIndex != -1) { layer = &list->hwLayers[extOnlyLayerIndex]; layer->compositionType = HWC_OVERLAY; } overlay::Overlay& ov = *(ctx->mOverlay); private_handle_t *hnd = (private_handle_t *)layer->handle; ovutils::Whf info(getWidth(hnd), getHeight(hnd), ovutils::getMdpFormat(hnd->format), hnd->size); //Request left RGB pipe ovutils::eDest destL = ov.nextPipe(ovutils::OV_MDP_PIPE_RGB, mDpy); if(destL == ovutils::OV_INVALID) { //None available ALOGE("%s: No pipes available to configure framebuffer", __FUNCTION__); return false; } //Request right RGB pipe ovutils::eDest destR = ov.nextPipe(ovutils::OV_MDP_PIPE_RGB, mDpy); if(destR == ovutils::OV_INVALID) { //None available ALOGE("%s: No pipes available to configure framebuffer", __FUNCTION__); return false; } mDestLeft = destL; mDestRight = destR; ovutils::eMdpFlags mdpFlagsL = ovutils::OV_MDP_BLEND_FG_PREMULT; ovutils::eZorder zOrder = static_cast<ovutils::eZorder>(fbZorder); //XXX: FB layer plane alpha is currently sent as zero from //surfaceflinger ovutils::PipeArgs pargL(mdpFlagsL, info, zOrder, ovutils::IS_FG_OFF, ovutils::ROT_FLAGS_NONE, ovutils::DEFAULT_PLANE_ALPHA, (ovutils::eBlending) getBlending(layer->blending)); ov.setSource(pargL, destL); ovutils::eMdpFlags mdpFlagsR = mdpFlagsL; ovutils::setMdpFlags(mdpFlagsR, ovutils::OV_MDSS_MDP_RIGHT_MIXER); ovutils::PipeArgs pargR(mdpFlagsR, info, zOrder, ovutils::IS_FG_OFF, ovutils::ROT_FLAGS_NONE, ovutils::DEFAULT_PLANE_ALPHA, (ovutils::eBlending) getBlending(layer->blending)); ov.setSource(pargR, destR); hwc_rect_t sourceCrop = layer->sourceCrop; hwc_rect_t displayFrame = layer->displayFrame; if(extOnlyLayerIndex == -1) { getNonWormholeRegion(list, sourceCrop); displayFrame = sourceCrop; } ovutils::Dim dcropL(sourceCrop.left, sourceCrop.top, (sourceCrop.right - sourceCrop.left) / 2, sourceCrop.bottom - sourceCrop.top); ovutils::Dim dcropR( sourceCrop.left + (sourceCrop.right - sourceCrop.left) / 2, sourceCrop.top, (sourceCrop.right - sourceCrop.left) / 2, sourceCrop.bottom - sourceCrop.top); ov.setCrop(dcropL, destL); ov.setCrop(dcropR, destR); int transform = layer->transform; ovutils::eTransform orient = static_cast<ovutils::eTransform>(transform); ov.setTransform(orient, destL); ov.setTransform(orient, destR); //For FB left, top will always be 0 //That should also be the case if using 2 mixers for single display ovutils::Dim dposL(displayFrame.left, displayFrame.top, (displayFrame.right - displayFrame.left) / 2, displayFrame.bottom - displayFrame.top); ov.setPosition(dposL, destL); ovutils::Dim dposR(0, displayFrame.top, (displayFrame.right - displayFrame.left) / 2, displayFrame.bottom - displayFrame.top); ov.setPosition(dposR, destR); ret = true; if (!ov.commit(destL)) { ALOGE("%s: commit fails for left", __FUNCTION__); ret = false; } if (!ov.commit(destR)) { ALOGE("%s: commit fails for right", __FUNCTION__); ret = false; } } return ret; }