status_t OverlayUI::setSource(const overlay_buffer_info& info, int orientation,
                                             bool useVGPipe, bool ignoreFB,
                                             int fbnum, int zorder) {
    status_t ret = NO_INIT;

    int format3D = FORMAT_3D(info.format);
    int colorFormat = COLOR_FORMAT(info.format);
    int format = get_mdp_format(colorFormat);

    if (format3D || !isRGBType(format))
        return ret;

    if (mChannelState == PENDING_CLOSE)
        closeChannel();

    if (mChannelState == UP) {
        mdp_overlay ov;
        if (mobjOVHelper.getOVInfo(ov) == NO_ERROR) {
            if (mOrientation == orientation &&
                   mFBNum == fbnum &&
                   checkOVState(info.width, info.height, format, orientation,
                                  zorder, ignoreFB, ov))
                return NO_ERROR;
            else
                mChannelState = PENDING_CLOSE;
        }
        else
            mChannelState = PENDING_CLOSE;
        return ret;
    }

    mOrientation = orientation;
    mdp_overlay ovInfo;
    msm_rotator_img_info rotInfo;
    setupOvRotInfo(info.width, info.height, format, orientation, ovInfo, rotInfo);

    int flags = 0;
    if (ignoreFB)
        ovInfo.is_fg = 1;
    else
        flags |= MDP_OV_PLAY_NOWAIT;

    if (turnOFFVSync())
        flags |= MDP_OV_PLAY_NOWAIT;

    if (useVGPipe ||
          (fbnum == FB0 && getRGBBpp(format) != mobjOVHelper.getFBBpp()))
        flags |= MDP_OV_PIPE_SHARE;

    ovInfo.flags = flags;
    if (zorder != NO_INIT)
        ovInfo.z_order = zorder;

    ret = startChannel(fbnum, ovInfo, rotInfo, info.size);
    return ret;
}
void OverlayUI::setSource(const overlay_buffer_info& info, int orientation) {
    status_t ret = NO_INIT;
    int format3D = FORMAT_3D(info.format);
    int colorFormat = COLOR_FORMAT(info.format);
    int format = get_mdp_format(colorFormat);

    if (format3D || !isRGBType(format)) {
        LOGE("%s: Unsupported format", __func__);
        return;
    }
    mSource.width = info.width;
    mSource.height = info.height;
    mSource.format = format;
    mSource.size = info.size;
    mOrientation = orientation;
    setupOvRotInfo();
}