// 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; }
bool FBSrcSplit::configure(hwc_context_t *ctx, hwc_display_contents_1 *list, hwc_rect_t fbUpdatingRect, int fbZorder) { hwc_layer_1_t *layer = &list->hwLayers[list->numHwLayers - 1]; 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)); ovutils::eMdpFlags mdpFlags = OV_MDP_BLEND_FG_PREMULT; ovutils::eZorder zOrder = static_cast<ovutils::eZorder>(fbZorder); ovutils::PipeArgs parg(mdpFlags, info, zOrder, ovutils::IS_FG_OFF, ovutils::ROT_FLAGS_NONE, ovutils::DEFAULT_PLANE_ALPHA, (ovutils::eBlending) getBlending(layer->blending)); int transform = layer->transform; ovutils::eTransform orient = static_cast<ovutils::eTransform>(transform); hwc_rect_t cropL = fbUpdatingRect; hwc_rect_t cropR = fbUpdatingRect; //Request left pipe (or 1 by default) 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 destL = ov.getPipe(pipeSpecs); if(destL == ovutils::OV_INVALID) { ALOGE("%s: No pipes available to configure fb for dpy %d's left" " mixer", __FUNCTION__, mDpy); return false; } ovutils::eDest destR = ovutils::OV_INVALID; /* Use 2 pipes IF a) FB's width is > 2048 or b) On primary, driver has indicated with caps to split always. This is based on an empirically derived value of panel height. */ bool primarySplitAlways = (mDpy == HWC_DISPLAY_PRIMARY) and qdutils::MDPVersion::getInstance().isSrcSplitAlways(); if(((fbUpdatingRect.right - fbUpdatingRect.left) > qdutils::MAX_DISPLAY_DIM) or primarySplitAlways) { destR = ov.getPipe(pipeSpecs); if(destR == ovutils::OV_INVALID) { ALOGE("%s: No pipes available to configure fb for dpy %d's right" " mixer", __FUNCTION__, mDpy); return false; } if(ctx->mOverlay->comparePipePriority(destL, destR) == -1) { qhwc::swap(destL, destR); } //Split crop equally when using 2 pipes cropL.right = (fbUpdatingRect.right + fbUpdatingRect.left) / 2; cropR.left = cropL.right; } mDestLeft = destL; mDestRight = destR; if(destL != OV_INVALID) { if(configMdp(ctx->mOverlay, parg, orient, cropL, cropL, NULL /*metadata*/, destL) < 0) { ALOGE("%s: commit failed for left mixer config", __FUNCTION__); return false; } } //configure right pipe if(destR != OV_INVALID) { if(configMdp(ctx->mOverlay, parg, orient, cropR, cropR, NULL /*metadata*/, destR) < 0) { ALOGE("%s: commit failed for right mixer config", __FUNCTION__); return false; } } return true; }
bool AssertiveDisplay::prepare(hwc_context_t *ctx, const hwc_rect_t& crop, const Whf& whf, const private_handle_t *hnd) { if(!isDoable()) { if(isModeOn()) { //Cleanup one time during this switch const int off = 0; adWrite(off); closeWbFb(mWbFd); } return false; } ovutils::eDest dest = ctx->mOverlay->nextPipe(ovutils::OV_MDP_PIPE_VG, overlay::Overlay::DPY_WRITEBACK, Overlay::MIXER_DEFAULT); if(dest == OV_INVALID) { ALOGE("%s failed: No VG pipe available", __func__); mDoable = false; return false; } overlay::Writeback *wb = overlay::Writeback::getInstance(); //Set Security flag on writeback if(isSecureBuffer(hnd)) { if(!wb->setSecure(isSecureBuffer(hnd))) { ALOGE("Failure in setting WB secure flag for ad"); return false; } } if(!wb->configureDpyInfo(hnd->width, hnd->height)) { ALOGE("%s: config display failed", __func__); mDoable = false; return false; } int tmpW, tmpH, size; int format = ovutils::getHALFormat(wb->getOutputFormat()); if(format < 0) { ALOGE("%s invalid format %d", __func__, format); mDoable = false; return false; } size = getBufferSizeAndDimensions(hnd->width, hnd->height, format, tmpW, tmpH); if(!wb->configureMemory(size)) { ALOGE("%s: config memory failed", __func__); mDoable = false; return false; } eMdpFlags mdpFlags = OV_MDP_FLAGS_NONE; if(isSecureBuffer(hnd)) { ovutils::setMdpFlags(mdpFlags, ovutils::OV_MDP_SECURE_OVERLAY_SESSION); } PipeArgs parg(mdpFlags, whf, ZORDER_0, IS_FG_OFF, ROT_FLAGS_NONE); hwc_rect_t dst = crop; //input same as output if(configMdp(ctx->mOverlay, parg, OVERLAY_TRANSFORM_0, crop, dst, NULL, dest) < 0) { ALOGE("%s: configMdp failed", __func__); mDoable = false; return false; } mDest = dest; if(!isModeOn()) { mWbFd = openWbFb(); if(mWbFd >= 0) { //write to sysfs, one time during this switch const int on = 1; adWrite(on); } } return true; }
// Configure bool FBUpdateSplit::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)) { /* External only layer present */ int extOnlyLayerIndex = ctx->listStats[mDpy].extOnlyLayerIndex; if(extOnlyLayerIndex != -1) { layer = &list->hwLayers[extOnlyLayerIndex]; layer->compositionType = HWC_OVERLAY; } ovutils::Whf info(mAlignedFBWidth, mAlignedFBHeight, ovutils::getMdpFormat(HAL_PIXEL_FORMAT_RGBA_8888, mTileEnabled)); overlay::Overlay& ov = *(ctx->mOverlay); ovutils::eMdpFlags mdpFlags = ovutils::OV_MDP_BLEND_FG_PREMULT; ovutils::eZorder zOrder = static_cast<ovutils::eZorder>(fbZorder); ovutils::eTransform orient = static_cast<ovutils::eTransform>(layer->transform); const int hw_w = ctx->dpyAttr[mDpy].xres; const int hw_h = ctx->dpyAttr[mDpy].yres; const int lSplit = getLeftSplit(ctx, mDpy); mDestLeft = ovutils::OV_INVALID; mDestRight = ovutils::OV_INVALID; hwc_rect_t sourceCrop = fbUpdatingRect; hwc_rect_t displayFrame = fbUpdatingRect; ret = true; Overlay::PipeSpecs pipeSpecs; pipeSpecs.formatClass = Overlay::FORMAT_RGB; pipeSpecs.needsScaling = qhwc::needsScaling(layer); pipeSpecs.dpy = mDpy; pipeSpecs.fb = true; /* Configure left pipe */ if(displayFrame.left < lSplit) { pipeSpecs.mixer = Overlay::MIXER_LEFT; ovutils::eDest destL = ov.getPipe(pipeSpecs); 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; } mDestLeft = destL; //XXX: FB layer plane alpha is currently sent as zero from //surfaceflinger ovutils::PipeArgs pargL(mdpFlags, info, zOrder, ovutils::IS_FG_OFF, ovutils::ROT_FLAGS_NONE, ovutils::DEFAULT_PLANE_ALPHA, (ovutils::eBlending) getBlending(layer->blending)); hwc_rect_t cropL = sourceCrop; hwc_rect_t dstL = displayFrame; hwc_rect_t scissorL = {0, 0, lSplit, hw_h }; qhwc::calculate_crop_rects(cropL, dstL, scissorL, 0); if (configMdp(ctx->mOverlay, pargL, orient, cropL, dstL, NULL, destL)< 0) { ALOGE("%s: configMdp fails for left FB", __FUNCTION__); ret = false; } } /* Configure right pipe */ if(displayFrame.right > lSplit) { pipeSpecs.mixer = Overlay::MIXER_RIGHT; ovutils::eDest destR = ov.getPipe(pipeSpecs); 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; } mDestRight = destR; ovutils::eMdpFlags mdpFlagsR = mdpFlags; ovutils::setMdpFlags(mdpFlagsR, ovutils::OV_MDSS_MDP_RIGHT_MIXER); //XXX: FB layer plane alpha is currently sent as zero from //surfaceflinger ovutils::PipeArgs pargR(mdpFlagsR, info, zOrder, ovutils::IS_FG_OFF, ovutils::ROT_FLAGS_NONE, ovutils::DEFAULT_PLANE_ALPHA, (ovutils::eBlending) getBlending(layer->blending)); hwc_rect_t cropR = sourceCrop; hwc_rect_t dstR = displayFrame; hwc_rect_t scissorR = {lSplit, 0, hw_w, hw_h }; qhwc::calculate_crop_rects(cropR, dstR, scissorR, 0); dstR.left -= lSplit; dstR.right -= lSplit; if (configMdp(ctx->mOverlay, pargR, orient, cropR, dstR, NULL, destR) < 0) { ALOGE("%s: configMdp fails for right FB", __FUNCTION__); 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; }
int configureLowRes(hwc_context_t *ctx, hwc_layer_1_t *layer, const int& dpy, eMdpFlags& mdpFlags, const eZorder& z, const eIsFg& isFg, const eDest& dest, Rotator **rot) { private_handle_t *hnd = (private_handle_t *)layer->handle; if(!hnd) { ALOGE("%s: layer handle is NULL", __FUNCTION__); return -1; } MetaData_t *metadata = (MetaData_t *)hnd->base_metadata; hwc_rect_t crop = layer->sourceCrop; hwc_rect_t dst = layer->displayFrame; int transform = layer->transform; eTransform orient = static_cast<eTransform>(transform); int downscale = 0; int rotFlags = ovutils::ROT_FLAGS_NONE; Whf whf(getWidth(hnd), getHeight(hnd), getMdpFormat(hnd->format), hnd->size); bool forceRot = false; if(isYuvBuffer(hnd) && ctx->mMDP.version >= qdutils::MDP_V4_2 && ctx->mMDP.version < qdutils::MDSS_V5) { downscale = getDownscaleFactor( crop.right - crop.left, crop.bottom - crop.top, dst.right - dst.left, dst.bottom - dst.top); if(downscale) { rotFlags = ROT_DOWNSCALE_ENABLED; } unsigned int& prevWidth = ctx->mPrevWHF[dpy].w; unsigned int& prevHeight = ctx->mPrevWHF[dpy].h; if(prevWidth != (uint32_t)getWidth(hnd) || prevHeight != (uint32_t)getHeight(hnd)) { uint32_t prevBufArea = (prevWidth * prevHeight); if(prevBufArea) { forceRot = true; } prevWidth = (uint32_t)getWidth(hnd); prevHeight = (uint32_t)getHeight(hnd); } } setMdpFlags(layer, mdpFlags, downscale); trimLayer(ctx, dpy, transform, crop, dst); if(isYuvBuffer(hnd) && //if 90 component or downscale, use rot ((transform & HWC_TRANSFORM_ROT_90) || downscale || forceRot)) { *rot = ctx->mRotMgr->getNext(); if(*rot == NULL) return -1; //Configure rotator for pre-rotation Whf origWhf(hnd->width, hnd->height, getMdpFormat(hnd->format), hnd->size); if(configRotator(*rot, whf, origWhf, mdpFlags, orient, downscale) < 0) return -1; ctx->mLayerRotMap[dpy]->add(layer, *rot); whf.format = (*rot)->getDstFormat(); updateSource(orient, whf, crop); rotFlags |= ovutils::ROT_PREROTATED; } //For the mdp, since either we are pre-rotating or MDP does flips orient = OVERLAY_TRANSFORM_0; transform = 0; PipeArgs parg(mdpFlags, whf, z, isFg, static_cast<eRotFlags>(rotFlags), layer->planeAlpha, (ovutils::eBlending) getBlending(layer->blending)); if(configMdp(ctx->mOverlay, parg, orient, crop, dst, metadata, dest) < 0) { ALOGE("%s: commit failed for low res panel", __FUNCTION__); ctx->mLayerRotMap[dpy]->reset(); return -1; } return 0; }
int configureHighRes(hwc_context_t *ctx, hwc_layer_1_t *layer, const int& dpy, eMdpFlags& mdpFlagsL, const eZorder& z, const eIsFg& isFg, const eDest& lDest, const eDest& rDest, Rotator **rot) { private_handle_t *hnd = (private_handle_t *)layer->handle; if(!hnd) { ALOGE("%s: layer handle is NULL", __FUNCTION__); return -1; } MetaData_t *metadata = (MetaData_t *)hnd->base_metadata; int hw_w = ctx->dpyAttr[dpy].xres; int hw_h = ctx->dpyAttr[dpy].yres; hwc_rect_t crop = layer->sourceCrop; hwc_rect_t dst = layer->displayFrame; int transform = layer->transform; eTransform orient = static_cast<eTransform>(transform); const int downscale = 0; int rotFlags = ROT_FLAGS_NONE; Whf whf(getWidth(hnd), getHeight(hnd), getMdpFormat(hnd->format), hnd->size); setMdpFlags(layer, mdpFlagsL); trimLayer(ctx, dpy, transform, crop, dst); if(isYuvBuffer(hnd) && (transform & HWC_TRANSFORM_ROT_90)) { (*rot) = ctx->mRotMgr->getNext(); if((*rot) == NULL) return -1; //Configure rotator for pre-rotation Whf origWhf(hnd->width, hnd->height, getMdpFormat(hnd->format), hnd->size); if(configRotator(*rot, whf, origWhf, mdpFlagsL, orient, downscale) < 0) return -1; ctx->mLayerRotMap[dpy]->add(layer, *rot); whf.format = (*rot)->getDstFormat(); updateSource(orient, whf, crop); rotFlags |= ROT_PREROTATED; } eMdpFlags mdpFlagsR = mdpFlagsL; setMdpFlags(mdpFlagsR, OV_MDSS_MDP_RIGHT_MIXER); hwc_rect_t tmp_cropL, tmp_dstL; hwc_rect_t tmp_cropR, tmp_dstR; if(lDest != OV_INVALID) { tmp_cropL = crop; tmp_dstL = dst; hwc_rect_t scissor = {0, 0, hw_w/2, hw_h }; qhwc::calculate_crop_rects(tmp_cropL, tmp_dstL, scissor, 0); } if(rDest != OV_INVALID) { tmp_cropR = crop; tmp_dstR = dst; hwc_rect_t scissor = {hw_w/2, 0, hw_w, hw_h }; qhwc::calculate_crop_rects(tmp_cropR, tmp_dstR, scissor, 0); } //When buffer is flipped, contents of mixer config also needs to swapped. //Not needed if the layer is confined to one half of the screen. //If rotator has been used then it has also done the flips, so ignore them. if((orient & OVERLAY_TRANSFORM_FLIP_V) && lDest != OV_INVALID && rDest != OV_INVALID && rot == NULL) { hwc_rect_t new_cropR; new_cropR.left = tmp_cropL.left; new_cropR.right = new_cropR.left + (tmp_cropR.right - tmp_cropR.left); hwc_rect_t new_cropL; new_cropL.left = new_cropR.right; new_cropL.right = tmp_cropR.right; tmp_cropL.left = new_cropL.left; tmp_cropL.right = new_cropL.right; tmp_cropR.left = new_cropR.left; tmp_cropR.right = new_cropR.right; } //For the mdp, since either we are pre-rotating or MDP does flips orient = OVERLAY_TRANSFORM_0; transform = 0; //configure left mixer if(lDest != OV_INVALID) { PipeArgs pargL(mdpFlagsL, whf, z, isFg, static_cast<eRotFlags>(rotFlags), layer->planeAlpha, (ovutils::eBlending) getBlending(layer->blending)); if(configMdp(ctx->mOverlay, pargL, orient, tmp_cropL, tmp_dstL, metadata, lDest) < 0) { ALOGE("%s: commit failed for left mixer config", __FUNCTION__); return -1; } } //configure right mixer if(rDest != OV_INVALID) { PipeArgs pargR(mdpFlagsR, whf, z, isFg, static_cast<eRotFlags>(rotFlags), layer->planeAlpha, (ovutils::eBlending) getBlending(layer->blending)); tmp_dstR.right = tmp_dstR.right - tmp_dstR.left; tmp_dstR.left = 0; if(configMdp(ctx->mOverlay, pargR, orient, tmp_cropR, tmp_dstR, metadata, rDest) < 0) { ALOGE("%s: commit failed for right mixer config", __FUNCTION__); return -1; } } return 0; }
// 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); private_handle_t *hnd = (private_handle_t *)layer->handle; ovutils::Whf info(getWidth(hnd), getHeight(hnd), ovutils::getMdpFormat(hnd->format), hnd->size); //Request an RGB pipe ovutils::eDest dest = ov.nextPipe(ovutils::OV_MDP_PIPE_ANY, mDpy); if(dest == ovutils::OV_INVALID) { //None available ALOGE("%s: No pipes available to configure framebuffer", __FUNCTION__); return false; } mDest = dest; 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 = layer->sourceCrop; hwc_rect_t displayFrame = layer->displayFrame; int transform = layer->transform; int fbWidth = ctx->dpyAttr[mDpy].xres; int fbHeight = ctx->dpyAttr[mDpy].yres; int rotFlags = ovutils::ROT_FLAGS_NONE; ovutils::eTransform orient = static_cast<ovutils::eTransform>(transform); if(mDpy && ctx->mExtOrientation) { // If there is a external orientation set, use that transform = ctx->mExtOrientation; orient = static_cast<ovutils::eTransform >(ctx->mExtOrientation); } // Dont do wormhole calculation when extorientation is set on External if((!mDpy || (mDpy && !ctx->mExtOrientation)) && extOnlyLayerIndex == -1) { getNonWormholeRegion(list, sourceCrop); displayFrame = sourceCrop; } ovutils::Dim dpos(displayFrame.left, displayFrame.top, displayFrame.right - displayFrame.left, displayFrame.bottom - displayFrame.top); if(mDpy) { // Get Aspect Ratio for external getAspectRatioPosition(ctx, mDpy, ctx->mExtOrientation, dpos.x, dpos.y, dpos.w, dpos.h); // Calculate the actionsafe dimensions for External(dpy = 1 or 2) getActionSafePosition(ctx, mDpy, dpos.x, dpos.y, dpos.w, dpos.h); // Convert dim to hwc_rect_t displayFrame.left = dpos.x; displayFrame.top = dpos.y; displayFrame.right = dpos.w + displayFrame.left; displayFrame.bottom = dpos.h + displayFrame.top; } setMdpFlags(layer, mdpFlags, 0); // For External use rotator if there is a rotation value set if(mDpy && (ctx->mExtOrientation & HWC_TRANSFORM_ROT_90)) { mRot = ctx->mRotMgr->getNext(); if(mRot == NULL) return -1; //Configure rotator for pre-rotation if(configRotator(mRot, info, mdpFlags, orient, 0) < 0) { ALOGE("%s: configRotator Failed!", __FUNCTION__); mRot = NULL; return -1; } info.format = (mRot)->getDstFormat(); updateSource(orient, info, sourceCrop); rotFlags |= ovutils::ROT_PREROTATED; } //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 low res", __FUNCTION__); ret = false; } } return ret; }