mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
msm: display: sync point clean up
Remove unused fence input in mdp_display_commit structure Use different timeline name for different fb Change-Id: I4edd335b36dce057ff3e54302af6088a9cc470ec Signed-off-by: Ken Zhang <kenz@codeaurora.org>
This commit is contained in:
parent
9044dea422
commit
d614c3611e
3 changed files with 33 additions and 104 deletions
|
@ -3,7 +3,7 @@
|
|||
* Core MSM framebuffer driver.
|
||||
*
|
||||
* Copyright (C) 2007 Google Incorporated
|
||||
* Copyright (c) 2008-2012, Code Aurora Forum. All rights reserved.
|
||||
* Copyright (c) 2008-2013, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
|
@ -125,6 +125,7 @@ static int msm_fb_pan_idle(struct msm_fb_data_type *mfd);
|
|||
#define WAIT_FENCE_TIMEOUT 800
|
||||
/* 900 ms for display operation time out */
|
||||
#define WAIT_DISP_OP_TIMEOUT 900
|
||||
#define MAX_TIMELINE_NAME_LEN 16
|
||||
|
||||
int msm_fb_debugfs_file_index;
|
||||
struct dentry *msm_fb_debugfs_root;
|
||||
|
@ -424,7 +425,10 @@ static int msm_fb_probe(struct platform_device *pdev)
|
|||
pdev_list[pdev_list_cnt++] = pdev;
|
||||
msm_fb_create_sysfs(pdev);
|
||||
if (mfd->timeline == NULL) {
|
||||
mfd->timeline = sw_sync_timeline_create("mdp-timeline");
|
||||
char timeline_name[MAX_TIMELINE_NAME_LEN];
|
||||
snprintf(timeline_name, sizeof(timeline_name),
|
||||
"mdp_fb_%d", mfd->index);
|
||||
mfd->timeline = sw_sync_timeline_create(timeline_name);
|
||||
if (mfd->timeline == NULL) {
|
||||
pr_err("%s: cannot create time line", __func__);
|
||||
return -ENOMEM;
|
||||
|
@ -952,17 +956,7 @@ static int msm_fb_blank_sub(int blank_mode, struct fb_info *info,
|
|||
if (ret)
|
||||
mfd->panel_power_on = curr_pwr_state;
|
||||
|
||||
if (mfd->timeline) {
|
||||
/* Adding 1 is enough when pan_display is still
|
||||
* a blocking call and with mutex protection.
|
||||
* But if it is an async call, we will still
|
||||
* need to add 2. Adding 2 can be safer in
|
||||
* order to signal all existing fences, and it
|
||||
* is harmless. */
|
||||
sw_sync_timeline_inc(mfd->timeline, 2);
|
||||
mfd->timeline_value+= 2;
|
||||
}
|
||||
|
||||
msm_fb_release_timeline(mfd);
|
||||
mfd->op_enable = TRUE;
|
||||
}
|
||||
break;
|
||||
|
@ -1774,7 +1768,7 @@ static int msm_fb_release(struct fb_info *info, int user)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int msm_fb_wait_for_fence(struct msm_fb_data_type *mfd)
|
||||
void msm_fb_wait_for_fence(struct msm_fb_data_type *mfd)
|
||||
{
|
||||
int i, ret = 0;
|
||||
/* buf sync */
|
||||
|
@ -1787,8 +1781,13 @@ int msm_fb_wait_for_fence(struct msm_fb_data_type *mfd)
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (ret < 0) {
|
||||
while (i < mfd->acq_fen_cnt) {
|
||||
sync_fence_put(mfd->acq_fen[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
mfd->acq_fen_cnt = 0;
|
||||
return ret;
|
||||
}
|
||||
int msm_fb_signal_timeline(struct msm_fb_data_type *mfd)
|
||||
{
|
||||
|
@ -1803,6 +1802,18 @@ int msm_fb_signal_timeline(struct msm_fb_data_type *mfd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void msm_fb_release_timeline(struct msm_fb_data_type *mfd)
|
||||
{
|
||||
mutex_lock(&mfd->sync_mutex);
|
||||
if (mfd->timeline) {
|
||||
sw_sync_timeline_inc(mfd->timeline, 2);
|
||||
mfd->timeline_value += 2;
|
||||
}
|
||||
mfd->last_rel_fence = 0;
|
||||
mfd->cur_rel_fence = 0;
|
||||
mutex_unlock(&mfd->sync_mutex);
|
||||
}
|
||||
|
||||
DEFINE_SEMAPHORE(msm_fb_pan_sem);
|
||||
static int msm_fb_pan_idle(struct msm_fb_data_type *mfd)
|
||||
{
|
||||
|
@ -1985,10 +1996,7 @@ static int msm_fb_pan_display_sub(struct fb_var_screeninfo *var,
|
|||
if (msm_fb_blank_sub(FB_BLANK_UNBLANK, info, mfd->op_enable)) {
|
||||
pr_err("%s: can't turn on display!\n", __func__);
|
||||
up(&msm_fb_pan_sem);
|
||||
if (mfd->timeline) {
|
||||
sw_sync_timeline_inc(mfd->timeline, 2);
|
||||
mfd->timeline_value+= 2;
|
||||
}
|
||||
msm_fb_release_timeline(mfd);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
@ -3560,6 +3568,7 @@ static int msmfb_handle_pp_ioctl(struct msm_fb_data_type *mfd,
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int msmfb_handle_buf_sync_ioctl(struct msm_fb_data_type *mfd,
|
||||
struct mdp_buf_sync *buf_sync)
|
||||
{
|
||||
|
@ -3646,103 +3655,23 @@ buf_sync_err_1:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int buf_fence_process(struct msm_fb_data_type *mfd,
|
||||
struct mdp_buf_fence *buf_fence)
|
||||
{
|
||||
int i, fence_cnt = 0, ret;
|
||||
struct sync_fence *fence;
|
||||
|
||||
if ((buf_fence->acq_fen_fd_cnt == 0) ||
|
||||
(buf_fence->acq_fen_fd_cnt > MDP_MAX_FENCE_FD) ||
|
||||
(mfd->timeline == NULL))
|
||||
return -EINVAL;
|
||||
|
||||
mutex_lock(&mfd->sync_mutex);
|
||||
for (i = 0; i < buf_fence->acq_fen_fd_cnt; i++) {
|
||||
fence = sync_fence_fdget(buf_fence->acq_fen_fd[i]);
|
||||
if (fence == NULL) {
|
||||
pr_info("%s: null fence! i=%d fd=%d\n", __func__, i,
|
||||
buf_fence->acq_fen_fd[i]);
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
mfd->acq_fen[i] = fence;
|
||||
}
|
||||
fence_cnt = i;
|
||||
if (ret)
|
||||
goto buf_fence_err_1;
|
||||
mfd->cur_rel_sync_pt = sw_sync_pt_create(mfd->timeline,
|
||||
mfd->timeline_value + 2);
|
||||
if (mfd->cur_rel_sync_pt == NULL) {
|
||||
pr_err("%s: cannot create sync point", __func__);
|
||||
ret = -ENOMEM;
|
||||
goto buf_fence_err_1;
|
||||
}
|
||||
/* 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_fence_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_fence_err_2;
|
||||
}
|
||||
sync_fence_install(mfd->cur_rel_fence, mfd->cur_rel_fen_fd);
|
||||
buf_fence->rel_fen_fd[0] = mfd->cur_rel_fen_fd;
|
||||
/* Only one released fd for now, -1 indicates an end */
|
||||
buf_fence->rel_fen_fd[1] = -1;
|
||||
mfd->acq_fen_cnt = buf_fence->acq_fen_fd_cnt;
|
||||
mutex_unlock(&mfd->sync_mutex);
|
||||
return ret;
|
||||
buf_fence_err_2:
|
||||
sync_fence_put(mfd->cur_rel_fence);
|
||||
mfd->cur_rel_fence = NULL;
|
||||
mfd->cur_rel_fen_fd = 0;
|
||||
buf_fence_err_1:
|
||||
for (i = 0; i < fence_cnt; i++)
|
||||
sync_fence_put(mfd->acq_fen[i]);
|
||||
mfd->acq_fen_cnt = 0;
|
||||
mutex_unlock(&mfd->sync_mutex);
|
||||
return ret;
|
||||
}
|
||||
static int msmfb_display_commit(struct fb_info *info,
|
||||
unsigned long *argp)
|
||||
{
|
||||
int ret;
|
||||
u32 copy_back = FALSE;
|
||||
struct msm_fb_data_type *mfd = (struct msm_fb_data_type *)info->par;
|
||||
struct mdp_display_commit disp_commit;
|
||||
struct mdp_buf_fence *buf_fence;
|
||||
ret = copy_from_user(&disp_commit, argp,
|
||||
sizeof(disp_commit));
|
||||
if (ret) {
|
||||
pr_err("%s:copy_from_user failed", __func__);
|
||||
return ret;
|
||||
}
|
||||
buf_fence = &disp_commit.buf_fence;
|
||||
if (buf_fence->acq_fen_fd_cnt > 0)
|
||||
ret = buf_fence_process(mfd, buf_fence);
|
||||
if ((!ret) && (buf_fence->rel_fen_fd[0] > 0))
|
||||
copy_back = TRUE;
|
||||
|
||||
ret = msm_fb_pan_display_ex(info, &disp_commit);
|
||||
|
||||
if (copy_back) {
|
||||
ret = copy_to_user(argp,
|
||||
&disp_commit, sizeof(disp_commit));
|
||||
if (ret)
|
||||
pr_err("%s:copy_to_user failed", __func__);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int msm_fb_ioctl(struct fb_info *info, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2008-2012, Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2008-2013, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -231,8 +231,9 @@ int msm_fb_writeback_stop(struct fb_info *info);
|
|||
int msm_fb_writeback_terminate(struct fb_info *info);
|
||||
int msm_fb_detect_client(const char *name);
|
||||
int calc_fb_offset(struct msm_fb_data_type *mfd, struct fb_info *fbi, int bpp);
|
||||
int msm_fb_wait_for_fence(struct msm_fb_data_type *mfd);
|
||||
void msm_fb_wait_for_fence(struct msm_fb_data_type *mfd);
|
||||
int msm_fb_signal_timeline(struct msm_fb_data_type *mfd);
|
||||
void msm_fb_release_timeline(struct msm_fb_data_type *mfd);
|
||||
#ifdef CONFIG_FB_BACKLIGHT
|
||||
void msm_fb_config_backlight(struct msm_fb_data_type *mfd);
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* include/linux/msm_mdp.h
|
||||
*
|
||||
* Copyright (C) 2007 Google Incorporated
|
||||
* Copyright (c) 2012 Code Aurora Forum. All rights reserved.
|
||||
* Copyright (c) 2013 Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
|
@ -519,7 +519,6 @@ struct mdp_display_commit {
|
|||
uint32_t flags;
|
||||
uint32_t wait_for_finish;
|
||||
struct fb_var_screeninfo var;
|
||||
struct mdp_buf_fence buf_fence;
|
||||
};
|
||||
|
||||
struct mdp_page_protection {
|
||||
|
|
Loading…
Reference in a new issue