msm: display: buf sync enhancement

Support waiting for acquire fences in the buffer sync ioctl.

Signed-off-by: Ken Zhang <kenz@codeaurora.org>
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
This commit is contained in:
Naseer Ahmed 2012-10-02 21:00:10 -04:00 committed by Iliyan Malchev
parent 504021da52
commit 8b804aaf0b
2 changed files with 10 additions and 6 deletions

View file

@ -3525,17 +3525,17 @@ static int msmfb_handle_pp_ioctl(struct msm_fb_data_type *mfd,
static int msmfb_handle_buf_sync_ioctl(struct msm_fb_data_type *mfd,
struct mdp_buf_sync *buf_sync)
{
int i, fence_cnt = 0, ret;
int i, fence_cnt = 0, ret = 0;
int acq_fen_fd[MDP_MAX_FENCE_FD];
struct sync_fence *fence;
if ((buf_sync->acq_fen_fd_cnt == 0) ||
(buf_sync->acq_fen_fd_cnt > MDP_MAX_FENCE_FD) ||
if ((buf_sync->acq_fen_fd_cnt > MDP_MAX_FENCE_FD) ||
(mfd->timeline == NULL))
return -EINVAL;
ret = copy_from_user(acq_fen_fd, buf_sync->acq_fen_fd,
buf_sync->acq_fen_fd_cnt * sizeof(int));
if (buf_sync->acq_fen_fd_cnt)
ret = copy_from_user(acq_fen_fd, buf_sync->acq_fen_fd,
buf_sync->acq_fen_fd_cnt * sizeof(int));
if (ret) {
pr_err("%s:copy_from_user failed", __func__);
return ret;
@ -3554,6 +3554,10 @@ static int msmfb_handle_buf_sync_ioctl(struct msm_fb_data_type *mfd,
fence_cnt = i;
if (ret)
goto buf_sync_err_1;
mfd->acq_fen_cnt = fence_cnt;
if (buf_sync->flags & MDP_BUF_SYNC_FLAG_WAIT) {
msm_fb_wait_for_fence(mfd);
}
mfd->cur_rel_sync_pt = sw_sync_pt_create(mfd->timeline,
mfd->timeline_value + 2);
if (mfd->cur_rel_sync_pt == NULL) {
@ -3580,7 +3584,6 @@ static int msmfb_handle_buf_sync_ioctl(struct msm_fb_data_type *mfd,
pr_err("%s:copy_to_user failed", __func__);
goto buf_sync_err_2;
}
mfd->acq_fen_cnt = buf_sync->acq_fen_fd_cnt;
mutex_unlock(&mfd->sync_mutex);
return ret;
buf_sync_err_2:

View file

@ -490,6 +490,7 @@ struct msmfb_mdp_pp {
};
#define MDP_MAX_FENCE_FD 10
#define MDP_BUF_SYNC_FLAG_WAIT 1
struct mdp_buf_sync {
uint32_t flags;