DAL_STATUS DAL_Clean(void) { DAL_STATUS ret = DAL_STATUS_OK; static int dal_clean_cnt; MFC_CONTEXT *ctxt = (MFC_CONTEXT *) mfc_handle; DISP_DRV_MSG("[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; */ DAL_LOCK(); DAL_CHECK_MFC_RET(MFC_ResetCursor(mfc_handle)); ctxt->screen_color = 0; DAL_SetScreenColor(DAL_COLOR_RED); /* TODO: if dal_shown=false, and 3D enabled, mtkfb may disable UI layer, please modify 3D driver */ if (isAEEEnabled == 1) { /* DAL disable, switch UI layer to default layer 3 */ DISP_DRV_MSG("[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; #ifdef DAL_LOWMEMORY_ASSERT if (dal_lowMemory_shown) { /* only need show lowmemory assert */ UINT32 LOWMEMORY_FG_COLOR = MAKE_TWO_RGB565_COLOR(DAL_LOWMEMORY_FG_COLOR, DAL_LOWMEMORY_FG_COLOR); UINT32 LOWMEMORY_BG_COLOR = MAKE_TWO_RGB565_COLOR(DAL_LOWMEMORY_BG_COLOR, DAL_LOWMEMORY_BG_COLOR); DAL_CHECK_MFC_RET(MFC_LowMemory_Printf (mfc_handle, low_memory_msg, LOWMEMORY_FG_COLOR, LOWMEMORY_BG_COLOR)); Show_LowMemory(); } dal_enable_when_resume_lowmemory = FALSE; dal_disable_when_resume_lowmemory = FALSE; #endif dal_disable_when_resume = FALSE; DAL_UpdateScreen(FALSE, FALSE, 0, 0); DAL_CHECK_DISP_RET(DISP_UpdateScreen(0, 0, DAL_WIDTH, DAL_HEIGHT)); DAL_UNLOCK(); return ret; }
DAL_STATUS DAL_LowMemoryOff(void) { UINT32 BG_COLOR = MAKE_TWO_RGB565_COLOR(DAL_BG_COLOR, DAL_BG_COLOR); DAL_LOG("Enter DAL_LowMemoryOff()\n"); DAL_CHECK_MFC_RET(MFC_SetMem(mfc_handle, low_memory_msg, BG_COLOR)); /* what about LCM_PHYSICAL_ROTATION = 180 */ if (!dal_shown) { /* only low memory assert shown on screen */ DAL_UpdateScreen(FALSE, FALSE, 0, 0); } dal_lowMemory_shown = FALSE; DAL_LOG("Leave DAL_LowMemoryOff()\n"); return DAL_STATUS_OK; }
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; DAL_LOCK(); if(isAEEEnabled==0) { printk("[DDP] isAEEEnabled from 0 to 1, ASSERT_LAYER=%d, dal_fb_pa %x\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_Ex(&mfc_handle, dal_fb_addr, DAL_WIDTH, DAL_HEIGHT,DAL_PITCH, DAL_BPP, DAL_FG_COLOR, DAL_BG_COLOR)); } 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 (!dal_shown) { dal_shown = TRUE; } DAL_UpdateScreen(TRUE, TRUE, DAL_WIDTH, DAL_HEIGHT); DAL_CHECK_DISP_RET(DISP_UpdateScreen(0, 0, DAL_WIDTH, DAL_HEIGHT)); DAL_UNLOCK(); return ret; }
static DAL_STATUS Show_LowMemory(void) { UINT32 update_width, update_height; MFC_CONTEXT *ctxt = (MFC_CONTEXT *)mfc_handle; if(!dal_shown) { //only need show lowmemory assert update_width = ctxt->font_width * strlen(low_memory_msg); update_height = ctxt->font_height; DISP_LOG_PRINT(ANDROID_LOG_INFO, "DAL", "update size:%d,%d",update_width, update_height); DAL_UpdateScreen(TRUE, FALSE, update_width, update_height); } /* if(!dal_lowMemory_shown) DAL_CHECK_DISP_RET(DISP_UpdateScreen(0, 0, DAL_WIDTH, DAL_HEIGHT)); */ return DAL_STATUS_OK; }
DAL_STATUS DAL_OnDispPowerOn(void) { DAL_LOCK(); /* Re-enable assertion layer when display resumes */ if (is_early_suspended) { if(dal_enable_when_resume) { dal_enable_when_resume = FALSE; if (!dal_shown) { DAL_UpdateScreen(TRUE, FALSE, DAL_WIDTH, DAL_HEIGHT); dal_shown = TRUE; } #ifdef DAL_LOWMEMORY_ASSERT dal_enable_when_resume_lowmemory = FALSE; dal_disable_when_resume_lowmemory = FALSE; #endif goto End; } else if(dal_disable_when_resume) { dal_disable_when_resume = FALSE; DAL_UpdateScreen(FALSE, FALSE, 0, 0); dal_shown = FALSE; #ifdef DAL_LOWMEMORY_ASSERT if (dal_lowMemory_shown) { //only need show lowmemory assert UINT32 LOWMEMORY_FG_COLOR = MAKE_TWO_RGB565_COLOR(DAL_LOWMEMORY_FG_COLOR, DAL_LOWMEMORY_FG_COLOR); UINT32 LOWMEMORY_BG_COLOR = MAKE_TWO_RGB565_COLOR(DAL_LOWMEMORY_BG_COLOR, DAL_LOWMEMORY_BG_COLOR); DAL_CHECK_MFC_RET(MFC_LowMemory_Printf(mfc_handle, low_memory_msg, LOWMEMORY_FG_COLOR, LOWMEMORY_BG_COLOR)); Show_LowMemory(); } dal_enable_when_resume_lowmemory = FALSE; dal_disable_when_resume_lowmemory = FALSE; #endif goto End; } #ifdef DAL_LOWMEMORY_ASSERT if(dal_enable_when_resume_lowmemory) { dal_enable_when_resume_lowmemory = FALSE; if(!dal_shown) { //only need show lowmemory assert Show_LowMemory(); } } else if(dal_disable_when_resume_lowmemory) { if(!dal_shown) { // only low memory assert shown on screen DAL_UpdateScreen(FALSE, FALSE, 0, 0); } } else {} #endif } End: DAL_UNLOCK(); return DAL_STATUS_OK; }