Loading drivers/media/platform/msm/camera/cam_isp/cam_isp_context.c +209 −115 Original line number Diff line number Diff line Loading @@ -38,18 +38,26 @@ static int cam_isp_context_dump_active_request(void *data, unsigned long iova, static void __cam_isp_ctx_update_state_monitor_array( struct cam_isp_context *ctx_isp, enum cam_isp_state_change_trigger trigger_type, uint32_t req_id) enum cam_isp_hw_event_type hw_event, enum cam_isp_ctx_activated_substate curr_state, enum cam_isp_ctx_activated_substate next_state) { int iterator = 0; iterator = INC_STATE_MONITOR_HEAD(&ctx_isp->state_monitor_head); ctx_isp->cam_isp_ctx_state_monitor[iterator].curr_state = ctx_isp->substate_activated; ctx_isp->cam_isp_ctx_state_monitor[iterator].trigger = trigger_type; ctx_isp->cam_isp_ctx_state_monitor[iterator].req_id = req_id; curr_state; ctx_isp->cam_isp_ctx_state_monitor[iterator].next_state = next_state; ctx_isp->cam_isp_ctx_state_monitor[iterator].hw_event = hw_event; ctx_isp->cam_isp_ctx_state_monitor[iterator].last_reported_id = ctx_isp->req_info.reported_req_id; ctx_isp->cam_isp_ctx_state_monitor[iterator].last_applied_req_id = ctx_isp->req_info.last_applied_req_id; ctx_isp->cam_isp_ctx_state_monitor[iterator].frame_id = ctx_isp->frame_id; ctx_isp->cam_isp_ctx_state_monitor[iterator].evt_time_stamp = jiffies_to_msecs(jiffies); } Loading Loading @@ -79,17 +87,17 @@ static const char *__cam_isp_hw_evt_val_to_type( uint32_t evt_id) { switch (evt_id) { case CAM_ISP_STATE_CHANGE_TRIGGER_ERROR: case CAM_ISP_HW_EVENT_ERROR: return "ERROR"; case CAM_ISP_STATE_CHANGE_TRIGGER_SOF: case CAM_ISP_HW_EVENT_SOF: return "SOF"; case CAM_ISP_STATE_CHANGE_TRIGGER_REG_UPDATE: case CAM_ISP_HW_EVENT_REG_UPDATE: return "REG_UPDATE"; case CAM_ISP_STATE_CHANGE_TRIGGER_EPOCH: case CAM_ISP_HW_EVENT_EPOCH: return "EPOCH"; case CAM_ISP_STATE_CHANGE_TRIGGER_EOF: case CAM_ISP_HW_EVENT_EOF: return "EOF"; case CAM_ISP_STATE_CHANGE_TRIGGER_DONE: case CAM_ISP_HW_EVENT_DONE: return "DONE"; default: return "CAM_ISP_EVENT_INVALID"; Loading @@ -97,14 +105,22 @@ static const char *__cam_isp_hw_evt_val_to_type( } static void __cam_isp_ctx_dump_state_monitor_array( struct cam_isp_context *ctx_isp) struct cam_isp_context *ctx_isp, bool log_rate_limit) { int i = 0; uint64_t state_head = 0; uint64_t index; struct cam_isp_context_state_monitor *ctx_monitor; state_head = atomic64_read(&ctx_isp->state_monitor_head); CAM_ERR_RATE_LIMIT(CAM_ISP, ctx_monitor = ctx_isp->cam_isp_ctx_state_monitor; if (log_rate_limit) CAM_INFO_RATE_LIMIT_CUSTOM(CAM_ISP, 5, 20, "Dumping state information for preceding requests"); else CAM_INFO(CAM_ISP, "Dumping state information for preceding requests"); for (i = CAM_ISP_CTX_STATE_MONITOR_MAX_ENTRIES - 1; i >= 0; Loading @@ -112,14 +128,35 @@ static void __cam_isp_ctx_dump_state_monitor_array( index = (((state_head - i) + CAM_ISP_CTX_STATE_MONITOR_MAX_ENTRIES) % CAM_ISP_CTX_STATE_MONITOR_MAX_ENTRIES); CAM_ERR_RATE_LIMIT(CAM_ISP, "time[0x%llx] req_id[%u] state[%s] evt_type[%s]", ctx_isp->cam_isp_ctx_state_monitor[index].evt_time_stamp, ctx_isp->cam_isp_ctx_state_monitor[index].req_id, if (log_rate_limit) { CAM_INFO_RATE_LIMIT_CUSTOM(CAM_ISP, 5, 20, "time[%lld] last reported req_id[%u] frame id[%lld] applied id[%lld] current state[%s] next state[%s] hw_event[%s]", ctx_monitor[index].evt_time_stamp, ctx_monitor[index].last_reported_id, ctx_monitor[index].frame_id, ctx_monitor[index].last_applied_req_id, __cam_isp_ctx_substate_val_to_type( ctx_monitor[index].curr_state), __cam_isp_ctx_substate_val_to_type( ctx_monitor[index].next_state), __cam_isp_hw_evt_val_to_type( ctx_monitor[index].hw_event)); } else { CAM_INFO(CAM_ISP, "time[%lld] last reported req_id[%u] frame id[%lld] applied id[%lld] current state[%s] next state[%s] hw_event[%s]", ctx_monitor[index].evt_time_stamp, ctx_monitor[index].last_reported_id, ctx_monitor[index].frame_id, ctx_monitor[index].last_applied_req_id, __cam_isp_ctx_substate_val_to_type( ctx_monitor[index].curr_state), __cam_isp_ctx_substate_val_to_type( ctx_isp->cam_isp_ctx_state_monitor[index].curr_state), ctx_monitor[index].next_state), __cam_isp_hw_evt_val_to_type( ctx_isp->cam_isp_ctx_state_monitor[index].trigger)); ctx_monitor[index].hw_event)); } } } Loading Loading @@ -508,6 +545,10 @@ static int __cam_isp_ctx_handle_buf_done_in_activated_state( CAM_DBG(CAM_REQ, "Move active request %lld to pending list(cnt = %d) [bubble recovery], ctx %u", req->request_id, ctx_isp->active_req_cnt, ctx->ctx_id); __cam_isp_ctx_update_state_monitor_array(ctx_isp, CAM_ISP_HW_EVENT_DONE, ctx_isp->substate_activated, ctx_isp->substate_activated); } else { list_del_init(&req->list); list_add_tail(&req->list, &ctx->free_req_list); Loading @@ -515,12 +556,16 @@ static int __cam_isp_ctx_handle_buf_done_in_activated_state( CAM_DBG(CAM_REQ, "Move active request %lld to free list(cnt = %d) [all fences done], ctx %u", req->request_id, ctx_isp->active_req_cnt, ctx->ctx_id); ctx_isp->req_info.last_bufdone_req_id = req->request_id; ctx_isp->req_info.last_bufdone_time_stamp = jiffies_to_msecs(jiffies); __cam_isp_ctx_update_state_monitor_array(ctx_isp, CAM_ISP_HW_EVENT_DONE, ctx_isp->substate_activated, ctx_isp->substate_activated); } end: __cam_isp_ctx_update_state_monitor_array(ctx_isp, CAM_ISP_STATE_CHANGE_TRIGGER_DONE, ctx_isp->base->req_list->request_id); return rc; } Loading Loading @@ -665,9 +710,12 @@ static int __cam_isp_ctx_notify_sof_in_activated_state( } list_for_each_entry(req, &ctx->active_req_list, list) { if (req->request_id > ctx_isp->reported_req_id) { if (req->request_id > ctx_isp->req_info.reported_req_id) { request_id = req->request_id; ctx_isp->reported_req_id = request_id; ctx_isp->req_info.reported_req_id = request_id; ctx_isp->req_info.last_reported_id_time_stamp = jiffies_to_msecs(jiffies); break; } } Loading @@ -675,6 +723,17 @@ static int __cam_isp_ctx_notify_sof_in_activated_state( if (ctx_isp->substate_activated == CAM_ISP_CTX_ACTIVATED_BUBBLE) request_id = 0; if (request_id && ctx_isp->req_info.reported_req_id && ((request_id - ctx_isp->req_info.reported_req_id) > 1)){ CAM_INFO(CAM_ISP, "ctx:%d curr req id: %u last reported id:%u", ctx->ctx_id, request_id, ctx_isp->req_info.reported_req_id); __cam_isp_ctx_dump_state_monitor_array(ctx_isp, true); } __cam_isp_ctx_send_sof_timestamp(ctx_isp, request_id, CAM_REQ_MGR_SOF_EVENT_SUCCESS); } else { Loading Loading @@ -742,8 +801,7 @@ static int __cam_isp_ctx_sof_in_activated_state( ctx_isp->frame_id++; ctx_isp->sof_timestamp_val = sof_event_data->timestamp; ctx_isp->boot_timestamp = sof_event_data->boot_time; __cam_isp_ctx_update_state_monitor_array(ctx_isp, CAM_ISP_STATE_CHANGE_TRIGGER_SOF, req->request_id); CAM_DBG(CAM_ISP, "frame id: %lld time stamp:0x%llx, ctx %u", ctx_isp->frame_id, ctx_isp->sof_timestamp_val, ctx->ctx_id); Loading Loading @@ -778,11 +836,7 @@ static int __cam_isp_ctx_reg_upd_in_sof(struct cam_isp_context *ctx_isp, CAM_ERR(CAM_ISP, "receive rup in unexpected state"); } if (req != NULL) { __cam_isp_ctx_update_state_monitor_array(ctx_isp, CAM_ISP_STATE_CHANGE_TRIGGER_REG_UPDATE, req->request_id); } end: return rc; } Loading @@ -800,7 +854,8 @@ static int __cam_isp_ctx_epoch_in_applied(struct cam_isp_context *ctx_isp, * If no wait req in epoch, this is an error case. * The recovery is to go back to sof state */ CAM_ERR(CAM_ISP, "No wait request"); CAM_ERR(CAM_ISP, "Ctx:%d No wait request", ctx->ctx_id); __cam_isp_ctx_dump_state_monitor_array(ctx_isp, true); ctx_isp->substate_activated = CAM_ISP_CTX_ACTIVATED_SOF; /* Send SOF event as empty frame*/ Loading @@ -815,7 +870,9 @@ static int __cam_isp_ctx_epoch_in_applied(struct cam_isp_context *ctx_isp, req_isp = (struct cam_isp_ctx_req *)req->req_priv; req_isp->bubble_detected = true; CAM_DBG(CAM_ISP, "Report Bubble flag %d", req_isp->bubble_report); CAM_INFO(CAM_ISP, "ctx:%d Report Bubble flag %d req id:%lld", ctx->ctx_id, req_isp->bubble_report, req->request_id); __cam_isp_ctx_dump_state_monitor_array(ctx_isp, true); if (req_isp->bubble_report && ctx->ctx_crm_intf && ctx->ctx_crm_intf->notify_err) { struct cam_req_mgr_error_notify notify; Loading @@ -842,9 +899,11 @@ static int __cam_isp_ctx_epoch_in_applied(struct cam_isp_context *ctx_isp, list_del_init(&req->list); list_add_tail(&req->list, &ctx->active_req_list); if (req->request_id > ctx_isp->reported_req_id) { if (req->request_id > ctx_isp->req_info.reported_req_id) { request_id = req->request_id; ctx_isp->reported_req_id = request_id; ctx_isp->req_info.reported_req_id = request_id; ctx_isp->req_info.last_reported_id_time_stamp = jiffies_to_msecs(jiffies); } __cam_isp_ctx_send_sof_timestamp(ctx_isp, request_id, CAM_REQ_MGR_SOF_EVENT_ERROR); Loading @@ -853,15 +912,7 @@ static int __cam_isp_ctx_epoch_in_applied(struct cam_isp_context *ctx_isp, CAM_DBG(CAM_ISP, "next substate %d", ctx_isp->substate_activated); end: if (request_id == 0) { req = list_last_entry(&ctx->active_req_list, struct cam_ctx_request, list); __cam_isp_ctx_update_state_monitor_array(ctx_isp, CAM_ISP_STATE_CHANGE_TRIGGER_EPOCH, req->request_id); } else { __cam_isp_ctx_update_state_monitor_array(ctx_isp, CAM_ISP_STATE_CHANGE_TRIGGER_EPOCH, request_id); } return 0; } Loading @@ -884,7 +935,6 @@ static int __cam_isp_ctx_sof_in_epoch(struct cam_isp_context *ctx_isp, int rc = 0; struct cam_context *ctx = ctx_isp->base; struct cam_isp_hw_sof_event_data *sof_event_data = evt_data; struct cam_ctx_request *req; if (!evt_data) { CAM_ERR(CAM_ISP, "in valid sof event data"); Loading @@ -900,12 +950,6 @@ static int __cam_isp_ctx_sof_in_epoch(struct cam_isp_context *ctx_isp, else CAM_DBG(CAM_ISP, "Still need to wait for the buf done"); req = list_last_entry(&ctx->active_req_list, struct cam_ctx_request, list); if (req) __cam_isp_ctx_update_state_monitor_array(ctx_isp, CAM_ISP_STATE_CHANGE_TRIGGER_SOF, ctx->req_list->request_id); CAM_DBG(CAM_ISP, "next substate %d", ctx_isp->substate_activated); Loading Loading @@ -952,7 +996,8 @@ static int __cam_isp_ctx_epoch_in_bubble_applied( * If no pending req in epoch, this is an error case. * Just go back to the bubble state. */ CAM_ERR(CAM_ISP, "No pending request."); CAM_ERR(CAM_ISP, "ctx:%d No pending request.", ctx->ctx_id); __cam_isp_ctx_dump_state_monitor_array(ctx_isp, true); __cam_isp_ctx_send_sof_timestamp(ctx_isp, request_id, CAM_REQ_MGR_SOF_EVENT_SUCCESS); Loading @@ -964,6 +1009,9 @@ static int __cam_isp_ctx_epoch_in_bubble_applied( list); req_isp = (struct cam_isp_ctx_req *)req->req_priv; req_isp->bubble_detected = true; CAM_INFO(CAM_ISP, "Ctx:%d Report Bubble flag %d req id:%lld", ctx->ctx_id, req_isp->bubble_report, req->request_id); __cam_isp_ctx_dump_state_monitor_array(ctx_isp, true); if (req_isp->bubble_report && ctx->ctx_crm_intf && ctx->ctx_crm_intf->notify_err) { Loading Loading @@ -992,9 +1040,11 @@ static int __cam_isp_ctx_epoch_in_bubble_applied( list_add_tail(&req->list, &ctx->active_req_list); if (!req_isp->bubble_report) { if (req->request_id > ctx_isp->reported_req_id) { if (req->request_id > ctx_isp->req_info.reported_req_id) { request_id = req->request_id; ctx_isp->reported_req_id = request_id; ctx_isp->req_info.reported_req_id = request_id; ctx_isp->req_info.last_reported_id_time_stamp = jiffies_to_msecs(jiffies); __cam_isp_ctx_send_sof_timestamp(ctx_isp, request_id, CAM_REQ_MGR_SOF_EVENT_ERROR); } else Loading @@ -1007,11 +1057,7 @@ static int __cam_isp_ctx_epoch_in_bubble_applied( ctx_isp->substate_activated = CAM_ISP_CTX_ACTIVATED_BUBBLE; CAM_DBG(CAM_ISP, "next substate %d", ctx_isp->substate_activated); end: req = list_last_entry(&ctx->active_req_list, struct cam_ctx_request, list); if (req) __cam_isp_ctx_update_state_monitor_array(ctx_isp, CAM_ISP_STATE_CHANGE_TRIGGER_EPOCH, req->request_id); return 0; } Loading @@ -1023,9 +1069,7 @@ static int __cam_isp_ctx_buf_done_in_bubble_applied( (struct cam_isp_hw_done_event_data *) evt_data; rc = __cam_isp_ctx_handle_buf_done_in_activated_state(ctx_isp, done, 1); __cam_isp_ctx_update_state_monitor_array(ctx_isp, CAM_ISP_STATE_CHANGE_TRIGGER_DONE, ctx_isp->base->req_list->request_id); return rc; } Loading Loading @@ -1083,9 +1127,6 @@ static int __cam_isp_ctx_handle_error(struct cam_isp_context *ctx_isp, if (error_event_data->enable_reg_dump) cam_isp_ctx_dump_req(req_isp); __cam_isp_ctx_update_state_monitor_array(ctx_isp, CAM_ISP_STATE_CHANGE_TRIGGER_ERROR, req_to_dump->request_id); list_for_each_entry_safe(req, req_temp, &ctx->active_req_list, list) { req_isp = (struct cam_isp_ctx_req *) req->req_priv; Loading Loading @@ -1176,14 +1217,15 @@ static int __cam_isp_ctx_handle_error(struct cam_isp_context *ctx_isp, end: do { if (list_empty(&ctx->pending_req_list)) { error_request_id = ctx_isp->last_applied_req_id + 1; error_request_id = ctx_isp->req_info.last_applied_req_id + 1; req_isp = NULL; break; } req = list_first_entry(&ctx->pending_req_list, struct cam_ctx_request, list); req_isp = (struct cam_isp_ctx_req *) req->req_priv; error_request_id = ctx_isp->last_applied_req_id; error_request_id = ctx_isp->req_info.last_applied_req_id; if (req_isp->bubble_report) { req_to_report = req; Loading @@ -1201,7 +1243,8 @@ static int __cam_isp_ctx_handle_error(struct cam_isp_context *ctx_isp, list_del_init(&req->list); list_add_tail(&req->list, &ctx->free_req_list); } while (req->request_id < ctx_isp->last_applied_req_id); } while (req->request_id < ctx_isp->req_info.last_applied_req_id); if (ctx->ctx_crm_intf && ctx->ctx_crm_intf->notify_err) { notify.link_hdl = ctx->link_hdl; Loading Loading @@ -1240,7 +1283,7 @@ static int __cam_isp_ctx_handle_error(struct cam_isp_context *ctx_isp, V4L_EVENT_CAM_REQ_MGR_EVENT)) CAM_ERR(CAM_ISP, "Error in notifying the error time for req id:%lld ctx %u", ctx_isp->last_applied_req_id, ctx_isp->req_info.last_applied_req_id, ctx->ctx_id); } ctx_isp->substate_activated = CAM_ISP_CTX_ACTIVATED_HW_ERROR; Loading Loading @@ -1278,8 +1321,7 @@ static int __cam_isp_ctx_fs2_sof_in_sof_state( ctx_isp->frame_id++; ctx_isp->sof_timestamp_val = sof_event_data->timestamp; ctx_isp->boot_timestamp = sof_event_data->boot_time; __cam_isp_ctx_update_state_monitor_array(ctx_isp, CAM_ISP_STATE_CHANGE_TRIGGER_SOF, req->request_id); CAM_DBG(CAM_ISP, "frame id: %lld time stamp:0x%llx", ctx_isp->frame_id, ctx_isp->sof_timestamp_val); Loading @@ -1300,9 +1342,12 @@ static int __cam_isp_ctx_fs2_sof_in_sof_state( } list_for_each_entry(req, &ctx->active_req_list, list) { if (req->request_id > ctx_isp->reported_req_id) { if (req->request_id > ctx_isp->req_info.reported_req_id) { request_id = req->request_id; ctx_isp->reported_req_id = request_id; ctx_isp->req_info.reported_req_id = request_id; ctx_isp->req_info.last_reported_id_time_stamp = jiffies_to_msecs(jiffies); break; } } Loading Loading @@ -1343,8 +1388,10 @@ static int __cam_isp_ctx_fs2_buf_done(struct cam_isp_context *ctx_isp, CAM_DBG(CAM_ISP, "No request, move to SOF"); ctx_isp->substate_activated = CAM_ISP_CTX_ACTIVATED_SOF; if (ctx_isp->reported_req_id < curr_req_id) { ctx_isp->reported_req_id = curr_req_id; if (ctx_isp->req_info.reported_req_id < curr_req_id) { ctx_isp->req_info.reported_req_id = curr_req_id; ctx_isp->req_info.last_reported_id_time_stamp = jiffies_to_msecs(jiffies); __cam_isp_ctx_send_sof_timestamp(ctx_isp, curr_req_id, CAM_REQ_MGR_SOF_EVENT_SUCCESS); Loading Loading @@ -1402,11 +1449,7 @@ static int __cam_isp_ctx_fs2_reg_upd_in_sof(struct cam_isp_context *ctx_isp, CAM_ERR(CAM_ISP, "receive rup in unexpected state"); } if (req != NULL) { __cam_isp_ctx_update_state_monitor_array(ctx_isp, CAM_ISP_STATE_CHANGE_TRIGGER_REG_UPDATE, req->request_id); } end: return rc; } Loading Loading @@ -1451,9 +1494,12 @@ static int __cam_isp_ctx_fs2_reg_upd_in_applied_state( if (ctx->ctx_crm_intf && ctx->ctx_crm_intf->notify_trigger && ctx_isp->active_req_cnt <= 2) { list_for_each_entry(req, &ctx->active_req_list, list) { if (req->request_id > ctx_isp->reported_req_id) { if (req->request_id > ctx_isp->req_info.reported_req_id) { request_id = req->request_id; ctx_isp->reported_req_id = request_id; ctx_isp->req_info.reported_req_id = request_id; ctx_isp->req_info.last_reported_id_time_stamp = jiffies_to_msecs(jiffies); break; } } Loading @@ -1478,11 +1524,7 @@ static int __cam_isp_ctx_fs2_reg_upd_in_applied_state( CAM_DBG(CAM_ISP, "next substate %d", ctx_isp->substate_activated); end: if (req != NULL && !rc) { __cam_isp_ctx_update_state_monitor_array(ctx_isp, CAM_ISP_STATE_CHANGE_TRIGGER_EPOCH, req->request_id); } return rc; } Loading Loading @@ -1729,19 +1771,19 @@ static int __cam_isp_ctx_apply_req_in_activated_state( } else { spin_lock_bh(&ctx->lock); ctx_isp->substate_activated = next_state; ctx_isp->last_applied_req_id = apply->request_id; ctx_isp->req_info.last_applied_req_id = apply->request_id; ctx_isp->req_info.last_applied_time_stamp = jiffies_to_msecs(jiffies); list_del_init(&req->list); list_add_tail(&req->list, &ctx->wait_req_list); CAM_DBG(CAM_ISP, "new substate state %d, applied req %lld", next_state, ctx_isp->last_applied_req_id); next_state, ctx_isp->req_info.last_applied_req_id); spin_unlock_bh(&ctx->lock); } end: if (ctx_isp != NULL) { __cam_isp_ctx_update_state_monitor_array(ctx_isp, CAM_ISP_STATE_CHANGE_TRIGGER_SOF, ctx->req_list->request_id); } return rc; } Loading Loading @@ -1875,6 +1917,23 @@ static int __cam_isp_ctx_flush_req_in_top_state( CAM_DBG(CAM_ISP, "try to flush pending list"); spin_lock_bh(&ctx->lock); rc = __cam_isp_ctx_flush_req(ctx, &ctx->pending_req_list, flush_req); if (!list_empty(&ctx->active_req_list)) { CAM_INFO_RATE_LIMIT_CUSTOM(CAM_ISP, 5, 20, "ctx:%d last applied id:%lld, reported req id:%lld, buf done id:%lld", ctx->ctx_id, ctx_isp->req_info.last_applied_req_id, ctx_isp->req_info.reported_req_id, ctx_isp->req_info.last_bufdone_req_id); CAM_INFO_RATE_LIMIT_CUSTOM(CAM_ISP, 5, 20, "current time:%lld last apply time:%lld, reported req time:%lld, buf done time:%lld", jiffies_to_msecs(jiffies), ctx_isp->req_info.last_applied_time_stamp, ctx_isp->req_info.last_reported_id_time_stamp, ctx_isp->req_info.last_bufdone_time_stamp); __cam_isp_ctx_dump_state_monitor_array(ctx_isp, true); } spin_unlock_bh(&ctx->lock); atomic_set(&ctx_isp->process_bubble, 0); Loading Loading @@ -2133,8 +2192,10 @@ static int __cam_isp_ctx_rdi_only_sof_in_bubble_applied( list); req_isp = (struct cam_isp_ctx_req *)req->req_priv; req_isp->bubble_detected = true; CAM_INFO(CAM_ISP, "Ctx:%d Report Bubble flag %d req id:%lld", ctx->ctx_id, req_isp->bubble_report, req->request_id); __cam_isp_ctx_dump_state_monitor_array(ctx_isp, true); CAM_DBG(CAM_ISP, "Report Bubble flag %d", req_isp->bubble_report); if (req_isp->bubble_report && ctx->ctx_crm_intf && ctx->ctx_crm_intf->notify_err) { struct cam_req_mgr_error_notify notify; Loading @@ -2161,9 +2222,11 @@ static int __cam_isp_ctx_rdi_only_sof_in_bubble_applied( req->request_id, ctx_isp->active_req_cnt); if (!req_isp->bubble_report) { if (req->request_id > ctx_isp->reported_req_id) { if (req->request_id > ctx_isp->req_info.reported_req_id) { request_id = req->request_id; ctx_isp->reported_req_id = request_id; ctx_isp->req_info.reported_req_id = request_id; ctx_isp->req_info.last_reported_id_time_stamp = jiffies_to_msecs(jiffies); __cam_isp_ctx_send_sof_timestamp(ctx_isp, request_id, CAM_REQ_MGR_SOF_EVENT_ERROR); } else Loading Loading @@ -2305,8 +2368,11 @@ static int __cam_isp_ctx_rdi_only_reg_upd_in_bubble_applied_state( } else { CAM_ERR(CAM_ISP, "Can not notify SOF to CRM"); } if (request_id) ctx_isp->reported_req_id = request_id; if (request_id) { ctx_isp->req_info.reported_req_id = request_id; ctx_isp->req_info.last_reported_id_time_stamp = jiffies_to_msecs(jiffies); } __cam_isp_ctx_send_sof_timestamp(ctx_isp, request_id, CAM_REQ_MGR_SOF_EVENT_SUCCESS); Loading Loading @@ -2481,9 +2547,14 @@ static int __cam_isp_ctx_release_hw_in_top_state(struct cam_context *ctx, ctx->last_flush_req = 0; ctx_isp->frame_id = 0; ctx_isp->active_req_cnt = 0; ctx_isp->reported_req_id = 0; ctx_isp->hw_acquired = false; ctx_isp->init_received = false; ctx_isp->req_info.reported_req_id = 0; ctx_isp->req_info.last_applied_req_id = 0; ctx_isp->req_info.last_bufdone_req_id = 0; ctx_isp->req_info.last_applied_time_stamp = 0; ctx_isp->req_info.last_bufdone_time_stamp = 0; ctx_isp->req_info.last_reported_id_time_stamp = 0; /* * Ideally, we should never have any active request here. Loading Loading @@ -2538,11 +2609,16 @@ static int __cam_isp_ctx_release_dev_in_top_state(struct cam_context *ctx, ctx->last_flush_req = 0; ctx_isp->frame_id = 0; ctx_isp->active_req_cnt = 0; ctx_isp->reported_req_id = 0; ctx_isp->hw_acquired = false; ctx_isp->init_received = false; ctx_isp->rdi_only_context = false; ctx_isp->split_acquire = false; ctx_isp->req_info.reported_req_id = 0; ctx_isp->req_info.last_applied_req_id = 0; ctx_isp->req_info.last_bufdone_req_id = 0; ctx_isp->req_info.last_applied_time_stamp = 0; ctx_isp->req_info.last_bufdone_time_stamp = 0; ctx_isp->req_info.last_reported_id_time_stamp = 0; /* * Ideally, we should never have any active request here. Loading Loading @@ -3169,7 +3245,7 @@ static int __cam_isp_ctx_start_dev_in_ready(struct cam_context *ctx, atomic_set(&ctx_isp->process_bubble, 0); ctx_isp->frame_id = 0; ctx_isp->active_req_cnt = 0; ctx_isp->reported_req_id = 0; ctx_isp->req_info.reported_req_id = 0; ctx_isp->substate_activated = ctx_isp->rdi_only_context ? CAM_ISP_CTX_ACTIVATED_APPLIED : (req_isp->num_fence_map_out) ? CAM_ISP_CTX_ACTIVATED_EPOCH : Loading Loading @@ -3301,7 +3377,13 @@ static int __cam_isp_ctx_stop_dev_in_activated_unlock( } ctx_isp->frame_id = 0; ctx_isp->active_req_cnt = 0; ctx_isp->reported_req_id = 0; ctx_isp->req_info.reported_req_id = 0; ctx_isp->req_info.last_applied_req_id = 0; ctx_isp->req_info.last_bufdone_req_id = 0; ctx_isp->req_info.last_applied_time_stamp = 0; ctx_isp->req_info.last_bufdone_time_stamp = 0; ctx_isp->req_info.last_reported_id_time_stamp = 0; atomic_set(&ctx_isp->process_bubble, 0); CAM_DBG(CAM_ISP, "Stop device success next state %d on ctx %u", Loading Loading @@ -3478,8 +3560,9 @@ static int __cam_isp_ctx_apply_req(struct cam_context *ctx, rc = ctx_ops->crm_ops.apply_req(ctx, apply); } else { CAM_ERR_RATE_LIMIT(CAM_ISP, "No handle function in activated substate %d", ctx_isp->substate_activated); "Ctx:%d No handle function in activated substate %d", ctx->ctx_id, ctx_isp->substate_activated); __cam_isp_ctx_dump_state_monitor_array(ctx_isp, true); rc = -EFAULT; } Loading @@ -3500,22 +3583,27 @@ static int __cam_isp_ctx_handle_irq_in_activated(void *context, struct cam_context *ctx = (struct cam_context *)context; struct cam_isp_context *ctx_isp = (struct cam_isp_context *)ctx->ctx_priv; enum cam_isp_ctx_activated_substate curr_state; spin_lock(&ctx->lock); trace_cam_isp_activated_irq(ctx, ctx_isp->substate_activated, evt_id, __cam_isp_ctx_get_event_ts(evt_id, evt_data)); curr_state = ctx_isp->substate_activated; CAM_DBG(CAM_ISP, "Enter: State %d, Substate %d, evt id %d", ctx->state, ctx_isp->substate_activated, evt_id); irq_ops = &ctx_isp->substate_machine_irq[ctx_isp->substate_activated]; if (irq_ops->irq_ops[evt_id]) { rc = irq_ops->irq_ops[evt_id](ctx_isp, evt_data); } else { CAM_DBG(CAM_ISP, "No handle function for substate %d", ctx_isp->substate_activated); __cam_isp_ctx_dump_state_monitor_array(ctx_isp); CAM_INFO(CAM_ISP, "Ctx:%d No handle function for substate %d", ctx->ctx_id, ctx_isp->substate_activated); __cam_isp_ctx_dump_state_monitor_array(ctx_isp, true); } if (evt_id != CAM_ISP_HW_EVENT_DONE) __cam_isp_ctx_update_state_monitor_array(ctx_isp, evt_id, curr_state, ctx_isp->substate_activated); CAM_DBG(CAM_ISP, "Exit: State %d Substate %d", ctx->state, ctx_isp->substate_activated); Loading Loading @@ -3677,7 +3765,13 @@ int cam_isp_context_init(struct cam_isp_context *ctx, ctx->base = ctx_base; ctx->frame_id = 0; ctx->active_req_cnt = 0; ctx->reported_req_id = 0; ctx->req_info.reported_req_id = 0; ctx->req_info.last_applied_req_id = 0; ctx->req_info.last_bufdone_req_id = 0; ctx->req_info.last_applied_time_stamp = 0; ctx->req_info.last_bufdone_time_stamp = 0; ctx->req_info.last_reported_id_time_stamp = 0; ctx->hw_ctx = NULL; ctx->substate_activated = CAM_ISP_CTX_ACTIVATED_SOF; ctx->substate_machine = cam_isp_ctx_activated_state_machine; Loading drivers/media/platform/msm/camera/cam_isp/cam_isp_context.h +36 −24 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
drivers/media/platform/msm/camera/cam_isp/cam_isp_context.c +209 −115 Original line number Diff line number Diff line Loading @@ -38,18 +38,26 @@ static int cam_isp_context_dump_active_request(void *data, unsigned long iova, static void __cam_isp_ctx_update_state_monitor_array( struct cam_isp_context *ctx_isp, enum cam_isp_state_change_trigger trigger_type, uint32_t req_id) enum cam_isp_hw_event_type hw_event, enum cam_isp_ctx_activated_substate curr_state, enum cam_isp_ctx_activated_substate next_state) { int iterator = 0; iterator = INC_STATE_MONITOR_HEAD(&ctx_isp->state_monitor_head); ctx_isp->cam_isp_ctx_state_monitor[iterator].curr_state = ctx_isp->substate_activated; ctx_isp->cam_isp_ctx_state_monitor[iterator].trigger = trigger_type; ctx_isp->cam_isp_ctx_state_monitor[iterator].req_id = req_id; curr_state; ctx_isp->cam_isp_ctx_state_monitor[iterator].next_state = next_state; ctx_isp->cam_isp_ctx_state_monitor[iterator].hw_event = hw_event; ctx_isp->cam_isp_ctx_state_monitor[iterator].last_reported_id = ctx_isp->req_info.reported_req_id; ctx_isp->cam_isp_ctx_state_monitor[iterator].last_applied_req_id = ctx_isp->req_info.last_applied_req_id; ctx_isp->cam_isp_ctx_state_monitor[iterator].frame_id = ctx_isp->frame_id; ctx_isp->cam_isp_ctx_state_monitor[iterator].evt_time_stamp = jiffies_to_msecs(jiffies); } Loading Loading @@ -79,17 +87,17 @@ static const char *__cam_isp_hw_evt_val_to_type( uint32_t evt_id) { switch (evt_id) { case CAM_ISP_STATE_CHANGE_TRIGGER_ERROR: case CAM_ISP_HW_EVENT_ERROR: return "ERROR"; case CAM_ISP_STATE_CHANGE_TRIGGER_SOF: case CAM_ISP_HW_EVENT_SOF: return "SOF"; case CAM_ISP_STATE_CHANGE_TRIGGER_REG_UPDATE: case CAM_ISP_HW_EVENT_REG_UPDATE: return "REG_UPDATE"; case CAM_ISP_STATE_CHANGE_TRIGGER_EPOCH: case CAM_ISP_HW_EVENT_EPOCH: return "EPOCH"; case CAM_ISP_STATE_CHANGE_TRIGGER_EOF: case CAM_ISP_HW_EVENT_EOF: return "EOF"; case CAM_ISP_STATE_CHANGE_TRIGGER_DONE: case CAM_ISP_HW_EVENT_DONE: return "DONE"; default: return "CAM_ISP_EVENT_INVALID"; Loading @@ -97,14 +105,22 @@ static const char *__cam_isp_hw_evt_val_to_type( } static void __cam_isp_ctx_dump_state_monitor_array( struct cam_isp_context *ctx_isp) struct cam_isp_context *ctx_isp, bool log_rate_limit) { int i = 0; uint64_t state_head = 0; uint64_t index; struct cam_isp_context_state_monitor *ctx_monitor; state_head = atomic64_read(&ctx_isp->state_monitor_head); CAM_ERR_RATE_LIMIT(CAM_ISP, ctx_monitor = ctx_isp->cam_isp_ctx_state_monitor; if (log_rate_limit) CAM_INFO_RATE_LIMIT_CUSTOM(CAM_ISP, 5, 20, "Dumping state information for preceding requests"); else CAM_INFO(CAM_ISP, "Dumping state information for preceding requests"); for (i = CAM_ISP_CTX_STATE_MONITOR_MAX_ENTRIES - 1; i >= 0; Loading @@ -112,14 +128,35 @@ static void __cam_isp_ctx_dump_state_monitor_array( index = (((state_head - i) + CAM_ISP_CTX_STATE_MONITOR_MAX_ENTRIES) % CAM_ISP_CTX_STATE_MONITOR_MAX_ENTRIES); CAM_ERR_RATE_LIMIT(CAM_ISP, "time[0x%llx] req_id[%u] state[%s] evt_type[%s]", ctx_isp->cam_isp_ctx_state_monitor[index].evt_time_stamp, ctx_isp->cam_isp_ctx_state_monitor[index].req_id, if (log_rate_limit) { CAM_INFO_RATE_LIMIT_CUSTOM(CAM_ISP, 5, 20, "time[%lld] last reported req_id[%u] frame id[%lld] applied id[%lld] current state[%s] next state[%s] hw_event[%s]", ctx_monitor[index].evt_time_stamp, ctx_monitor[index].last_reported_id, ctx_monitor[index].frame_id, ctx_monitor[index].last_applied_req_id, __cam_isp_ctx_substate_val_to_type( ctx_monitor[index].curr_state), __cam_isp_ctx_substate_val_to_type( ctx_monitor[index].next_state), __cam_isp_hw_evt_val_to_type( ctx_monitor[index].hw_event)); } else { CAM_INFO(CAM_ISP, "time[%lld] last reported req_id[%u] frame id[%lld] applied id[%lld] current state[%s] next state[%s] hw_event[%s]", ctx_monitor[index].evt_time_stamp, ctx_monitor[index].last_reported_id, ctx_monitor[index].frame_id, ctx_monitor[index].last_applied_req_id, __cam_isp_ctx_substate_val_to_type( ctx_monitor[index].curr_state), __cam_isp_ctx_substate_val_to_type( ctx_isp->cam_isp_ctx_state_monitor[index].curr_state), ctx_monitor[index].next_state), __cam_isp_hw_evt_val_to_type( ctx_isp->cam_isp_ctx_state_monitor[index].trigger)); ctx_monitor[index].hw_event)); } } } Loading Loading @@ -508,6 +545,10 @@ static int __cam_isp_ctx_handle_buf_done_in_activated_state( CAM_DBG(CAM_REQ, "Move active request %lld to pending list(cnt = %d) [bubble recovery], ctx %u", req->request_id, ctx_isp->active_req_cnt, ctx->ctx_id); __cam_isp_ctx_update_state_monitor_array(ctx_isp, CAM_ISP_HW_EVENT_DONE, ctx_isp->substate_activated, ctx_isp->substate_activated); } else { list_del_init(&req->list); list_add_tail(&req->list, &ctx->free_req_list); Loading @@ -515,12 +556,16 @@ static int __cam_isp_ctx_handle_buf_done_in_activated_state( CAM_DBG(CAM_REQ, "Move active request %lld to free list(cnt = %d) [all fences done], ctx %u", req->request_id, ctx_isp->active_req_cnt, ctx->ctx_id); ctx_isp->req_info.last_bufdone_req_id = req->request_id; ctx_isp->req_info.last_bufdone_time_stamp = jiffies_to_msecs(jiffies); __cam_isp_ctx_update_state_monitor_array(ctx_isp, CAM_ISP_HW_EVENT_DONE, ctx_isp->substate_activated, ctx_isp->substate_activated); } end: __cam_isp_ctx_update_state_monitor_array(ctx_isp, CAM_ISP_STATE_CHANGE_TRIGGER_DONE, ctx_isp->base->req_list->request_id); return rc; } Loading Loading @@ -665,9 +710,12 @@ static int __cam_isp_ctx_notify_sof_in_activated_state( } list_for_each_entry(req, &ctx->active_req_list, list) { if (req->request_id > ctx_isp->reported_req_id) { if (req->request_id > ctx_isp->req_info.reported_req_id) { request_id = req->request_id; ctx_isp->reported_req_id = request_id; ctx_isp->req_info.reported_req_id = request_id; ctx_isp->req_info.last_reported_id_time_stamp = jiffies_to_msecs(jiffies); break; } } Loading @@ -675,6 +723,17 @@ static int __cam_isp_ctx_notify_sof_in_activated_state( if (ctx_isp->substate_activated == CAM_ISP_CTX_ACTIVATED_BUBBLE) request_id = 0; if (request_id && ctx_isp->req_info.reported_req_id && ((request_id - ctx_isp->req_info.reported_req_id) > 1)){ CAM_INFO(CAM_ISP, "ctx:%d curr req id: %u last reported id:%u", ctx->ctx_id, request_id, ctx_isp->req_info.reported_req_id); __cam_isp_ctx_dump_state_monitor_array(ctx_isp, true); } __cam_isp_ctx_send_sof_timestamp(ctx_isp, request_id, CAM_REQ_MGR_SOF_EVENT_SUCCESS); } else { Loading Loading @@ -742,8 +801,7 @@ static int __cam_isp_ctx_sof_in_activated_state( ctx_isp->frame_id++; ctx_isp->sof_timestamp_val = sof_event_data->timestamp; ctx_isp->boot_timestamp = sof_event_data->boot_time; __cam_isp_ctx_update_state_monitor_array(ctx_isp, CAM_ISP_STATE_CHANGE_TRIGGER_SOF, req->request_id); CAM_DBG(CAM_ISP, "frame id: %lld time stamp:0x%llx, ctx %u", ctx_isp->frame_id, ctx_isp->sof_timestamp_val, ctx->ctx_id); Loading Loading @@ -778,11 +836,7 @@ static int __cam_isp_ctx_reg_upd_in_sof(struct cam_isp_context *ctx_isp, CAM_ERR(CAM_ISP, "receive rup in unexpected state"); } if (req != NULL) { __cam_isp_ctx_update_state_monitor_array(ctx_isp, CAM_ISP_STATE_CHANGE_TRIGGER_REG_UPDATE, req->request_id); } end: return rc; } Loading @@ -800,7 +854,8 @@ static int __cam_isp_ctx_epoch_in_applied(struct cam_isp_context *ctx_isp, * If no wait req in epoch, this is an error case. * The recovery is to go back to sof state */ CAM_ERR(CAM_ISP, "No wait request"); CAM_ERR(CAM_ISP, "Ctx:%d No wait request", ctx->ctx_id); __cam_isp_ctx_dump_state_monitor_array(ctx_isp, true); ctx_isp->substate_activated = CAM_ISP_CTX_ACTIVATED_SOF; /* Send SOF event as empty frame*/ Loading @@ -815,7 +870,9 @@ static int __cam_isp_ctx_epoch_in_applied(struct cam_isp_context *ctx_isp, req_isp = (struct cam_isp_ctx_req *)req->req_priv; req_isp->bubble_detected = true; CAM_DBG(CAM_ISP, "Report Bubble flag %d", req_isp->bubble_report); CAM_INFO(CAM_ISP, "ctx:%d Report Bubble flag %d req id:%lld", ctx->ctx_id, req_isp->bubble_report, req->request_id); __cam_isp_ctx_dump_state_monitor_array(ctx_isp, true); if (req_isp->bubble_report && ctx->ctx_crm_intf && ctx->ctx_crm_intf->notify_err) { struct cam_req_mgr_error_notify notify; Loading @@ -842,9 +899,11 @@ static int __cam_isp_ctx_epoch_in_applied(struct cam_isp_context *ctx_isp, list_del_init(&req->list); list_add_tail(&req->list, &ctx->active_req_list); if (req->request_id > ctx_isp->reported_req_id) { if (req->request_id > ctx_isp->req_info.reported_req_id) { request_id = req->request_id; ctx_isp->reported_req_id = request_id; ctx_isp->req_info.reported_req_id = request_id; ctx_isp->req_info.last_reported_id_time_stamp = jiffies_to_msecs(jiffies); } __cam_isp_ctx_send_sof_timestamp(ctx_isp, request_id, CAM_REQ_MGR_SOF_EVENT_ERROR); Loading @@ -853,15 +912,7 @@ static int __cam_isp_ctx_epoch_in_applied(struct cam_isp_context *ctx_isp, CAM_DBG(CAM_ISP, "next substate %d", ctx_isp->substate_activated); end: if (request_id == 0) { req = list_last_entry(&ctx->active_req_list, struct cam_ctx_request, list); __cam_isp_ctx_update_state_monitor_array(ctx_isp, CAM_ISP_STATE_CHANGE_TRIGGER_EPOCH, req->request_id); } else { __cam_isp_ctx_update_state_monitor_array(ctx_isp, CAM_ISP_STATE_CHANGE_TRIGGER_EPOCH, request_id); } return 0; } Loading @@ -884,7 +935,6 @@ static int __cam_isp_ctx_sof_in_epoch(struct cam_isp_context *ctx_isp, int rc = 0; struct cam_context *ctx = ctx_isp->base; struct cam_isp_hw_sof_event_data *sof_event_data = evt_data; struct cam_ctx_request *req; if (!evt_data) { CAM_ERR(CAM_ISP, "in valid sof event data"); Loading @@ -900,12 +950,6 @@ static int __cam_isp_ctx_sof_in_epoch(struct cam_isp_context *ctx_isp, else CAM_DBG(CAM_ISP, "Still need to wait for the buf done"); req = list_last_entry(&ctx->active_req_list, struct cam_ctx_request, list); if (req) __cam_isp_ctx_update_state_monitor_array(ctx_isp, CAM_ISP_STATE_CHANGE_TRIGGER_SOF, ctx->req_list->request_id); CAM_DBG(CAM_ISP, "next substate %d", ctx_isp->substate_activated); Loading Loading @@ -952,7 +996,8 @@ static int __cam_isp_ctx_epoch_in_bubble_applied( * If no pending req in epoch, this is an error case. * Just go back to the bubble state. */ CAM_ERR(CAM_ISP, "No pending request."); CAM_ERR(CAM_ISP, "ctx:%d No pending request.", ctx->ctx_id); __cam_isp_ctx_dump_state_monitor_array(ctx_isp, true); __cam_isp_ctx_send_sof_timestamp(ctx_isp, request_id, CAM_REQ_MGR_SOF_EVENT_SUCCESS); Loading @@ -964,6 +1009,9 @@ static int __cam_isp_ctx_epoch_in_bubble_applied( list); req_isp = (struct cam_isp_ctx_req *)req->req_priv; req_isp->bubble_detected = true; CAM_INFO(CAM_ISP, "Ctx:%d Report Bubble flag %d req id:%lld", ctx->ctx_id, req_isp->bubble_report, req->request_id); __cam_isp_ctx_dump_state_monitor_array(ctx_isp, true); if (req_isp->bubble_report && ctx->ctx_crm_intf && ctx->ctx_crm_intf->notify_err) { Loading Loading @@ -992,9 +1040,11 @@ static int __cam_isp_ctx_epoch_in_bubble_applied( list_add_tail(&req->list, &ctx->active_req_list); if (!req_isp->bubble_report) { if (req->request_id > ctx_isp->reported_req_id) { if (req->request_id > ctx_isp->req_info.reported_req_id) { request_id = req->request_id; ctx_isp->reported_req_id = request_id; ctx_isp->req_info.reported_req_id = request_id; ctx_isp->req_info.last_reported_id_time_stamp = jiffies_to_msecs(jiffies); __cam_isp_ctx_send_sof_timestamp(ctx_isp, request_id, CAM_REQ_MGR_SOF_EVENT_ERROR); } else Loading @@ -1007,11 +1057,7 @@ static int __cam_isp_ctx_epoch_in_bubble_applied( ctx_isp->substate_activated = CAM_ISP_CTX_ACTIVATED_BUBBLE; CAM_DBG(CAM_ISP, "next substate %d", ctx_isp->substate_activated); end: req = list_last_entry(&ctx->active_req_list, struct cam_ctx_request, list); if (req) __cam_isp_ctx_update_state_monitor_array(ctx_isp, CAM_ISP_STATE_CHANGE_TRIGGER_EPOCH, req->request_id); return 0; } Loading @@ -1023,9 +1069,7 @@ static int __cam_isp_ctx_buf_done_in_bubble_applied( (struct cam_isp_hw_done_event_data *) evt_data; rc = __cam_isp_ctx_handle_buf_done_in_activated_state(ctx_isp, done, 1); __cam_isp_ctx_update_state_monitor_array(ctx_isp, CAM_ISP_STATE_CHANGE_TRIGGER_DONE, ctx_isp->base->req_list->request_id); return rc; } Loading Loading @@ -1083,9 +1127,6 @@ static int __cam_isp_ctx_handle_error(struct cam_isp_context *ctx_isp, if (error_event_data->enable_reg_dump) cam_isp_ctx_dump_req(req_isp); __cam_isp_ctx_update_state_monitor_array(ctx_isp, CAM_ISP_STATE_CHANGE_TRIGGER_ERROR, req_to_dump->request_id); list_for_each_entry_safe(req, req_temp, &ctx->active_req_list, list) { req_isp = (struct cam_isp_ctx_req *) req->req_priv; Loading Loading @@ -1176,14 +1217,15 @@ static int __cam_isp_ctx_handle_error(struct cam_isp_context *ctx_isp, end: do { if (list_empty(&ctx->pending_req_list)) { error_request_id = ctx_isp->last_applied_req_id + 1; error_request_id = ctx_isp->req_info.last_applied_req_id + 1; req_isp = NULL; break; } req = list_first_entry(&ctx->pending_req_list, struct cam_ctx_request, list); req_isp = (struct cam_isp_ctx_req *) req->req_priv; error_request_id = ctx_isp->last_applied_req_id; error_request_id = ctx_isp->req_info.last_applied_req_id; if (req_isp->bubble_report) { req_to_report = req; Loading @@ -1201,7 +1243,8 @@ static int __cam_isp_ctx_handle_error(struct cam_isp_context *ctx_isp, list_del_init(&req->list); list_add_tail(&req->list, &ctx->free_req_list); } while (req->request_id < ctx_isp->last_applied_req_id); } while (req->request_id < ctx_isp->req_info.last_applied_req_id); if (ctx->ctx_crm_intf && ctx->ctx_crm_intf->notify_err) { notify.link_hdl = ctx->link_hdl; Loading Loading @@ -1240,7 +1283,7 @@ static int __cam_isp_ctx_handle_error(struct cam_isp_context *ctx_isp, V4L_EVENT_CAM_REQ_MGR_EVENT)) CAM_ERR(CAM_ISP, "Error in notifying the error time for req id:%lld ctx %u", ctx_isp->last_applied_req_id, ctx_isp->req_info.last_applied_req_id, ctx->ctx_id); } ctx_isp->substate_activated = CAM_ISP_CTX_ACTIVATED_HW_ERROR; Loading Loading @@ -1278,8 +1321,7 @@ static int __cam_isp_ctx_fs2_sof_in_sof_state( ctx_isp->frame_id++; ctx_isp->sof_timestamp_val = sof_event_data->timestamp; ctx_isp->boot_timestamp = sof_event_data->boot_time; __cam_isp_ctx_update_state_monitor_array(ctx_isp, CAM_ISP_STATE_CHANGE_TRIGGER_SOF, req->request_id); CAM_DBG(CAM_ISP, "frame id: %lld time stamp:0x%llx", ctx_isp->frame_id, ctx_isp->sof_timestamp_val); Loading @@ -1300,9 +1342,12 @@ static int __cam_isp_ctx_fs2_sof_in_sof_state( } list_for_each_entry(req, &ctx->active_req_list, list) { if (req->request_id > ctx_isp->reported_req_id) { if (req->request_id > ctx_isp->req_info.reported_req_id) { request_id = req->request_id; ctx_isp->reported_req_id = request_id; ctx_isp->req_info.reported_req_id = request_id; ctx_isp->req_info.last_reported_id_time_stamp = jiffies_to_msecs(jiffies); break; } } Loading Loading @@ -1343,8 +1388,10 @@ static int __cam_isp_ctx_fs2_buf_done(struct cam_isp_context *ctx_isp, CAM_DBG(CAM_ISP, "No request, move to SOF"); ctx_isp->substate_activated = CAM_ISP_CTX_ACTIVATED_SOF; if (ctx_isp->reported_req_id < curr_req_id) { ctx_isp->reported_req_id = curr_req_id; if (ctx_isp->req_info.reported_req_id < curr_req_id) { ctx_isp->req_info.reported_req_id = curr_req_id; ctx_isp->req_info.last_reported_id_time_stamp = jiffies_to_msecs(jiffies); __cam_isp_ctx_send_sof_timestamp(ctx_isp, curr_req_id, CAM_REQ_MGR_SOF_EVENT_SUCCESS); Loading Loading @@ -1402,11 +1449,7 @@ static int __cam_isp_ctx_fs2_reg_upd_in_sof(struct cam_isp_context *ctx_isp, CAM_ERR(CAM_ISP, "receive rup in unexpected state"); } if (req != NULL) { __cam_isp_ctx_update_state_monitor_array(ctx_isp, CAM_ISP_STATE_CHANGE_TRIGGER_REG_UPDATE, req->request_id); } end: return rc; } Loading Loading @@ -1451,9 +1494,12 @@ static int __cam_isp_ctx_fs2_reg_upd_in_applied_state( if (ctx->ctx_crm_intf && ctx->ctx_crm_intf->notify_trigger && ctx_isp->active_req_cnt <= 2) { list_for_each_entry(req, &ctx->active_req_list, list) { if (req->request_id > ctx_isp->reported_req_id) { if (req->request_id > ctx_isp->req_info.reported_req_id) { request_id = req->request_id; ctx_isp->reported_req_id = request_id; ctx_isp->req_info.reported_req_id = request_id; ctx_isp->req_info.last_reported_id_time_stamp = jiffies_to_msecs(jiffies); break; } } Loading @@ -1478,11 +1524,7 @@ static int __cam_isp_ctx_fs2_reg_upd_in_applied_state( CAM_DBG(CAM_ISP, "next substate %d", ctx_isp->substate_activated); end: if (req != NULL && !rc) { __cam_isp_ctx_update_state_monitor_array(ctx_isp, CAM_ISP_STATE_CHANGE_TRIGGER_EPOCH, req->request_id); } return rc; } Loading Loading @@ -1729,19 +1771,19 @@ static int __cam_isp_ctx_apply_req_in_activated_state( } else { spin_lock_bh(&ctx->lock); ctx_isp->substate_activated = next_state; ctx_isp->last_applied_req_id = apply->request_id; ctx_isp->req_info.last_applied_req_id = apply->request_id; ctx_isp->req_info.last_applied_time_stamp = jiffies_to_msecs(jiffies); list_del_init(&req->list); list_add_tail(&req->list, &ctx->wait_req_list); CAM_DBG(CAM_ISP, "new substate state %d, applied req %lld", next_state, ctx_isp->last_applied_req_id); next_state, ctx_isp->req_info.last_applied_req_id); spin_unlock_bh(&ctx->lock); } end: if (ctx_isp != NULL) { __cam_isp_ctx_update_state_monitor_array(ctx_isp, CAM_ISP_STATE_CHANGE_TRIGGER_SOF, ctx->req_list->request_id); } return rc; } Loading Loading @@ -1875,6 +1917,23 @@ static int __cam_isp_ctx_flush_req_in_top_state( CAM_DBG(CAM_ISP, "try to flush pending list"); spin_lock_bh(&ctx->lock); rc = __cam_isp_ctx_flush_req(ctx, &ctx->pending_req_list, flush_req); if (!list_empty(&ctx->active_req_list)) { CAM_INFO_RATE_LIMIT_CUSTOM(CAM_ISP, 5, 20, "ctx:%d last applied id:%lld, reported req id:%lld, buf done id:%lld", ctx->ctx_id, ctx_isp->req_info.last_applied_req_id, ctx_isp->req_info.reported_req_id, ctx_isp->req_info.last_bufdone_req_id); CAM_INFO_RATE_LIMIT_CUSTOM(CAM_ISP, 5, 20, "current time:%lld last apply time:%lld, reported req time:%lld, buf done time:%lld", jiffies_to_msecs(jiffies), ctx_isp->req_info.last_applied_time_stamp, ctx_isp->req_info.last_reported_id_time_stamp, ctx_isp->req_info.last_bufdone_time_stamp); __cam_isp_ctx_dump_state_monitor_array(ctx_isp, true); } spin_unlock_bh(&ctx->lock); atomic_set(&ctx_isp->process_bubble, 0); Loading Loading @@ -2133,8 +2192,10 @@ static int __cam_isp_ctx_rdi_only_sof_in_bubble_applied( list); req_isp = (struct cam_isp_ctx_req *)req->req_priv; req_isp->bubble_detected = true; CAM_INFO(CAM_ISP, "Ctx:%d Report Bubble flag %d req id:%lld", ctx->ctx_id, req_isp->bubble_report, req->request_id); __cam_isp_ctx_dump_state_monitor_array(ctx_isp, true); CAM_DBG(CAM_ISP, "Report Bubble flag %d", req_isp->bubble_report); if (req_isp->bubble_report && ctx->ctx_crm_intf && ctx->ctx_crm_intf->notify_err) { struct cam_req_mgr_error_notify notify; Loading @@ -2161,9 +2222,11 @@ static int __cam_isp_ctx_rdi_only_sof_in_bubble_applied( req->request_id, ctx_isp->active_req_cnt); if (!req_isp->bubble_report) { if (req->request_id > ctx_isp->reported_req_id) { if (req->request_id > ctx_isp->req_info.reported_req_id) { request_id = req->request_id; ctx_isp->reported_req_id = request_id; ctx_isp->req_info.reported_req_id = request_id; ctx_isp->req_info.last_reported_id_time_stamp = jiffies_to_msecs(jiffies); __cam_isp_ctx_send_sof_timestamp(ctx_isp, request_id, CAM_REQ_MGR_SOF_EVENT_ERROR); } else Loading Loading @@ -2305,8 +2368,11 @@ static int __cam_isp_ctx_rdi_only_reg_upd_in_bubble_applied_state( } else { CAM_ERR(CAM_ISP, "Can not notify SOF to CRM"); } if (request_id) ctx_isp->reported_req_id = request_id; if (request_id) { ctx_isp->req_info.reported_req_id = request_id; ctx_isp->req_info.last_reported_id_time_stamp = jiffies_to_msecs(jiffies); } __cam_isp_ctx_send_sof_timestamp(ctx_isp, request_id, CAM_REQ_MGR_SOF_EVENT_SUCCESS); Loading Loading @@ -2481,9 +2547,14 @@ static int __cam_isp_ctx_release_hw_in_top_state(struct cam_context *ctx, ctx->last_flush_req = 0; ctx_isp->frame_id = 0; ctx_isp->active_req_cnt = 0; ctx_isp->reported_req_id = 0; ctx_isp->hw_acquired = false; ctx_isp->init_received = false; ctx_isp->req_info.reported_req_id = 0; ctx_isp->req_info.last_applied_req_id = 0; ctx_isp->req_info.last_bufdone_req_id = 0; ctx_isp->req_info.last_applied_time_stamp = 0; ctx_isp->req_info.last_bufdone_time_stamp = 0; ctx_isp->req_info.last_reported_id_time_stamp = 0; /* * Ideally, we should never have any active request here. Loading Loading @@ -2538,11 +2609,16 @@ static int __cam_isp_ctx_release_dev_in_top_state(struct cam_context *ctx, ctx->last_flush_req = 0; ctx_isp->frame_id = 0; ctx_isp->active_req_cnt = 0; ctx_isp->reported_req_id = 0; ctx_isp->hw_acquired = false; ctx_isp->init_received = false; ctx_isp->rdi_only_context = false; ctx_isp->split_acquire = false; ctx_isp->req_info.reported_req_id = 0; ctx_isp->req_info.last_applied_req_id = 0; ctx_isp->req_info.last_bufdone_req_id = 0; ctx_isp->req_info.last_applied_time_stamp = 0; ctx_isp->req_info.last_bufdone_time_stamp = 0; ctx_isp->req_info.last_reported_id_time_stamp = 0; /* * Ideally, we should never have any active request here. Loading Loading @@ -3169,7 +3245,7 @@ static int __cam_isp_ctx_start_dev_in_ready(struct cam_context *ctx, atomic_set(&ctx_isp->process_bubble, 0); ctx_isp->frame_id = 0; ctx_isp->active_req_cnt = 0; ctx_isp->reported_req_id = 0; ctx_isp->req_info.reported_req_id = 0; ctx_isp->substate_activated = ctx_isp->rdi_only_context ? CAM_ISP_CTX_ACTIVATED_APPLIED : (req_isp->num_fence_map_out) ? CAM_ISP_CTX_ACTIVATED_EPOCH : Loading Loading @@ -3301,7 +3377,13 @@ static int __cam_isp_ctx_stop_dev_in_activated_unlock( } ctx_isp->frame_id = 0; ctx_isp->active_req_cnt = 0; ctx_isp->reported_req_id = 0; ctx_isp->req_info.reported_req_id = 0; ctx_isp->req_info.last_applied_req_id = 0; ctx_isp->req_info.last_bufdone_req_id = 0; ctx_isp->req_info.last_applied_time_stamp = 0; ctx_isp->req_info.last_bufdone_time_stamp = 0; ctx_isp->req_info.last_reported_id_time_stamp = 0; atomic_set(&ctx_isp->process_bubble, 0); CAM_DBG(CAM_ISP, "Stop device success next state %d on ctx %u", Loading Loading @@ -3478,8 +3560,9 @@ static int __cam_isp_ctx_apply_req(struct cam_context *ctx, rc = ctx_ops->crm_ops.apply_req(ctx, apply); } else { CAM_ERR_RATE_LIMIT(CAM_ISP, "No handle function in activated substate %d", ctx_isp->substate_activated); "Ctx:%d No handle function in activated substate %d", ctx->ctx_id, ctx_isp->substate_activated); __cam_isp_ctx_dump_state_monitor_array(ctx_isp, true); rc = -EFAULT; } Loading @@ -3500,22 +3583,27 @@ static int __cam_isp_ctx_handle_irq_in_activated(void *context, struct cam_context *ctx = (struct cam_context *)context; struct cam_isp_context *ctx_isp = (struct cam_isp_context *)ctx->ctx_priv; enum cam_isp_ctx_activated_substate curr_state; spin_lock(&ctx->lock); trace_cam_isp_activated_irq(ctx, ctx_isp->substate_activated, evt_id, __cam_isp_ctx_get_event_ts(evt_id, evt_data)); curr_state = ctx_isp->substate_activated; CAM_DBG(CAM_ISP, "Enter: State %d, Substate %d, evt id %d", ctx->state, ctx_isp->substate_activated, evt_id); irq_ops = &ctx_isp->substate_machine_irq[ctx_isp->substate_activated]; if (irq_ops->irq_ops[evt_id]) { rc = irq_ops->irq_ops[evt_id](ctx_isp, evt_data); } else { CAM_DBG(CAM_ISP, "No handle function for substate %d", ctx_isp->substate_activated); __cam_isp_ctx_dump_state_monitor_array(ctx_isp); CAM_INFO(CAM_ISP, "Ctx:%d No handle function for substate %d", ctx->ctx_id, ctx_isp->substate_activated); __cam_isp_ctx_dump_state_monitor_array(ctx_isp, true); } if (evt_id != CAM_ISP_HW_EVENT_DONE) __cam_isp_ctx_update_state_monitor_array(ctx_isp, evt_id, curr_state, ctx_isp->substate_activated); CAM_DBG(CAM_ISP, "Exit: State %d Substate %d", ctx->state, ctx_isp->substate_activated); Loading Loading @@ -3677,7 +3765,13 @@ int cam_isp_context_init(struct cam_isp_context *ctx, ctx->base = ctx_base; ctx->frame_id = 0; ctx->active_req_cnt = 0; ctx->reported_req_id = 0; ctx->req_info.reported_req_id = 0; ctx->req_info.last_applied_req_id = 0; ctx->req_info.last_bufdone_req_id = 0; ctx->req_info.last_applied_time_stamp = 0; ctx->req_info.last_bufdone_time_stamp = 0; ctx->req_info.last_reported_id_time_stamp = 0; ctx->hw_ctx = NULL; ctx->substate_activated = CAM_ISP_CTX_ACTIVATED_SOF; ctx->substate_machine = cam_isp_ctx_activated_state_machine; Loading
drivers/media/platform/msm/camera/cam_isp/cam_isp_context.h +36 −24 File changed.Preview size limit exceeded, changes collapsed. Show changes