bool GenericPipe::queueBuffer(int fd, uint32_t offset) { //TODO Move pipe-id transfer to CtrlData class. Make ctrl and data private. OVASSERT(isOpen(), "State is closed, cannot queueBuffer"); int pipeId = mCtrlData.ctrl.getPipeId(); OVASSERT(-1 != pipeId, "Ctrl ID should not be -1"); // set pipe id from ctrl to data mCtrlData.data.setPipeId(pipeId); int finalFd = fd; uint32_t finalOffset = offset; //If rotator is to be used, queue to it, so it can ROTATE. if(mRotUsed) { if(!mRot->queueBuffer(fd, offset)) { ALOGE("GenPipe Rotator play failed"); return false; } //Configure MDP's source buffer as the current output buffer of rotator if(mRot->getDstMemId() != -1) { finalFd = mRot->getDstMemId(); finalOffset = mRot->getDstOffset(); } else { //Could be -1 for NullRotator, if queue above succeeds. //Need an actual rotator. Modify overlay State Traits. //Not fatal, keep queuing to MDP without rotation. ALOGE("Null rotator in use, where an actual is required"); } } return mCtrlData.data.queueBuffer(finalFd, finalOffset); }
bool OverlayImpl<P0, P1, P2>::reconfigure(const utils::ReconfArgs& args) { OVASSERT(mPipe0 && mPipe1 && mPipe2, "%s: Pipes are null p0=%p p1=%p p2=%p", __FUNCTION__, mPipe0, mPipe1, mPipe2); switch(args.reconf) { case utils::RECONFIG_ON: { LOGE_IF(DEBUG_OVERLAY, "%s reconfig is on", __FUNCTION__); // reconfig the buffers here utils::PlayInfo play; if(!mReconf.setupBuf(args, play)) { LOGE("%s failed to reconf setupargs", __FUNCTION__); return false; } // regular setXXX interface calls here utils::ReconfArgs reargs(args); reargs.play = play; utils::PipeArgs parg0(mPipe0->getArgs()); parg0 = reargs; utils::PipeArgs parg1(mPipe1->getArgs()); parg1 = reargs; utils::PipeArgs parg2(mPipe2->getArgs()); parg2 = reargs; utils::PipeArgs pargs[utils::MAX_PIPES] = {parg0, parg1, parg2}; if(!this->setSource(pargs)) { LOGE("%s failed to setCrop", __FUNCTION__); return false; } if(!this->setCrop(reargs.crop)) { LOGE("%s failed to setCrop", __FUNCTION__); return false; } if(!this->setPosition(reargs.pos)) { LOGE("%s failed to setPosition", __FUNCTION__); return false; } utils::Params param(utils::OVERLAY_TRANSFORM, reargs.orientation); if(!this->setParameter(param)) { LOGE("%s failed to setParameter", __FUNCTION__); return false; } if(!this->commit()){ LOGE("%s failed to commit", __FUNCTION__); return false; } break; } case utils::RECONFIG_OFF: LOGE_IF(DEBUG_OVERLAY, "%s reconfig is off", __FUNCTION__); mReconf.reset(); break; default: OVASSERT(false, "%s unknown reconfig state %d", __FUNCTION__, args.reconf); return false; } return true; }
bool OverlayImpl<P0, P1, P2>::copyOvPipe(OverlayImplBase* ov, utils::eDest dest) { OVASSERT(ov, "%s: OverlayImpl ov is null", __FUNCTION__); OVASSERT(utils::isValidDest(dest), "%s: OverlayImpl invalid dest=%d", __FUNCTION__, dest); OverlayImpl<P0, P1, P2>* ovimpl = static_cast<OverlayImpl<P0, P1, P2>*>(ov); if (utils::OV_PIPE0 & dest) { mPipe0 = ovimpl->mPipe0; mRotP0 = ovimpl->mRotP0; } if (utils::OV_PIPE1 & dest) { mPipe1 = ovimpl->mPipe1; mRotP1 = ovimpl->mRotP1; } if (utils::OV_PIPE2 & dest) { mPipe2 = ovimpl->mPipe2; mRotP2 = ovimpl->mRotP2; } return true; }
bool GenericPipe<FB>::start(const utils::PipeArgs& args) { /* open before your start control rotator */ uint32_t sz = args.whf.size; //utils::getSizeByMdp(args.whf); OVASSERT(sz, "GenericPipe sz=%d", sz); if(!mRot->open()) { LOGE("GenericPipe start failed to open rot"); return false; } if(!mCtrlData.ctrl.start(args)){ LOGE("GenericPipe failed to start"); return false; } int ctrlId = mCtrlData.ctrl.getId(); OVASSERT(-1 != ctrlId, "Ctrl ID should not be -1"); // set ID requeset to assoc ctrl to data setId(ctrlId); // set ID request to assoc MDP data to ROT MDP data mRot->setDataReqId(mCtrlData.data.getId()); // cache the args for future reference. mArgs = args; // we got here so we are open+start and good to go mFlags = 0; // clear flags from CLOSED // TODO make it more robust when more flags // are added return true; }
inline void GenericPipe<FB>::setMemoryId(int id) { OVASSERT(isOpen(), "State is closed, cannot setMemoryId"); if(utils::RECONFIG_ON == mArgs.reconf) { id = mArgs.play.fd; OVASSERT(-1 != id, "%s id is -1", __FUNCTION__); } mCtrlData.data.setMemoryId(id); }
bool GenericPipe::queueBuffer(int fd, uint32_t offset) { //TODO Move pipe-id transfer to CtrlData class. Make ctrl and data private. OVASSERT(isOpen(), "State is closed, cannot queueBuffer"); int pipeId = mCtrlData.ctrl.getPipeId(); OVASSERT(-1 != pipeId, "Ctrl ID should not be -1"); // set pipe id from ctrl to data mCtrlData.data.setPipeId(pipeId); return mCtrlData.data.queueBuffer(fd, offset); }
bool OverlayImpl<P0, P1, P2>::openPipe(RotatorBase* rot, utils::eDest dest) { OVASSERT(rot, "%s: OverlayImpl rot is null", __FUNCTION__); OVASSERT(utils::isValidDest(dest), "%s: OverlayImpl invalid dest=%d", __FUNCTION__, dest); // Need to down case rotator to mdp one. // we assume p0/p1/p2/px all use the _same_ underlying mdp structure. // FIXME STATIC_ASSERT here bool ret = true; if (utils::OV_PIPE0 & dest) { OVASSERT(mPipe0, "%s: OverlayImpl pipe0 is null", __FUNCTION__); LOGE_IF(DEBUG_OVERLAY, "Open pipe0"); ret = mPipe0->open(rot); mRotP0 = rot; if(!ret) { LOGE("%s: OverlayImpl pipe0 failed to open", __FUNCTION__); } return ret; } if (utils::OV_PIPE1 & dest) { OVASSERT(mPipe1, "%s: OverlayImpl pipe1 is null", __FUNCTION__); LOGE_IF(DEBUG_OVERLAY, "Open pipe1"); ret = mPipe1->open(rot); mRotP1 = rot; if(!ret) { LOGE("%s: OverlayImpl pipe1 failed to open", __FUNCTION__); } return ret; } if (utils::OV_PIPE2 & dest) { OVASSERT(mPipe2, "%s: OverlayImpl pipe2 is null", __FUNCTION__); LOGE_IF(DEBUG_OVERLAY, "Open pipe2"); ret = mPipe2->open(rot); mRotP2 = rot; if(!ret) { LOGE("%s: OverlayImpl pipe2 failed to open", __FUNCTION__); } return ret; } // Should have returned by here return false; }
bool OverlayImpl<P0, P1, P2>::waitForVsync(utils::eDest dest) { OVASSERT(mPipe0 && mPipe1 && mPipe2, "%s: Pipes are null p0=%p p1=%p p2=%p", __FUNCTION__, mPipe0, mPipe1, mPipe2); if (utils::OV_PIPE0 & dest) { if(!mPipe0->waitForVsync()) { LOGE("OverlayImpl p0 failed to waitForVsync"); return false; } } if (utils::OV_PIPE1 & dest) { if(!mPipe1->waitForVsync()) { LOGE("OverlayImpl p1 failed to waitForVsync"); return false; } } if (utils::OV_PIPE2 & dest) { if(!mPipe2->waitForVsync()) { LOGE("OverlayImpl p2 failed to waitForVsync"); return false; } } return true; }
bool OverlayImpl<P0, P1, P2>::dequeueBuffer(void*& buf, utils::eDest dest) { OVASSERT(mPipe0 && mPipe1 && mPipe2, "%s: Pipes are null p0=%p p1=%p p2=%p", __FUNCTION__, mPipe0, mPipe1, mPipe2); if (utils::OV_PIPE0 & dest) { if(!mPipe0->dequeueBuffer(buf)) { LOGE("OverlayImpl p0 failed to dequeueBuffer"); return false; } } if (utils::OV_PIPE1 & dest) { if(!mPipe1->dequeueBuffer(buf)) { LOGE("OverlayImpl p1 failed to dequeueBuffer"); return false; } } if (utils::OV_PIPE2 & dest) { if(!mPipe2->dequeueBuffer(buf)) { LOGE("OverlayImpl p2 failed to dequeueBuffer"); return false; } } return true; }
bool OverlayImpl<P0, P1, P2>::setSource(const utils::PipeArgs args[utils::MAX_PIPES], utils::eDest dest) { OVASSERT(mPipe0 && mPipe1 && mPipe2, "%s: Pipes are null p0=%p p1=%p p2=%p", __FUNCTION__, mPipe0, mPipe1, mPipe2); if (utils::OV_PIPE0 & dest) { if(!mPipe0->setSource(args[0])) { LOGE("OverlayImpl p0 failed to setsrc"); return false; } } if (utils::OV_PIPE1 & dest) { if(!mPipe1->setSource(args[1])) { LOGE("OverlayImpl p1 failed to setsrc"); return false; } } if (utils::OV_PIPE2 & dest) { if(!mPipe2->setSource(args[2])) { LOGE("OverlayImpl p2 failed to setsrc"); return false; } } return true; }
bool OverlayImpl<P0, P1, P2>::setParameter(const utils::Params& param, utils::eDest dest) { OVASSERT(mPipe0 && mPipe1 && mPipe2, "%s: Pipes are null p0=%p p1=%p p2=%p", __FUNCTION__, mPipe0, mPipe1, mPipe2); if (utils::OV_PIPE0 & dest) { if(!mPipe0->setParameter(param)) { LOGE("OverlayImpl p0 failed to setparam"); return false; } } if (utils::OV_PIPE1 & dest) { if(!mPipe1->setParameter(param)) { LOGE("OverlayImpl p1 failed to setparam"); return false; } } if (utils::OV_PIPE2 & dest) { if(!mPipe2->setParameter(param)) { LOGE("OverlayImpl p2 failed to setparam"); return false; } } return true; }
bool WritebackMem::alloc(uint32_t size, bool isSecure) { if(!mBuf.open(NUM_BUFS, size, isSecure)){ ALOGE("%s: Failed to open", __func__); mBuf.close(); return false; } OVASSERT(MAP_FAILED != mBuf.addr(), "MAP failed"); OVASSERT(mBuf.getFD() != -1, "getFd is -1"); mCurrOffsetIndex = 0; for (uint32_t i = 0; i < NUM_BUFS; i++) { mOffsets[i] = i * size; } return true; }
bool MdssRot::queueBuffer(int fd, uint32_t offset) { if(enabled()) { mRotData.data.memory_id = fd; mRotData.data.offset = offset; remap(RotMem::Mem::ROT_NUM_BUFS); OVASSERT(mMem.curr().m.numBufs(), "queueBuffer numbufs is 0"); mRotData.dst_data.offset = mMem.curr().mRotOffset[mMem.curr().mCurrOffset]; mMem.curr().mCurrOffset = (mMem.curr().mCurrOffset + 1) % mMem.curr().m.numBufs(); if(!overlay::mdp_wrapper::play(mFd.getFD(), mRotData)) { ALOGE("MdssRot play failed!"); dump(); return false; } // if the prev mem is valid, we need to close if(mMem.prev().valid()) { // FIXME if no wait for vsync the above // play will return immediatly and might cause // tearing when prev.close is called. if(!mMem.prev().close()) { ALOGE("%s error in closing prev rot mem", __FUNCTION__); return false; } } } return true; }
bool GenericPipe::queueBuffer(int fd, uint32_t offset) { int pipeId = mCtrl->getPipeId(); OVASSERT(-1 != pipeId, "Ctrl ID should not be -1"); // set pipe id from ctrl to data mData->setPipeId(pipeId); return mData->queueBuffer(fd, offset); }
/* * Transition from any state to 3D video on 2D panel */ OverlayImplBase* OverlayState::handle_xxx_to_3D_2DPanel( OverlayImplBase* ov) { OVASSERT(ov, "%s: ov is null", __FUNCTION__); ALOGE("%s", __FUNCTION__); // Create new ovimpl based on new state typedef StateTraits<utils::OV_3D_VIDEO_ON_2D_PANEL> NewState; OverlayImplBase* newov = new NewState::ovimpl; //================================================================= // For each pipe: // - If pipe matches, copy from previous into new ovimpl. // (which also makes previous pipe ref 0, so nobody can use) // - Otherwise init pipe for new ovimpl and delete from previous //================================================================= // pipe0/rot0 (M3DPrimaryPipe) if (ov->getOvPipeType(utils::OV_PIPE0) == utils::OV_PIPE_TYPE_M3D_PRIMARY) { ALOGE_IF(DEBUG_OVERLAY, "%s: Copy pipe0 (M3DPrimaryPipe)", __FUNCTION__); newov->copyOvPipe(ov, utils::OV_PIPE0); } else { ALOGE_IF(DEBUG_OVERLAY, "%s: init pipe0 (M3DPrimaryPipe)", __FUNCTION__); RotatorBase* rot0 = new NewState::rot0; ov->closePipe(utils::OV_PIPE0); newov->initPipe(rot0, utils::OV_PIPE0); } // pipe1/rot1 (NullPipe) if (ov->getOvPipeType(utils::OV_PIPE1) == utils::OV_PIPE_TYPE_NULL) { ALOGE_IF(DEBUG_OVERLAY, "%s: Copy pipe1 (NullPipe)", __FUNCTION__); newov->copyOvPipe(ov, utils::OV_PIPE1); } else { ALOGE_IF(DEBUG_OVERLAY, "%s: init pipe1 (NullPipe)", __FUNCTION__); RotatorBase* rot1 = new NewState::rot1; ov->closePipe(utils::OV_PIPE1); newov->initPipe(rot1, utils::OV_PIPE1); } // pipe2/rot2 (NullPipe) if (ov->getOvPipeType(utils::OV_PIPE2) == utils::OV_PIPE_TYPE_NULL) { ALOGE_IF(DEBUG_OVERLAY, "%s: Copy pipe2 (NullPipe)", __FUNCTION__); newov->copyOvPipe(ov, utils::OV_PIPE2); } else { ALOGE_IF(DEBUG_OVERLAY, "%s: init pipe2 (NullPipe)", __FUNCTION__); RotatorBase* rot2 = new NewState::rot2; ov->closePipe(utils::OV_PIPE2); newov->initPipe(rot2, utils::OV_PIPE2); } // All pipes are copied or deleted so no more need for previous ovimpl delete ov; ov = 0; return newov; }
void GenericPipe::dump() const { ALOGE("== Dump Generic pipe start =="); ALOGE("pipe state = %d", (int)pipeState); OVASSERT(mRot, "GenericPipe should have a valid Rot"); mCtrlData.ctrl.dump(); mCtrlData.data.dump(); mRot->dump(); ALOGE("== Dump Generic pipe end =="); }
bool MdssRot::open_i(uint32_t numbufs, uint32_t bufsz) { OvMem mem; OVASSERT(MAP_FAILED == mem.addr(), "MAP failed in open_i"); if(!mem.open(numbufs, bufsz, false)){ // TODO: secure for badger ALOGE("%s: Failed to open", __func__); mem.close(); return false; } OVASSERT(MAP_FAILED != mem.addr(), "MAP failed"); OVASSERT(mem.getFD() != -1, "getFd is -1"); mRotData.dst_data.memory_id = mem.getFD(); mRotData.dst_data.offset = 0; mMem.curr().m = mem; return true; }
void GenericPipe<FB>::dump() const { LOGE("== Dump Generic pipe start =="); LOGE("flags=0x%x", mFlags); OVASSERT(mRot, "GenericPipe should have a valid Rot"); mCtrlData.ctrl.dump(); mCtrlData.data.dump(); mRot->dump(); LOGE("== Dump Generic pipe end =="); }
/* * Transition from any state to 2D video on 2D panel and 2D TV */ OverlayImplBase* OverlayState::handle_xxx_to_2D_2DTV( OverlayImplBase* ov) { OVASSERT(ov, "%s: ov is null", __FUNCTION__); ALOGE("%s", __FUNCTION__); // Create new ovimpl based on new state typedef StateTraits<utils::OV_2D_VIDEO_ON_PANEL_TV> NewState; OverlayImplBase* newov = new NewState::ovimpl; //=========================================================== // For each pipe: // - If pipe matches, copy from previous into new ovimpl // - Otherwise init for new and delete from previous ovimpl //=========================================================== // pipe0/rot0 (GenericPipe) if (ov->getOvPipeType(utils::OV_PIPE0) == utils::OV_PIPE_TYPE_GENERIC) { ALOGE_IF(DEBUG_OVERLAY, "%s: Copy pipe0 (GenericPipe)", __FUNCTION__); newov->copyOvPipe(ov, utils::OV_PIPE0); } else { ALOGE_IF(DEBUG_OVERLAY, "%s: init pipe0 (GenericPipe)", __FUNCTION__); RotatorBase* rot0 = new NewState::rot0; ov->closePipe(utils::OV_PIPE0); newov->initPipe(rot0, utils::OV_PIPE0); } // pipe1/rot1 (VideoExtPipe) if (ov->getOvPipeType(utils::OV_PIPE1) == utils::OV_PIPE_TYPE_VIDEO_EXT) { ALOGE_IF(DEBUG_OVERLAY, "%s: Copy pipe1 (VideoExtPipe)", __FUNCTION__); newov->copyOvPipe(ov, utils::OV_PIPE1); } else { ALOGE_IF(DEBUG_OVERLAY, "%s: init pipe1 (VideoExtPipe)", __FUNCTION__); RotatorBase* rot1 = new NewState::rot1; ov->closePipe(utils::OV_PIPE1); newov->initPipe(rot1, utils::OV_PIPE1); } // pipe2/rot2 (NullPipe) if (ov->getOvPipeType(utils::OV_PIPE2) == utils::OV_PIPE_TYPE_NULL) { ALOGE_IF(DEBUG_OVERLAY, "%s: Copy pipe2 (NullPipe)", __FUNCTION__); newov->copyOvPipe(ov, utils::OV_PIPE2); } else { ALOGE_IF(DEBUG_OVERLAY, "%s: init pipe2 (NullPipe)", __FUNCTION__); RotatorBase* rot2 = new NewState::rot2; ov->closePipe(utils::OV_PIPE2); newov->initPipe(rot2, utils::OV_PIPE2); } // All pipes are copied or deleted so no more need for previous ovimpl delete ov; ov = 0; return newov; }
bool MdssRot::open_i(uint32_t numbufs, uint32_t bufsz) { OvMem mem; OVASSERT(MAP_FAILED == mem.addr(), "MAP failed in open_i"); bool isSecure = mRotInfo.flags & utils::OV_MDP_SECURE_OVERLAY_SESSION; if(!mem.open(numbufs, bufsz, isSecure)){ ALOGE("%s: Failed to open", __func__); mem.close(); return false; } OVASSERT(MAP_FAILED != mem.addr(), "MAP failed"); OVASSERT(mem.getFD() != -1, "getFd is -1"); mRotData.dst_data.memory_id = mem.getFD(); mRotData.dst_data.offset = 0; mMem.curr().m = mem; return true; }
bool MdpRot::open_i(uint32_t numbufs, uint32_t bufsz) { OvMem mem; OVASSERT(MAP_FAILED == mem.addr(), "MAP failed in open_i"); if(!mem.open(numbufs, bufsz, mRotImgInfo.secure)){ ALOGE("%s: Failed to open", __func__); mem.close(); return false; } OVASSERT(MAP_FAILED != mem.addr(), "MAP failed"); OVASSERT(mem.getFD() != -1, "getFd is -1"); mRotDataInfo.dst.memory_id = mem.getFD(); mRotDataInfo.dst.offset = 0; mMem.mem = mem; return true; }
int main(int, char**) { LOGE("UtilsTest start"); OVASSERT(true, "This is true"); ovutils::Dim d; OVASSERT(!d.x && !d.y && !d.w && !d.h, "Failed dim"); ovutils::Whf whf; OVASSERT(!whf.w && !whf.h && !whf.format, "Failed whf"); ovutils::ScreenInfo info; OVASSERT(!info.mFBWidth && !info.mFBHeight && !info.mFBbpp && !info.mFBystride, "failed Screen info"); // FIXME more examples here OVASSERT(MDP_RGBA_8888 == ovutils::getMdpFormat(HAL_PIXEL_FORMAT_RGBA_8888), "Failed getMdpFormat"); whf = (ovutils::Whf(1024, 500, MDP_RGBA_8888)); uint32_t s = ovutils::getSize(whf); OVASSERT(1024*500*4 == s, "Failed getSize s=%d expect %d", s, 1024*500*4); LOGE("UtilsTest end"); return 0; }
inline bool S3DExtPipe<CHAN>::start(const utils::PipeArgs& args) { OVASSERT(mS3Dfmt, "S3DExtPipe mS3Dfmt should not be 0 here"); if(!mS3d.start(args)) { LOGE("S3DExtPipe start failed"); return false; } uint32_t fmt = mS3Dfmt & utils::OUTPUT_3D_MASK; if(!utils::send3DInfoPacket(fmt)){ LOGE("Error S3DExtPipe start error send3DInfoPacket %d", fmt); return false; } return true; }
inline bool GenericPipe<FB>::queueBuffer(uint32_t offset) { OVASSERT(isOpen(), "State is closed, cannot queueBuffer"); // when dealing with reconfig - we need to make sure data // channel is setup with the proper offset/fd as the src // for rot. The dst fd/src of the reconfig rotator // is the src of the queueBuf if(utils::RECONFIG_ON == mArgs.reconf) { offset = mArgs.play.offset; } return mCtrlData.data.queueBuffer(offset); }
utils::eOverlayPipeType OverlayImpl<P0, P1, P2>::getOvPipeType(utils::eDest dest) const { OVASSERT(utils::isValidDest(dest), "%s: OverlayImpl invalid dest=%d", __FUNCTION__, dest); if (utils::OV_PIPE0 & dest) { OVASSERT(mPipe0, "%s: OverlayImpl pipe0 is null", __FUNCTION__); return mPipe0->getOvPipeType(); } if (utils::OV_PIPE1 & dest) { OVASSERT(mPipe1, "%s: OverlayImpl pipe1 is null", __FUNCTION__); return mPipe1->getOvPipeType(); } if (utils::OV_PIPE2 & dest) { OVASSERT(mPipe2, "%s: OverlayImpl pipe2 is null", __FUNCTION__); return mPipe2->getOvPipeType(); } // Should never get here return utils::OV_PIPE_TYPE_NULL; }
inline bool GenericPipe<FB>::setParameter( const utils::Params& param) { OVASSERT(isOpen(), "State is closed, cannot setParameter"); // Currently setParameter would start rotator if(!mCtrlData.ctrl.setParameter(param)) { LOGE("GenericPipe failed to setparam"); return false; } // if rot flags are ENABLED it means we would always // like to have rot. Even with 0 rot. (solves tearing) if(utils::ROT_FLAG_ENABLED == mArgs.rotFlags) { mRot->setEnable(); } return startRotator(); }
void OverlayImpl<P0, P1, P2>::setMemoryId(int id, utils::eDest dest) { OVASSERT(mPipe0 && mPipe1 && mPipe2, "%s: Pipes are null p0=%p p1=%p p2=%p", __FUNCTION__, mPipe0, mPipe1, mPipe2); if (utils::OV_PIPE0 & dest) { mPipe0->setMemoryId(id); } if (utils::OV_PIPE1 & dest) { mPipe1->setMemoryId(id); } if (utils::OV_PIPE2 & dest) { mPipe2->setMemoryId(id); } }
bool MdssRot::remap(uint32_t numbufs) { // if current size changed, remap if(mBufSize == mMem.curr().size()) { ALOGE_IF(DEBUG_OVERLAY, "%s: same size %d", __FUNCTION__, mBufSize); return true; } ALOGE_IF(DEBUG_OVERLAY, "%s: size changed - remapping", __FUNCTION__); OVASSERT(!mMem.prev().valid(), "Prev should not be valid"); // ++mMem will make curr to be prev, and prev will be curr ++mMem; if(!open_i(numbufs, mBufSize)) { ALOGE("%s Error could not open", __FUNCTION__); return false; } for (uint32_t i = 0; i < numbufs; ++i) { mMem.curr().mRotOffset[i] = i * mBufSize; } return true; }
bool GenericPipe<FB>::open(RotatorBase* rot) { OVASSERT(rot, "rot is null"); // open ctrl and data uint32_t fbnum = FB; LOGE_IF(DEBUG_OVERLAY, "GenericPipe open"); if(!mCtrlData.ctrl.open(fbnum, rot)) { LOGE("GenericPipe failed to open ctrl"); return false; } if(!mCtrlData.data.open(fbnum, rot)) { LOGE("GenericPipe failed to open data"); return false; } mRot = rot; // NOTE: we won't have the flags as non CLOSED since we // consider the pipe opened for business only when we call // start() return true; }
bool MdssRot::remap(uint32_t numbufs) { // Calculate the size based on rotator's dst format, w and h. uint32_t opBufSize = calcOutputBufSize(); // If current size changed, remap if(opBufSize == mMem.curr().size()) { ALOGE_IF(DEBUG_OVERLAY, "%s: same size %d", __FUNCTION__, opBufSize); return true; } ALOGE_IF(DEBUG_OVERLAY, "%s: size changed - remapping", __FUNCTION__); OVASSERT(!mMem.prev().valid(), "Prev should not be valid"); // ++mMem will make curr to be prev, and prev will be curr ++mMem; if(!open_i(numbufs, opBufSize)) { ALOGE("%s Error could not open", __FUNCTION__); return false; } for (uint32_t i = 0; i < numbufs; ++i) { mMem.curr().mRotOffset[i] = i * opBufSize; } return true; }