示例#1
0
void iep_set_deinterlace_mode(int mode, void *base)
{
    int cfg;

    if (mode > dein_mode_bypass) {
        IEP_ERR("invalid deinterlace mode\n");
        return;
    }

    cfg = ReadReg32(base, RAW_IEP_CONFIG0);
    cfg = (cfg & (~(7<<8))) | (mode << 8);
    WriteReg32(base, IEP_CONFIG0, cfg);

    //IEP_REGB_DIL_MODE(base, mode);
}
示例#2
0
static void iep_config_lcdc(struct iep_reg *reg)
{
    struct fb_info *fb;
    int fbi = 0;
    int fmt = 0;

    fbi = reg->layer == 0 ? 0 : 1;

    rk_fb_dpi_win_sel(fbi);

    fb = rk_get_fb(fbi);
#if 1
    switch (reg->format) {
    case IEP_FORMAT_ARGB_8888:
    case IEP_FORMAT_ABGR_8888:
        fmt = HAL_PIXEL_FORMAT_RGBA_8888;
        fb->var.bits_per_pixel = 32;

        fb->var.red.length = 8;
        fb->var.red.offset = 16;
        fb->var.red.msb_right = 0;

        fb->var.green.length = 8;
        fb->var.green.offset = 8;
        fb->var.green.msb_right = 0;

        fb->var.blue.length = 8;
        fb->var.blue.offset = 0;
        fb->var.blue.msb_right = 0;

        fb->var.transp.length = 8;
        fb->var.transp.offset = 24;
        fb->var.transp.msb_right = 0;

        break;
    case IEP_FORMAT_BGRA_8888:
        fmt = HAL_PIXEL_FORMAT_BGRA_8888;
        fb->var.bits_per_pixel = 32;
        break;
    case IEP_FORMAT_RGB_565:
        fmt = HAL_PIXEL_FORMAT_RGB_565;
        fb->var.bits_per_pixel = 16;

        fb->var.red.length = 5;
        fb->var.red.offset = 11;
        fb->var.red.msb_right = 0;

        fb->var.green.length = 6;
        fb->var.green.offset = 5;
        fb->var.green.msb_right = 0;

        fb->var.blue.length = 5;
        fb->var.blue.offset = 0;
        fb->var.blue.msb_right = 0;

        break;
    case IEP_FORMAT_YCbCr_422_SP:
        fmt = HAL_PIXEL_FORMAT_YCbCr_422_SP;
        fb->var.bits_per_pixel = 16;
        break;
    case IEP_FORMAT_YCbCr_420_SP:
        fmt = HAL_PIXEL_FORMAT_YCrCb_NV12;
        fb->var.bits_per_pixel = 16;
        break;
    case IEP_FORMAT_YCbCr_422_P:
    case IEP_FORMAT_YCrCb_422_SP:
    case IEP_FORMAT_YCrCb_422_P:
    case IEP_FORMAT_YCrCb_420_SP:
    case IEP_FORMAT_YCbCr_420_P:
    case IEP_FORMAT_YCrCb_420_P:
    case IEP_FORMAT_RGBA_8888:
    case IEP_FORMAT_BGR_565:
        // unsupported format
        IEP_ERR("unsupported format %d\n", reg->format);
        break;
    default:
        ;
    }

    fb->var.xoffset         = 0;
    fb->var.yoffset         = 0;
    fb->var.xres            = reg->act_width;
    fb->var.yres            = reg->act_height;
    fb->var.xres_virtual    = reg->act_width;
    fb->var.yres_virtual    = reg->act_height;
    fb->var.nonstd          = ((reg->off_y&0xFFF)<<20) + ((reg->off_x&0xFFF)<<8) + (fmt&0xFF);
    fb->var.grayscale       = ((reg->vir_height&0xFFF)<<20) + ((reg->vir_width&0xFFF)<<8) + 0;   //win0 xsize & ysize
#endif
    rk_direct_fb_show(fb);
}
示例#3
0
static void iep_config_vir_line(IEP_MSG *iep_msg)
{
    unsigned int src_vir_w;
    unsigned int dst_vir_w;

    switch (iep_msg->src.format) {
    case IEP_FORMAT_ARGB_8888 :
        src_vir_w = iep_msg->src.vir_w;
        break;
    case IEP_FORMAT_ABGR_8888 :
        src_vir_w = iep_msg->src.vir_w;
        break;
    case IEP_FORMAT_RGBA_8888 :
        src_vir_w = iep_msg->src.vir_w;
        break;
    case IEP_FORMAT_BGRA_8888 :
        src_vir_w = iep_msg->src.vir_w;
        break;
    case IEP_FORMAT_RGB_565 :
        if (iep_msg->src.vir_w % 2 == 1) src_vir_w = (iep_msg->src.vir_w + 1) / 2;
        else src_vir_w = iep_msg->src.vir_w / 2;
        break;
    case IEP_FORMAT_BGR_565 :
        if (iep_msg->src.vir_w % 2 == 1) src_vir_w = iep_msg->src.vir_w / 2 + 1;
        else src_vir_w = iep_msg->src.vir_w / 2;
        break;
    case IEP_FORMAT_YCbCr_422_SP :
        if (iep_msg->src.vir_w % 4 != 0) src_vir_w = iep_msg->src.vir_w / 4 + 1;
        else src_vir_w = iep_msg->src.vir_w / 4;
        break;
    case IEP_FORMAT_YCbCr_422_P :
        if (iep_msg->src.vir_w % 4 != 0) src_vir_w = iep_msg->src.vir_w / 4 + 1;
        else src_vir_w = iep_msg->src.vir_w / 4;
        break;
    case IEP_FORMAT_YCbCr_420_SP :
        if (iep_msg->src.vir_w % 4 != 0) src_vir_w = iep_msg->src.vir_w / 4 + 1;
        else src_vir_w = iep_msg->src.vir_w / 4;
        break;
    case IEP_FORMAT_YCbCr_420_P :
        if (iep_msg->src.vir_w % 4 != 0) src_vir_w = iep_msg->src.vir_w / 4 + 1;
        else src_vir_w = iep_msg->src.vir_w / 4;
        break;
    case IEP_FORMAT_YCrCb_422_SP :
        if (iep_msg->src.vir_w % 4 != 0) src_vir_w = iep_msg->src.vir_w / 4 + 1;
        else src_vir_w = iep_msg->src.vir_w / 4;
        break;
    case IEP_FORMAT_YCrCb_422_P :
        if (iep_msg->src.vir_w % 4 != 0) src_vir_w = iep_msg->src.vir_w / 4 + 1;
        else src_vir_w = iep_msg->src.vir_w / 4;
        break;
    case IEP_FORMAT_YCrCb_420_SP :
        if (iep_msg->src.vir_w % 4 != 0) src_vir_w = iep_msg->src.vir_w / 4 + 1;
        else src_vir_w = iep_msg->src.vir_w / 4;
        break;
    case IEP_FORMAT_YCrCb_420_P :
        if (iep_msg->src.vir_w % 4 != 0) src_vir_w = iep_msg->src.vir_w / 4 + 1;
        else src_vir_w = iep_msg->src.vir_w / 4;
        break;
    default:
        IEP_ERR("Unkown format, set the source image virtual width 0\n");
        src_vir_w = 0;
        break;
    }

    switch (iep_msg->dst.format) {
    case IEP_FORMAT_ARGB_8888 :
        dst_vir_w = iep_msg->dst.vir_w;
        break;
    case IEP_FORMAT_ABGR_8888 :
        dst_vir_w = iep_msg->dst.vir_w;
        break;
    case IEP_FORMAT_RGBA_8888 :
        dst_vir_w = iep_msg->dst.vir_w;
        break;
    case IEP_FORMAT_BGRA_8888 :
        dst_vir_w = iep_msg->dst.vir_w;
        break;
    case IEP_FORMAT_RGB_565 :
        if (iep_msg->dst.vir_w % 2 == 1) dst_vir_w = (iep_msg->dst.vir_w + 1) / 2;
        else dst_vir_w = iep_msg->dst.vir_w / 2;
        break;
    case IEP_FORMAT_BGR_565 :
        if (iep_msg->dst.vir_w % 2 == 1) dst_vir_w = iep_msg->dst.vir_w / 2 + 1;
        else dst_vir_w = iep_msg->dst.vir_w / 2;
        break;
    case IEP_FORMAT_YCbCr_422_SP :
        if (iep_msg->dst.vir_w % 4 != 0) dst_vir_w = iep_msg->dst.vir_w / 4 + 1;
        else dst_vir_w = iep_msg->dst.vir_w / 4;
        break;
    case IEP_FORMAT_YCbCr_422_P :
        if (iep_msg->dst.vir_w % 4 != 0) dst_vir_w = iep_msg->dst.vir_w / 4 + 1;
        else dst_vir_w = iep_msg->dst.vir_w / 4;
        break;
    case IEP_FORMAT_YCbCr_420_SP :
        if (iep_msg->dst.vir_w % 4 != 0) dst_vir_w = iep_msg->dst.vir_w / 4 + 1;
        else dst_vir_w = iep_msg->dst.vir_w / 4;
        break;
    case IEP_FORMAT_YCbCr_420_P :
        if (iep_msg->dst.vir_w % 4 != 0) dst_vir_w = iep_msg->dst.vir_w / 4 + 1;
        else dst_vir_w = iep_msg->dst.vir_w / 4;
        break;
    case IEP_FORMAT_YCrCb_422_SP :
        if (iep_msg->dst.vir_w % 4 != 0) dst_vir_w = iep_msg->dst.vir_w / 4 + 1;
        else dst_vir_w = iep_msg->dst.vir_w / 4;
        break;
    case IEP_FORMAT_YCrCb_422_P :
        if (iep_msg->dst.vir_w % 4 != 0) dst_vir_w = iep_msg->dst.vir_w / 4 + 1;
        else dst_vir_w = iep_msg->dst.vir_w / 4;
        break;
    case IEP_FORMAT_YCrCb_420_SP :
        if (iep_msg->dst.vir_w % 4 != 0) dst_vir_w = iep_msg->dst.vir_w / 4 + 1;
        else dst_vir_w = iep_msg->dst.vir_w / 4;
        break;
    case IEP_FORMAT_YCrCb_420_P :
        if (iep_msg->dst.vir_w % 4 != 0) dst_vir_w = iep_msg->dst.vir_w / 4 + 1;
        else dst_vir_w = iep_msg->dst.vir_w / 4;
        break;
    default:
        IEP_ERR("Unkown format, set the destination image virtual width 0\n");
        dst_vir_w = 0;
        break;
    }
    IEP_REGB_DST_VIR_LINE_WIDTH(iep_msg->base, dst_vir_w);
    IEP_REGB_SRC_VIR_LINE_WIDTH(iep_msg->base, src_vir_w);
#ifdef IEP_PRINT_INFO
    IEP_DBG("/==virtual line width config==================//\n\n");
    IEP_DBG("sw_dst_vir_line_width      = %d;//destination virtual line width \n", dst_vir_w);
    IEP_DBG("sw_src_vir_line_width      = %d;//source virtual line width \n\n", src_vir_w);
#endif
}
示例#4
0
static void iep_config_dil(IEP_MSG *iep_msg)
{
    //unsigned int value_tab0, value_tab1, value_tab2, value_tab3, value_tab4, value_tab5, value_tab6, value_tab7;
    int dein_mode;
    //double tab[256] =
    //{
    //	1.0,1.0,1.0,1.0,
    //  1.000000,0.996856,0.987464,0.971942,
    //  0.950484,0.923362,0.890916,0.853553,
    //  0.811745,0.766016,0.716942,0.665140,
    //  0.611260,0.555982,0.500000,0.444018,
    //  0.388740,0.334860,0.283058,0.233984,
    //  0.188255,0.146447,0.109084,0.076638,
    //  0.049516,0.028058,0.012536,0.003144
    //};
    switch (iep_msg->dein_mode) {
    case IEP_DEINTERLACE_MODE_DISABLE:
        dein_mode = dein_mode_bypass_dis;
        break;
    case IEP_DEINTERLACE_MODE_I2O1:
        dein_mode = iep_msg->field_order == FIELD_ORDER_TOP_FIRST ? dein_mode_I2O1T : dein_mode_I2O1B;
        break;
    case IEP_DEINTERLACE_MODE_I4O1:
#if 1
        dein_mode = iep_msg->field_order == FIELD_ORDER_TOP_FIRST ? dein_mode_I4O1B : dein_mode_I4O1T;
#else
        dein_mode = iep_msg->field_order == FIELD_ORDER_TOP_FIRST ? dein_mode_I4O1T : dein_mode_I4O1B;
#endif
        break;
    case IEP_DEINTERLACE_MODE_I4O2:
        dein_mode = dein_mode_I4O2;
        break;
    case IEP_DEINTERLACE_MODE_BYPASS:
        dein_mode = dein_mode_bypass;
        break;
    default:
        IEP_ERR("unknown deinterlace mode, set deinterlace mode (bypass)\n");
        dein_mode = dein_mode_bypass;
    }

    IEP_REGB_DIL_MODE(iep_msg->base, dein_mode);
    //hf
    IEP_REGB_DIL_HF_EN(iep_msg->base, iep_msg->dein_high_fre_en);
    if (iep_msg->dein_high_fre_en == 1) IEP_REGB_DIL_HF_FCT(iep_msg->base, iep_msg->dein_high_fre_fct);
    //ei
    IEP_REGB_DIL_EI_MODE(iep_msg->base, iep_msg->dein_ei_mode);
    IEP_REGB_DIL_EI_SMOOTH(iep_msg->base, iep_msg->dein_ei_smooth);
    IEP_REGB_DIL_EI_SEL(iep_msg->base, iep_msg->dein_ei_sel);
    if (iep_msg->dein_ei_sel == 0) IEP_REGB_DIL_EI_RADIUS(iep_msg->base, iep_msg->dein_ei_radius);

    /*
    value_tab0=(64<<24)+(64<<16)+(64<<8)+64;
    IEP_REGB_DIL_MTN_TAB0(value_tab0);
    
    value_tab1=(62<<24)+(63<<16)+(63<<8)+64;
    IEP_REGB_DIL_MTN_TAB1(value_tab1);
    
    value_tab2=(54<<24)+(57<<16)+(59<<8)+60;
    IEP_REGB_DIL_MTN_TAB2(value_tab2);
    
    value_tab3=(42<<24)+(45<<16)+(49<<8)+51;
    IEP_REGB_DIL_MTN_TAB3(value_tab3);
    
    value_tab4=(28<<24)+(32<<16)+(35<<8)+39;
    IEP_REGB_DIL_MTN_TAB4(value_tab4);
    
    value_tab5=(14<<24)+(18<<16)+(21<<8)+24;
    IEP_REGB_DIL_MTN_TAB5(value_tab5);
    
    value_tab6=(4<<24)+(6<<16)+(9<<8)+12;
    IEP_REGB_DIL_MTN_TAB6(value_tab6);
    
    value_tab6=(1<<8)+3;
    IEP_REGB_DIL_MTN_TAB7(value_tab6);	
    */
    IEP_REGB_DIL_MTN_TAB0(iep_msg->base, 0x40404040);
    IEP_REGB_DIL_MTN_TAB1(iep_msg->base, 0x3c3e3f3f);
    IEP_REGB_DIL_MTN_TAB2(iep_msg->base, 0x3336393b);
    IEP_REGB_DIL_MTN_TAB3(iep_msg->base, 0x272a2d31);
    IEP_REGB_DIL_MTN_TAB4(iep_msg->base, 0x181c2023);
    IEP_REGB_DIL_MTN_TAB5(iep_msg->base, 0x0c0e1215);
    IEP_REGB_DIL_MTN_TAB6(iep_msg->base, 0x03040609);
    IEP_REGB_DIL_MTN_TAB7(iep_msg->base, 0x00000001);
#ifdef IEP_PRINT_INFO
    IEP_DBG(" //==deinterlace config========================//\n\n");
    IEP_DBG("sw_dil_hf_en               = %d;//0:disable  high-frequency deinterlace; 1:enahble\n", iep_msg->dein_high_fre_en);
    IEP_DBG("sw_dil_mode                = %d;//0:deinterlace disable; 1:I4O2; 2:I4O1B; 3:I4O1T; 4:I201B; 5:I201T 6:bypass\n", iep_msg->dein_mode);
    IEP_DBG("sw_dil_ei_mode             = %d;//edge interpolation\n", iep_msg->dein_ei_mode);
    IEP_DBG("sw_dil_mtn_tab0            = 63,64,64,64;//motion table  0~ 3,7bit\n");
    IEP_DBG("sw_dil_mtn_tab1            = 52,57,60,62;//motion table  0~ 3,7bit\n");
    IEP_DBG("sw_dil_mtn_tab2            = 0,0,0,0,46;//motion table  0~ 3,7bit\n");
    IEP_DBG("sw_dil_mtn_tab3            = 0;//motion table  0~ 3,7bit\n");
    IEP_DBG("sw_dil_mtn_tab4            = 0;//motion table  0~ 3,7bit\n");
    IEP_DBG("sw_dil_mtn_tab5            = 0;//motion table  0~ 3,7bit\n");
    IEP_DBG("sw_dil_mtn_tab6            = 0;//motion table  0~ 3,7bit\n");
    IEP_DBG("sw_dil_mtn_tab7            = 0;//motion table  0~ 3,7bit\n\n");
#endif
}
示例#5
0
void iep_config(iep_session *session, IEP_MSG *iep_msg)
{
    struct iep_reg *reg = kzalloc(sizeof(struct iep_reg), GFP_KERNEL);

    reg->session = session;
    iep_msg->base = reg->reg;
    atomic_set(&reg->session->done, 0);

    INIT_LIST_HEAD(&reg->session_link);
    INIT_LIST_HEAD(&reg->status_link);
    
#if defined(CONFIG_IEP_IOMMU)
    INIT_LIST_HEAD(&reg->mem_region_list);    
#endif

    //write config
    iep_config_src_size(iep_msg);
    iep_config_dst_size(iep_msg);
    iep_config_dst_width_tile(iep_msg); //not implement
    iep_config_dst_fmt(iep_msg);
    iep_config_src_fmt(iep_msg);
    iep_config_scl(iep_msg);
    iep_config_cg_order(iep_msg);

    iep_config_cg(iep_msg);
    iep_config_dde(iep_msg);            //not implement
    iep_config_color_enh(iep_msg);      //not implement
    iep_config_yuv_dns(iep_msg);
    iep_config_dil(iep_msg);
    iep_config_yuv_enh(iep_msg);
    iep_config_rgb2yuv(iep_msg);
    iep_config_yuv2rgb(iep_msg);
    iep_config_dither_up(iep_msg);
    iep_config_dither_down(iep_msg);
    iep_config_glb_alpha(iep_msg);
    iep_config_vir_line(iep_msg);
    iep_config_src_addr(iep_msg);
    iep_config_dst_addr(iep_msg);
    iep_config_lcdc_path(iep_msg);
    iep_config_misc(iep_msg);           //not implement

    if (iep_msg->lcdc_path_en) {
        reg->dpi_en     = true;
        reg->act_width  = iep_msg->dst.act_w;
        reg->act_height = iep_msg->dst.act_h;
        reg->off_x      = iep_msg->off_x;
        reg->off_y      = iep_msg->off_y;
        reg->vir_width  = iep_msg->width;
        reg->vir_height = iep_msg->height;
        reg->layer      = iep_msg->layer;
        reg->format     = iep_msg->dst.format;
    } else {
        reg->dpi_en     = false;
    }

#if defined(CONFIG_IEP_MMU)
    if (iep_msg->vir_addr_enable) {
        iep_config_mmu_cmd(iep_msg->base, MMU_ENABLE_PAGING);
        iep_config_mmu_page_fault_int_en(iep_msg->base, 1);
    } else {
        iep_config_mmu_cmd(iep_msg->base, MMU_DISABLE_PAGING);
        iep_config_mmu_page_fault_int_en(iep_msg->base, 0);
    }
    iep_config_mmu_dte_addr(iep_msg->base, (uint32_t)virt_to_phys((uint32_t*)session->dte_table));
#endif

#if defined(CONFIG_IEP_IOMMU)
    if (iep_service.iommu_dev) {
        if (0 > iep_reg_address_translate(&iep_service, reg)) {
            IEP_ERR("error: translate reg address failed\n");
            kfree(reg);
            return;
        }
    }
#endif

    mutex_lock(&iep_service.lock);

    list_add_tail(&reg->status_link, &iep_service.waiting);
    list_add_tail(&reg->session_link, &session->waiting);
    mutex_unlock(&iep_service.lock);
}