msm: camera: isp: Add code for new request frame command
Add code to handle the new request frame command that takes a buffer index CRs-Fixed: 1012335 Change-Id: I9dfdc185fda547eea8fccd8d463911a93e582931 Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org> Signed-off-by: Harsh Shah <harshs@codeaurora.org>
This commit is contained in:
parent
06108b52b7
commit
26ea3057fc
5 changed files with 42 additions and 13 deletions
|
@ -463,7 +463,8 @@ static int msm_isp_buf_unprepare(struct msm_isp_buf_mgr *buf_mgr,
|
|||
|
||||
|
||||
static int msm_isp_get_buf(struct msm_isp_buf_mgr *buf_mgr, uint32_t id,
|
||||
uint32_t bufq_handle, struct msm_isp_buffer **buf_info)
|
||||
uint32_t bufq_handle, uint32_t buf_index,
|
||||
struct msm_isp_buffer **buf_info)
|
||||
{
|
||||
int rc = -1;
|
||||
unsigned long flags;
|
||||
|
@ -513,8 +514,12 @@ static int msm_isp_get_buf(struct msm_isp_buf_mgr *buf_mgr, uint32_t id,
|
|||
}
|
||||
break;
|
||||
case MSM_ISP_BUFFER_SRC_HAL:
|
||||
vb2_v4l2_buf = buf_mgr->vb2_ops->get_buf(
|
||||
bufq->session_id, bufq->stream_id);
|
||||
if (buf_index == MSM_ISP_INVALID_BUF_INDEX)
|
||||
vb2_v4l2_buf = buf_mgr->vb2_ops->get_buf(
|
||||
bufq->session_id, bufq->stream_id);
|
||||
else
|
||||
vb2_v4l2_buf = buf_mgr->vb2_ops->get_buf_by_idx(
|
||||
bufq->session_id, bufq->stream_id, buf_index);
|
||||
if (vb2_v4l2_buf) {
|
||||
if (vb2_v4l2_buf->vb2_buf.index < bufq->num_bufs) {
|
||||
*buf_info = &bufq->bufs[vb2_v4l2_buf
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2013-2016, The Linux Foundation. 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
|
||||
|
@ -32,6 +32,8 @@
|
|||
#define BUF_MGR_NUM_BUF_Q 28
|
||||
#define MAX_IOMMU_CTX 2
|
||||
|
||||
#define MSM_ISP_INVALID_BUF_INDEX 0xFFFFFFFF
|
||||
|
||||
struct msm_isp_buf_mgr;
|
||||
|
||||
enum msm_isp_buffer_src_t {
|
||||
|
@ -140,7 +142,8 @@ struct msm_isp_buf_ops {
|
|||
uint32_t bufq_handle, uint32_t *buf_src);
|
||||
|
||||
int (*get_buf)(struct msm_isp_buf_mgr *buf_mgr, uint32_t id,
|
||||
uint32_t bufq_handle, struct msm_isp_buffer **buf_info);
|
||||
uint32_t bufq_handle, uint32_t buf_index,
|
||||
struct msm_isp_buffer **buf_info);
|
||||
|
||||
int (*get_buf_by_index)(struct msm_isp_buf_mgr *buf_mgr,
|
||||
uint32_t bufq_handle, uint32_t buf_index,
|
||||
|
|
|
@ -394,6 +394,7 @@ enum msm_vfe_axi_stream_type {
|
|||
struct msm_vfe_frame_request_queue {
|
||||
struct list_head list;
|
||||
enum msm_vfe_buff_queue_id buff_queue_id;
|
||||
uint32_t buf_index;
|
||||
uint8_t cmd_used;
|
||||
};
|
||||
|
||||
|
|
|
@ -1603,6 +1603,7 @@ static struct msm_isp_buffer *msm_isp_get_stream_buffer(
|
|||
struct msm_isp_buffer *buf = NULL;
|
||||
struct msm_vfe_axi_stream *temp_stream_info = NULL;
|
||||
struct msm_vfe_frame_request_queue *queue_req;
|
||||
uint32_t buf_index = MSM_ISP_INVALID_BUF_INDEX;
|
||||
|
||||
if (!stream_info->controllable_output) {
|
||||
bufq_handle = stream_info->bufq_handle
|
||||
|
@ -1625,12 +1626,13 @@ static struct msm_isp_buffer *msm_isp_get_stream_buffer(
|
|||
__func__);
|
||||
return buf;
|
||||
}
|
||||
buf_index = queue_req->buf_index;
|
||||
queue_req->cmd_used = 0;
|
||||
list_del(&queue_req->list);
|
||||
temp_stream_info->request_q_cnt--;
|
||||
}
|
||||
rc = vfe_dev->buf_mgr->ops->get_buf(vfe_dev->buf_mgr,
|
||||
vfe_dev->pdev->id, bufq_handle, &buf);
|
||||
vfe_dev->pdev->id, bufq_handle, buf_index, &buf);
|
||||
|
||||
if (rc == -EFAULT) {
|
||||
msm_isp_halt_send_error(vfe_dev,
|
||||
|
@ -2925,7 +2927,8 @@ int msm_isp_cfg_axi_stream(struct vfe_device *vfe_dev, void *arg)
|
|||
|
||||
static int msm_isp_return_empty_buffer(struct vfe_device *vfe_dev,
|
||||
struct msm_vfe_axi_stream *stream_info, uint32_t user_stream_id,
|
||||
uint32_t frame_id, enum msm_vfe_input_src frame_src)
|
||||
uint32_t frame_id, uint32_t buf_index,
|
||||
enum msm_vfe_input_src frame_src)
|
||||
{
|
||||
int rc = -1;
|
||||
struct msm_isp_buffer *buf = NULL;
|
||||
|
@ -2961,7 +2964,7 @@ static int msm_isp_return_empty_buffer(struct vfe_device *vfe_dev,
|
|||
|
||||
|
||||
rc = vfe_dev->buf_mgr->ops->get_buf(vfe_dev->buf_mgr,
|
||||
vfe_dev->pdev->id, bufq_handle, &buf);
|
||||
vfe_dev->pdev->id, bufq_handle, buf_index, &buf);
|
||||
if (rc == -EFAULT) {
|
||||
msm_isp_halt_send_error(vfe_dev, ISP_EVENT_BUF_FATAL_ERROR);
|
||||
return rc;
|
||||
|
@ -2999,7 +3002,7 @@ static int msm_isp_return_empty_buffer(struct vfe_device *vfe_dev,
|
|||
|
||||
static int msm_isp_request_frame(struct vfe_device *vfe_dev,
|
||||
struct msm_vfe_axi_stream *stream_info, uint32_t user_stream_id,
|
||||
uint32_t frame_id)
|
||||
uint32_t frame_id, uint32_t buf_index)
|
||||
{
|
||||
struct msm_vfe_axi_stream_request_cmd stream_cfg_cmd;
|
||||
struct msm_vfe_frame_request_queue *queue_req;
|
||||
|
@ -3052,7 +3055,7 @@ static int msm_isp_request_frame(struct vfe_device *vfe_dev,
|
|||
vfe_dev->axi_data.src_info[VFE_PIX_0].active);
|
||||
|
||||
rc = msm_isp_return_empty_buffer(vfe_dev, stream_info,
|
||||
user_stream_id, frame_id, frame_src);
|
||||
user_stream_id, frame_id, buf_index, frame_src);
|
||||
if (rc < 0)
|
||||
pr_err("%s:%d failed: return_empty_buffer src %d\n",
|
||||
__func__, __LINE__, frame_src);
|
||||
|
@ -3067,7 +3070,7 @@ static int msm_isp_request_frame(struct vfe_device *vfe_dev,
|
|||
stream_info->stream_id);
|
||||
|
||||
rc = msm_isp_return_empty_buffer(vfe_dev, stream_info,
|
||||
user_stream_id, frame_id, frame_src);
|
||||
user_stream_id, frame_id, buf_index, frame_src);
|
||||
if (rc < 0)
|
||||
pr_err("%s:%d failed: return_empty_buffer src %d\n",
|
||||
__func__, __LINE__, frame_src);
|
||||
|
@ -3097,6 +3100,7 @@ static int msm_isp_request_frame(struct vfe_device *vfe_dev,
|
|||
user_stream_id, queue_req->buff_queue_id);
|
||||
return 0;
|
||||
}
|
||||
queue_req->buf_index = buf_index;
|
||||
queue_req->cmd_used = 1;
|
||||
|
||||
stream_info->request_q_idx =
|
||||
|
@ -3435,7 +3439,8 @@ int msm_isp_update_axi_stream(struct vfe_device *vfe_dev, void *arg)
|
|||
update_info->stream_handle)];
|
||||
rc = msm_isp_request_frame(vfe_dev, stream_info,
|
||||
update_info->user_stream_id,
|
||||
update_info->frame_id);
|
||||
update_info->frame_id,
|
||||
MSM_ISP_INVALID_BUF_INDEX);
|
||||
if (rc)
|
||||
pr_err("%s failed to request frame!\n",
|
||||
__func__);
|
||||
|
@ -3479,6 +3484,20 @@ int msm_isp_update_axi_stream(struct vfe_device *vfe_dev, void *arg)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case UPDATE_STREAM_REQUEST_FRAMES_VER2: {
|
||||
struct msm_vfe_axi_stream_cfg_update_info_req_frm *req_frm =
|
||||
&update_cmd->req_frm_ver2;
|
||||
stream_info = &axi_data->stream_info[HANDLE_TO_IDX(
|
||||
req_frm->stream_handle)];
|
||||
rc = msm_isp_request_frame(vfe_dev, stream_info,
|
||||
req_frm->user_stream_id,
|
||||
req_frm->frame_id,
|
||||
req_frm->buf_index);
|
||||
if (rc)
|
||||
pr_err("%s failed to request frame!\n",
|
||||
__func__);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
pr_err("%s: Invalid update type %d\n", __func__,
|
||||
update_cmd->update_type);
|
||||
|
|
|
@ -68,7 +68,8 @@ static int msm_isp_stats_cfg_ping_pong_address(struct vfe_device *vfe_dev,
|
|||
pingpong_bit = (~(pingpong_status >> stats_pingpong_offset) & 0x1);
|
||||
|
||||
rc = vfe_dev->buf_mgr->ops->get_buf(vfe_dev->buf_mgr,
|
||||
vfe_dev->pdev->id, bufq_handle, &buf);
|
||||
vfe_dev->pdev->id, bufq_handle,
|
||||
MSM_ISP_INVALID_BUF_INDEX, &buf);
|
||||
if (rc == -EFAULT) {
|
||||
msm_isp_halt_send_error(vfe_dev, ISP_EVENT_BUF_FATAL_ERROR);
|
||||
return rc;
|
||||
|
|
Loading…
Add table
Reference in a new issue