Beispiel #1
0
static CSC_ERRORCODE csc_set_format(
    void *handle)
{
    CSC_HANDLE *csc_handle;
    CSC_ERRORCODE ret = CSC_ErrorNone;

    if (handle == NULL)
        return CSC_ErrorNotInit;

    csc_handle = (CSC_HANDLE *)handle;
    if (csc_handle->csc_method == CSC_METHOD_HW) {
        switch (csc_handle->csc_hw_type) {
        case CSC_HW_TYPE_FIMC:
            break;
#ifdef ENABLE_GSCALER
        case CSC_HW_TYPE_GSCALER:
            exynos_gsc_set_src_format(
                csc_handle->csc_hw_handle,
                ALIGN(csc_handle->src_format.width, GSCALER_IMG_ALIGN),
                ALIGN(csc_handle->src_format.height, GSCALER_IMG_ALIGN),
                csc_handle->src_format.crop_left,
                csc_handle->src_format.crop_top,
                csc_handle->src_format.crop_width,
                csc_handle->src_format.crop_height,
                HAL_PIXEL_FORMAT_2_V4L2_PIX(csc_handle->src_format.color_format),
                csc_handle->src_format.cacheable,
                csc_handle->hw_property.mode_drm);

            exynos_gsc_set_dst_format(
                csc_handle->csc_hw_handle,
                ALIGN(csc_handle->dst_format.width, GSCALER_IMG_ALIGN),
                ALIGN(csc_handle->dst_format.height, GSCALER_IMG_ALIGN),
                csc_handle->dst_format.crop_left,
                csc_handle->dst_format.crop_top,
                csc_handle->dst_format.crop_width,
                csc_handle->dst_format.crop_height,
                HAL_PIXEL_FORMAT_2_V4L2_PIX(csc_handle->dst_format.color_format),
                csc_handle->dst_format.cacheable,
                csc_handle->hw_property.mode_drm,
                0);
            break;
#endif
        default:
            ALOGE("%s:: unsupported csc_hw_type", __func__);
            break;
        }
    }

    return ret;
}
static CSC_ERRORCODE csc_set_format(
    void *handle)
{
    CSC_HANDLE *csc_handle;
    CSC_ERRORCODE ret = CSC_ErrorNone;

    if (handle == NULL)
        return CSC_ErrorNotInit;

    csc_handle = (CSC_HANDLE *)handle;
    if (csc_handle->csc_method == CSC_METHOD_HW) {
        switch (csc_handle->csc_hw_type) {
        case CSC_HW_TYPE_FIMC:
            break;
#ifdef ENABLE_GSCALER
        case CSC_HW_TYPE_GSCALER:
            exynos_gsc_set_src_format(
                csc_handle->csc_hw_handle,
                ALIGN(csc_handle->src_format.width, GSCALER_IMG_ALIGN),
                ALIGN(csc_handle->src_format.height, GSCALER_IMG_ALIGN),
                csc_handle->src_format.crop_left,
                csc_handle->src_format.crop_top,
                csc_handle->src_format.crop_width,
                csc_handle->src_format.crop_height,
                HAL_PIXEL_FORMAT_2_V4L2_PIX(csc_handle->src_format.color_format),
                csc_handle->src_format.cacheable,
                csc_handle->hw_property.mode_drm);

            exynos_gsc_set_dst_format(
                csc_handle->csc_hw_handle,
                ALIGN(csc_handle->dst_format.width, GSCALER_IMG_ALIGN),
                ALIGN(csc_handle->dst_format.height, GSCALER_IMG_ALIGN),
                csc_handle->dst_format.crop_left,
                csc_handle->dst_format.crop_top,
                csc_handle->dst_format.crop_width,
                csc_handle->dst_format.crop_height,
                HAL_PIXEL_FORMAT_2_V4L2_PIX(csc_handle->dst_format.color_format),
                csc_handle->dst_format.cacheable,
                csc_handle->hw_property.mode_drm,
                0);
            break;
#endif
#ifdef ENABLE_G2D
        case CSC_HW_TYPE_G2D:
        {
            g2d_data *g2d = (g2d_data *)csc_handle->csc_hw_handle;

            g2d->src.width = ALIGN(csc_handle->src_format.width,
                    GSCALER_IMG_ALIGN);
            g2d->src.height = csc_handle->src_format.height;
            g2d->src.stride = g2d->src.width *
                    hal_2_g2d_bpp(csc_handle->src_format.color_format) >> 3;
            g2d->src.order = hal_2_g2d_pixel_order(csc_handle->src_format.color_format);
            g2d->src.fmt = hal_2_g2d_color_format(csc_handle->src_format.color_format);
            g2d->src.rect.x1 = csc_handle->src_format.crop_left;
            g2d->src.rect.y1 = csc_handle->src_format.crop_top;
            g2d->src.rect.x2 = csc_handle->src_format.crop_left +
                    csc_handle->src_format.crop_width;
            g2d->src.rect.y2 = csc_handle->src_format.crop_top +
                    csc_handle->src_format.crop_height;

            g2d->dst.width = ALIGN(csc_handle->dst_format.width,
                    GSCALER_IMG_ALIGN);
            g2d->dst.height = csc_handle->dst_format.height;
            g2d->dst.stride = g2d->dst.width *
                    hal_2_g2d_bpp(csc_handle->dst_format.color_format) >> 3;
            g2d->dst.order = hal_2_g2d_pixel_order(csc_handle->dst_format.color_format);
            g2d->dst.fmt = hal_2_g2d_color_format(csc_handle->dst_format.color_format);
            g2d->dst.rect.x1 = csc_handle->dst_format.crop_left;
            g2d->dst.rect.y1 = csc_handle->dst_format.crop_top;
            g2d->dst.rect.x2 = csc_handle->dst_format.crop_left +
                    csc_handle->dst_format.crop_width;
            g2d->dst.rect.y2 = csc_handle->dst_format.crop_top +
                    csc_handle->dst_format.crop_height;

            break;
        }
#endif
        default:
            ALOGE("%s:: unsupported csc_hw_type", __func__);
            break;
        }
    }

    return ret;
}