Jelajahi Sumber

msm: camera: reqmgr: Reduce delay by one frame during bubble recovery

The EPOCH at which bubble is detected no setting is applied
to any device. This change will trigger applying the bubbled
setting to the device with highest pipeline delay.

CRs-Fixed: 2564669
Change-Id: I180b4a1d2d29267f330546b8860a099baf1688e9
Signed-off-by: Karthik Anantha Ram <[email protected]>
Karthik Anantha Ram 5 tahun lalu
induk
melakukan
fbfa512811

+ 15 - 0
drivers/cam_isp/cam_isp_context.c

@@ -1102,6 +1102,11 @@ static int __cam_isp_ctx_epoch_in_applied(struct cam_isp_context *ctx_isp,
 		notify.dev_hdl = ctx->dev_hdl;
 		notify.req_id = req->request_id;
 		notify.error = CRM_KMD_ERR_BUBBLE;
+		notify.trigger = 0;
+		if (ctx_isp->subscribe_event & CAM_TRIGGER_POINT_SOF)
+			notify.trigger = CAM_TRIGGER_POINT_SOF;
+		notify.frame_id = ctx_isp->frame_id;
+		notify.sof_timestamp_val = ctx_isp->sof_timestamp_val;
 		CAM_WARN(CAM_ISP,
 			"Notify CRM about Bubble req %lld frame %lld, ctx %u",
 			req->request_id, ctx_isp->frame_id, ctx->ctx_id);
@@ -1264,6 +1269,11 @@ static int __cam_isp_ctx_epoch_in_bubble_applied(
 		notify.dev_hdl = ctx->dev_hdl;
 		notify.req_id = req->request_id;
 		notify.error = CRM_KMD_ERR_BUBBLE;
+		notify.trigger = 0;
+		if (ctx_isp->subscribe_event & CAM_TRIGGER_POINT_SOF)
+			notify.trigger = CAM_TRIGGER_POINT_SOF;
+		notify.frame_id = ctx_isp->frame_id;
+		notify.sof_timestamp_val = ctx_isp->sof_timestamp_val;
 		CAM_WARN(CAM_REQ,
 			"Notify CRM about Bubble req_id %llu frame %lld, ctx %u",
 			req->request_id, ctx_isp->frame_id, ctx->ctx_id);
@@ -2564,6 +2574,11 @@ static int __cam_isp_ctx_rdi_only_sof_in_bubble_applied(
 		notify.dev_hdl = ctx->dev_hdl;
 		notify.req_id = req->request_id;
 		notify.error = CRM_KMD_ERR_BUBBLE;
+		notify.trigger = 0;
+		if (ctx_isp->subscribe_event & CAM_TRIGGER_POINT_SOF)
+			notify.trigger = CAM_TRIGGER_POINT_SOF;
+		notify.frame_id = ctx_isp->frame_id;
+		notify.sof_timestamp_val = ctx_isp->sof_timestamp_val;
 		CAM_WARN(CAM_ISP,
 			"Notify CRM about Bubble req %lld frame %lld ctx %u",
 			req->request_id,

+ 30 - 0
drivers/cam_req_mgr/cam_req_mgr_core.c

@@ -2321,6 +2321,35 @@ end:
 	return rc;
 }
 
+/**
+ * __cam_req_mgr_apply_on_bubble()
+ *
+ * @brief    : This API tries to apply settings to the device
+ *             with highest pd on the bubbled frame
+ * @link     : link information.
+ * @err_info : contains information about frame_id, trigger etc.
+ *
+ */
+void __cam_req_mgr_apply_on_bubble(
+	struct cam_req_mgr_core_link    *link,
+	struct cam_req_mgr_error_notify *err_info)
+{
+	int rc = 0;
+	struct cam_req_mgr_trigger_notify trigger_data;
+
+	trigger_data.dev_hdl = err_info->dev_hdl;
+	trigger_data.frame_id = err_info->frame_id;
+	trigger_data.link_hdl = err_info->link_hdl;
+	trigger_data.sof_timestamp_val =
+		err_info->sof_timestamp_val;
+	trigger_data.trigger = err_info->trigger;
+
+	rc = __cam_req_mgr_process_req(link, &trigger_data);
+	if (rc)
+		CAM_ERR(CAM_CRM,
+			"Failed to apply request on bubbled frame");
+}
+
 /**
  * cam_req_mgr_process_error()
  *
@@ -2405,6 +2434,7 @@ int cam_req_mgr_process_error(void *priv, void *data)
 			link->state = CAM_CRM_LINK_STATE_ERR;
 			spin_unlock_bh(&link->link_state_spin_lock);
 			link->open_req_cnt++;
+			__cam_req_mgr_apply_on_bubble(link, err_info);
 		}
 	}
 	mutex_unlock(&link->req.lock);

+ 6 - 0
drivers/cam_req_mgr/cam_req_mgr_interface.h

@@ -227,12 +227,18 @@ struct cam_req_mgr_timer_notify {
  * @link_hdl : link identifier
  * @dev_hdl  : device handle which has sent this req id
  * @req_id   : req id which hit error
+ * @frame_id : frame id for internal tracking
+ * @trigger  : trigger point of this notification, CRM will send apply
+ * @sof_timestamp_val : Captured time stamp value at sof hw event
  * @error    : what error device hit while processing this req
  */
 struct cam_req_mgr_error_notify {
 	int32_t  link_hdl;
 	int32_t  dev_hdl;
 	uint64_t req_id;
+	int64_t  frame_id;
+	uint32_t trigger;
+	uint64_t sof_timestamp_val;
 	enum cam_req_mgr_device_error error;
 };