int ext_disp_trigger(int blocking, void *callback, unsigned int userdata) { int ret = 0; EXT_DISP_FUNC(); if((is_hdmi_active() == false)|| pgc->state == EXTD_DEINIT || pgc->state == EXTD_SUSPEND || pgc->need_trigger_overlay < 1) { EXT_DISP_LOG("trigger ext display is already sleeped\n"); MMProfileLogEx(ddp_mmp_get_events()->Extd_ErrorInfo, MMProfileFlagPulse, Trigger, 0); return -1; } _ext_disp_path_lock(); if(_should_trigger_interface()) { _trigger_display_interface(blocking, callback, userdata); } else { _trigger_overlay_engine(); } pgc->state = EXTD_RESUME; _ext_disp_path_unlock(); EXT_DISP_LOG("ext_disp_trigger done \n"); return ret; }
int ext_disp_config_input_multiple(ext_disp_input_config* input, int idx) { int ret = 0; int i=0; int layer =0; ///EXT_DISP_FUNC(); disp_ddp_path_config *data_config; if((is_hdmi_active() == false) || (pgc->state != EXTD_INIT && pgc->state != EXTD_RESUME) ) { EXT_DISP_LOG("[Donglei]config ext disp is already sleeped, hdmi_active:%d, state:%d\n", is_hdmi_active(), pgc->state); MMProfileLogEx(ddp_mmp_get_events()->Extd_ErrorInfo, MMProfileFlagPulse, Config, idx ); return -2; } _ext_disp_path_lock(); // all dirty should be cleared in dpmgr_path_get_last_config() data_config = dpmgr_path_get_last_config(pgc->dpmgr_handle); // hope we can use only 1 input struct for input config, just set layer number if(_should_config_ovl_input()) { for(i = 0;i<HW_OVERLAY_COUNT;i++) { if(input[i].dirty) { ret = _convert_disp_input_to_ovl(&(data_config->ovl_config[input[i].layer]), &input[i]); dprec_mmp_dump_ovl_layer(&(data_config->ovl_config[input[i].layer]), input[i].layer, 2); } if (init_roi == 1) { LCM_PARAMS *lcm_param = extd_drv_get_params(pgc->plcm); memcpy(&(data_config->dispif_config), &(extd_dpi_params.dispif_config), sizeof(LCM_PARAMS)); if(lcm_param != NULL) { EXT_DISP_LOG("set dest w:%d, h:%d\n", lcm_param->width, lcm_param->height); data_config->dst_w = lcm_param->width; data_config->dst_h = lcm_param->height; } data_config->dst_dirty = 1; data_config->rdma_config.address = 0; } data_config->ovl_dirty = 1; } } else { OVL_CONFIG_STRUCT ovl_config; _convert_disp_input_to_ovl(&ovl_config, input); dprec_mmp_dump_ovl_layer(&ovl_config, input->layer, 2); ret = _convert_disp_input_to_rdma(&(data_config->rdma_config), input); if (data_config->rdma_config.address) { data_config->rdma_dirty = 1; } } if(_should_wait_path_idle()) { dpmgr_wait_event_timeout(pgc->dpmgr_handle, DISP_PATH_EVENT_FRAME_DONE, HZ/2); } memcpy(&(data_config->dispif_config), &(extd_dpi_params.dispif_config), sizeof(LCM_PARAMS)); ret = dpmgr_path_config(pgc->dpmgr_handle, data_config, ext_disp_cmdq_enabled()? pgc->cmdq_handle_config : NULL); // this is used for decouple mode, to indicate whether we need to trigger ovl pgc->need_trigger_overlay = 1; init_roi = 0; _ext_disp_path_unlock(); if (data_config->ovl_dirty) { EXT_DISP_LOG("config_input_multiple idx:%d -w:%d, h:%d, pitch:%d\n", idx ,data_config->ovl_config[0].src_w, data_config->ovl_config[0].src_h, data_config->ovl_config[0].src_pitch); }else{ EXT_DISP_LOG("config_input_multiple idx:%d -w:%d, h:%d, pitch:%d, mva:%p\n", idx ,data_config->rdma_config.width, data_config->rdma_config.height, data_config->rdma_config.pitch, data_config->rdma_config.address); } return ret; }
int ext_disp_config_input(ext_disp_input_config* input) { int ret = 0; int i=0; int layer =0; ///EXT_DISP_FUNC(); disp_ddp_path_config *data_config; if((is_hdmi_active() == false)|| ext_disp_is_sleepd()) { EXT_DISP_LOG("ext disp is already sleeped\n"); return 0; } _ext_disp_path_lock(); data_config = dpmgr_path_get_last_config(pgc->dpmgr_handle); if(input->layer_en) { if(input->vaddr) { ///_debug_pattern(0x00000000, input->vaddr, input->dst_w, input->dst_h, input->src_pitch, 0x00000000, input->layer, input->buff_idx); } else { ///_debug_pattern(input->addr,0x00000000, input->dst_w, input->dst_h, input->src_pitch, 0x00000000, input->layer, input->buff_idx); } } #ifdef EXTD_DBG_USE_INNER_BUF if(input->fmt == eYUY2) { ///input->layer_en = 1; ///memset(input, 0, sizeof(ext_disp_input_config)); input->layer_en = 1; input->addr = hdmi_mva_r ; input->vaddr = hdmi_va ; input->fmt = eRGB888; ///eRGBA8888 eYUY2 input->src_w = 1280; input->src_h = 720; input->src_x = 0; input->src_y = 0; input->src_pitch = 1280*3; input->dst_w = 1280; input->dst_h = 720; input->dst_x = 0; input->dst_y = 0; input->aen = 0; input->alpha = 0xff; } #endif // hope we can use only 1 input struct for input config, just set layer number if(_should_config_ovl_input()) { ret = _convert_disp_input_to_ovl(&(data_config->ovl_config[input->layer]), input); data_config->ovl_dirty = 1; } else { ret = _convert_disp_input_to_rdma(&(data_config->rdma_config), input); data_config->rdma_dirty= 1; } ///EXT_DISP_ERR("ext_disp_config_input cmdq %d wi %d ovl %d vm %d\n", ext_disp_cmdq_enabled(), _should_wait_path_idle(), _should_config_ovl_input(), ext_disp_is_video_mode()); if(_should_wait_path_idle()) { dpmgr_wait_event_timeout(pgc->dpmgr_handle, DISP_PATH_EVENT_FRAME_DONE, HZ/2); } memcpy(&(data_config->dispif_config), &(extd_dpi_params.dispif_config), sizeof(LCM_PARAMS)); ret = dpmgr_path_config(pgc->dpmgr_handle, data_config, ext_disp_cmdq_enabled()? pgc->cmdq_handle_config : NULL); // this is used for decouple mode, to indicate whether we need to trigger ovl pgc->need_trigger_overlay = 1; ///EXT_DISP_LOG("ext_disp_config_input done \n"); _ext_disp_path_unlock(); return ret; }
int ext_disp_config_input_multiple(ext_disp_input_config* input, int idx) { int ret = 0; int i=0; int layer =0; ///DISPFUNC(); disp_ddp_path_config *data_config; if((is_hdmi_active() == false) || (pgc->state != EXTD_RESUME) ) { DISPMSG("config ext disp is already sleeped\n"); MMProfileLogEx(ddp_mmp_get_events()->Extd_ErrorInfo, MMProfileFlagPulse, Config, idx ); return 0; } _ext_disp_path_lock(); // all dirty should be cleared in dpmgr_path_get_last_config() data_config = dpmgr_path_get_last_config(pgc->dpmgr_handle); data_config->dst_dirty = 0; data_config->ovl_dirty = 0; data_config->rdma_dirty = 0; data_config->wdma_dirty = 0; // hope we can use only 1 input struct for input config, just set layer number if(_should_config_ovl_input()) { for(i = 0;i<HW_OVERLAY_COUNT;i++) { ///dprec_logger_start(DPREC_LOGGER_PRIMARY_CONFIG, input->layer|(input->layer_en<<16), input->addr); if(input[i].dirty) { dprec_mmp_dump_ovl_layer(&(data_config->ovl_config[input[i].layer]), input[i].layer, 2); ret = _convert_disp_input_to_ovl(&(data_config->ovl_config[input[i].layer]), &input[i]); } /* else { data_config->ovl_config[input[i].layer].layer_en = input[i].layer_en; data_config->ovl_config[input[i].layer].layer = input[i].layer; } */ data_config->ovl_dirty = 1; ///dprec_logger_done(DPREC_LOGGER_PRIMARY_CONFIG, input->src_x, input->src_y); } } else { ret = _convert_disp_input_to_rdma(&(data_config->rdma_config), input); data_config->rdma_dirty= 1; } if(_should_wait_path_idle()) { dpmgr_wait_event_timeout(pgc->dpmgr_handle, DISP_PATH_EVENT_FRAME_DONE, HZ/2); } memcpy(&(data_config->dispif_config), &(extd_dpi_params.dispif_config), sizeof(LCM_PARAMS)); ret = dpmgr_path_config(pgc->dpmgr_handle, data_config, ext_disp_cmdq_enabled()? pgc->cmdq_handle_config : NULL); // this is used for decouple mode, to indicate whether we need to trigger ovl pgc->need_trigger_overlay = 1; _ext_disp_path_unlock(); DISPMSG("config_input_multiple idx %x -w %d, h %d\n", idx ,data_config->ovl_config[0].src_w, data_config->ovl_config[0].src_h); return ret; }
static long mtkfb_vsync_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { int ret = 0; MTKFB_VSYNC_FUNC(); switch (cmd) { case MTKFB_VSYNC_IOCTL: { MTKFB_VSYNC_LOG("[MTKFB_VSYNC]: enter MTKFB_VSYNC_IOCTL %ld\n", arg); #if defined(CONFIG_SINGLE_PANEL_OUTPUT) if (is_hdmi_active()) { #else if (arg == MTKFB_VSYNC_SOURCE_HDMI) { #endif #if defined(CONFIG_MTK_HDMI_SUPPORT) if (down_interruptible(&mtkfb_vsync_sem)) { MTKFB_MSG("[mtkfb_vsync_ioctl] can't get semaphore,%d\n", __LINE__); msleep(20); return ret; } hdmi_waitVsync(); up(&mtkfb_vsync_sem); MTKFB_VSYNC_LOG("[MTKFB_VSYNC]: leave MTKFB_VSYNC_IOCTL, %d\n", __LINE__); #else MTKFB_VSYNC_LOG("[MTKFB_VSYNC]: NS leave MTKFB_VSYNC_IOCTL, %d\n", __LINE__); ret = -EFAULT; #endif return ret; } if (down_interruptible(&mtkfb_vsync_sem)) { MTKFB_MSG("[mtkfb_vsync_ioctl] can't get semaphore,%d\n", __LINE__); msleep(20); return ret; } mtkfb_waitVsync(); up(&mtkfb_vsync_sem); MTKFB_VSYNC_LOG("[MTKFB_VSYNC]: leave MTKFB_VSYNC_IOCTL\n"); } break; } return ret; } static const struct file_operations mtkfb_vsync_fops = { .owner = THIS_MODULE, .unlocked_ioctl = mtkfb_vsync_unlocked_ioctl, .open = mtkfb_vsync_open, .release = mtkfb_vsync_release, .flush = mtkfb_vsync_flush, .read = mtkfb_vsync_read, }; static int mtkfb_vsync_probe(struct platform_device *pdev) { struct class_device; struct class_device *class_dev = NULL; MTKFB_MSG("\n=== MTKFB_VSYNC probe ===\n"); if (alloc_chrdev_region(&mtkfb_vsync_devno, 0, 1, MTKFB_VSYNC_DEVNAME)) { VSYNC_ERR("can't get device major number...\n"); return -EFAULT; } MTKFB_MSG("get device major number (%d)\n", mtkfb_vsync_devno); mtkfb_vsync_cdev = cdev_alloc(); mtkfb_vsync_cdev->owner = THIS_MODULE; mtkfb_vsync_cdev->ops = &mtkfb_vsync_fops; cdev_add(mtkfb_vsync_cdev, mtkfb_vsync_devno, 1); mtkfb_vsync_class = class_create(THIS_MODULE, MTKFB_VSYNC_DEVNAME); class_dev = (struct class_device *)device_create(mtkfb_vsync_class, NULL, mtkfb_vsync_devno, NULL, MTKFB_VSYNC_DEVNAME); VSYNC_INF("probe is done\n"); return 0; } static int mtkfb_vsync_remove(struct platform_device *pdev) { VSYNC_INF("device remove\n"); return 0; }