Revert "msm: mdp: Update sync pt. behaviour"

* Commit "egl: Avoid use of retire as present"
    in frameworks/native deprecated the use
    of retire fence, therefore retire fence
    support has to be removed from the kernel
    to allow HWC2on1Adapter support

This reverts commit fd75d86c883b7a6852d8d291b58203b0999a1584.
Change-Id: I19877296ac762e4d5c3162843ccaf5cc9a88ff1c
Signed-off-by: Adrian DC <radian.dc@gmail.com>
This commit is contained in:
Arne Coucheron 2018-08-10 16:31:26 +02:00 committed by Artem Borisov
parent a4b9cf707b
commit f715505de6
3 changed files with 43 additions and 43 deletions

View file

@ -2084,6 +2084,8 @@ int msm_fb_signal_timeline(struct msm_fb_data_type *mfd)
sw_sync_timeline_inc(mfd->timeline, 1);
mfd->timeline_value++;
}
mfd->last_rel_fence = mfd->cur_rel_fence;
mfd->cur_rel_fence = 0;
if (atomic_read(&mfd->commit_cnt) > 0)
atomic_dec(&mfd->commit_cnt);
mutex_unlock(&mfd->sync_mutex);
@ -2094,13 +2096,15 @@ void msm_fb_release_timeline(struct msm_fb_data_type *mfd)
{
u32 commit_cnt;
mutex_lock(&mfd->sync_mutex);
commit_cnt = atomic_read(&mfd->commit_cnt) + 3;
commit_cnt = atomic_read(&mfd->commit_cnt) + 2;
if (commit_cnt < 0)
commit_cnt = 0;
if (mfd->timeline) {
sw_sync_timeline_inc(mfd->timeline, 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);
mutex_unlock(&mfd->sync_mutex);
}
@ -3945,12 +3949,6 @@ static int msmfb_handle_buf_sync_ioctl(struct msm_fb_data_type *mfd,
u32 threshold;
int acq_fen_fd[MDP_MAX_FENCE_FD];
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) ||
(mfd->timeline == NULL))
@ -3988,56 +3986,46 @@ static int msmfb_handle_buf_sync_ioctl(struct msm_fb_data_type *mfd,
threshold = 1;
else
threshold = 2;
release_fen_fd = get_unused_fd_flags(0);
if (release_fen_fd < 0) {
pr_err("%s: get_unused_fd_flags failed", __func__);
ret = -EIO;
mfd->cur_rel_sync_pt = sw_sync_pt_create(mfd->timeline,
mfd->timeline_value + threshold +
atomic_read(&mfd->commit_cnt));
if (mfd->cur_rel_sync_pt == NULL) {
pr_err("%s: cannot create sync point", __func__);
ret = -ENOMEM;
goto buf_sync_err_1;
}
retire_fen_fd = get_unused_fd_flags(0);
if (retire_fen_fd < 0) {
/* create fence */
mfd->cur_rel_fence = sync_fence_create("mdp-fence",
mfd->cur_rel_sync_pt);
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__);
ret = -EIO;
goto buf_sync_err_2;
}
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);
sync_fence_install(mfd->cur_rel_fence, mfd->cur_rel_fen_fd);
ret = copy_to_user(buf_sync->rel_fen_fd,
&release_fen_fd, sizeof(int));
&mfd->cur_rel_fen_fd, sizeof(int));
if (ret) {
pr_err("%s:copy_to_user failed", __func__);
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);
return ret;
buf_sync_err_3:
sync_fence_put(release_fence);
sync_fence_put(retire_fence);
put_unused_fd(retire_fen_fd);
put_unused_fd(mfd->cur_rel_fen_fd);
buf_sync_err_2:
put_unused_fd(release_fen_fd);
sync_fence_put(mfd->cur_rel_fence);
mfd->cur_rel_fence = NULL;
mfd->cur_rel_fen_fd = 0;
buf_sync_err_1:
for (i = 0; i < mfd->acq_fen_cnt; i++)
sync_fence_put(mfd->acq_fen[i]);

View file

@ -205,8 +205,14 @@ struct msm_fb_data_type {
void *cpu_pm_hdl;
u32 acq_fen_cnt;
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;
int timeline_value;
u32 last_acq_fen_cnt;
struct sync_fence *last_acq_fen[MDP_MAX_FENCE_FD];
struct mutex sync_mutex;
struct mutex queue_mutex;
struct completion commit_comp;

View file

@ -573,7 +573,13 @@ struct mdp_buf_sync {
uint32_t acq_fen_fd_cnt;
int *acq_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