void LCD_vbi_event_proc(__u32 sel, __u32 tcon_index)
{    
        __u32 cur_line = 0, start_delay = 0;
        __u32 i = 0;

        //add by heyihang.Jan 28, 2013
        if(gdisp.screen[sel].vsync_event_en && gdisp.init_para.vsync_event)
        {
                gdisp.init_para.vsync_event(sel);
        }
        
	Video_Operation_In_Vblanking(sel, tcon_index);
        disp_capture_screen_proc(sel);
        cur_line = LCDC_get_cur_line(sel, tcon_index);
        start_delay = LCDC_get_start_delay(sel, tcon_index);
        if(cur_line > start_delay-3)
	{
	      //DE_INF("cur_line(%d) >= start_delay(%d)-3 in LCD_vbi_event_proc\n", cur_line, start_delay);
		return ;
	}

        if(gdisp.screen[sel].LCD_CPUIF_ISR)
        {
        	(*gdisp.screen[sel].LCD_CPUIF_ISR)();
        }

        if(gdisp.screen[sel].cache_flag == FALSE )//&& gdisp.screen[sel].cfg_cnt == 0)
        {
                for(i=0; i<2; i++)
                {
                        if((gdisp.scaler[i].status & SCALER_USED) && (gdisp.scaler[i].screen_index == sel))
                        {
                                DE_SCAL_Set_Reg_Rdy(i);
                                //DE_SCAL_Reset(i);
                                //DE_SCAL_Start(i);
                                gdisp.scaler[i].b_reg_change = FALSE;
                        }
                        if(gdisp.scaler[i].b_close == TRUE)
                        {
                                Scaler_close(i);
                                gdisp.scaler[i].b_close = FALSE;
                        }
                }
                DE_BE_Cfg_Ready(sel);
        	gdisp.screen[sel].have_cfg_reg = TRUE;
        }
#if 0
    cur_line = LCDC_get_cur_line(sel, tcon_index);
    
	if(cur_line > 5)
	{
    	DE_INF("%d\n", cur_line);
    }
#endif

    return ;
}
示例#2
0
static __inline __s32 Hal_Set_Frame(__u32 sel, __u32 tcon_index, __u32 id)
{	
    __u32 cur_line = 0, start_delay = 0;

    cur_line = LCDC_get_cur_line(sel, tcon_index);
    start_delay = LCDC_get_start_delay(sel, tcon_index);
	if(cur_line > start_delay-5)
	{
	    //DE_INF("cur_line(%d) >= start_delay(%d)-3 in Hal_Set_Frame\n", cur_line, start_delay);
		return DIS_FAIL;
	}

    if(g_video[sel][id].display_cnt == 0)
    {
	    g_video[sel][id].pre_frame_addr0 = g_video[sel][id].video_cur.addr[0];
        memcpy(&g_video[sel][id].video_cur, &g_video[sel][id].video_new, sizeof(__disp_video_fb_t));
    }

    if(gdisp.screen[sel].layer_manage[id].para.mode == DISP_LAYER_WORK_MODE_SCALER)
    {
        __u32 scaler_index;
    	__scal_buf_addr_t scal_addr;
        __scal_src_size_t in_size;
        __scal_out_size_t out_size;
        __scal_src_type_t in_type;
        __scal_out_type_t out_type;
        __scal_scan_mod_t in_scan;
        __scal_scan_mod_t out_scan;
        __disp_scaler_t * scaler;
        __u32 pre_frame_addr = 0;
        __u32 maf_flag_addr = 0;
        __u32 maf_linestride = 0;

        scaler_index = gdisp.screen[sel].layer_manage[id].scaler_index;
        
        scaler = &(gdisp.scaler[scaler_index]);

    	if(g_video[sel][id].video_cur.interlace == TRUE)
    	{
    		g_video[sel][id].dit_enable = TRUE;

            g_video[sel][id].fetch_field = FALSE;
        	if(g_video[sel][id].display_cnt == 0)
        	{
        	    g_video[sel][id].fetch_bot = (g_video[sel][id].video_cur.top_field_first)?0:1;
        	}
        	else
        	{
        		g_video[sel][id].fetch_bot = (g_video[sel][id].video_cur.top_field_first)?1:0;
        	}

    		if(g_video[sel][id].dit_enable == TRUE)
    		{
    			if(g_video[sel][id].video_cur.maf_valid == TRUE)
    			{
    				g_video[sel][id].dit_mode = DIT_MODE_MAF;
                	maf_flag_addr = (__u32)OSAL_VAtoPA((void*)g_video[sel][id].video_cur.flag_addr);
            		maf_linestride =  g_video[sel][id].video_cur.flag_stride;
    			}
    			else
    			{
    				g_video[sel][id].dit_mode = DIT_MODE_MAF_BOB;
    			}

    			if(g_video[sel][id].video_cur.pre_frame_valid == TRUE)
    			{
    				g_video[sel][id].tempdiff_en = TRUE;
    				pre_frame_addr = (__u32)OSAL_VAtoPA((void*)g_video[sel][id].pre_frame_addr0);
    			}
    			else
    			{
    				g_video[sel][id].tempdiff_en = FALSE;
    			}
    			g_video[sel][id].diagintp_en = TRUE;

                g_video[sel][id].fetch_field = FALSE;//todo
                g_video[sel][id].fetch_bot = 0;//todo
                g_video[sel][id].dit_mode = DIT_MODE_MAF_BOB;//todo
                g_video[sel][id].tempdiff_en = FALSE;//todo
                g_video[sel][id].diagintp_en = FALSE;//todo
    		}
    		else
    		{
        	    g_video[sel][id].dit_mode = DIT_MODE_WEAVE;
        	    g_video[sel][id].tempdiff_en = FALSE;
        	    g_video[sel][id].diagintp_en = FALSE;
    		}
    	}
    	else
    	{
    		g_video[sel][id].dit_enable = FALSE;
    	    g_video[sel][id].fetch_field = FALSE;
    	    g_video[sel][id].fetch_bot = FALSE;
    	    g_video[sel][id].dit_mode = DIT_MODE_WEAVE;
    	    g_video[sel][id].tempdiff_en = FALSE;
    	    g_video[sel][id].diagintp_en = FALSE;
    	}
        
    	in_type.fmt= Scaler_sw_para_to_reg(0,scaler->in_fb.format);
    	in_type.mod= Scaler_sw_para_to_reg(1,scaler->in_fb.mode);
    	in_type.ps= Scaler_sw_para_to_reg(2,scaler->in_fb.seq);
    	in_type.byte_seq = 0;
    	in_type.sample_method = 0;

    	scal_addr.ch0_addr= (__u32)OSAL_VAtoPA((void*)(g_video[sel][id].video_cur.addr[0]));
    	scal_addr.ch1_addr= (__u32)OSAL_VAtoPA((void*)(g_video[sel][id].video_cur.addr[1]));
    	scal_addr.ch2_addr= (__u32)OSAL_VAtoPA((void*)(g_video[sel][id].video_cur.addr[2]));

    	in_size.src_width = scaler->in_fb.size.width;
    	in_size.src_height = scaler->in_fb.size.height;
    	in_size.x_off =  scaler->src_win.x;
    	in_size.y_off =  scaler->src_win.y;
    	in_size.scal_height=  scaler->src_win.height;
    	in_size.scal_width=  scaler->src_win.width;

    	out_type.byte_seq =  scaler->out_fb.seq;
    	out_type.fmt =  scaler->out_fb.format;

    	out_size.width =  scaler->out_size.width;
    	out_size.height =  scaler->out_size.height;

    	in_scan.field = g_video[sel][id].fetch_field;
    	in_scan.bottom = g_video[sel][id].fetch_bot;

    	out_scan.field = (gdisp.screen[sel].de_flicker_status == DE_FLICKER_USED)?0: gdisp.screen[sel].b_out_interlace;
        
    	if(scaler->out_fb.cs_mode > DISP_VXYCC)
    	{
    		scaler->out_fb.cs_mode = DISP_BT601;
    	}	

        if(scaler->in_fb.b_trd_src)
        {
            __scal_3d_inmode_t inmode;
            __scal_3d_outmode_t outmode = 0;
            __scal_buf_addr_t scal_addr_right;

            inmode = Scaler_3d_sw_para_to_reg(0, scaler->in_fb.trd_mode, 0);
            outmode = Scaler_3d_sw_para_to_reg(1, scaler->out_trd_mode, gdisp.screen[sel].b_out_interlace);
            
            DE_SCAL_Get_3D_In_Single_Size(inmode, &in_size, &in_size);
            if(scaler->b_trd_out)
            {
                DE_SCAL_Get_3D_Out_Single_Size(outmode, &out_size, &out_size);
            }

        	scal_addr_right.ch0_addr= (__u32)OSAL_VAtoPA((void*)(g_video[sel][id].video_cur.addr_right[0]));
        	scal_addr_right.ch1_addr= (__u32)OSAL_VAtoPA((void*)(g_video[sel][id].video_cur.addr_right[1]));
        	scal_addr_right.ch2_addr= (__u32)OSAL_VAtoPA((void*)(g_video[sel][id].video_cur.addr_right[2]));

            DE_SCAL_Set_3D_Ctrl(scaler_index, scaler->b_trd_out, inmode, outmode);
            DE_SCAL_Config_3D_Src(scaler_index, &scal_addr, &in_size, &in_type, inmode, &scal_addr_right);
        }
        else
        {
    	    DE_SCAL_Config_Src(scaler_index,&scal_addr,&in_size,&in_type,FALSE,FALSE);
    	}

        if(g_video[sel][id].dit_enable == TRUE && gdisp.screen[sel].de_flicker_status == DE_FLICKER_USED)
        {   
            Disp_de_flicker_enable(sel, FALSE);
        }
    	DE_SCAL_Set_Init_Phase(scaler_index, &in_scan, &in_size, &in_type, &out_scan, &out_size, &out_type, g_video[sel][id].dit_enable);
    	DE_SCAL_Set_Scaling_Factor(scaler_index, &in_scan, &in_size, &in_type, &out_scan, &out_size, &out_type);
    	DE_SCAL_Set_Scaling_Coef(scaler_index, &in_scan, &in_size, &in_type, &out_scan, &out_size, &out_type,  scaler->smooth_mode);
    	DE_SCAL_Set_Out_Size(scaler_index, &out_scan,&out_type, &out_size);
    	DE_SCAL_Set_Di_Ctrl(scaler_index,g_video[sel][id].dit_enable,g_video[sel][id].dit_mode,g_video[sel][id].diagintp_en,g_video[sel][id].tempdiff_en);
    	DE_SCAL_Set_Di_PreFrame_Addr(scaler_index, pre_frame_addr);
    	DE_SCAL_Set_Di_MafFlag_Src(scaler_index, maf_flag_addr, maf_linestride);

        DE_SCAL_Set_Reg_Rdy(scaler_index);
    }
    else
    {
        __layer_man_t * layer_man;
        __disp_fb_t fb;
        layer_src_t layer_fb;

        layer_man = &gdisp.screen[sel].layer_manage[id];

        BSP_disp_layer_get_framebuffer(sel, id, &fb);
        fb.addr[0] = (__u32)OSAL_VAtoPA((void*)(g_video[sel][id].video_cur.addr[0]));
        fb.addr[1] = (__u32)OSAL_VAtoPA((void*)(g_video[sel][id].video_cur.addr[1]));
        fb.addr[2] = (__u32)OSAL_VAtoPA((void*)(g_video[sel][id].video_cur.addr[2]));

    	if(get_fb_type(fb.format) == DISP_FB_TYPE_YUV)
    	{
        	Yuv_Channel_adjusting(sel , fb.mode, fb.format, &layer_man->para.src_win.x, &layer_man->para.scn_win.width);
    		Yuv_Channel_Set_framebuffer(sel, &fb, layer_man->para.src_win.x, layer_man->para.src_win.y);
    	}
    	else
    	{        	    
            layer_fb.fb_addr    = (__u32)OSAL_VAtoPA((void*)fb.addr[0]);
            layer_fb.pixseq     = img_sw_para_to_reg(3,0,fb.seq);
            layer_fb.br_swap    = fb.br_swap;
            layer_fb.fb_width   = fb.size.width;
            layer_fb.offset_x   = layer_man->para.src_win.x;
            layer_fb.offset_y   = layer_man->para.src_win.y;
            layer_fb.format = fb.format;
            DE_BE_Layer_Set_Framebuffer(sel, id,&layer_fb);
        }
    }

    g_video[sel][id].display_cnt++;
    gdisp.screen[sel].layer_manage[id].para.fb.addr[0] = g_video[sel][id].video_cur.addr[0];
    gdisp.screen[sel].layer_manage[id].para.fb.addr[1] = g_video[sel][id].video_cur.addr[1];
    gdisp.screen[sel].layer_manage[id].para.fb.addr[2] = g_video[sel][id].video_cur.addr[2];
    gdisp.screen[sel].layer_manage[id].para.fb.trd_right_addr[0] = g_video[sel][id].video_cur.addr_right[0];
    gdisp.screen[sel].layer_manage[id].para.fb.trd_right_addr[1] = g_video[sel][id].video_cur.addr_right[1];
    gdisp.screen[sel].layer_manage[id].para.fb.trd_right_addr[2] = g_video[sel][id].video_cur.addr_right[2];
	return DIS_SUCCESS;
}
示例#3
0
__s32 bsp_disp_capture_screen(__u32 screen_id, __disp_capture_screen_para_t * para)
{
	__scal_buf_addr_t in_addr;
	__scal_buf_addr_t out_addr;
	__scal_src_size_t in_size;
	__scal_out_size_t out_size;
	__scal_src_type_t in_type;
	__scal_out_type_t out_type;
	__scal_scan_mod_t in_scan;
	__scal_scan_mod_t out_scan;
	__u32 size = 0;
	__s32 scaler_index = 0;
	__s32 ret = 0;

	if(para==NULL) {
		DE_WRN("input parameter can't be null!\n");
		return DIS_FAIL;
	}

	scaler_index =  Scaler_Request(0xff);
	if(scaler_index < 0) {
		DE_WRN("request scaler fail in bsp_disp_capture_screen\n");
		return DIS_FAIL;
	}

	in_type.fmt= Scaler_sw_para_to_reg(0,DISP_MOD_INTERLEAVED, DISP_FORMAT_ARGB8888, DISP_SEQ_ARGB);
	in_type.mod= Scaler_sw_para_to_reg(1,DISP_MOD_INTERLEAVED, DISP_FORMAT_ARGB8888, DISP_SEQ_ARGB);
	in_type.ps= Scaler_sw_para_to_reg(2,DISP_MOD_INTERLEAVED, DISP_FORMAT_ARGB8888, (__u8)DISP_SEQ_ARGB);
	in_type.byte_seq = 0;
	in_type.sample_method = 0;

	if(get_fb_type(para->output_fb.format) == DISP_FB_TYPE_YUV) {
		if(para->output_fb.mode == DISP_MOD_NON_MB_PLANAR) {
			out_type.fmt = Scaler_sw_para_to_reg(3, para->output_fb.mode, para->output_fb.format, para->output_fb.seq);
		} else {
			DE_WRN("output mode:%d invalid in Display_Scaler_Start\n",para->output_fb.mode);
			return DIS_FAIL;
		}
	} else {
		if(para->output_fb.mode == DISP_MOD_NON_MB_PLANAR && (para->output_fb.format == DISP_FORMAT_RGB888
		|| para->output_fb.format == DISP_FORMAT_ARGB8888)) {
			out_type.fmt = DE_SCAL_OUTPRGB888;
		} else if(para->output_fb.mode == DISP_MOD_INTERLEAVED && para->output_fb.format == DISP_FORMAT_ARGB8888) {
			out_type.fmt = DE_SCAL_OUTI0RGB888;
		} else {
			DE_WRN("output para invalid in Display_Scaler_Start,mode:%d,format:%d\n",para->output_fb.mode, para->output_fb.format);
			return DIS_FAIL;
		}
		para->output_fb.br_swap= FALSE;
	}
	out_type.byte_seq = Scaler_sw_para_to_reg(2,para->output_fb.mode, para->output_fb.format, para->output_fb.seq);
	out_type.alpha_en = 1;
	out_type.alpha_coef_type = 0;

	out_size.width     = para->output_fb.size.width;
	out_size.height = para->output_fb.size.height;

	if(bsp_disp_get_output_type(screen_id) != DISP_OUTPUT_TYPE_NONE) {
		in_size.src_width = bsp_disp_get_screen_width(screen_id);
		in_size.src_height = bsp_disp_get_screen_height(screen_id);
		in_size.x_off = 0;
		in_size.y_off = 0;
		in_size.scal_width= bsp_disp_get_screen_width(screen_id);
		in_size.scal_height= bsp_disp_get_screen_height(screen_id);
	} else {
		in_size.src_width = para->screen_size.width;
		in_size.src_height= para->screen_size.height;
		in_size.x_off = 0;
		in_size.y_off = 0;
		in_size.scal_width= para->screen_size.width;
		in_size.scal_height= para->screen_size.height;
	}

	in_scan.field = FALSE;
	in_scan.bottom = FALSE;

	out_scan.field = FALSE; //when use scaler as writeback, won't be outinterlaced for any display device
	out_scan.bottom = FALSE;

	in_addr.ch0_addr = 0;
	in_addr.ch1_addr = 0;
	in_addr.ch2_addr = 0;

	out_addr.ch0_addr = (__u32)OSAL_VAtoPA((void*)(para->output_fb.addr[0]));
	out_addr.ch1_addr = (__u32)OSAL_VAtoPA((void*)(para->output_fb.addr[1]));
	out_addr.ch2_addr = (__u32)OSAL_VAtoPA((void*)(para->output_fb.addr[2]));

	size = (para->output_fb.size.width * para->output_fb.size.height * de_format_to_bpp(para->output_fb.format) + 7)/8;
	OSAL_CacheRangeFlush((void *)para->output_fb.addr[0],size ,CACHE_FLUSH_D_CACHE_REGION);

	if(bsp_disp_get_output_type(screen_id) == DISP_OUTPUT_TYPE_NONE) {
		DE_SCAL_Input_Select(scaler_index, 6 + screen_id);
		DE_BE_set_display_size(screen_id, para->screen_size.width, para->screen_size.height);
		DE_BE_Output_Select(screen_id, 6 + scaler_index);
		image_clk_on(screen_id, 1);
		Image_open(screen_id);
		DE_BE_Cfg_Ready(screen_id);
	} else {
		DE_SCAL_Input_Select(scaler_index, 4 + screen_id);
		DE_BE_Output_Select(screen_id, 2 + (scaler_index * 2) + screen_id);
	}
	DE_SCAL_Config_Src(scaler_index,&in_addr,&in_size,&in_type,FALSE,FALSE);
	DE_SCAL_Set_Scaling_Factor(scaler_index, &in_scan, &in_size, &in_type, &out_scan, &out_size, &out_type);
	DE_SCAL_Set_Init_Phase(scaler_index, &in_scan, &in_size, &in_type, &out_scan, &out_size, &out_type, FALSE);
	DE_SCAL_Set_CSC_Coef(scaler_index, DISP_BT601, para->output_fb.cs_mode, DISP_FB_TYPE_RGB, get_fb_type(para->output_fb.format), 0, 0);
	DE_SCAL_Set_Scaling_Coef(scaler_index, &in_scan, &in_size, &in_type, &out_scan, &out_size, &out_type, DISP_VIDEO_NATUAL);
	DE_SCAL_Set_Out_Format(scaler_index, &out_type);
	DE_SCAL_Set_Out_Size(scaler_index, &out_scan,&out_type, &out_size);
	DE_SCAL_Set_Writeback_Addr(scaler_index,&out_addr);
	DE_SCAL_Output_Select(scaler_index, 3);
	DE_SCAL_ClearINT(scaler_index,DE_WB_END_IE);
	DE_SCAL_EnableINT(scaler_index,DE_WB_END_IE);
	DE_SCAL_Set_Reg_Rdy(scaler_index);
	DE_SCAL_Writeback_Enable(scaler_index);
	DE_SCAL_Start(scaler_index);

	DE_INF("capture begin\n");
	#ifndef __LINUX_OSAL__
	while(!(DE_SCAL_QueryINT(scaler_index) & DE_WB_END_IE)) {

	}
	#else
	{
		long timeout = (100 * HZ)/1000;//100ms

		init_waitqueue_head(&(gdisp.scaler[scaler_index].scaler_queue));
		gdisp.scaler[scaler_index].b_scaler_finished = 1;
		DE_SCAL_Writeback_Enable(scaler_index);

		timeout = wait_event_interruptible_timeout(gdisp.scaler[scaler_index].scaler_queue, gdisp.scaler[scaler_index].b_scaler_finished == 2, timeout);
		gdisp.scaler[scaler_index].b_scaler_finished = 0;
		if(timeout == 0) {
			__wrn("wait scaler %d finished timeout\n", scaler_index);
			return -1;
		}
	}
	#endif
	DE_SCAL_Reset(scaler_index);
	Scaler_Release(scaler_index, FALSE);
	if(bsp_disp_get_output_type(screen_id) == DISP_OUTPUT_TYPE_NONE) {
		Image_close(screen_id);
		image_clk_off(screen_id, 1);
	}
	DE_BE_Output_Select(screen_id, screen_id);
	DE_SCAL_ClearINT(scaler_index,DE_WB_END_IE);
	DE_SCAL_DisableINT(scaler_index,DE_WB_END_IE);

	return ret;
}
示例#4
0
void LCD_vbi_event_proc(__u32 sel, __u32 tcon_index)
{    
    __u32 cur_line = 0, start_delay = 0;
    __u32 i = 0;

//	if(BSP_disp_get_output_type(sel) == DISP_OUTPUT_TYPE_NONE)
//		return;
    if(gdisp.screen[sel].vsync_event_en && gdisp.init_para.vsync_event)
    {
        gdisp.init_para.vsync_event(sel);
    }
	
	Video_Operation_In_Vblanking(sel, tcon_index);


    cur_line = LCDC_get_cur_line(sel, tcon_index);
    start_delay = LCDC_get_start_delay(sel, tcon_index);
    if(cur_line > start_delay-3)
	{
	      //DE_INF("cur_line(%d) >= start_delay(%d)-3 in LCD_vbi_event_proc\n", cur_line, start_delay);
		return ;
	}

	IEP_Operation_In_Vblanking(sel, tcon_index);
		
    if(gdisp.screen[sel].LCD_CPUIF_ISR)
    {
    	(*gdisp.screen[sel].LCD_CPUIF_ISR)();
    }

    if(gdisp.screen[sel].cache_flag == FALSE && gdisp.screen[sel].cfg_cnt == 0)
    {
        for(i=0; i<2; i++)
        {
            if((gdisp.scaler[i].status & SCALER_USED) && (gdisp.scaler[i].screen_index == sel))
            {
                DE_SCAL_Set_Reg_Rdy(i);
                //DE_SCAL_Reset(i);
                //DE_SCAL_Start(i);
                gdisp.scaler[i].b_reg_change = FALSE;
            }
            if(gdisp.scaler[i].b_close == TRUE)
            {
                Scaler_close(i);
                gdisp.scaler[i].b_close = FALSE;
            }
            if((gdisp.scaler[i].status & SCALER_USED) && (gdisp.scaler[i].screen_index == sel) && (gdisp.scaler[i].coef_change == TRUE))
            {
            	__scal_src_size_t in_size;
            	__scal_out_size_t out_size;
            	__scal_src_type_t in_type;
            	__scal_out_type_t out_type;
            	__scal_scan_mod_t in_scan;
            	__scal_scan_mod_t out_scan;
                __disp_scaler_t * scaler;

                scaler = &(gdisp.scaler[i]);

            	in_scan.field = FALSE;
            	in_scan.bottom = FALSE;

            	in_type.fmt= Scaler_sw_para_to_reg(0,scaler->in_fb.format);
            	in_type.mod= Scaler_sw_para_to_reg(1,scaler->in_fb.mode);
            	in_type.ps= Scaler_sw_para_to_reg(2,(__u8)scaler->in_fb.seq);
            	in_type.byte_seq = 0;
            	in_type.sample_method = 0;

            	in_size.src_width = scaler->in_fb.size.width;
            	in_size.src_height = scaler->in_fb.size.height;
            	in_size.x_off = scaler->src_win.x;
            	in_size.y_off = scaler->src_win.y;
            	in_size.scal_width = scaler->src_win.width;
            	in_size.scal_height = scaler->src_win.height;

            	out_scan.field = (gdisp.screen[sel].iep_status & DE_FLICKER_USED)?FALSE: gdisp.screen[sel].b_out_interlace;

            	out_type.byte_seq = scaler->out_fb.seq;
            	out_type.fmt = scaler->out_fb.format;

            	out_size.width = scaler->out_size.width;
            	out_size.height = scaler->out_size.height;
                //__inf("vint\n");
                DE_SCAL_Set_Scaling_Coef(i, &in_scan, &in_size, &in_type, &out_scan, &out_size, &out_type, scaler->smooth_mode);

                gdisp.scaler[i].coef_change = FALSE;
            }
        }
        DE_BE_Cfg_Ready(sel);
		gdisp.screen[sel].have_cfg_reg = TRUE;
    }

#if 0
    cur_line = LCDC_get_cur_line(sel, tcon_index);
    
	if(cur_line > 5)
	{
    	DE_INF("%d\n", cur_line);
    }
#endif

    return ;
}
示例#5
0
void LCD_vbi_event_proc(__u32 screen_id, __u32 tcon_index)
{
	__u32 cur_line = 0, start_delay = 0;
	__u32 i = 0;
	__u32 num_scalers;
#ifdef __LINUX_OSAL__
	unsigned long flags;
#endif
	num_scalers = bsp_disp_feat_get_num_scalers();

	disp_vint_checkin(screen_id);
	disp_lcd_set_fps(screen_id);

	Video_Operation_In_Vblanking(screen_id, tcon_index);
	disp_capture_screen_proc(screen_id);

	cur_line = TCON_get_cur_line(screen_id, tcon_index);
	start_delay = TCON_get_start_delay(screen_id, tcon_index);
	if(cur_line > start_delay-4) {
		//DE_INF("int:%d,%d\n", cur_line,start_delay);
		/* return while not  trigger mode  */
		if(gpanel_info[screen_id].lcd_fresh_mode == 0) {
			return ;
		}
	}

#ifdef __LINUX_OSAL__
	spin_lock_irqsave(&gdisp.screen[screen_id].flag_lock, flags);
#endif
	if(gdisp.screen[screen_id].cache_flag == FALSE && gdisp.screen[screen_id].cfg_cnt == 0) {
		gdisp.screen[screen_id].have_cfg_reg = TRUE;
#ifdef __LINUX_OSAL__
	spin_unlock_irqrestore(&gdisp.screen[screen_id].flag_lock, flags);
#endif
		DE_BE_Cfg_Ready(screen_id);
		IEP_CMU_Operation_In_Vblanking(screen_id);
		for(i=0; i<num_scalers; i++) {
			if((gdisp.scaler[i].status & SCALER_USED) && (gdisp.scaler[i].screen_index == screen_id))	{
				__u32 hid;

				if(gdisp.scaler[i].b_close == TRUE) {
					Scaler_close(i);
					gdisp.scaler[i].b_close = FALSE;
				}	else {
					hid = gdisp.scaler[i].layer_id;
					DE_SCAL_Set_Reg_Rdy(i);
					//DE_SCAL_Reset(i);
					//DE_SCAL_Start(i);
					disp_deu_set_frame_info(screen_id, IDTOHAND(hid));
					disp_deu_output_select(screen_id, IDTOHAND(hid), screen_id);
					IEP_Deu_Operation_In_Vblanking(i);
				}
				gdisp.scaler[i].b_reg_change = FALSE;
			}
		}

		if(DISP_OUTPUT_TYPE_LCD == bsp_disp_get_output_type(screen_id)) {
			IEP_Drc_Operation_In_Vblanking(screen_id);
		}

		if(gdisp.init_para.take_effect) {
			gdisp.init_para.take_effect(screen_id);
		}
	} else {
#ifdef __LINUX_OSAL__
	spin_unlock_irqrestore(&gdisp.screen[screen_id].flag_lock, flags);
#endif
	}

#if 0
	cur_line = LCDC_get_cur_line(screen_id, tcon_index);

	if(cur_line > 5) {
		DE_INF("%d\n", cur_line);
	}
#endif

	return ;
}
示例#6
0
__s32 BSP_disp_scaler_start(__u32 handle,__disp_scaler_para_t *para)
{
	__scal_buf_addr_t in_addr;
	__scal_buf_addr_t out_addr;
	__scal_src_size_t in_size;
	__scal_out_size_t out_size;
	__scal_src_type_t in_type;
	__scal_out_type_t out_type;
	__scal_scan_mod_t in_scan;
	__scal_scan_mod_t out_scan;
	__u32 size = 0;
	__u32 sel = 0;
	__s32 ret = 0;
	__u32 i = 0;
	__u32 ch_num = 0;

	if(para==NULL)
	{
		DE_WRN("input parameter can't be null!\n");
		return DIS_FAIL;
	}

	sel = SCALER_HANDTOID(handle);
	
	in_type.mod= Scaler_sw_para_to_reg(1,para->input_fb.mode);
	in_type.fmt= Scaler_sw_para_to_reg(0,para->input_fb.format);
	in_type.ps= Scaler_sw_para_to_reg(2,(__u8)para->input_fb.seq);
	in_type.byte_seq = 0;
	in_type.sample_method = 0;

	if(get_fb_type(para->output_fb.format) == DISP_FB_TYPE_YUV)
	{      
		if(para->output_fb.mode == DISP_MOD_NON_MB_PLANAR)
		{
			out_type.fmt = Scaler_sw_para_to_reg(3, para->output_fb.format);
		}
		else
		{	
			DE_WRN("output mode:%d invalid in Display_Scaler_Start\n",para->output_fb.mode);
			return DIS_FAIL;
		}
	}
	else
	{
		if(para->output_fb.mode == DISP_MOD_NON_MB_PLANAR && (para->output_fb.format == DISP_FORMAT_RGB888 || para->output_fb.format == DISP_FORMAT_ARGB8888))
		{
			out_type.fmt = DE_SCAL_OUTPRGB888;
		}
		else if(para->output_fb.mode == DISP_MOD_INTERLEAVED && para->output_fb.format == DISP_FORMAT_ARGB8888)
		{
			out_type.fmt = DE_SCAL_OUTI0RGB888;
		}
		else
		{
			DE_WRN("output para invalid in Display_Scaler_Start,mode:%d,format:%d\n",para->output_fb.mode, para->output_fb.format);
			return DIS_FAIL;
		}
	}  
    out_type.byte_seq = Scaler_sw_para_to_reg(2,para->output_fb.seq);

    out_size.width     = para->output_fb.size.width;
    out_size.height = para->output_fb.size.height;

    in_addr.ch0_addr = (__u32)OSAL_VAtoPA((void*)(para->input_fb.addr[0]));
    in_addr.ch1_addr = (__u32)OSAL_VAtoPA((void*)(para->input_fb.addr[1]));
    in_addr.ch2_addr = (__u32)OSAL_VAtoPA((void*)(para->input_fb.addr[2]));

    in_size.src_width = para->input_fb.size.width;
    in_size.src_height = para->input_fb.size.height;
    in_size.x_off = para->source_regn.x;
    in_size.y_off = para->source_regn.y;
    in_size.scal_width= para->source_regn.width;
    in_size.scal_height= para->source_regn.height;

    in_scan.field = FALSE;
    in_scan.bottom = FALSE;

    out_scan.field = FALSE;	//when use scaler as writeback, won't be outinterlaced for any display device
    out_scan.bottom = FALSE;

    out_addr.ch0_addr = (__u32)OSAL_VAtoPA((void*)(para->output_fb.addr[0]));
    out_addr.ch1_addr = (__u32)OSAL_VAtoPA((void*)(para->output_fb.addr[1]));
    out_addr.ch2_addr = (__u32)OSAL_VAtoPA((void*)(para->output_fb.addr[2]));

    size = (para->input_fb.size.width * para->input_fb.size.height * de_format_to_bpp(para->input_fb.format) + 7)/8;
    OSAL_CacheRangeFlush((void *)para->input_fb.addr[0],size ,CACHE_CLEAN_FLUSH_D_CACHE_REGION);

    size = (para->output_fb.size.width * para->output_fb.size.height * de_format_to_bpp(para->output_fb.format) + 7)/8;
    OSAL_CacheRangeFlush((void *)para->output_fb.addr[0],size ,CACHE_FLUSH_D_CACHE_REGION);
    if(para->input_fb.b_trd_src)
    {
        __scal_3d_inmode_t inmode;
        __scal_3d_outmode_t outmode = 0;
        __scal_buf_addr_t scal_addr_right;

        inmode = Scaler_3d_sw_para_to_reg(0, para->input_fb.trd_mode, FALSE);
        outmode = Scaler_3d_sw_para_to_reg(1, para->output_fb.trd_mode, FALSE);
        
        DE_SCAL_Get_3D_In_Single_Size(inmode, &in_size, &in_size);
        if(para->output_fb.b_trd_src)
        {
            DE_SCAL_Get_3D_Out_Single_Size(outmode, &out_size, &out_size);
        }
        
    	scal_addr_right.ch0_addr= (__u32)OSAL_VAtoPA((void*)(para->input_fb.trd_right_addr[0]));
    	scal_addr_right.ch1_addr= (__u32)OSAL_VAtoPA((void*)(para->input_fb.trd_right_addr[1]));
    	scal_addr_right.ch2_addr= (__u32)OSAL_VAtoPA((void*)(para->input_fb.trd_right_addr[2]));

        DE_SCAL_Set_3D_Ctrl(sel, para->output_fb.b_trd_src, inmode, outmode);
        DE_SCAL_Config_3D_Src(sel, &in_addr, &in_size, &in_type, inmode, &scal_addr_right);
    }
    else
    {
        DE_SCAL_Config_Src(sel,&in_addr,&in_size,&in_type,FALSE,FALSE);
    }
    DE_SCAL_Set_Scaling_Factor(sel, &in_scan, &in_size, &in_type, &out_scan, &out_size, &out_type);
    DE_SCAL_Set_Init_Phase(sel, &in_scan, &in_size, &in_type, &out_scan, &out_size, &out_type, FALSE);
    DE_SCAL_Set_CSC_Coef(sel, para->input_fb.cs_mode, para->output_fb.cs_mode, get_fb_type(para->input_fb.format), get_fb_type(para->output_fb.format),  para->input_fb.br_swap, para->output_fb.br_swap);
    DE_SCAL_Set_Scaling_Coef(sel, &in_scan, &in_size, &in_type, &out_scan, &out_size, &out_type, DISP_VIDEO_NATUAL);
    DE_SCAL_Set_Out_Format(sel, &out_type);
    DE_SCAL_Set_Out_Size(sel, &out_scan,&out_type, &out_size);

    if(para->output_fb.mode == DISP_MOD_INTERLEAVED)
    {
        ch_num = 1;
    }
    else if(para->output_fb.mode == DISP_MOD_MB_UV_COMBINED || para->output_fb.mode == DISP_MOD_NON_MB_UV_COMBINED)
    {
        ch_num = 2;
    }
    else if(para->output_fb.mode == DISP_MOD_MB_PLANAR|| para->output_fb.mode == DISP_MOD_NON_MB_PLANAR)
    {
        ch_num = 3;
    }
    
	for(i=0; i<ch_num; i++)
	{
	    __scal_buf_addr_t addr;
	    ret = 0;
	    
	    addr.ch0_addr = out_addr.ch0_addr;
	    if(i == 1)
	    {
	        addr.ch0_addr = out_addr.ch1_addr;
	    }
	    else if(i == 2)
	    {
	        addr.ch0_addr = out_addr.ch2_addr;
	    }
        DE_SCAL_Enable(sel);

    	DE_SCAL_Set_Writeback_Addr(sel,&addr);
    	DE_SCAL_Set_Writeback_Chnl(sel, i);
        DE_SCAL_Output_Select(sel, 3);
    	DE_SCAL_EnableINT(sel,DE_WB_END_IE);
    	DE_SCAL_Start(sel);   
    	DE_SCAL_Set_Reg_Rdy(sel);

#ifndef __LINUX_OSAL__
        DE_SCAL_Writeback_Enable(sel);
        while(!(DE_SCAL_QueryINT(sel) & DE_WB_END_IE) )
        {
        }
#else
        {
            long timeout = (100 * HZ)/1000;//100ms

            init_waitqueue_head(&(gdisp.scaler[sel].scaler_queue));
            gdisp.scaler[sel].b_scaler_finished = 1;
            DE_SCAL_Writeback_Enable(sel);
            
            timeout = wait_event_interruptible_timeout(gdisp.scaler[sel].scaler_queue, gdisp.scaler[sel].b_scaler_finished == 2, timeout);
            gdisp.scaler[sel].b_scaler_finished = 0;
            if(timeout == 0)
            {
                __wrn("wait scaler %d finished timeout\n", sel);
                DE_SCAL_Writeback_Disable(sel);
                DE_SCAL_Reset(sel);
                DE_SCAL_Disable(sel);
                
                return -1;
            }
        }
#endif
        DE_SCAL_Writeback_Disable(sel);
        DE_SCAL_Reset(sel);
        DE_SCAL_Disable(sel);
	}

    return ret;
}
示例#7
0
static __inline __s32 Hal_Set_Frame(__u32 screen_id, __u32 tcon_index, __u32 id)
{
	__u32 cur_line = 0, start_delay = 0;
#ifdef __LINUX_OSAL__
	unsigned long flags;
#endif

	cur_line = tcon_get_cur_line(screen_id, tcon_index);
	start_delay = tcon_get_start_delay(screen_id, tcon_index);
	if(cur_line > start_delay-5) {
		//DE_INF("cur_line(%d) >= start_delay(%d)-3 in Hal_Set_Frame\n", cur_line, start_delay);
		return DIS_FAIL;
	}
#ifdef __LINUX_OSAL__
	spin_lock_irqsave(&g_video[screen_id][id].flag_lock, flags);
#endif
	if(g_video[screen_id][id].display_cnt == 0) {
		g_video[screen_id][id].pre_frame_addr_luma = g_video[screen_id][id].video_cur.addr[0];
		g_video[screen_id][id].pre_frame_addr_chroma= g_video[screen_id][id].video_cur.addr[1];
		memcpy(&g_video[screen_id][id].video_cur, &g_video[screen_id][id].video_new, sizeof(__disp_video_fb_t));
		g_video[screen_id][id].cur_maf_flag_addr ^=  g_video[screen_id][id].pre_maf_flag_addr;
		g_video[screen_id][id].pre_maf_flag_addr ^=  g_video[screen_id][id].cur_maf_flag_addr;
		g_video[screen_id][id].cur_maf_flag_addr ^=  g_video[screen_id][id].pre_maf_flag_addr;
		disp_video_checkin(screen_id, id);
	}
	g_video[screen_id][id].display_cnt++;
#ifdef __LINUX_OSAL__
	spin_unlock_irqrestore(&g_video[screen_id][id].flag_lock, flags);
#endif

	/* scaler layer */
	if(gdisp.screen[screen_id].layer_manage[id].para.mode == DISP_LAYER_WORK_MODE_SCALER) {
		__u32 scaler_index;
		__scal_buf_addr_t scal_addr;
		__scal_src_size_t in_size;
		__scal_out_size_t out_size;
		__scal_src_type_t in_type;
		__scal_out_type_t out_type;
		__scal_scan_mod_t in_scan;
		__scal_scan_mod_t out_scan;
		__disp_scaler_t * scaler;
		__u32 pre_frame_addr_luma = 0, pre_frame_addr_chroma = 0;
		__u32 maf_linestride = 0;
		__u32 size;

		scaler_index = gdisp.screen[screen_id].layer_manage[id].scaler_index;

		scaler = &(gdisp.scaler[scaler_index]);

		if(g_video[screen_id][id].video_cur.interlace == TRUE) {
			/* todo , full size of 3d mode < 1920 */
			if((!(gdisp.screen[screen_id].de_flicker_status & DE_FLICKER_USED)) &&
			    (scaler->in_fb.format == DISP_FORMAT_YUV420 && scaler->in_fb.mode == DISP_MOD_MB_UV_COMBINED)
			    && (dit_mode_default[scaler_index] != 0xff) && (scaler->in_fb.size.width < 1920)) {
				g_video[screen_id][id].dit_enable = TRUE;
				if(!(bsp_disp_feat_get_layer_feats(scaler->screen_index, DISP_LAYER_WORK_MODE_SCALER, scaler_index)
				    & DISP_LAYER_FEAT_DE_INTERLACE)) {
					g_video[screen_id][id].dit_enable = FALSE;
				}
			} else {
				g_video[screen_id][id].dit_enable = FALSE;
			}

			g_video[screen_id][id].fetch_field = FALSE;
			if(g_video[screen_id][id].display_cnt == 0) {
				g_video[screen_id][id].fetch_bot = (g_video[screen_id][id].video_cur.top_field_first)?0:1;
			}	else {
				g_video[screen_id][id].fetch_bot = (g_video[screen_id][id].video_cur.top_field_first)?1:0;
			}

			if(g_video[screen_id][id].dit_enable == TRUE) {
				g_video[screen_id][id].dit_mode = dit_mode_default[scaler_index];
				maf_linestride = (((scaler->src_win.width + 31) & 	0xffffffe0)*2/8 + 31) & 0xffffffe0;
				// //g_video[screen_id][id].video_cur.flag_stride;//todo? ( (ги720 + 31гй&0xffffffe0 ) * 2/8  + 31) & 0xffffffe0

				if(g_video[screen_id][id].video_cur.pre_frame_valid == TRUE) {
					g_video[screen_id][id].tempdiff_en = TRUE;
					pre_frame_addr_luma= (__u32)OSAL_VAtoPA((void*)g_video[screen_id][id].pre_frame_addr_luma);
					pre_frame_addr_chroma= (__u32)OSAL_VAtoPA((void*)g_video[screen_id][id].pre_frame_addr_chroma);
				}	else {
					g_video[screen_id][id].tempdiff_en = FALSE;
				}
				g_video[screen_id][id].diagintp_en = TRUE;
			}
			else
			{
				g_video[screen_id][id].dit_mode = DIT_MODE_WEAVE;
				g_video[screen_id][id].tempdiff_en = FALSE;
				g_video[screen_id][id].diagintp_en = FALSE;
			}
		}	else {
			g_video[screen_id][id].dit_enable = FALSE;
			g_video[screen_id][id].fetch_field = FALSE;
			g_video[screen_id][id].fetch_bot = FALSE;
			g_video[screen_id][id].dit_mode = DIT_MODE_WEAVE;
			g_video[screen_id][id].tempdiff_en = FALSE;
			g_video[screen_id][id].diagintp_en = FALSE;
		}

		in_type.fmt= Scaler_sw_para_to_reg(0,scaler->in_fb.mode, scaler->in_fb.format, scaler->in_fb.seq);
		in_type.mod= Scaler_sw_para_to_reg(1,scaler->in_fb.mode, scaler->in_fb.format, scaler->in_fb.seq);
		in_type.ps= Scaler_sw_para_to_reg(2,scaler->in_fb.mode, scaler->in_fb.format, (__u8)scaler->in_fb.seq);
		in_type.byte_seq = 0;
		in_type.sample_method = 0;

		scal_addr.ch0_addr= (__u32)OSAL_VAtoPA((void*)(g_video[screen_id][id].video_cur.addr[0]));
		scal_addr.ch1_addr= (__u32)OSAL_VAtoPA((void*)(g_video[screen_id][id].video_cur.addr[1]));
		scal_addr.ch2_addr= (__u32)OSAL_VAtoPA((void*)(g_video[screen_id][id].video_cur.addr[2]));

		in_size.src_width = scaler->in_fb.size.width;
		in_size.src_height = scaler->in_fb.size.height;
		in_size.x_off =  scaler->src_win.x;
		in_size.y_off =  scaler->src_win.y;
		in_size.scal_height=  scaler->src_win.height;
		in_size.scal_width=  scaler->src_win.width;

		out_type.byte_seq =  scaler->out_fb.seq;
		out_type.fmt =  scaler->out_fb.format;

		out_size.width =  scaler->out_size.width;
		out_size.height =  scaler->out_size.height;

		in_scan.field = g_video[screen_id][id].fetch_field;
		in_scan.bottom = g_video[screen_id][id].fetch_bot;

		out_scan.field = (gdisp.screen[screen_id].de_flicker_status & DE_FLICKER_USED)?0: gdisp.screen[screen_id].b_out_interlace;

		if(scaler->out_fb.cs_mode > DISP_VXYCC)	{
			scaler->out_fb.cs_mode = DISP_BT601;
		}

		/* 3d source */
		if(scaler->in_fb.b_trd_src)	{
			__scal_3d_inmode_t inmode;
			__scal_3d_outmode_t outmode = 0;
			__scal_buf_addr_t scal_addr_right;

			/* if supported 3d display */
			if(bsp_disp_feat_get_layer_feats(scaler->screen_index, DISP_LAYER_WORK_MODE_SCALER, scaler_index) & DISP_LAYER_FEAT_3D) {
				inmode = Scaler_3d_sw_para_to_reg(0, scaler->in_fb.trd_mode, 0);
				outmode = Scaler_3d_sw_para_to_reg(1, scaler->out_trd_mode, gdisp.screen[screen_id].b_out_interlace);

				DE_SCAL_Get_3D_In_Single_Size(inmode, &in_size, &in_size);
				if(scaler->b_trd_out)	{
					DE_SCAL_Get_3D_Out_Single_Size(outmode, &out_size, &out_size);
				}

				scal_addr_right.ch0_addr= (__u32)OSAL_VAtoPA((void*)(g_video[screen_id][id].video_cur.addr_right[0]));
				scal_addr_right.ch1_addr= (__u32)OSAL_VAtoPA((void*)(g_video[screen_id][id].video_cur.addr_right[1]));
				scal_addr_right.ch2_addr= (__u32)OSAL_VAtoPA((void*)(g_video[screen_id][id].video_cur.addr_right[2]));

				DE_SCAL_Set_3D_Ctrl(scaler_index, scaler->b_trd_out, inmode, outmode);
				DE_SCAL_Config_3D_Src(scaler_index, &scal_addr, &in_size, &in_type, inmode, &scal_addr_right);
				DE_SCAL_Agth_Config(scaler_index, &in_type, &in_size, &out_size, 0, scaler->b_trd_out, outmode);
			}	else {
				DE_WRN("This platform not support 3d output!\n");
				DE_SCAL_Config_Src(scaler_index,&scal_addr,&in_size,&in_type,FALSE,FALSE);
				DE_SCAL_Agth_Config(scaler_index, &in_type, &in_size, &out_size, 0, 0, 0);
			}
		}	else {
			/* 2d source */
			DE_SCAL_Config_Src(scaler_index,&scal_addr,&in_size,&in_type,FALSE,FALSE);
			DE_SCAL_Agth_Config(scaler_index, &in_type, &in_size, &out_size, 0, 0, 0);
		}

		DE_SCAL_Set_Init_Phase(scaler_index, &in_scan, &in_size, &in_type, &out_scan, &out_size, &out_type, g_video[screen_id][id].dit_enable);
		DE_SCAL_Set_Scaling_Factor(scaler_index, &in_scan, &in_size, &in_type, &out_scan, &out_size, &out_type);
		//DE_SCAL_Set_Scaling_Coef_for_video(scaler_index, &in_scan, &in_size, &in_type, &out_scan, &out_size, &out_type, 0x00000101);
		DE_SCAL_Set_Scaling_Coef(scaler_index, &in_scan, &in_size, &in_type, &out_scan, &out_size, &out_type, scaler->smooth_mode);
		DE_SCAL_Set_Out_Size(scaler_index, &out_scan,&out_type, &out_size);
		DE_SCAL_Set_Di_Ctrl(scaler_index,g_video[screen_id][id].dit_enable,g_video[screen_id][id].dit_mode,g_video[screen_id][id].diagintp_en,g_video[screen_id][id].tempdiff_en);
		DE_SCAL_Set_Di_PreFrame_Addr(scaler_index, pre_frame_addr_luma, pre_frame_addr_chroma);
		DE_SCAL_Set_Di_MafFlag_Src(scaler_index, 
		    OSAL_VAtoPA((void*)g_video[screen_id][id].cur_maf_flag_addr),
		    OSAL_VAtoPA((void*)g_video[screen_id][id].pre_maf_flag_addr), maf_linestride);

		if(g_video[screen_id][id].display_cnt == 0) {
			size = (scaler->in_fb.size.width * scaler->src_win.height * de_format_to_bpp(scaler->in_fb.format) + 7)/8;
			//OSAL_CacheRangeFlush((void *)scal_addr.ch0_addr,size ,CACHE_CLEAN_FLUSH_D_CACHE_REGION);
		}

		DE_SCAL_Set_Reg_Rdy(scaler_index);
	}
	/* normal layer */
	else {
		__layer_man_t * layer_man;
		__disp_fb_t fb;
		layer_src_t layer_fb;

		memset(&layer_fb, 0, sizeof(layer_src_t));
		layer_man = &gdisp.screen[screen_id].layer_manage[id];

		bsp_disp_layer_get_framebuffer(screen_id, id, &fb);
		fb.addr[0] = (__u32)OSAL_VAtoPA((void*)(g_video[screen_id][id].video_cur.addr[0]));
		fb.addr[1] = (__u32)OSAL_VAtoPA((void*)(g_video[screen_id][id].video_cur.addr[1]));
		fb.addr[2] = (__u32)OSAL_VAtoPA((void*)(g_video[screen_id][id].video_cur.addr[2]));

		if(get_fb_type(fb.format) == DISP_FB_TYPE_YUV) {
			Yuv_Channel_adjusting(screen_id , fb.mode, fb.format, &layer_man->para.src_win.x, &layer_man->para.scn_win.width);
			Yuv_Channel_Set_framebuffer(screen_id, &fb, layer_man->para.src_win.x, layer_man->para.src_win.y);
		}	else {
			layer_fb.fb_addr    = (__u32)OSAL_VAtoPA((void*)fb.addr[0]);
			layer_fb.pixseq     = img_sw_para_to_reg(3,0,fb.seq);
			layer_fb.br_swap    = fb.br_swap;
			layer_fb.fb_width   = fb.size.width;
			layer_fb.offset_x   = layer_man->para.src_win.x;
			layer_fb.offset_y   = layer_man->para.src_win.y;
			layer_fb.format = fb.format;
			DE_BE_Layer_Set_Framebuffer(screen_id, id,&layer_fb);
		}
	}

	gdisp.screen[screen_id].layer_manage[id].para.fb.addr[0] = g_video[screen_id][id].video_cur.addr[0];
	gdisp.screen[screen_id].layer_manage[id].para.fb.addr[1] = g_video[screen_id][id].video_cur.addr[1];
	gdisp.screen[screen_id].layer_manage[id].para.fb.addr[2] = g_video[screen_id][id].video_cur.addr[2];
	gdisp.screen[screen_id].layer_manage[id].para.fb.trd_right_addr[0] = g_video[screen_id][id].video_cur.addr_right[0];
	gdisp.screen[screen_id].layer_manage[id].para.fb.trd_right_addr[1] = g_video[screen_id][id].video_cur.addr_right[1];
	gdisp.screen[screen_id].layer_manage[id].para.fb.trd_right_addr[2] = g_video[screen_id][id].video_cur.addr_right[2];

	return DIS_SUCCESS;
}
示例#8
0
__s32 BSP_disp_scaler_start(__u32 handle,__disp_scaler_para_t *para)
{
	__scal_buf_addr_t in_addr;
	__scal_buf_addr_t out_addr;
	__scal_src_size_t in_size;
	__scal_out_size_t out_size;
	__scal_src_type_t in_type;
	__scal_out_type_t out_type;
	__scal_scan_mod_t in_scan;
	__scal_scan_mod_t out_scan;
	__u32 size = 0;
	__u32 sel = 0;
	__s32 ret = 0;

	if(para==NULL)
	{
		DE_WRN("input parameter can't be null!\n");
		return DIS_FAIL;
	}

	sel = SCALER_HANDTOID(handle);

	in_type.mod= Scaler_sw_para_to_reg(1,para->input_fb.mode);
	in_type.fmt= Scaler_sw_para_to_reg(0,para->input_fb.format);
	in_type.ps= Scaler_sw_para_to_reg(2,(__u8)para->input_fb.seq);
	in_type.byte_seq = 0;

	if(get_fb_type(para->output_fb.format) == DISP_FB_TYPE_YUV)
	{
		if(para->output_fb.mode == DISP_MOD_NON_MB_PLANAR)
		{
			out_type.fmt = Scaler_sw_para_to_reg(3, para->output_fb.format);
		}
		else
		{
			DE_WRN("output mode:%d invalid in Display_Scaler_Start\n",para->output_fb.mode);
			return DIS_FAIL;
		}
	}
	else
	{
		if(para->output_fb.mode == DISP_MOD_NON_MB_PLANAR && para->output_fb.format == DISP_FORMAT_RGB888)
		{
			out_type.fmt = DE_SCAL_OUTPRGB888;
		}
		else if(para->output_fb.mode == DISP_MOD_INTERLEAVED && para->output_fb.format == DISP_FORMAT_ARGB8888)
		{
			out_type.fmt = DE_SCAL_OUTI0RGB888;
		}
		else
		{
			DE_WRN("output para invalid in Display_Scaler_Start,mode:%d,format:%d\n",para->output_fb.mode, para->output_fb.format);
			return DIS_FAIL;
		}
		para->output_fb.br_swap= FALSE;
	}
	out_type.byte_seq = Scaler_sw_para_to_reg(2,para->output_fb.seq);

	out_size.width     = para->output_fb.size.width;
	out_size.height = para->output_fb.size.height;

	in_addr.ch0_addr = (__u32)OSAL_VAtoPA((void*)(para->input_fb.addr[0]));
	in_addr.ch1_addr = (__u32)OSAL_VAtoPA((void*)(para->input_fb.addr[1]));
	in_addr.ch2_addr = (__u32)OSAL_VAtoPA((void*)(para->input_fb.addr[2]));

	in_size.src_width = para->input_fb.size.width;
	in_size.x_off = para->source_regn.x;
	in_size.y_off = para->source_regn.y;
	in_size.scal_width= para->source_regn.width;
	in_size.scal_height= para->source_regn.height;

	in_scan.field = FALSE;
	in_scan.bottom = FALSE;

	out_scan.field = FALSE;	//when use scaler as writeback, won't be outinterlaced for any display device
	out_scan.bottom = FALSE;

	out_addr.ch0_addr = (__u32)OSAL_VAtoPA((void*)(para->output_fb.addr[0]));
	out_addr.ch1_addr = (__u32)OSAL_VAtoPA((void*)(para->output_fb.addr[1]));
	out_addr.ch2_addr = (__u32)OSAL_VAtoPA((void*)(para->output_fb.addr[2]));

	size = (para->input_fb.size.width * para->input_fb.size.height * de_format_to_bpp(para->input_fb.format) + 7)/8;
    OSAL_CacheRangeFlush((void *)para->input_fb.addr[0],size ,CACHE_CLEAN_FLUSH_D_CACHE_REGION);

	size = (para->output_fb.size.width * para->output_fb.size.height * de_format_to_bpp(para->output_fb.format) + 7)/8;
    OSAL_CacheRangeFlush((void *)para->output_fb.addr[0],size ,CACHE_FLUSH_D_CACHE_REGION);

	DE_SCAL_Config_Src(sel,&in_addr,&in_size,&in_type,FALSE,FALSE);
	DE_SCAL_Set_Scaling_Factor(sel, &in_scan, &in_size, &in_type, &out_scan, &out_size, &out_type);
	DE_SCAL_Set_Init_Phase(sel, &in_scan, &in_size, &in_type, &out_scan, &out_size, &out_type, FALSE);
	DE_SCAL_Set_CSC_Coef(sel, para->input_fb.cs_mode, para->output_fb.cs_mode, get_fb_type(para->input_fb.format), get_fb_type(para->output_fb.format));
	DE_SCAL_Set_Scaling_Coef(sel, &in_scan, &in_size, &in_type, &out_scan, &out_size, &out_type, DISP_VIDEO_NATUAL);
	DE_SCAL_Set_Out_Format(sel, &out_type);
	DE_SCAL_Set_Out_Size(sel, &out_scan,&out_type, &out_size);
	DE_SCAL_Set_Writeback_Addr(sel,&out_addr);
    DE_SCAL_Output_Select(sel, 3);
	DE_SCAL_EnableINT(sel,DE_WB_END_IE);
	DE_SCAL_Start(sel);
	DE_SCAL_Set_Reg_Rdy(sel);
	DE_SCAL_Writeback_Enable(sel);

	ret = gdisp.init_para.scaler_begin(sel);


	DE_SCAL_Reset(sel);
	DE_SCAL_Writeback_Disable(sel);

	return ret;

}