// Configure bool FBUpdateLowRes::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 a fb pipe ovutils::eDest dest = getPipeForFb(ctx, mDpy); if(dest == ovutils::OV_INVALID) { //None available ALOGE("%s: No pipes available to configure fb for dpy %d", __FUNCTION__, mDpy); return false; } mDest = dest; if((mDpy && ctx->deviceOrientation) && ctx->listStats[mDpy].isDisplayAnimating) { fbZorder = 0; } ovutils::eMdpFlags mdpFlags = ovutils::OV_MDP_BLEND_FG_PREMULT; ovutils::eIsFg isFg = ovutils::IS_FG_OFF; ovutils::eZorder zOrder = static_cast<ovutils::eZorder>(fbZorder); hwc_rect_t sourceCrop = integerizeSourceCrop(layer->sourceCropf); hwc_rect_t displayFrame = layer->displayFrame; int transform = layer->transform; int rotFlags = ovutils::ROT_FLAGS_NONE; ovutils::eTransform orient = static_cast<ovutils::eTransform>(transform); // use ext orientation if any int extOrient = getExtOrientation(ctx); // Do not use getNonWormholeRegion() function to calculate the // sourceCrop during animation on external display and // Dont do wormhole calculation when extorientation is set on External // Dont do wormhole calculation when extDownscale is enabled on External if(ctx->listStats[mDpy].isDisplayAnimating && mDpy) { sourceCrop = layer->displayFrame; displayFrame = sourceCrop; } else if((!mDpy || (mDpy && !extOrient && !ctx->dpyAttr[mDpy].mDownScaleMode)) && (extOnlyLayerIndex == -1)) { getNonWormholeRegion(list, sourceCrop); displayFrame = sourceCrop; } calcExtDisplayPosition(ctx, NULL, mDpy, sourceCrop, displayFrame, transform, orient); //Store the displayFrame, will be used in getDisplayViewFrame ctx->dpyAttr[mDpy].mDstRect = displayFrame; setMdpFlags(layer, mdpFlags, 0, transform); // For External use rotator if there is a rotation value set ret = preRotateExtDisplay(ctx, layer, info, sourceCrop, mdpFlags, rotFlags); if(!ret) { ALOGE("%s: preRotate for external Failed!", __FUNCTION__); ctx->mOverlay->clear(mDpy); ctx->mLayerRotMap[mDpy]->clear(); return false; } //For the mdp, since either we are pre-rotating or MDP does flips orient = ovutils::OVERLAY_TRANSFORM_0; transform = 0; //XXX: FB layer plane alpha is currently sent as zero from //surfaceflinger ovutils::PipeArgs parg(mdpFlags, info, zOrder, isFg, static_cast<ovutils::eRotFlags>(rotFlags), ovutils::DEFAULT_PLANE_ALPHA, (ovutils::eBlending) getBlending(layer->blending)); ret = true; if(configMdp(ctx->mOverlay, parg, orient, sourceCrop, displayFrame, NULL, mDest) < 0) { ALOGE("%s: configMdp failed for dpy %d", __FUNCTION__, mDpy); ctx->mLayerRotMap[mDpy]->clear(); ret = false; } } return ret; }
// Configure bool FBUpdateNonSplit::configure(hwc_context_t *ctx, hwc_display_contents_1 *list, hwc_rect_t fbUpdatingRect, 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, mTileEnabled)); Overlay::PipeSpecs pipeSpecs; pipeSpecs.formatClass = Overlay::FORMAT_RGB; pipeSpecs.needsScaling = qhwc::needsScaling(layer); pipeSpecs.dpy = mDpy; pipeSpecs.mixer = Overlay::MIXER_DEFAULT; pipeSpecs.fb = true; ovutils::eDest dest = ov.getPipe(pipeSpecs); if(dest == ovutils::OV_INVALID) { //None available ALOGE("%s: No pipes available to configure fb for dpy %d", __FUNCTION__, mDpy); return false; } mDest = dest; if((mDpy && ctx->deviceOrientation) && ctx->listStats[mDpy].isDisplayAnimating) { fbZorder = 0; } ovutils::eMdpFlags mdpFlags = ovutils::OV_MDP_BLEND_FG_PREMULT; ovutils::eIsFg isFg = ovutils::IS_FG_OFF; ovutils::eZorder zOrder = static_cast<ovutils::eZorder>(fbZorder); hwc_rect_t sourceCrop = integerizeSourceCrop(layer->sourceCropf); hwc_rect_t displayFrame = layer->displayFrame; // No FB update optimization on (1) Custom FB resolution, // (2) External Mirror mode, (3) External orientation if(!ctx->dpyAttr[mDpy].customFBSize && !ctx->mBufferMirrorMode && !ctx->mExtOrientation) { sourceCrop = fbUpdatingRect; displayFrame = fbUpdatingRect; } int transform = layer->transform; int rotFlags = ovutils::ROT_FLAGS_NONE; ovutils::eTransform orient = static_cast<ovutils::eTransform>(transform); // use ext orientation if any int extOrient = getExtOrientation(ctx); // Do not use getNonWormholeRegion() function to calculate the // sourceCrop during animation on external display and // Dont do wormhole calculation when extorientation is set on External // Dont do wormhole calculation when extDownscale is enabled on External if(ctx->listStats[mDpy].isDisplayAnimating && mDpy) { sourceCrop = layer->displayFrame; } else if((!mDpy || (mDpy && !extOrient && !ctx->dpyAttr[mDpy].mDownScaleMode)) && (extOnlyLayerIndex == -1)) { if(ctx->mOverlay->isUIScalingOnExternalSupported() && !ctx->dpyAttr[mDpy].customFBSize) { getNonWormholeRegion(list, sourceCrop); displayFrame = sourceCrop; } } calcExtDisplayPosition(ctx, NULL, mDpy, sourceCrop, displayFrame, transform, orient); //Store the displayFrame, will be used in getDisplayViewFrame ctx->dpyAttr[mDpy].mDstRect = displayFrame; setMdpFlags(layer, mdpFlags, 0, transform); // For External use rotator if there is a rotation value set ret = preRotateExtDisplay(ctx, layer, info, sourceCrop, mdpFlags, rotFlags); if(!ret) { ALOGE("%s: preRotate for external Failed!", __FUNCTION__); return false; } //For the mdp, since either we are pre-rotating or MDP does flips orient = ovutils::OVERLAY_TRANSFORM_0; transform = 0; ovutils::PipeArgs parg(mdpFlags, info, zOrder, isFg, static_cast<ovutils::eRotFlags>(rotFlags), ovutils::DEFAULT_PLANE_ALPHA, (ovutils::eBlending) getBlending(layer->blending)); ret = true; if(configMdp(ctx->mOverlay, parg, orient, sourceCrop, displayFrame, NULL, mDest) < 0) { ALOGE("%s: configMdp failed for dpy %d", __FUNCTION__, mDpy); ret = false; } } return ret; }