static void DAL_UpdateScreen (BOOL enable, BOOL aen, UINT32 width, UINT32 height) { disp_job *job = disp_deque_job(disp_config.session_id); mutex_lock(&job->lock); job->input[ASSERT_LAYER].layer_id = ASSERT_LAYER; job->input[ASSERT_LAYER].layer_enable = enable; job->input[ASSERT_LAYER].dirty = TRUE; if (enable) { job->input[ASSERT_LAYER].src_x = DAL_WIDTH - width; job->input[ASSERT_LAYER].src_y = 0; job->input[ASSERT_LAYER].dst_x = DAL_WIDTH - width; job->input[ASSERT_LAYER].dst_y = 0; job->input[ASSERT_LAYER].width = width; job->input[ASSERT_LAYER].height = height; job->input[ASSERT_LAYER].pitch = DAL_PITCH * DAL_BPP; job->input[ASSERT_LAYER].format = DAL_FORMAT; job->input[ASSERT_LAYER].address = dal_fb_pa; job->input[ASSERT_LAYER].alpha_enable = aen; if (aen) { job->input[ASSERT_LAYER].alpha = 0x80; } } mutex_unlock(&job->lock); printk("[FB Driver] DAL_UpdateScreen(): id=%d,en=%d,aen=%d,fmt=%d,pitch=%d,w=%d,h=%d\n", ASSERT_LAYER, enable, aen, DP_COLOR_GET_UNIQUE_ID(DAL_FORMAT), (int)(DAL_PITCH * DAL_BPP), width, height); disp_enque_job(disp_config.session_id); if (DISP_IsDecoupleMode()) { DISP_StartOverlayTransfer(); } }
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(); mutex_lock(&OverlaySettingMutex); 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)); //DAL_Clean(); cached_layer_config[ASSERT_LAYER].addr = dal_fb_pa; cached_layer_config[ASSERT_LAYER].alpha = 0x80; cached_layer_config[ASSERT_LAYER].aen = TRUE; cached_layer_config[ASSERT_LAYER].src_pitch = DAL_PITCH * 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; 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); 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 atomic_set(&OverlaySettingDirtyFlag, 1); atomic_set(&OverlaySettingApplied, 0); mutex_unlock(&OverlaySettingMutex); if (DISP_IsDecoupleMode()) { DISP_StartOverlayTransfer(); } 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; 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)); MFC_CONTEXT *ctxt = (MFC_CONTEXT *)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; } */ 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) { cached_layer_config[ASSERT_LAYER].layer_en= FALSE; cached_layer_config[ASSERT_LAYER].isDirty = true; // 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; #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); if (DISP_IsDecoupleMode()) { DISP_StartOverlayTransfer(); } DAL_CHECK_DISP_RET(DISP_UpdateScreen(0, 0, DAL_WIDTH, DAL_HEIGHT)); End: DAL_UNLOCK(); return ret; }