static int mdp3_overlay_unset(struct msm_fb_data_type *mfd, int ndx) { int rc = 0; struct mdp3_session_data *mdp3_session = mfd->mdp.private1; struct fb_info *fbi = mfd->fbi; struct fb_fix_screeninfo *fix; int format; fix = &fbi->fix; format = mdp3_ctrl_get_source_format(mfd->fb_imgType); mutex_lock(&mdp3_session->lock); if (mdp3_session->overlay.id == ndx && ndx == 1) { struct mdp3_dma *dma = mdp3_session->dma; dma->source_config.format = format; dma->source_config.stride = fix->line_length; dma->output_config.pack_pattern = mdp3_ctrl_get_pack_pattern(mfd->fb_imgType); mdp3_clk_enable(1, 0); mdp3_session->dma->dma_config_source(dma); mdp3_clk_enable(0, 0); mdp3_session->overlay.id = MSMFB_NEW_REQUEST; mdp3_bufq_deinit(&mdp3_session->bufq_in); } else { rc = -EINVAL; } mutex_unlock(&mdp3_session->lock); return rc; }
static int mdp3_ctrl_dma_init(struct msm_fb_data_type *mfd, struct mdp3_dma *dma) { int rc; struct mdss_panel_info *panel_info = mfd->panel_info; struct fb_info *fbi = mfd->fbi; struct fb_fix_screeninfo *fix; struct fb_var_screeninfo *var; struct mdp3_dma_output_config outputConfig; struct mdp3_dma_source sourceConfig; fix = &fbi->fix; var = &fbi->var; sourceConfig.format = mdp3_ctrl_get_source_format(mfd); sourceConfig.width = panel_info->xres; sourceConfig.height = panel_info->yres; sourceConfig.x = 0; sourceConfig.y = 0; sourceConfig.stride = fix->line_length; sourceConfig.buf = (void *)mfd->iova; outputConfig.dither_en = 0; outputConfig.out_sel = mdp3_ctrl_get_intf_type(mfd); outputConfig.bit_mask_polarity = 0; outputConfig.color_components_flip = 0; outputConfig.pack_pattern = mdp3_ctrl_get_pack_pattern(mfd); outputConfig.pack_align = MDP3_DMA_OUTPUT_PACK_ALIGN_LSB; outputConfig.color_comp_out_bits = (MDP3_DMA_OUTPUT_COMP_BITS_8 << 4) | (MDP3_DMA_OUTPUT_COMP_BITS_8 << 2)| MDP3_DMA_OUTPUT_COMP_BITS_8; rc = mdp3_dma_init(dma, &sourceConfig, &outputConfig); return rc; }
static int mdp3_ctrl_dma_init(struct msm_fb_data_type *mfd, struct mdp3_dma *dma) { int rc; struct mdss_panel_info *panel_info = mfd->panel_info; struct fb_info *fbi = mfd->fbi; struct fb_fix_screeninfo *fix; struct fb_var_screeninfo *var; struct mdp3_dma_output_config outputConfig; struct mdp3_dma_source sourceConfig; int frame_rate = mfd->panel_info->mipi.frame_rate; int vbp, vfp, vspw; int vtotal, vporch; struct mdp3_notification dma_done_callback; vbp = panel_info->lcdc.v_back_porch; vfp = panel_info->lcdc.v_front_porch; vspw = panel_info->lcdc.v_pulse_width; vporch = vbp + vfp + vspw; vtotal = vporch + panel_info->yres; fix = &fbi->fix; var = &fbi->var; sourceConfig.format = mdp3_ctrl_get_source_format(mfd->fb_imgType); sourceConfig.width = panel_info->xres; sourceConfig.height = panel_info->yres; sourceConfig.x = 0; sourceConfig.y = 0; sourceConfig.stride = fix->line_length; sourceConfig.buf = (void *)mfd->iova; sourceConfig.vporch = vporch; sourceConfig.vsync_count = MDP_VSYNC_CLK_RATE / (frame_rate * vtotal); outputConfig.dither_en = 0; outputConfig.out_sel = mdp3_ctrl_get_intf_type(mfd); outputConfig.bit_mask_polarity = 0; outputConfig.color_components_flip = 0; outputConfig.pack_pattern = mdp3_ctrl_get_pack_pattern(mfd->fb_imgType); outputConfig.pack_align = MDP3_DMA_OUTPUT_PACK_ALIGN_LSB; outputConfig.color_comp_out_bits = (MDP3_DMA_OUTPUT_COMP_BITS_8 << 4) | (MDP3_DMA_OUTPUT_COMP_BITS_8 << 2)| MDP3_DMA_OUTPUT_COMP_BITS_8; if (dma->dma_config) rc = dma->dma_config(dma, &sourceConfig, &outputConfig); else rc = -EINVAL; if (outputConfig.out_sel == MDP3_DMA_OUTPUT_SEL_DSI_CMD) { dma_done_callback.handler = dma_done_notify_handler; dma_done_callback.arg = mfd->mdp.private1; dma->dma_done_notifier(dma, &dma_done_callback); } return rc; }
static int mdp3_overlay_set(struct msm_fb_data_type *mfd, struct mdp_overlay *req) { int rc = 0; struct mdp3_session_data *mdp3_session = mfd->mdp.private1; struct mdp3_dma *dma = mdp3_session->dma; struct fb_fix_screeninfo *fix; struct fb_info *fbi = mfd->fbi; int stride; int format; fix = &fbi->fix; stride = req->src.width * ppp_bpp(req->src.format); format = mdp3_ctrl_get_source_format(req->src.format); mutex_lock(&mdp3_session->lock); if (mdp3_session->overlay.id != req->id) pr_err("overlay was not released, continue to recover\n"); mdp3_session->overlay = *req; if (req->id == MSMFB_NEW_REQUEST) { if (dma->source_config.stride != stride || dma->source_config.format != format) { dma->source_config.format = format; dma->source_config.stride = stride; dma->output_config.pack_pattern = mdp3_ctrl_get_pack_pattern(req->src.format); mdp3_clk_enable(1, 0); mdp3_session->dma->dma_config_source(dma); mdp3_clk_enable(0, 0); } mdp3_session->overlay.id = 1; req->id = 1; } mutex_unlock(&mdp3_session->lock); return rc; }