DAL_STATUS DAL_Clean(void) { const UINT32 BG_COLOR = MAKE_TWO_RGB565_COLOR(DAL_BG_COLOR, DAL_BG_COLOR); UINT32 i, *ptr; if (NULL == mfc_handle) return DAL_STATUS_NOT_READY; DAL_LOCK(); MFC_CHECK_RET(MFC_ResetCursor(mfc_handle)); LCD_CHECK_RET(LCD_LayerEnable(ASSERT_LAYER, FALSE)); ptr = (UINT32 *)dal_fb_addr; for(i = 0; i < DAL_GetLayerSize() / sizeof(UINT32); ++ i) { *ptr ++ = BG_COLOR; } dal_shown = FALSE; DAL_UNLOCK(); return DAL_STATUS_OK; }
DAL_STATUS DAL_Printf(const char *fmt, ...) { va_list args; uint i; char printbuffer[1024] = ""; if (NULL == mfc_handle) return DAL_STATUS_NOT_READY; if (NULL == fmt) return DAL_STATUS_INVALID_ARGUMENT; DAL_LOCK(); va_start (args, fmt); i = vsprintf(printbuffer, fmt, args); va_end (args); MFC_CHECK_RET(MFC_Print(mfc_handle, printbuffer)); if (!dal_shown) { LCD_CHECK_RET(LCD_LayerEnable(ASSERT_LAYER, TRUE)); dal_shown = TRUE; } flush_cache_all(); DISP_CHECK_RET(DISP_UpdateScreen(0, 0, DAL_WIDTH, DAL_HEIGHT)); DAL_UNLOCK(); return DAL_STATUS_OK; }
int is_DAL_Enabled(void) { int ret = 0; DAL_LOCK(); ret = isAEEEnabled; DAL_UNLOCK(); return ret; }
DAL_STATUS DAL_OnDispPowerOn(void) { #if 0 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) { mutex_lock(&OverlaySettingMutex); cached_layer_config[ASSERT_LAYER].src_x = 0; cached_layer_config[ASSERT_LAYER].src_y = 0; cached_layer_config[ASSERT_LAYER].src_w = DAL_WIDTH; cached_layer_config[ASSERT_LAYER].src_h = DAL_HEIGHT; cached_layer_config[ASSERT_LAYER].dst_x = 0; cached_layer_config[ASSERT_LAYER].dst_y = 0; cached_layer_config[ASSERT_LAYER].dst_w = DAL_WIDTH; cached_layer_config[ASSERT_LAYER].dst_h = DAL_HEIGHT; cached_layer_config[ASSERT_LAYER].layer_en= TRUE; cached_layer_config[ASSERT_LAYER].isDirty = true; atomic_set(&OverlaySettingDirtyFlag, 1); atomic_set(&OverlaySettingApplied, 0); mutex_unlock(&OverlaySettingMutex); dal_shown = TRUE; } goto End; } else if(dal_disable_when_resume) { dal_disable_when_resume = FALSE; mutex_lock(&OverlaySettingMutex); cached_layer_config[ASSERT_LAYER].layer_en= FALSE; cached_layer_config[ASSERT_LAYER].isDirty = true; atomic_set(&OverlaySettingDirtyFlag, 1); atomic_set(&OverlaySettingApplied, 0); mutex_unlock(&OverlaySettingMutex); dal_shown = FALSE; goto End; } } End: DAL_UNLOCK(); #endif return DAL_STATUS_OK; }
DAL_STATUS DAL_SetColor(unsigned int fgColor, unsigned int bgColor) { if (NULL == mfc_handle) return DAL_STATUS_NOT_READY; DAL_LOCK(); dal_fg_color = RGB888_To_RGB565(fgColor); dal_bg_color = RGB888_To_RGB565(bgColor); DAL_CHECK_MFC_RET(MFC_SetColor(mfc_handle, dal_fg_color, dal_bg_color)); DAL_UNLOCK(); return DAL_STATUS_OK; }
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_Printf(const char *fmt, ...) { va_list args; uint i; DAL_STATUS ret = DAL_STATUS_OK; if (NULL == mfc_handle) return DAL_STATUS_NOT_READY; if (NULL == fmt) return DAL_STATUS_INVALID_ARGUMENT; DAL_LOCK(); 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 (!dal_shown) { DAL_CHECK_LCD_RET(LCD_LayerSetWindowOffset(ASSERT_LAYER,0,0)); DAL_CHECK_LCD_RET(LCD_LayerSetOffset(ASSERT_LAYER, 0,0)); DAL_CHECK_LCD_RET(LCD_LayerSetSize(ASSERT_LAYER, DAL_WIDTH, DAL_HEIGHT)); DAL_CHECK_LCD_RET(LCD_LayerEnable(ASSERT_LAYER, TRUE)); dal_shown = TRUE; } DAL_CHECK_DISP_RET(DISP_UpdateScreen(0, 0, DAL_WIDTH, DAL_HEIGHT)); End: DAL_UNLOCK(); return ret; }
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; UINT32 i, *ptr; 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)); ptr = (UINT32 *)dal_fb_addr; for(i = 0; i < DAL_GetLayerSize() / sizeof(UINT32); ++ i) { *ptr ++ = BG_COLOR; } 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; } DAL_CHECK_LCD_RET(LCD_LayerEnable(ASSERT_LAYER, FALSE)); 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; End: DAL_UNLOCK(); return ret; }
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; }
DAL_STATUS DAL_OnDispPowerOn(void) { DAL_LOCK(); /* Re-enable assertion layer when display resumes */ if (LCD_STATE_POWER_OFF != LCD_GetState()){ if(dal_enable_when_resume) { dal_enable_when_resume = FALSE; if (!dal_shown) { DAL_CHECK_LCD_RET(LCD_LayerSetWindowOffset(ASSERT_LAYER,0,0)); DAL_CHECK_LCD_RET(LCD_LayerSetOffset(ASSERT_LAYER, 0,0)); DAL_CHECK_LCD_RET(LCD_LayerSetSize(ASSERT_LAYER, DAL_WIDTH, DAL_HEIGHT)); DAL_CHECK_LCD_RET(LCD_LayerEnable(ASSERT_LAYER, TRUE)); 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_CHECK_LCD_RET(LCD_LayerEnable(ASSERT_LAYER, FALSE)); 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_CHECK_LCD_RET(LCD_LayerEnable(ASSERT_LAYER, FALSE)); DAL_CHECK_LCD_RET(LCD_LayerSetOffset(ASSERT_LAYER, 0,0)); DAL_CHECK_LCD_RET(LCD_LayerSetWindowOffset(ASSERT_LAYER, 0,0)); DAL_CHECK_LCD_RET(LCD_LayerSetSize(ASSERT_LAYER, DAL_WIDTH, DAL_HEIGHT)); } } else{} #endif } End: DAL_UNLOCK(); return DAL_STATUS_OK; }
DAL_STATUS DAL_Printf(const char *fmt, ...) { va_list args; uint i; DAL_STATUS ret = DAL_STATUS_OK; //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(); 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 (down_interruptible(&sem_early_suspend)) { DISP_LOG_PRINT(ANDROID_LOG_INFO, "DAL", "can't get semaphore in DAL_Printf()\n"); 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 up(&sem_early_suspend); mutex_lock(&OverlaySettingMutex); if (!dal_shown) { dal_shown = TRUE; } //DAL enable, switch ui layer from default 3 to 2 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_CHECK_LCD_RET(LCD_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(); DAL_CHECK_LCD_RET(LCD_LayerSetAddress(ASSERT_LAYER, dal_fb_pa)); DAL_CHECK_LCD_RET(LCD_LayerSetAlphaBlending(ASSERT_LAYER, TRUE, 0x80)); DAL_CHECK_LCD_RET(LCD_LayerSetPitch(ASSERT_LAYER, DAL_WIDTH * DAL_BPP)); cached_layer_config[ASSERT_LAYER].fmt= DAL_FORMAT; cached_layer_config[ASSERT_LAYER].src_x = 0; cached_layer_config[ASSERT_LAYER].src_y = 0; cached_layer_config[ASSERT_LAYER].src_w = DAL_WIDTH; cached_layer_config[ASSERT_LAYER].src_h = DAL_HEIGHT; cached_layer_config[ASSERT_LAYER].dst_x = 0; cached_layer_config[ASSERT_LAYER].dst_y = 0; cached_layer_config[ASSERT_LAYER].dst_w = DAL_WIDTH; cached_layer_config[ASSERT_LAYER].dst_h = DAL_HEIGHT; DAL_CHECK_LCD_RET(LCD_LayerEnable(ASSERT_LAYER, TRUE)); printk("after AEE config LCD layer 3: \n"); LCD_Dump_Layer_Info(); } atomic_set(&OverlaySettingDirtyFlag, 1); atomic_set(&OverlaySettingApplied, 0); mutex_unlock(&OverlaySettingMutex); DAL_CHECK_DISP_RET(DISP_UpdateScreen(0, 0, DAL_WIDTH, DAL_HEIGHT)); End: DAL_UNLOCK(); return ret; }
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; UINT32 i, *ptr; static int dal_clean_cnt = 0; 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; DAL_LOCK(); DAL_CHECK_MFC_RET(MFC_ResetCursor(mfc_handle)); ptr = (UINT32 *)dal_fb_addr; for(i = 0; i < DAL_GetLayerSize() / sizeof(UINT32); ++ i) { *ptr ++ = BG_COLOR; } /* 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; } */ if (down_interruptible(&sem_early_suspend)) { DISP_LOG_PRINT(ANDROID_LOG_INFO, "DAL", "can't get semaphore in DAL_Clean()\n"); 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 up(&sem_early_suspend); mutex_lock(&OverlaySettingMutex); //TODO: if dal_shown=false, and 3D enabled, mtkfb may disable UI layer, please modify 3D driver if(isAEEEnabled==1) { DAL_CHECK_LCD_RET(LCD_LayerEnable(ASSERT_LAYER, FALSE)); // DAL disable, switch UI layer to default layer 3 printk("[DDP]* isAEEEnabled from 1 to 0, %d \n", dal_clean_cnt++); isAEEEnabled = 0; DAL_CHECK_LCD_RET(LCD_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; atomic_set(&OverlaySettingDirtyFlag, 1); atomic_set(&OverlaySettingApplied, 0); mutex_unlock(&OverlaySettingMutex); DAL_CHECK_DISP_RET(DISP_UpdateScreen(0, 0, DAL_WIDTH, DAL_HEIGHT)); End: DAL_UNLOCK(); return ret; }
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; }
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; }
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; }
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) { mutex_lock(&OverlaySettingMutex); cached_layer_config[ASSERT_LAYER].src_x = 0; cached_layer_config[ASSERT_LAYER].src_y = 0; cached_layer_config[ASSERT_LAYER].src_w = DAL_WIDTH; cached_layer_config[ASSERT_LAYER].src_h = DAL_HEIGHT; cached_layer_config[ASSERT_LAYER].dst_x = 0; cached_layer_config[ASSERT_LAYER].dst_y = 0; cached_layer_config[ASSERT_LAYER].dst_w = DAL_WIDTH; cached_layer_config[ASSERT_LAYER].dst_h = DAL_HEIGHT; cached_layer_config[ASSERT_LAYER].layer_en= TRUE; cached_layer_config[ASSERT_LAYER].isDirty = true; atomic_set(&OverlaySettingDirtyFlag, 1); atomic_set(&OverlaySettingApplied, 0); mutex_unlock(&OverlaySettingMutex); 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; mutex_lock(&OverlaySettingMutex); cached_layer_config[ASSERT_LAYER].layer_en= FALSE; cached_layer_config[ASSERT_LAYER].isDirty = true; atomic_set(&OverlaySettingDirtyFlag, 1); atomic_set(&OverlaySettingApplied, 0); mutex_unlock(&OverlaySettingMutex); 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 mutex_lock(&OverlaySettingMutex); cached_layer_config[ASSERT_LAYER].src_x = 0; cached_layer_config[ASSERT_LAYER].src_y = 0; cached_layer_config[ASSERT_LAYER].src_w = DAL_WIDTH; cached_layer_config[ASSERT_LAYER].src_h = DAL_HEIGHT; cached_layer_config[ASSERT_LAYER].dst_x = 0; cached_layer_config[ASSERT_LAYER].dst_y = 0; cached_layer_config[ASSERT_LAYER].dst_w = DAL_WIDTH; cached_layer_config[ASSERT_LAYER].dst_h = DAL_HEIGHT; cached_layer_config[ASSERT_LAYER].layer_en= FALSE; cached_layer_config[ASSERT_LAYER].isDirty = true; atomic_set(&OverlaySettingDirtyFlag, 1); atomic_set(&OverlaySettingApplied, 0); mutex_unlock(&OverlaySettingMutex); } } else{} #endif } End: DAL_UNLOCK(); return DAL_STATUS_OK; }