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();
}
Beispiel #3
0
void gpu_context_t::getGrallocInformationFromFormat(int inputFormat, int *colorFormat, int *bufferType)
{
    *bufferType = BUFFER_TYPE_VIDEO;
    *colorFormat = inputFormat;

    if (inputFormat == HAL_PIXEL_FORMAT_YV12) {
        *bufferType = BUFFER_TYPE_VIDEO;
    } else if (inputFormat & S3D_FORMAT_MASK) {
        // S3D format
        *colorFormat = COLOR_FORMAT(inputFormat);
    } else if (inputFormat & INTERLACE_MASK) {
        // Interlaced
        *colorFormat = inputFormat ^ HAL_PIXEL_FORMAT_INTERLACE;
    } else if (inputFormat < 0x7) {
        // RGB formats
        *colorFormat = inputFormat;
        *bufferType = BUFFER_TYPE_UI;
    } else if ((inputFormat == HAL_PIXEL_FORMAT_R_8) ||
               (inputFormat == HAL_PIXEL_FORMAT_RG_88)) {
        *colorFormat = inputFormat;
        *bufferType = BUFFER_TYPE_UI;
    }
}