From 07869d3af88571cfcc040379981dc14ac91c1178 Mon Sep 17 00:00:00 2001 From: Abhishek Kondaveeti Date: Thu, 27 Apr 2017 09:51:19 +0530 Subject: [PATCH] msm: isp: Fix pdaf buffer drop Use common data accessible to both ISPs to store pdaf buffer index Change-Id: I27d33eaa8bc517250503bdb0e9267e94180a99f0 Signed-off-by: Abhishek Kondaveeti --- drivers/media/platform/msm/camera_v2/isp/msm_isp.h | 3 +-- drivers/media/platform/msm/camera_v2/isp/msm_isp_axi_util.c | 9 +++++++-- drivers/media/platform/msm/camera_v2/isp/msm_isp_stats_util.c | 8 ++++++-- drivers/media/platform/msm/camera_v2/isp/msm_isp_util.c | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/msm/camera_v2/isp/msm_isp.h b/drivers/media/platform/msm/camera_v2/isp/msm_isp.h index b283f6277b87..6525dac353fd 100644 --- a/drivers/media/platform/msm/camera_v2/isp/msm_isp.h +++ b/drivers/media/platform/msm/camera_v2/isp/msm_isp.h @@ -738,6 +738,7 @@ struct msm_vfe_common_dev_data { struct msm_vfe_axi_stream streams[VFE_AXI_SRC_MAX * MAX_VFE]; struct msm_vfe_stats_stream stats_streams[MSM_ISP_STATS_MAX * MAX_VFE]; struct mutex vfe_common_mutex; + uint8_t pd_buf_idx; /* Irq debug Info */ struct msm_vfe_irq_dump vfe_irq_dump; struct msm_vfe_tasklet tasklets[MAX_VFE + 1]; @@ -836,8 +837,6 @@ struct vfe_device { uint32_t bus_err_ign_mask; uint32_t recovery_irq0_mask; uint32_t recovery_irq1_mask; - /* Store the buf_idx for pd stats RDI stream */ - uint8_t pd_buf_idx; /* total bandwidth per vfe */ uint64_t total_bandwidth; }; 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 63e46125c292..38ed018137ca 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 @@ -995,6 +995,7 @@ static void msm_isp_update_pd_stats_idx(struct vfe_device *vfe_dev, uint32_t pingpong_status = 0, pingpong_bit = 0; struct msm_isp_buffer *done_buf = NULL; int vfe_idx = -1; + unsigned long flags; if (frame_src < VFE_RAW_0 || frame_src > VFE_RAW_2) return; @@ -1012,10 +1013,14 @@ static void msm_isp_update_pd_stats_idx(struct vfe_device *vfe_dev, pingpong_bit = ((pingpong_status >> pd_stream_info->wm[vfe_idx][0]) & 0x1); done_buf = pd_stream_info->buf[pingpong_bit]; + spin_lock_irqsave(&vfe_dev->common_data-> + common_dev_data_lock, flags); if (done_buf) - vfe_dev->pd_buf_idx = done_buf->buf_idx; + vfe_dev->common_data->pd_buf_idx = done_buf->buf_idx; else - vfe_dev->pd_buf_idx = 0xF; + vfe_dev->common_data->pd_buf_idx = 0xF; + spin_unlock_irqrestore(&vfe_dev->common_data-> + common_dev_data_lock, flags); } } diff --git a/drivers/media/platform/msm/camera_v2/isp/msm_isp_stats_util.c b/drivers/media/platform/msm/camera_v2/isp/msm_isp_stats_util.c index 73068a615380..ee695bf5dfd9 100644 --- a/drivers/media/platform/msm/camera_v2/isp/msm_isp_stats_util.c +++ b/drivers/media/platform/msm/camera_v2/isp/msm_isp_stats_util.c @@ -229,8 +229,12 @@ static int32_t msm_isp_stats_buf_divert(struct vfe_device *vfe_dev, stats_event->pd_stats_idx = 0xF; if (stream_info->stats_type == MSM_ISP_STATS_BF) { - stats_event->pd_stats_idx = vfe_dev->pd_buf_idx; - vfe_dev->pd_buf_idx = 0xF; + spin_lock_irqsave(&vfe_dev->common_data-> + common_dev_data_lock, flags); + stats_event->pd_stats_idx = vfe_dev->common_data->pd_buf_idx; + vfe_dev->common_data->pd_buf_idx = 0xF; + spin_unlock_irqrestore(&vfe_dev->common_data-> + common_dev_data_lock, flags); } if (comp_stats_type_mask == NULL) { stats_event->stats_mask = diff --git a/drivers/media/platform/msm/camera_v2/isp/msm_isp_util.c b/drivers/media/platform/msm/camera_v2/isp/msm_isp_util.c index c8f5c051424e..e61fc696dd22 100644 --- a/drivers/media/platform/msm/camera_v2/isp/msm_isp_util.c +++ b/drivers/media/platform/msm/camera_v2/isp/msm_isp_util.c @@ -2316,7 +2316,7 @@ int msm_isp_open_node(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) /* Register page fault handler */ vfe_dev->buf_mgr->pagefault_debug_disable = 0; /* initialize pd_buf_idx with an invalid index 0xF */ - vfe_dev->pd_buf_idx = 0xF; + vfe_dev->common_data->pd_buf_idx = 0xF; cam_smmu_reg_client_page_fault_handler( vfe_dev->buf_mgr->iommu_hdl, -- 2.11.0