|
@@ -425,6 +425,7 @@ static int __cam_isp_ctx_enqueue_init_request(
|
|
struct cam_isp_ctx_req *req_isp_new;
|
|
struct cam_isp_ctx_req *req_isp_new;
|
|
struct cam_isp_prepare_hw_update_data *req_update_old;
|
|
struct cam_isp_prepare_hw_update_data *req_update_old;
|
|
struct cam_isp_prepare_hw_update_data *req_update_new;
|
|
struct cam_isp_prepare_hw_update_data *req_update_new;
|
|
|
|
+ struct cam_isp_prepare_hw_update_data *hw_update_data;
|
|
|
|
|
|
spin_lock_bh(&ctx->lock);
|
|
spin_lock_bh(&ctx->lock);
|
|
if (list_empty(&ctx->pending_req_list)) {
|
|
if (list_empty(&ctx->pending_req_list)) {
|
|
@@ -487,6 +488,13 @@ static int __cam_isp_ctx_enqueue_init_request(
|
|
req_update_new->num_reg_dump_buf;
|
|
req_update_new->num_reg_dump_buf;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /* Update frame header params for EPCR */
|
|
|
|
+ hw_update_data = &req_isp_new->hw_update_data;
|
|
|
|
+ req_isp_old->hw_update_data.frame_header_res_id =
|
|
|
|
+ req_isp_new->hw_update_data.frame_header_res_id;
|
|
|
|
+ req_isp_old->hw_update_data.frame_header_cpu_addr =
|
|
|
|
+ hw_update_data->frame_header_cpu_addr;
|
|
|
|
+
|
|
req_old->request_id = req->request_id;
|
|
req_old->request_id = req->request_id;
|
|
|
|
|
|
list_add_tail(&req->list, &ctx->free_req_list);
|
|
list_add_tail(&req->list, &ctx->free_req_list);
|
|
@@ -645,9 +653,9 @@ static void __cam_isp_ctx_send_sof_boot_timestamp(
|
|
req_msg.u.frame_msg.frame_id_meta = ctx_isp->frame_id_meta;
|
|
req_msg.u.frame_msg.frame_id_meta = ctx_isp->frame_id_meta;
|
|
|
|
|
|
CAM_DBG(CAM_ISP,
|
|
CAM_DBG(CAM_ISP,
|
|
- "request id:%lld frame number:%lld boot time stamp:0x%llx",
|
|
|
|
|
|
+ "request id:%lld frame number:%lld boot time stamp:0x%llx status:%u",
|
|
request_id, ctx_isp->frame_id,
|
|
request_id, ctx_isp->frame_id,
|
|
- ctx_isp->boot_timestamp);
|
|
|
|
|
|
+ ctx_isp->boot_timestamp, sof_event_status);
|
|
|
|
|
|
if (cam_req_mgr_notify_message(&req_msg,
|
|
if (cam_req_mgr_notify_message(&req_msg,
|
|
V4L_EVENT_CAM_REQ_MGR_SOF_BOOT_TS,
|
|
V4L_EVENT_CAM_REQ_MGR_SOF_BOOT_TS,
|
|
@@ -657,6 +665,41 @@ static void __cam_isp_ctx_send_sof_boot_timestamp(
|
|
request_id);
|
|
request_id);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static void __cam_isp_ctx_send_sof_timestamp_frame_header(
|
|
|
|
+ struct cam_isp_context *ctx_isp, uint32_t *frame_header_cpu_addr,
|
|
|
|
+ uint64_t request_id, uint32_t sof_event_status)
|
|
|
|
+{
|
|
|
|
+ uint32_t *time32 = NULL;
|
|
|
|
+ uint64_t timestamp = 0;
|
|
|
|
+ struct cam_req_mgr_message req_msg;
|
|
|
|
+
|
|
|
|
+ time32 = frame_header_cpu_addr;
|
|
|
|
+ timestamp = (uint64_t) time32[1];
|
|
|
|
+ timestamp = timestamp << 24;
|
|
|
|
+ timestamp |= (uint64_t)(time32[0] >> 8);
|
|
|
|
+ timestamp = mul_u64_u32_div(timestamp,
|
|
|
|
+ CAM_IFE_QTIMER_MUL_FACTOR,
|
|
|
|
+ CAM_IFE_QTIMER_DIV_FACTOR);
|
|
|
|
+
|
|
|
|
+ ctx_isp->sof_timestamp_val = timestamp;
|
|
|
|
+ req_msg.session_hdl = ctx_isp->base->session_hdl;
|
|
|
|
+ req_msg.u.frame_msg.frame_id = ctx_isp->frame_id;
|
|
|
|
+ req_msg.u.frame_msg.request_id = request_id;
|
|
|
|
+ req_msg.u.frame_msg.timestamp = ctx_isp->sof_timestamp_val;
|
|
|
|
+ req_msg.u.frame_msg.link_hdl = ctx_isp->base->link_hdl;
|
|
|
|
+ req_msg.u.frame_msg.sof_status = sof_event_status;
|
|
|
|
+
|
|
|
|
+ CAM_DBG(CAM_ISP,
|
|
|
|
+ "request id:%lld frame number:%lld SOF time stamp:0x%llx status:%u",
|
|
|
|
+ request_id, ctx_isp->frame_id,
|
|
|
|
+ ctx_isp->sof_timestamp_val, sof_event_status);
|
|
|
|
+
|
|
|
|
+ if (cam_req_mgr_notify_message(&req_msg,
|
|
|
|
+ V4L_EVENT_CAM_REQ_MGR_SOF, V4L_EVENT_CAM_REQ_MGR_EVENT))
|
|
|
|
+ CAM_ERR(CAM_ISP,
|
|
|
|
+ "Error in notifying the sof time for req id:%lld",
|
|
|
|
+ request_id);
|
|
|
|
+}
|
|
|
|
|
|
static void __cam_isp_ctx_send_sof_timestamp(
|
|
static void __cam_isp_ctx_send_sof_timestamp(
|
|
struct cam_isp_context *ctx_isp, uint64_t request_id,
|
|
struct cam_isp_context *ctx_isp, uint64_t request_id,
|
|
@@ -664,6 +707,10 @@ static void __cam_isp_ctx_send_sof_timestamp(
|
|
{
|
|
{
|
|
struct cam_req_mgr_message req_msg;
|
|
struct cam_req_mgr_message req_msg;
|
|
|
|
|
|
|
|
+ if ((ctx_isp->use_frame_header_ts) && (request_id) &&
|
|
|
|
+ (sof_event_status == CAM_REQ_MGR_SOF_EVENT_SUCCESS))
|
|
|
|
+ goto end;
|
|
|
|
+
|
|
req_msg.session_hdl = ctx_isp->base->session_hdl;
|
|
req_msg.session_hdl = ctx_isp->base->session_hdl;
|
|
req_msg.u.frame_msg.frame_id = ctx_isp->frame_id;
|
|
req_msg.u.frame_msg.frame_id = ctx_isp->frame_id;
|
|
req_msg.u.frame_msg.request_id = request_id;
|
|
req_msg.u.frame_msg.request_id = request_id;
|
|
@@ -673,10 +720,9 @@ static void __cam_isp_ctx_send_sof_timestamp(
|
|
req_msg.u.frame_msg.frame_id_meta = ctx_isp->frame_id_meta;
|
|
req_msg.u.frame_msg.frame_id_meta = ctx_isp->frame_id_meta;
|
|
|
|
|
|
CAM_DBG(CAM_ISP,
|
|
CAM_DBG(CAM_ISP,
|
|
- "request id:%lld frame number:%lld SOF time stamp:0x%llx",
|
|
|
|
|
|
+ "request id:%lld frame number:%lld SOF time stamp:0x%llx status:%u",
|
|
request_id, ctx_isp->frame_id,
|
|
request_id, ctx_isp->frame_id,
|
|
- ctx_isp->sof_timestamp_val);
|
|
|
|
- CAM_DBG(CAM_ISP, "sof status:%d", sof_event_status);
|
|
|
|
|
|
+ ctx_isp->sof_timestamp_val, sof_event_status);
|
|
|
|
|
|
if (cam_req_mgr_notify_message(&req_msg,
|
|
if (cam_req_mgr_notify_message(&req_msg,
|
|
V4L_EVENT_CAM_REQ_MGR_SOF, V4L_EVENT_CAM_REQ_MGR_EVENT))
|
|
V4L_EVENT_CAM_REQ_MGR_SOF, V4L_EVENT_CAM_REQ_MGR_EVENT))
|
|
@@ -684,9 +730,9 @@ static void __cam_isp_ctx_send_sof_timestamp(
|
|
"Error in notifying the sof time for req id:%lld",
|
|
"Error in notifying the sof time for req id:%lld",
|
|
request_id);
|
|
request_id);
|
|
|
|
|
|
|
|
+end:
|
|
__cam_isp_ctx_send_sof_boot_timestamp(ctx_isp,
|
|
__cam_isp_ctx_send_sof_boot_timestamp(ctx_isp,
|
|
request_id, sof_event_status);
|
|
request_id, sof_event_status);
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
static void __cam_isp_ctx_handle_buf_done_fail_log(
|
|
static void __cam_isp_ctx_handle_buf_done_fail_log(
|
|
@@ -738,7 +784,7 @@ static int __cam_isp_ctx_handle_buf_done_for_request(
|
|
{
|
|
{
|
|
int rc = 0;
|
|
int rc = 0;
|
|
int i, j;
|
|
int i, j;
|
|
- struct cam_isp_ctx_req *req_isp;
|
|
|
|
|
|
+ struct cam_isp_ctx_req *req_isp;
|
|
struct cam_context *ctx = ctx_isp->base;
|
|
struct cam_context *ctx = ctx_isp->base;
|
|
uint64_t buf_done_req_id;
|
|
uint64_t buf_done_req_id;
|
|
const char *handle_type;
|
|
const char *handle_type;
|
|
@@ -840,6 +886,14 @@ static int __cam_isp_ctx_handle_buf_done_for_request(
|
|
req_isp->num_acked++;
|
|
req_isp->num_acked++;
|
|
req_isp->fence_map_out[j].sync_id = -1;
|
|
req_isp->fence_map_out[j].sync_id = -1;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if ((ctx_isp->use_frame_header_ts) &&
|
|
|
|
+ (req_isp->hw_update_data.frame_header_res_id ==
|
|
|
|
+ req_isp->fence_map_out[j].resource_handle))
|
|
|
|
+ __cam_isp_ctx_send_sof_timestamp_frame_header(
|
|
|
|
+ ctx_isp,
|
|
|
|
+ req_isp->hw_update_data.frame_header_cpu_addr,
|
|
|
|
+ req->request_id, CAM_REQ_MGR_SOF_EVENT_SUCCESS);
|
|
}
|
|
}
|
|
|
|
|
|
if (req_isp->num_acked > req_isp->num_fence_map_out) {
|
|
if (req_isp->num_acked > req_isp->num_fence_map_out) {
|
|
@@ -883,10 +937,14 @@ static int __cam_isp_ctx_handle_buf_done_for_request(
|
|
ctx->ctx_id);
|
|
ctx->ctx_id);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- if (ctx_isp->reported_req_id < buf_done_req_id) {
|
|
|
|
- ctx_isp->reported_req_id = buf_done_req_id;
|
|
|
|
- __cam_isp_ctx_send_sof_timestamp(ctx_isp,
|
|
|
|
- buf_done_req_id, CAM_REQ_MGR_SOF_EVENT_SUCCESS);
|
|
|
|
|
|
+
|
|
|
|
+ if (!ctx_isp->use_frame_header_ts) {
|
|
|
|
+ if (ctx_isp->reported_req_id < buf_done_req_id) {
|
|
|
|
+ ctx_isp->reported_req_id = buf_done_req_id;
|
|
|
|
+ __cam_isp_ctx_send_sof_timestamp(ctx_isp,
|
|
|
|
+ buf_done_req_id,
|
|
|
|
+ CAM_REQ_MGR_SOF_EVENT_SUCCESS);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
list_del_init(&req->list);
|
|
list_del_init(&req->list);
|
|
list_add_tail(&req->list, &ctx->free_req_list);
|
|
list_add_tail(&req->list, &ctx->free_req_list);
|
|
@@ -3375,6 +3433,8 @@ static int __cam_isp_ctx_release_hw_in_top_state(struct cam_context *ctx,
|
|
}
|
|
}
|
|
|
|
|
|
ctx->last_flush_req = 0;
|
|
ctx->last_flush_req = 0;
|
|
|
|
+ ctx_isp->custom_enabled = false;
|
|
|
|
+ ctx_isp->use_frame_header_ts = false;
|
|
ctx_isp->frame_id = 0;
|
|
ctx_isp->frame_id = 0;
|
|
ctx_isp->active_req_cnt = 0;
|
|
ctx_isp->active_req_cnt = 0;
|
|
ctx_isp->reported_req_id = 0;
|
|
ctx_isp->reported_req_id = 0;
|
|
@@ -4030,6 +4090,12 @@ static int __cam_isp_ctx_acquire_hw_v2(struct cam_context *ctx,
|
|
goto free_res;
|
|
goto free_res;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /* Set custom flag if applicable
|
|
|
|
+ * custom hw is supported only on v2
|
|
|
|
+ */
|
|
|
|
+ ctx_isp->custom_enabled = param.custom_enabled;
|
|
|
|
+ ctx_isp->use_frame_header_ts = param.use_frame_header_ts;
|
|
|
|
+
|
|
/* Query the context has rdi only resource */
|
|
/* Query the context has rdi only resource */
|
|
hw_cmd_args.ctxt_to_hw_map = param.ctxt_to_hw_map;
|
|
hw_cmd_args.ctxt_to_hw_map = param.ctxt_to_hw_map;
|
|
hw_cmd_args.cmd_type = CAM_HW_MGR_CMD_INTERNAL;
|
|
hw_cmd_args.cmd_type = CAM_HW_MGR_CMD_INTERNAL;
|
|
@@ -4935,6 +5001,8 @@ int cam_isp_context_init(struct cam_isp_context *ctx,
|
|
|
|
|
|
ctx->base = ctx_base;
|
|
ctx->base = ctx_base;
|
|
ctx->frame_id = 0;
|
|
ctx->frame_id = 0;
|
|
|
|
+ ctx->custom_enabled = false;
|
|
|
|
+ ctx->use_frame_header_ts = false;
|
|
ctx->active_req_cnt = 0;
|
|
ctx->active_req_cnt = 0;
|
|
ctx->reported_req_id = 0;
|
|
ctx->reported_req_id = 0;
|
|
ctx->req_info.last_bufdone_req_id = 0;
|
|
ctx->req_info.last_bufdone_req_id = 0;
|