msm: mdp: Update sync pt. behaviour
Add a retire fence and clean up the existing release fence implementation Signed-off-by: Naseer Ahmed <naseer@codeaurora.org> Change-Id: Iecf7e95d0786ac43aa6a12d70442936600c0249a
This commit is contained in:
committed by
Iliyan Malchev
parent
3482311e76
commit
3ff9b8e96a
@@ -1864,8 +1864,6 @@ int msm_fb_signal_timeline(struct msm_fb_data_type *mfd)
|
|||||||
sw_sync_timeline_inc(mfd->timeline, 1);
|
sw_sync_timeline_inc(mfd->timeline, 1);
|
||||||
mfd->timeline_value++;
|
mfd->timeline_value++;
|
||||||
}
|
}
|
||||||
mfd->last_rel_fence = mfd->cur_rel_fence;
|
|
||||||
mfd->cur_rel_fence = 0;
|
|
||||||
if (atomic_read(&mfd->commit_cnt) > 0)
|
if (atomic_read(&mfd->commit_cnt) > 0)
|
||||||
atomic_dec(&mfd->commit_cnt);
|
atomic_dec(&mfd->commit_cnt);
|
||||||
mutex_unlock(&mfd->sync_mutex);
|
mutex_unlock(&mfd->sync_mutex);
|
||||||
@@ -1876,15 +1874,13 @@ void msm_fb_release_timeline(struct msm_fb_data_type *mfd)
|
|||||||
{
|
{
|
||||||
u32 commit_cnt;
|
u32 commit_cnt;
|
||||||
mutex_lock(&mfd->sync_mutex);
|
mutex_lock(&mfd->sync_mutex);
|
||||||
commit_cnt = atomic_read(&mfd->commit_cnt) + 2;
|
commit_cnt = atomic_read(&mfd->commit_cnt) + 3;
|
||||||
if (commit_cnt < 0)
|
if (commit_cnt < 0)
|
||||||
commit_cnt = 0;
|
commit_cnt = 0;
|
||||||
if (mfd->timeline) {
|
if (mfd->timeline) {
|
||||||
sw_sync_timeline_inc(mfd->timeline, 2 + commit_cnt);
|
sw_sync_timeline_inc(mfd->timeline, 2 + commit_cnt);
|
||||||
mfd->timeline_value += 2 + commit_cnt;
|
mfd->timeline_value += 2 + commit_cnt;
|
||||||
}
|
}
|
||||||
mfd->last_rel_fence = 0;
|
|
||||||
mfd->cur_rel_fence = 0;
|
|
||||||
atomic_set(&mfd->commit_cnt, 0);
|
atomic_set(&mfd->commit_cnt, 0);
|
||||||
mutex_unlock(&mfd->sync_mutex);
|
mutex_unlock(&mfd->sync_mutex);
|
||||||
}
|
}
|
||||||
@@ -3724,6 +3720,12 @@ static int msmfb_handle_buf_sync_ioctl(struct msm_fb_data_type *mfd,
|
|||||||
u32 threshold;
|
u32 threshold;
|
||||||
int acq_fen_fd[MDP_MAX_FENCE_FD];
|
int acq_fen_fd[MDP_MAX_FENCE_FD];
|
||||||
struct sync_fence *fence;
|
struct sync_fence *fence;
|
||||||
|
struct sync_pt *release_sync_pt;
|
||||||
|
struct sync_pt *retire_sync_pt;
|
||||||
|
struct sync_fence *release_fence;
|
||||||
|
struct sync_fence *retire_fence;
|
||||||
|
int release_fen_fd;
|
||||||
|
int retire_fen_fd;
|
||||||
|
|
||||||
if ((buf_sync->acq_fen_fd_cnt > MDP_MAX_FENCE_FD) ||
|
if ((buf_sync->acq_fen_fd_cnt > MDP_MAX_FENCE_FD) ||
|
||||||
(mfd->timeline == NULL))
|
(mfd->timeline == NULL))
|
||||||
@@ -3761,46 +3763,56 @@ static int msmfb_handle_buf_sync_ioctl(struct msm_fb_data_type *mfd,
|
|||||||
threshold = 1;
|
threshold = 1;
|
||||||
else
|
else
|
||||||
threshold = 2;
|
threshold = 2;
|
||||||
mfd->cur_rel_sync_pt = sw_sync_pt_create(mfd->timeline,
|
|
||||||
mfd->timeline_value + threshold +
|
release_fen_fd = get_unused_fd_flags(0);
|
||||||
atomic_read(&mfd->commit_cnt));
|
if (release_fen_fd < 0) {
|
||||||
if (mfd->cur_rel_sync_pt == NULL) {
|
pr_err("%s: get_unused_fd_flags failed", __func__);
|
||||||
pr_err("%s: cannot create sync point", __func__);
|
ret = -EIO;
|
||||||
ret = -ENOMEM;
|
|
||||||
goto buf_sync_err_1;
|
goto buf_sync_err_1;
|
||||||
}
|
}
|
||||||
/* create fence */
|
|
||||||
mfd->cur_rel_fence = sync_fence_create("mdp-fence",
|
retire_fen_fd = get_unused_fd_flags(0);
|
||||||
mfd->cur_rel_sync_pt);
|
if (retire_fen_fd < 0) {
|
||||||
if (mfd->cur_rel_fence == NULL) {
|
|
||||||
sync_pt_free(mfd->cur_rel_sync_pt);
|
|
||||||
mfd->cur_rel_sync_pt = NULL;
|
|
||||||
pr_err("%s: cannot create fence", __func__);
|
|
||||||
ret = -ENOMEM;
|
|
||||||
goto buf_sync_err_1;
|
|
||||||
}
|
|
||||||
/* create fd */
|
|
||||||
mfd->cur_rel_fen_fd = get_unused_fd_flags(0);
|
|
||||||
if (mfd->cur_rel_fen_fd < 0) {
|
|
||||||
pr_err("%s: get_unused_fd_flags failed", __func__);
|
pr_err("%s: get_unused_fd_flags failed", __func__);
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
goto buf_sync_err_2;
|
goto buf_sync_err_2;
|
||||||
}
|
}
|
||||||
sync_fence_install(mfd->cur_rel_fence, mfd->cur_rel_fen_fd);
|
|
||||||
|
release_sync_pt = sw_sync_pt_create(mfd->timeline,
|
||||||
|
mfd->timeline_value + threshold +
|
||||||
|
atomic_read(&mfd->commit_cnt));
|
||||||
|
release_fence = sync_fence_create("mdp-fence",
|
||||||
|
release_sync_pt);
|
||||||
|
sync_fence_install(release_fence, release_fen_fd);
|
||||||
|
retire_sync_pt = sw_sync_pt_create(mfd->timeline,
|
||||||
|
mfd->timeline_value + threshold +
|
||||||
|
atomic_read(&mfd->commit_cnt) + 1);
|
||||||
|
retire_fence = sync_fence_create("mdp-retire-fence",
|
||||||
|
retire_sync_pt);
|
||||||
|
sync_fence_install(retire_fence, retire_fen_fd);
|
||||||
|
|
||||||
ret = copy_to_user(buf_sync->rel_fen_fd,
|
ret = copy_to_user(buf_sync->rel_fen_fd,
|
||||||
&mfd->cur_rel_fen_fd, sizeof(int));
|
&release_fen_fd, sizeof(int));
|
||||||
if (ret) {
|
if (ret) {
|
||||||
pr_err("%s:copy_to_user failed", __func__);
|
pr_err("%s:copy_to_user failed", __func__);
|
||||||
goto buf_sync_err_3;
|
goto buf_sync_err_3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = copy_to_user(buf_sync->retire_fen_fd,
|
||||||
|
&retire_fen_fd, sizeof(int));
|
||||||
|
if (ret) {
|
||||||
|
pr_err("%s:copy_to_user failed", __func__);
|
||||||
|
goto buf_sync_err_3;
|
||||||
|
}
|
||||||
|
|
||||||
mutex_unlock(&mfd->sync_mutex);
|
mutex_unlock(&mfd->sync_mutex);
|
||||||
return ret;
|
return ret;
|
||||||
buf_sync_err_3:
|
buf_sync_err_3:
|
||||||
put_unused_fd(mfd->cur_rel_fen_fd);
|
sync_fence_put(release_fence);
|
||||||
|
sync_fence_put(retire_fence);
|
||||||
|
put_unused_fd(retire_fen_fd);
|
||||||
buf_sync_err_2:
|
buf_sync_err_2:
|
||||||
sync_fence_put(mfd->cur_rel_fence);
|
put_unused_fd(release_fen_fd);
|
||||||
mfd->cur_rel_fence = NULL;
|
|
||||||
mfd->cur_rel_fen_fd = 0;
|
|
||||||
buf_sync_err_1:
|
buf_sync_err_1:
|
||||||
for (i = 0; i < mfd->acq_fen_cnt; i++)
|
for (i = 0; i < mfd->acq_fen_cnt; i++)
|
||||||
sync_fence_put(mfd->acq_fen[i]);
|
sync_fence_put(mfd->acq_fen[i]);
|
||||||
|
|||||||
@@ -199,14 +199,8 @@ struct msm_fb_data_type {
|
|||||||
void *cpu_pm_hdl;
|
void *cpu_pm_hdl;
|
||||||
u32 acq_fen_cnt;
|
u32 acq_fen_cnt;
|
||||||
struct sync_fence *acq_fen[MDP_MAX_FENCE_FD];
|
struct sync_fence *acq_fen[MDP_MAX_FENCE_FD];
|
||||||
int cur_rel_fen_fd;
|
|
||||||
struct sync_pt *cur_rel_sync_pt;
|
|
||||||
struct sync_fence *cur_rel_fence;
|
|
||||||
struct sync_fence *last_rel_fence;
|
|
||||||
struct sw_sync_timeline *timeline;
|
struct sw_sync_timeline *timeline;
|
||||||
int timeline_value;
|
int timeline_value;
|
||||||
u32 last_acq_fen_cnt;
|
|
||||||
struct sync_fence *last_acq_fen[MDP_MAX_FENCE_FD];
|
|
||||||
struct mutex sync_mutex;
|
struct mutex sync_mutex;
|
||||||
struct mutex queue_mutex;
|
struct mutex queue_mutex;
|
||||||
struct completion commit_comp;
|
struct completion commit_comp;
|
||||||
|
|||||||
@@ -573,13 +573,7 @@ struct mdp_buf_sync {
|
|||||||
uint32_t acq_fen_fd_cnt;
|
uint32_t acq_fen_fd_cnt;
|
||||||
int *acq_fen_fd;
|
int *acq_fen_fd;
|
||||||
int *rel_fen_fd;
|
int *rel_fen_fd;
|
||||||
};
|
int *retire_fen_fd;
|
||||||
|
|
||||||
struct mdp_buf_fence {
|
|
||||||
uint32_t flags;
|
|
||||||
uint32_t acq_fen_fd_cnt;
|
|
||||||
int acq_fen_fd[MDP_MAX_FENCE_FD];
|
|
||||||
int rel_fen_fd[MDP_MAX_FENCE_FD];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MDP_DISPLAY_COMMIT_OVERLAY 0x00000001
|
#define MDP_DISPLAY_COMMIT_OVERLAY 0x00000001
|
||||||
|
|||||||
Reference in New Issue
Block a user