msm_fb: Wifi display changes for commit ioctl

This change handles panel updates for WFD panel via
overlay_commit interface, along with conglomeration of
some common code across pan_update and overlay_commit ioctls

Signed-off-by: Kalyan Thota <kalyant@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp4_overlay.c
	drivers/video/msm/msm_fb.c
	include/linux/msm_mdp.h

Change-Id: I9e332856782c59ab598bb388a2ec482076746ad2
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
This commit is contained in:
Kalyan Thota 2012-11-02 20:55:30 +05:30 committed by Stephen Boyd
parent 0cb749aee4
commit 531c753232
4 changed files with 111 additions and 65 deletions

View file

@ -567,6 +567,7 @@ void mdp4_overlay0_done_dsi_video(int cndx);
void mdp4_overlay0_done_dsi_cmd(int cndx);
void mdp4_primary_rdptr(void);
void mdp4_dsi_cmd_overlay(struct msm_fb_data_type *mfd);
int mdp4_overlay_commit(struct fb_info *info);
int mdp4_dsi_video_pipe_commit(int cndx, int wait);
int mdp4_dsi_cmd_pipe_commit(int cndx, int wait);
int mdp4_lcdc_pipe_commit(int cndx, int wait);
@ -599,7 +600,6 @@ int mdp4_overlay_unset_mixer(int mixer);
int mdp4_overlay_play_wait(struct fb_info *info,
struct msmfb_overlay_data *req);
int mdp4_overlay_play(struct fb_info *info, struct msmfb_overlay_data *req);
int mdp4_overlay_commit(struct fb_info *info);
struct mdp4_overlay_pipe *mdp4_overlay_pipe_alloc(int ptype, int mixer);
void mdp4_overlay_dma_commit(int mixer);
void mdp4_overlay_vsync_commit(struct mdp4_overlay_pipe *pipe);
@ -948,9 +948,15 @@ static inline void mdp4_wfd_init(int cndx)
{
/* empty */
}
static inline int mdp4_wfd_pipe_commit(struct msm_fb_data_type *mfd,
int cndx, int wait)
{
return 0;
}
#else
void mdp4_wfd_pipe_queue(int cndx, struct mdp4_overlay_pipe *pipe);
void mdp4_wfd_init(int cndx);
int mdp4_wfd_pipe_commit(struct msm_fb_data_type *mfd, int cndx, int wait);
#endif
#endif /* MDP_H */

View file

@ -3382,6 +3382,7 @@ end:
int mdp4_overlay_commit(struct fb_info *info)
{
int ret = 0;
struct msm_fb_data_type *mfd = (struct msm_fb_data_type *)info->par;
int mixer;
@ -3393,29 +3394,32 @@ int mdp4_overlay_commit(struct fb_info *info)
mixer = mfd->panel_info.pdest; /* DISPLAY_1 or DISPLAY_2 */
if (mixer >= MDP4_MIXER_MAX)
return -EPERM;
mutex_lock(&mfd->dma->ov_mutex);
mdp4_overlay_mdp_perf_upd(mfd, 1);
msm_fb_wait_for_fence(mfd);
if (mixer == MDP4_MIXER0) {
if (ctrl->panel_mode & MDP4_PANEL_DSI_CMD) {
/* cndx = 0 */
mdp4_dsi_cmd_pipe_commit(0, 1);
} else if (ctrl->panel_mode & MDP4_PANEL_DSI_VIDEO) {
/* cndx = 0 */
mdp4_dsi_video_pipe_commit(0, 1);
} else if (ctrl->panel_mode & MDP4_PANEL_LCDC) {
/* cndx = 0 */
mdp4_lcdc_pipe_commit(0, 1);
}
} else if (mixer == MDP4_MIXER1) {
if (ctrl->panel_mode & MDP4_PANEL_DTV)
mdp4_dtv_pipe_commit(0, 1);
switch (mfd->panel.type) {
case MIPI_CMD_PANEL:
mdp4_dsi_cmd_pipe_commit(0, 1);
break;
case MIPI_VIDEO_PANEL:
mdp4_dsi_video_pipe_commit(0, 1);
break;
case LCDC_PANEL:
mdp4_lcdc_pipe_commit(0, 1);
break;
case DTV_PANEL:
mdp4_dtv_pipe_commit(0, 1);
break;
case WRITEBACK_PANEL:
mdp4_wfd_pipe_commit(mfd, 0, 1);
break;
default:
pr_err("Panel Not Supported for Commit");
ret = -EINVAL;
break;
}
msm_fb_signal_timeline(mfd);
@ -3423,7 +3427,7 @@ int mdp4_overlay_commit(struct fb_info *info)
mutex_unlock(&mfd->dma->ov_mutex);
return 0;
return ret;
}
struct msm_iommu_ctx {

View file

@ -88,6 +88,10 @@ static void vsync_irq_disable(int intr, int term)
}
static int mdp4_overlay_writeback_update(struct msm_fb_data_type *mfd);
static void mdp4_wfd_queue_wakeup(struct msm_fb_data_type *mfd,
struct msmfb_writeback_data_list *node);
static void mdp4_wfd_dequeue_update(struct msm_fb_data_type *mfd,
struct msmfb_writeback_data_list **wfdnode);
int mdp4_overlay_writeback_on(struct platform_device *pdev)
{
@ -299,7 +303,8 @@ void mdp4_wfd_pipe_queue(int cndx, struct mdp4_overlay_pipe *pipe)
static void mdp4_wfd_wait4ov(int cndx);
int mdp4_wfd_pipe_commit(void)
int mdp4_wfd_pipe_commit(struct msm_fb_data_type *mfd,
int cndx, int wait)
{
int i, undx;
int mixer = 0;
@ -309,8 +314,9 @@ int mdp4_wfd_pipe_commit(void)
struct mdp4_overlay_pipe *real_pipe;
unsigned long flags;
int cnt = 0;
struct msmfb_writeback_data_list *node = NULL;
vctrl = &vsync_ctrl_db[0];
vctrl = &vsync_ctrl_db[cndx];
mutex_lock(&vctrl->update_lock);
undx = vctrl->update_ndx;
@ -328,6 +334,8 @@ int mdp4_wfd_pipe_commit(void)
vp->update_cnt = 0; /* reset */
mutex_unlock(&vctrl->update_lock);
mdp4_wfd_dequeue_update(mfd, &node);
/* free previous committed iommu back to pool */
mdp4_overlay_iommu_unmap_freelist(mixer);
@ -365,6 +373,11 @@ int mdp4_wfd_pipe_commit(void)
mdp4_stat.overlay_commit[pipe->mixer_num]++;
if (wait)
mdp4_wfd_wait4ov(cndx);
mdp4_wfd_queue_wakeup(mfd, node);
return cnt;
}
@ -426,7 +439,6 @@ void mdp4_overlay2_done_wfd(struct mdp_dma_data *dma)
void mdp4_writeback_overlay(struct msm_fb_data_type *mfd)
{
struct msmfb_writeback_data_list *node = NULL;
struct vsycn_ctrl *vctrl;
struct mdp4_overlay_pipe *pipe;
@ -438,36 +450,7 @@ void mdp4_writeback_overlay(struct msm_fb_data_type *mfd)
vctrl = &vsync_ctrl_db[0];
pipe = vctrl->base_pipe;
mutex_lock(&mfd->unregister_mutex);
mutex_lock(&mfd->writeback_mutex);
if (!list_empty(&mfd->writeback_free_queue)
&& mfd->writeback_state != WB_STOPING
&& mfd->writeback_state != WB_STOP) {
node = list_first_entry(&mfd->writeback_free_queue,
struct msmfb_writeback_data_list, active_entry);
}
if (node) {
list_del(&(node->active_entry));
node->state = IN_BUSY_QUEUE;
mfd->writeback_active_cnt++;
}
mutex_unlock(&mfd->writeback_mutex);
pipe->ov_blt_addr = (ulong) (node ? node->addr : NULL);
if (!pipe->ov_blt_addr) {
pr_err("%s: no writeback buffer 0x%x, %p\n", __func__,
(unsigned int)pipe->ov_blt_addr, node);
mutex_unlock(&mfd->unregister_mutex);
return;
}
mutex_lock(&mfd->dma->ov_mutex);
if (pipe && !pipe->ov_blt_addr) {
pr_err("%s: no writeback buffer 0x%x\n", __func__,
(unsigned int)pipe->ov_blt_addr);
goto fail_no_blt_addr;
}
if (pipe->pipe_type == OVERLAY_TYPE_RGB)
mdp4_wfd_pipe_queue(0, pipe);
@ -475,26 +458,15 @@ void mdp4_writeback_overlay(struct msm_fb_data_type *mfd)
mdp4_overlay_mdp_perf_upd(mfd, 1);
mdp_clk_ctrl(1);
mdp4_overlay_writeback_update(mfd);
mdp4_wfd_pipe_commit();
mdp4_wfd_pipe_commit(mfd, 0, 1);
mdp4_overlay_mdp_perf_upd(mfd, 0);
mdp4_wfd_wait4ov(0);
mdp_clk_ctrl(0);
mutex_lock(&mfd->writeback_mutex);
list_add_tail(&node->active_entry, &mfd->writeback_busy_queue);
mfd->writeback_active_cnt--;
mutex_unlock(&mfd->writeback_mutex);
wake_up(&mfd->wait_q);
fail_no_blt_addr:
/*NOTE: This api was removed
mdp4_overlay_resource_release();*/
mutex_unlock(&mfd->dma->ov_mutex);
mutex_unlock(&mfd->unregister_mutex);
pr_debug("%s:-\n", __func__);
}
static int mdp4_overlay_writeback_register_buffer(
@ -745,3 +717,68 @@ terminate_err:
mutex_unlock(&mfd->unregister_mutex);
return rc;
}
static void mdp4_wfd_dequeue_update(struct msm_fb_data_type *mfd,
struct msmfb_writeback_data_list **wfdnode)
{
struct vsycn_ctrl *vctrl;
struct mdp4_overlay_pipe *pipe;
struct msmfb_writeback_data_list *node = NULL;
if (mfd && !mfd->panel_power_on)
return;
pr_debug("%s:+ mfd=%x\n", __func__, (int)mfd);
vctrl = &vsync_ctrl_db[0];
pipe = vctrl->base_pipe;
mutex_lock(&mfd->unregister_mutex);
mutex_lock(&mfd->writeback_mutex);
if (!list_empty(&mfd->writeback_free_queue)
&& mfd->writeback_state != WB_STOPING
&& mfd->writeback_state != WB_STOP) {
node = list_first_entry(&mfd->writeback_free_queue,
struct msmfb_writeback_data_list, active_entry);
}
if (node) {
list_del(&(node->active_entry));
node->state = IN_BUSY_QUEUE;
mfd->writeback_active_cnt++;
}
mutex_unlock(&mfd->writeback_mutex);
pipe->ov_blt_addr = (ulong) (node ? node->addr : NULL);
if (!pipe->ov_blt_addr) {
pr_err("%s: no writeback buffer 0x%x, %p\n", __func__,
(unsigned int)pipe->ov_blt_addr, node);
mutex_unlock(&mfd->unregister_mutex);
return;
}
mdp4_overlay_writeback_update(mfd);
*wfdnode = node;
mutex_unlock(&mfd->unregister_mutex);
}
static void mdp4_wfd_queue_wakeup(struct msm_fb_data_type *mfd,
struct msmfb_writeback_data_list *node)
{
if (mfd && !mfd->panel_power_on)
return;
if (node == NULL)
return;
pr_debug("%s: mfd=%x node: %p", __func__, (int)mfd, node);
mutex_lock(&mfd->writeback_mutex);
list_add_tail(&node->active_entry, &mfd->writeback_busy_queue);
mfd->writeback_active_cnt--;
mutex_unlock(&mfd->writeback_mutex);
wake_up(&mfd->wait_q);
}

View file

@ -71,7 +71,6 @@
#define MSMFB_OVERLAY_VSYNC_CTRL _IOW(MSMFB_IOCTL_MAGIC, 160, unsigned int)
#define MSMFB_VSYNC_CTRL _IOW(MSMFB_IOCTL_MAGIC, 161, unsigned int)
#define MSMFB_BUFFER_SYNC _IOW(MSMFB_IOCTL_MAGIC, 162, struct mdp_buf_sync)
#define MSMFB_DISPLAY_COMMIT _IOW(MSMFB_IOCTL_MAGIC, 164, \
struct mdp_display_commit)