summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2019-07-24 13:31:10 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2019-07-24 13:31:10 -0700
commit9401ae085688cc18db703b0e13af47aea9b177b4 (patch)
treedcc84426b50401ab2a5d27369a695d438ad77aeb
parent63241ff58504735418770b32f968374b14672233 (diff)
parent48b52acae3d0bc5307591f947fa731b1ae8eed33 (diff)
Merge "msm: camera_v2: isp: handle frame drop in error case"
-rw-r--r--drivers/media/platform/msm/camera_v2/isp/msm_isp_axi_util.c63
1 files changed, 52 insertions, 11 deletions
diff --git a/drivers/media/platform/msm/camera_v2/isp/msm_isp_axi_util.c b/drivers/media/platform/msm/camera_v2/isp/msm_isp_axi_util.c
index 706fd8a023ad..f021707a53cd 100644
--- a/drivers/media/platform/msm/camera_v2/isp/msm_isp_axi_util.c
+++ b/drivers/media/platform/msm/camera_v2/isp/msm_isp_axi_util.c
@@ -2051,6 +2051,8 @@ static int msm_isp_cfg_ping_pong_address(
if (!buf) {
msm_isp_cfg_stream_scratch(stream_info, pingpong_status);
+ if (stream_info->controllable_output)
+ return 1;
return 0;
}
@@ -2723,7 +2725,11 @@ int msm_isp_axi_reset(struct vfe_device *vfe_dev,
struct msm_isp_timestamp timestamp;
struct msm_vfe_frame_request_queue *queue_req;
unsigned long flags;
+ uint32_t pingpong_status;
int vfe_idx;
+ uint32_t pingpong_bit = 0;
+ uint32_t frame_id = 0;
+ struct timeval *time_stamp;
if (!reset_cmd) {
pr_err("%s: NULL pointer reset cmd %pK\n", __func__, reset_cmd);
@@ -2732,6 +2738,7 @@ int msm_isp_axi_reset(struct vfe_device *vfe_dev,
}
msm_isp_get_timestamp(&timestamp, vfe_dev);
+ time_stamp = &timestamp.buf_time;
for (i = 0; i < VFE_AXI_SRC_MAX; i++) {
stream_info = msm_isp_get_stream_common_data(
@@ -2754,6 +2761,28 @@ int msm_isp_axi_reset(struct vfe_device *vfe_dev,
/* set ping pong to scratch before flush */
spin_lock_irqsave(&stream_info->lock, flags);
+ frame_id = vfe_dev->axi_data.src_info[VFE_PIX_0].frame_id;
+ if (stream_info->controllable_output &&
+ stream_info->undelivered_request_cnt > 0) {
+ pingpong_status = VFE_PING_FLAG;
+ pingpong_bit = (~(pingpong_status >>
+ stream_info->wm[0][0]) & 0x1);
+ if (stream_info->buf[pingpong_bit] != NULL) {
+ msm_isp_process_done_buf(vfe_dev, stream_info,
+ stream_info->buf[pingpong_bit],
+ time_stamp,
+ frame_id);
+ }
+ pingpong_status = VFE_PONG_FLAG;
+ pingpong_bit = (~(pingpong_status >>
+ stream_info->wm[0][0]) & 0x1);
+ if (stream_info->buf[pingpong_bit] != NULL) {
+ msm_isp_process_done_buf(vfe_dev, stream_info,
+ stream_info->buf[pingpong_bit],
+ time_stamp,
+ frame_id);
+ }
+ }
msm_isp_cfg_stream_scratch(stream_info,
VFE_PING_FLAG);
msm_isp_cfg_stream_scratch(stream_info,
@@ -3262,9 +3291,8 @@ static int msm_isp_start_axi_stream(struct vfe_device *vfe_dev_ioctl,
msm_isp_reset_framedrop(vfe_dev_ioctl, stream_info);
rc = msm_isp_init_stream_ping_pong_reg(stream_info);
if (rc < 0) {
- pr_err("%s: No buffer for stream%d\n", __func__,
- HANDLE_TO_IDX(
- stream_cfg_cmd->stream_handle[i]));
+ pr_err("%s: No buffer for stream%x\n", __func__,
+ stream_info->stream_id);
spin_unlock_irqrestore(&stream_info->lock, flags);
mutex_unlock(&vfe_dev_ioctl->buf_mgr->lock);
goto error;
@@ -3713,11 +3741,16 @@ static int msm_isp_request_frame(struct vfe_device *vfe_dev,
if (rc) {
spin_unlock_irqrestore(&stream_info->lock, flags);
stream_info->undelivered_request_cnt--;
- pr_err_ratelimited("%s:%d fail to cfg HAL buffer\n",
- __func__, __LINE__);
- queue_req->cmd_used = 0;
- list_del(&queue_req->list);
- stream_info->request_q_cnt--;
+ queue_req = list_first_entry_or_null(
+ &stream_info->request_q,
+ struct msm_vfe_frame_request_queue, list);
+ if (queue_req) {
+ queue_req->cmd_used = 0;
+ list_del(&queue_req->list);
+ stream_info->request_q_cnt--;
+ }
+ pr_err_ratelimited("%s:%d fail to cfg HAL buffer stream %x\n",
+ __func__, __LINE__, stream_info->stream_id);
return rc;
}
@@ -3754,11 +3787,16 @@ static int msm_isp_request_frame(struct vfe_device *vfe_dev,
stream_info->undelivered_request_cnt--;
spin_unlock_irqrestore(&stream_info->lock,
flags);
+ queue_req = list_first_entry_or_null(
+ &stream_info->request_q,
+ struct msm_vfe_frame_request_queue, list);
+ if (queue_req) {
+ queue_req->cmd_used = 0;
+ list_del(&queue_req->list);
+ stream_info->request_q_cnt--;
+ }
pr_err_ratelimited("%s:%d fail to cfg HAL buffer\n",
__func__, __LINE__);
- queue_req->cmd_used = 0;
- list_del(&queue_req->list);
- stream_info->request_q_cnt--;
return rc;
}
} else {
@@ -4352,7 +4390,10 @@ void msm_isp_process_axi_irq_stream(struct vfe_device *vfe_dev,
frame_id_diff = vfe_dev->irq_sof_id - frame_id;
if (stream_info->controllable_output && frame_id_diff > 1) {
+ pr_err_ratelimited("%s: scheduling problem do recovery irq_sof_id %d frame_id %d\n",
+ __func__, vfe_dev->irq_sof_id, frame_id);
/* scheduling problem need to do recovery */
+ stream_info->buf[pingpong_bit] = done_buf;
spin_unlock_irqrestore(&stream_info->lock, flags);
msm_isp_halt_send_error(vfe_dev,
ISP_EVENT_PING_PONG_MISMATCH);