IFBUpdate::IFBUpdate(hwc_context_t *ctx, const int& dpy) : mDpy(dpy) { getBufferSizeAndDimensions(ctx->dpyAttr[dpy].xres, ctx->dpyAttr[dpy].yres, HAL_PIXEL_FORMAT_RGBA_8888, mAlignedFBWidth, mAlignedFBHeight); }
uint32_t Rotator::calcOutputBufSize(const utils::Whf& destWhf) { //dummy aligned w & h. int alW = 0, alH = 0; int halFormat = ovutils::getHALFormat(destWhf.format); //A call into gralloc/memalloc return getBufferSizeAndDimensions( destWhf.w, destWhf.h, halFormat, alW, alH); }
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; }