Ejemplo n.º 1
0
static int mipi_vdin_canvas_init(vdin_ops_privdata_t* data,unsigned int mem_start, unsigned int mem_size)
{
    int i, canvas_start_index ;
    unsigned int canvas_width  = (data->input.active_pixel*data->input.depth)>>3;
    unsigned int canvas_height = data->input.active_line;
    unsigned decbuf_start = mem_start;
    unsigned decbuf_size   = canvas_width*canvas_height + 0x1000;

#if 0
    if( mem_size >= CANVAS_SIZE_6_500M){
	canvas_width  = 2592 << 1;
	canvas_height = 1952;
	decbuf_size   = canvas_width*canvas_height + 0x1000;
	mipi_dbg("mipi_vdin_canvas_init--5M canvas config\n");
    }else if( mem_size >= CANVAS_SIZE_6_300M ){
	canvas_width  = 2048 << 1;
	canvas_height = 1536;
	decbuf_size  = canvas_width*canvas_height + 0x1000;
	mipi_dbg("mipi_vdin_canvas_init--3M canvas config\n");
    }
#endif

    i = (unsigned)(mem_size  / decbuf_size);

    data->canvas_total_count = (VDIN_VF_POOL_MAX_SIZE > i)? i : VDIN_VF_POOL_MAX_SIZE;
    data->decbuf_size = decbuf_size;

    if((data->param.port == TVIN_PORT_MIPI_NV12)||(data->param.port == TVIN_PORT_MIPI_NV21)){
        if(data->vdin_num)
            canvas_start_index = tvin_canvas_tab[1][0];
        else
            canvas_start_index = tvin_canvas_tab[0][0];

        for ( i = 0; i < data->canvas_total_count; i++){
            canvas_config(canvas_start_index + i, decbuf_start + i * data->decbuf_size,
                data->input.active_pixel, canvas_height, CANVAS_ADDR_NOWRAP, CANVAS_BLKMODE_LINEAR);
        }
        for ( i = 0; i < data->canvas_total_count; i++){
            canvas_config(VDIN_START_CANVAS_CHROMA_OFFSET+canvas_start_index + i, decbuf_start + (i * data->decbuf_size)+(data->input.active_line*data->input.active_pixel),
                data->input.active_pixel, canvas_height/2, CANVAS_ADDR_NOWRAP, CANVAS_BLKMODE_LINEAR);
        }
    }else{
        if(data->vdin_num)
            canvas_start_index = tvin_canvas_tab[1][0];
        else
            canvas_start_index = tvin_canvas_tab[0][0];

        for ( i = 0; i < data->canvas_total_count; i++){
            canvas_config(canvas_start_index + i, decbuf_start + i * data->decbuf_size,
                canvas_width, canvas_height, CANVAS_ADDR_NOWRAP, CANVAS_BLKMODE_LINEAR);
        }
    }

    set_tvin_canvas_info(canvas_start_index ,data->canvas_total_count);
    return 0;
}
Ejemplo n.º 2
0
inline void d2d3_canvas_init(struct d2d3_dev_s *devp)
{
        unsigned int canvas_max_w = D2D3_CANVAS_MAX_WIDTH;
        unsigned int canvas_max_h = D2D3_CANVAS_MAX_HEIGH;
        devp->dpg_canvas_idx = D2D3_CANV_DPG;
        devp->dbr_canvas_idx = D2D3_CANV_DBR;
        canvas_config(devp->dpg_canvas_idx,devp->mem_start,canvas_max_w,canvas_max_h,CANVAS_ADDR_NOWRAP, CANVAS_BLKMODE_LINEAR);
        canvas_config(devp->dbr_canvas_idx,devp->mem_start+0x100000,canvas_max_w,canvas_max_h,CANVAS_ADDR_NOWRAP, CANVAS_BLKMODE_LINEAR);

        Wr_reg_bits(D2D3_DWMIF_CTRL,devp->dpg_canvas_idx,0,8);
        Wr_reg_bits(D2D3_DRMIF_CTRL,devp->dbr_canvas_idx,0,8);
}
inline int d2d3_canvas_init(struct d2d3_dev_s *devp)
{
        unsigned int i,canvas_id,canvas_addr;
        devp->canvas_w = D2D3_HORIZONTAL_PIXLE_MAX;
        devp->canvas_h = devp->param.height>>1;//1/2        
        devp->canvas_max_size = PAGE_ALIGN(devp->canvas_w*devp->canvas_h);
        printk("[d2d3..]%s canvas max size 0x%x.\n",__func__);
        devp->canvas_max_num = devp->mem_size/devp->canvas_max_size;
        if(devp->canvas_max_num > D2D3_CANVAS_MAX_CNT){                
                devp->canvas_max_num = D2D3_CANVAS_MAX_CNT;
                printk("[d2d3..]%s d2d3 get %u over %u buffer.\n",__func__,devp->canvas_max_num, D2D3_CANVAS_MAX_CNT);
        } 
        else if(devp->canvas_max_num < D2D3_CANVAS_MAX_CNT){
                printk("[d2d3..]%s d2d3 get %u small than %u buffer.\n",__func__,devp->canvas_max_num, D2D3_CANVAS_MAX_CNT);
                return -1;
        }
                
        printk("[d2d3..]: canvas initial table:\n");
        for(i=0; i<devp->canvas_max_num;i++){
                canvas_id = d2d3_canvas_ids[i];
                canvas_addr = devp->mem_start + devp->canvas_max_size*i;
                if(i == D2D3_DPG_CANVAS_INDEX)
                        devp->dpg_addr= canvas_addr;
                if(i == D2D3_DPR_CANVAS_INDEX)
                        devp->dpr_addr = canvas_addr;
                canvas_config(canvas_id, canvas_addr, devp->canvas_w, devp->canvas_h,
                                           CANVAS_ADDR_NOWRAP, CANVAS_BLKMODE_LINEAR);
                printk("   %d: 0x%x-0x%x  %dx%d (%d KB)\n",
                canvas_id, canvas_addr, (canvas_addr + devp->canvas_max_size),
                devp->canvas_w, devp->canvas_h, (devp->canvas_max_size >> 10));
        }
        return 0;
        
}
Ejemplo n.º 4
0
static int it660x_in_canvas_init(unsigned int mem_start, unsigned int mem_size)
{
    int i, canvas_start_index ;
    unsigned int canvas_width  = 1920 << 1;
    unsigned int canvas_height = 1080;
    unsigned decbuf_start = mem_start + IT660XIN_ANCI_DATA_SIZE;
    amit660xin_dec_info.decbuf_size   = 0x400000;

    i = (unsigned)((mem_size - IT660XIN_ANCI_DATA_SIZE) / amit660xin_dec_info.decbuf_size);

    amit660xin_dec_info.canvas_total_count = (IT660XIN_VF_POOL_SIZE > i)? i : IT660XIN_VF_POOL_SIZE;

    amit660xin_dec_info.pbufAddr  = mem_start;

    if(vdin_devp_it660x->index )
        canvas_start_index = tvin_canvas_tab[1][0];
    else
        canvas_start_index = tvin_canvas_tab[0][0];

    for ( i = 0; i < amit660xin_dec_info.canvas_total_count; i++)
    {
        canvas_config(canvas_start_index + i, decbuf_start + i * amit660xin_dec_info.decbuf_size,
            canvas_width, canvas_height, CANVAS_ADDR_NOWRAP, CANVAS_BLKMODE_LINEAR);
    }
    set_tvin_canvas_info(canvas_start_index ,amit660xin_dec_info.canvas_total_count );
    return 0;
}
Ejemplo n.º 5
0
static int config_canvas_index(unsigned address,int v4l2_format,unsigned w,unsigned h,int id)
{
    int canvas = -1;
    unsigned char canvas_y = 0;
    switch(v4l2_format){
        case V4L2_PIX_FMT_RGB565:
        case V4L2_PIX_FMT_UYVY:
            canvas = AML_MIPI_DST_Y_CANVAS+(id*3);
            canvas_config(AML_MIPI_DST_Y_CANVAS+(id*3),(unsigned long)address,w*2, h, CANVAS_ADDR_NOWRAP, CANVAS_BLKMODE_LINEAR);
            break; 
        case V4L2_PIX_FMT_BGR24:
        case V4L2_PIX_FMT_RGB24:
            canvas = AML_MIPI_DST_Y_CANVAS+(id*3);
            canvas_config(AML_MIPI_DST_Y_CANVAS+(id*3),(unsigned long)address,w*3, h, CANVAS_ADDR_NOWRAP, CANVAS_BLKMODE_LINEAR);
            break; 
        case V4L2_PIX_FMT_NV12:
        case V4L2_PIX_FMT_NV21: 
            canvas_y = AML_MIPI_DST_Y_CANVAS+(id*3);
            canvas = (canvas_y | ((canvas_y+1)<<8));
            canvas_config(canvas_y,(unsigned long)address,w, h, CANVAS_ADDR_NOWRAP, CANVAS_BLKMODE_LINEAR);
            canvas_config(canvas_y+1,(unsigned long)(address+w*h),w, h/2, CANVAS_ADDR_NOWRAP, CANVAS_BLKMODE_LINEAR);
            break;
        case V4L2_PIX_FMT_YUV420:
            canvas_y = AML_MIPI_DST_Y_CANVAS+(id*3);
            canvas = (canvas_y | ((canvas_y+1)<<8)|((canvas_y+2)<<16));
            canvas_config(canvas_y,(unsigned long)address,w, h, CANVAS_ADDR_NOWRAP, CANVAS_BLKMODE_LINEAR);
            canvas_config(canvas_y+1,(unsigned long)(address+w*h),w/2, h/2, CANVAS_ADDR_NOWRAP, CANVAS_BLKMODE_LINEAR);
            canvas_config(canvas_y+2,(unsigned long)(address+w*h*5/4),w/2, h/2, CANVAS_ADDR_NOWRAP, CANVAS_BLKMODE_LINEAR);
            break;
        default:
            break;
    }
    return canvas;
}
Ejemplo n.º 6
0
int vm_fill_buffer(struct videobuf_buffer* vb , int v4l2_format , int magic,void* vaddr)
{
    vm_contig_memory_t *mem = NULL;
    char *buf_start,*vbuf_start;
    int buf_size;
    int depth=0;
    int ret = -1;    
    int canvas_index = -1 ;
    struct videobuf_buffer buf={0};
    get_vm_buf_info((const char **)&buf_start,&buf_size,&vbuf_start); 
#if 0    
    if(!vb){
        goto exit;
     }
#else
    if(!vb){
        buf.width = 640;
        buf.height = 480;  
        magic = MAGIC_VMAL_MEM ;
        v4l2_format =  V4L2_PIX_FMT_YUV444 ; 
        vb = &buf;
    }    
#endif             
     switch(magic){
        case   MAGIC_DC_MEM:
            mem = vb->priv;
            canvas_config(VM_DMA_CANVAS_INDEX,
                          mem->dma_handle,
                          vb->bytesperline, vb->height,
                          CANVAS_ADDR_NOWRAP, CANVAS_BLKMODE_32X32);        
            canvas_index =  VM_DMA_CANVAS_INDEX ;
            depth =  (vb->bytesperline <<3)/vb->width;                   
            break;
        case  MAGIC_SG_MEM:           
        case  MAGIC_VMAL_MEM:
            if(buf_start&&buf_size){
                canvas_index = get_canvas_index(v4l2_format,&depth) ;
            }            
            break;
        default:
            canvas_index = VM_DEPTH_16_CANVAS ;
            break;
     }
     output_para.width = vb->width;
     output_para.height = vb->height;
     output_para.bytesperline  = (vb->width *depth)>>3;
     output_para.index = canvas_index ;
     output_para.v4l2_format  = v4l2_format ;
     output_para.v4l2_memory   = magic ;
     output_para.vaddr = (unsigned)vaddr;
     up(&vb_start_sema);
     down_interruptible(&vb_done_sema);        
     ret = 0;  
    return ret;     
}
Ejemplo n.º 7
0
static void jpeglogo_canvas_init(logo_object_t *plogo)
{
       int i;
       u32 canvas_width, canvas_height;
       u32 decbuf_size, decbuf_y_size, decbuf_uv_size;
	jpeg_private_t *priv=(jpeg_private_t *)plogo->parser->priv;
	u32 disp=plogo->platform_res[LOGO_DEV_VID].mem_start;//decode to video layer.
    
        if ((priv->vf.width< 768) && (priv->vf.height< 576)) {
            /* SD only */
            canvas_width   = 768;
            canvas_height  = 576;
            decbuf_y_size  = 0x80000;
            decbuf_uv_size = 0x20000;
            decbuf_size    = 0x100000;
        }
        else {
            /* HD & SD */
            canvas_width   = 1920;
            canvas_height  = 1088;
            decbuf_y_size  = 0x200000;
            decbuf_uv_size = 0x80000;
            decbuf_size    = 0x300000;
        }
    
        for (i = 0; i < 4; i++) {
            canvas_config(3 * i + 0,
                          disp + i * decbuf_size,
                          canvas_width, canvas_height,
                          CANVAS_ADDR_NOWRAP, CANVAS_BLKMODE_LINEAR);
            canvas_config(3 * i + 1,
                          disp + i * decbuf_size + decbuf_y_size,
                          canvas_width / 2, canvas_height / 2,
                          CANVAS_ADDR_NOWRAP, CANVAS_BLKMODE_LINEAR);
            canvas_config(3 * i + 2,
                          disp + i * decbuf_size + decbuf_y_size + decbuf_uv_size,
                          canvas_width/2, canvas_height/2,
                          CANVAS_ADDR_NOWRAP, CANVAS_BLKMODE_LINEAR);
	    		
        }
}
inline void d2d3_canvas_config(struct d2d3_dev_s *devp)
{
        int i, canvas_id;
        unsigned long canvas_addr;

        devp->canvas_w = D2D3_HORIZONTAL_PIXLE_MAX;
        devp->canvas_h = devp->param.height>>1;//1/2        
        devp->canvas_max_size = PAGE_ALIGN(devp->canvas_w * devp->canvas_h);
        printk("[d2d3..]: canvas configuration table:\n");

        for (i = 0; i < devp->canvas_max_num; i++)
        {
                canvas_id = d2d3_canvas_ids[i];
                //canvas_addr = canvas_get_addr(canvas_id);
                /*reinitlize the canvas*/
                canvas_addr = devp->mem_start + devp->canvas_max_size * i;
                canvas_config(canvas_id, canvas_addr, devp->canvas_w, devp->canvas_h,
                                CANVAS_ADDR_NOWRAP, CANVAS_BLKMODE_LINEAR);
                pr_info("   %d: 0x%lx-0x%lx %ux%u\n",
                                canvas_id, canvas_addr, canvas_addr + devp->canvas_max_size, devp->canvas_w, devp->canvas_h);
        }
}
Ejemplo n.º 9
0
inline void vdin_canvas_init(struct vdin_dev_s *devp)
{
	int i, canvas_id;
	unsigned int canvas_addr;
	int canvas_max_w = VDIN_CANVAS_MAX_WIDTH << 1;
	int canvas_max_h = VDIN_CANVAS_MAX_HEIGH;
	devp->canvas_max_size = PAGE_ALIGN(canvas_max_w*canvas_max_h);
	devp->canvas_max_num  = devp->mem_size / devp->canvas_max_size;
	if (devp->canvas_max_num > VDIN_CANVAS_MAX_CNT)
		devp->canvas_max_num = VDIN_CANVAS_MAX_CNT;

	devp->mem_start = roundup(devp->mem_start,32);
	pr_info("vdin.%d cnavas initial table:\n", devp->index);
	for ( i = 0; i < devp->canvas_max_num; i++){
		canvas_id = vdin_canvas_ids[devp->index][i];
		canvas_addr = devp->mem_start + devp->canvas_max_size * i;

		canvas_config(canvas_id, canvas_addr, canvas_max_w, canvas_max_h,
				CANVAS_ADDR_NOWRAP, CANVAS_BLKMODE_LINEAR);
		pr_info("\t%d: 0x%x-0x%x  %dx%d (%d KB)\n",
				canvas_id, canvas_addr, (canvas_addr + devp->canvas_max_size),
				canvas_max_w, canvas_max_h, (devp->canvas_max_size >> 10));
	}
}
inline void d2d3_config_dpr_canvas(struct d2d3_dev_s *devp)
{
        unsigned int canvas_id = d2d3_canvas_ids[D2D3_DPR_CANVAS_INDEX];
        canvas_config(canvas_id,devp->dpr_addr, devp->canvas_w,devp->canvas_h,
                CANVAS_ADDR_NOWRAP, CANVAS_BLKMODE_LINEAR);
}
Ejemplo n.º 11
0
inline void d2d3_config_dbr_canvas(struct d2d3_dev_s *devp)
{
        canvas_config(devp->dbr_canvas_idx,devp->dbr_addr, devp->canvas_w,devp->canvas_h,
                        CANVAS_ADDR_NOWRAP, CANVAS_BLKMODE_LINEAR);
}