DAL_STATUS DAL_Printf(const char *fmt, ...)
{
    va_list args;
    uint i;
    DAL_STATUS ret = DAL_STATUS_OK;
    printk("%s", __func__);
    //printk("[MTKFB_DAL] DAL_Printf mfc_handle=0x%08X, fmt=0x%08X\n", mfc_handle, fmt);
    if (NULL == mfc_handle) 
        return DAL_STATUS_NOT_READY;
    
    if (NULL == fmt)
        return DAL_STATUS_INVALID_ARGUMENT;

	
		MMProfileLogEx(ddp_mmp_get_events()->dal_printf, MMProfileFlagStart, 0, 0);
    DAL_LOCK();
     if(isAEEEnabled==0)
    {
        printk("[DDP] isAEEEnabled from 0 to 1, ASSERT_LAYER=%d, dal_fb_pa %lx\n", 
            ASSERT_LAYER, dal_fb_pa);
            
        isAEEEnabled = 1;
        DAL_Dynamic_Change_FB_Layer(isAEEEnabled); // default_ui_ layer coniig to changed_ui_layer
        
        DAL_CHECK_MFC_RET(MFC_Open(&mfc_handle, dal_fb_addr,
                                   DAL_WIDTH, DAL_HEIGHT, DAL_BPP,
                                   DAL_FG_COLOR, DAL_BG_COLOR));        
        //DAL_Clean();  
              	primary_disp_input_config input;
	memset((void*)&input, 0, sizeof(primary_disp_input_config));

	input.addr = (unsigned long)dal_fb_pa;
	input.layer = primary_display_get_option("ASSERT_LAYER");
	input.layer_en = 1;
	input.src_x = 0;
	input.src_y = 0;
	input.src_w = DAL_WIDTH;
	input.src_h = DAL_HEIGHT;
	input.dst_x = 0;
	input.dst_y = 0;
	input.dst_w = DAL_WIDTH;
	input.dst_h = DAL_HEIGHT;
        input.alpha = 0x80;
	input.aen = 1;
        input.buff_idx = -1;
        input.src_pitch = DAL_WIDTH * DAL_BPP;
	input.isDirty = 1;
	input.fmt = DAL_FORMAT;

	ret = primary_display_config_input(&input);
    }
    va_start (args, fmt);
    i = vsprintf(dal_print_buffer, fmt, args);
    BUG_ON(i>=ARRAY_SIZE(dal_print_buffer));
    va_end (args);
    DAL_CHECK_MFC_RET(MFC_Print(mfc_handle, dal_print_buffer));

    flush_cache_all();
/*
    if (LCD_STATE_POWER_OFF == LCD_GetState()) {
        ret = DAL_STATUS_LCD_IN_SUSPEND;
        dal_enable_when_resume = TRUE;
        goto End;
    }
    */

#if 0
    if(is_early_suspended){
        up(&sem_early_suspend);
        DISP_LOG_PRINT(ANDROID_LOG_INFO, "DAL", "DAL_Printf in power off\n");
        goto End;
    }
#endif

    if (!dal_shown) {
        dal_shown = TRUE;
    }
	ret = primary_display_trigger(0, NULL, 0);

End:
	
    DAL_UNLOCK();
	
	MMProfileLogEx(ddp_mmp_get_events()->dal_printf, MMProfileFlagEnd, 0, 0);

    return ret;
}
Exemplo n.º 2
0
void mt_disp_init(void *lcdbase)
{
	unsigned int lcm_fake_width = 0;
	unsigned int lcm_fake_height = 0;
	UINT32 boot_mode_addr = 0;
	/// fb base pa and va
	fb_addr_pa_k = arm_mmu_va2pa(lcdbase);

	fb_addr_pa   = fb_addr_pa_k & 0xffffffffull;
	fb_addr      = lcdbase;

	dprintf(0,"fb_va: 0x%08x, fb_pa: 0x%08x, fb_pa_k: 0x%llx\n", fb_addr, fb_addr_pa, fb_addr_pa_k);

        fb_size = ALIGN_TO(CFG_DISPLAY_WIDTH, MTK_FB_ALIGNMENT) * ALIGN_TO(CFG_DISPLAY_HEIGHT, MTK_FB_ALIGNMENT) * CFG_DISPLAY_BPP / 8;
	// pa;
	boot_mode_addr = ((UINT32)fb_addr_pa + fb_size);
        logo_db_addr_pa = (void *)((UINT32)fb_addr_pa - 4 * 1024 * 1024);

	// va;
        logo_db_addr = (void *)((UINT32)fb_addr - 4 * 1024 * 1024);

	fb_offset_logo = 0;
  
        primary_display_init(NULL);
        memset((void*)lcdbase, 0x0, DISP_GetVRamSize());
    
        disp_input_config input;
        memset(&input, 0, sizeof(disp_input_config));
	input.layer 	= BOOT_MENU_LAYER;
	input.layer_en 	= 1;
	input.fmt 		= redoffset_32bit ? eBGRA8888 : eRGBA8888;
	input.addr		= boot_mode_addr;  
	input.src_x		= 0;
	input.src_y		= 0;
	input.src_w		= CFG_DISPLAY_WIDTH;
	input.src_h		= CFG_DISPLAY_HEIGHT;
	input.src_pitch = CFG_DISPLAY_WIDTH*4;
	input.dst_x		= 0;
	input.dst_y		= 0;
	input.dst_w		= CFG_DISPLAY_WIDTH;
	input.dst_h		= CFG_DISPLAY_HEIGHT;
	input.aen		= 1;
	input.alpha		= 0xff;
	
	primary_display_config_input(&input);

	memset(&input, 0, sizeof(disp_input_config));
	input.layer 	= FB_LAYER;
	input.layer_en 	= 1;
	input.fmt 		= redoffset_32bit ? eBGRA8888 : eRGBA8888;
	input.addr		= fb_addr_pa;
	input.src_x		= 0;
	input.src_y		= 0;
	input.src_w		= CFG_DISPLAY_WIDTH;
	input.src_h		= CFG_DISPLAY_HEIGHT;
	input.src_pitch = ALIGN_TO(CFG_DISPLAY_WIDTH, MTK_FB_ALIGNMENT)*4;
	input.dst_x		= 0;
	input.dst_y		= 0;
	input.dst_w		= CFG_DISPLAY_WIDTH;
	input.dst_h		= CFG_DISPLAY_HEIGHT;
	
	input.aen		= 1;
	input.alpha		= 0xff;
    	primary_display_config_input(&input);
	
 
	//_mtkfb_internal_test(fb_addr, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT);
    
#if 0
	mt_disp_parse_dfo_setting();	

	if((0 == mt_disp_get_dfo_setting("LCM_FAKE_WIDTH", &lcm_fake_width)) && (0 == mt_disp_get_dfo_setting("LCM_FAKE_HEIGHT", &lcm_fake_height)))
	{
		if(DISP_STATUS_OK != DISP_Change_LCM_Resolution(lcm_fake_width, lcm_fake_height))
		{
			dprintf(INFO,"[DISP_DFO]WARNING!!! Change LCM Resolution FAILED!!!\n");
		}
	}
#endif
    
}
DAL_STATUS DAL_Clean(void)
{
    const UINT32 BG_COLOR = MAKE_TWO_RGB565_COLOR(DAL_BG_COLOR, DAL_BG_COLOR);
    DAL_STATUS ret = DAL_STATUS_OK;

    static int dal_clean_cnt = 0;
    MFC_CONTEXT *ctxt = (MFC_CONTEXT *)mfc_handle;
    printk("[MTKFB_DAL] DAL_Clean\n");
    if (NULL == mfc_handle) 
        return DAL_STATUS_NOT_READY;

//    if (LCD_STATE_POWER_OFF == LCD_GetState())
//        return DAL_STATUS_LCD_IN_SUSPEND;
	MMProfileLogEx(ddp_mmp_get_events()->dal_clean, MMProfileFlagStart, 0, 0);

    DAL_LOCK();

    DAL_CHECK_MFC_RET(MFC_ResetCursor(mfc_handle));

    ctxt->screen_color=0;
    DAL_SetScreenColor(DAL_COLOR_RED);
 
/*
    if (LCD_STATE_POWER_OFF == LCD_GetState()) {
	    DISP_LOG_PRINT(ANDROID_LOG_INFO, "DAL", "dal_clean in power off\n");
        dal_disable_when_resume = TRUE;
        ret = DAL_STATUS_LCD_IN_SUSPEND;
        goto End;
    }
    */
 
    //xuecheng, for debug
#if 0
    if(is_early_suspended){
        up(&sem_early_suspend);
        DISP_LOG_PRINT(ANDROID_LOG_INFO, "DAL", "dal_clean in power off\n");
        goto End;
    }
#endif

    //TODO: if dal_shown=false, and 3D enabled, mtkfb may disable UI layer, please modify 3D driver
    if(isAEEEnabled==1)
    {
				primary_disp_input_config input;
		memset((void*)&input, 0, sizeof(primary_disp_input_config));
		
		input.addr = (unsigned long)dal_fb_pa;
		input.layer = primary_display_get_option("ASSERT_LAYER");
		input.layer_en = 0;
		input.src_x = 0;
		input.src_y = 0;
		input.src_w = DAL_WIDTH;
		input.src_h = DAL_HEIGHT;
		input.dst_x = 0;
		input.dst_y = 0;
		input.dst_w = DAL_WIDTH;
		input.dst_h = DAL_HEIGHT;
			input.alpha = 0x80;
		input.aen = 1;
			input.buff_idx = -1;
			input.src_pitch = DAL_WIDTH * DAL_BPP;
		input.isDirty = 1;
		input.fmt = DAL_FORMAT;
		
		ret = primary_display_config_input(&input);

        
        // DAL disable, switch UI layer to default layer 3
        printk("[DDP]* isAEEEnabled from 1 to 0, %d \n", dal_clean_cnt++);
        isAEEEnabled = 0;
        DAL_Dynamic_Change_FB_Layer(isAEEEnabled);  // restore UI layer to DEFAULT_UI_LAYER
    }
    
    dal_shown = FALSE;
    dal_disable_when_resume = FALSE;

    primary_display_trigger(0, NULL, 0);
                                         

End:
    DAL_UNLOCK();
	MMProfileLogEx(ddp_mmp_get_events()->dal_clean, MMProfileFlagEnd, 0, 0);
    return ret;
}