Browse Source

msm: camera: icp: Remove input/output fence dependency

It is possible for UMD to send synx handles directly to FW
for input or output. FW will signal these fences to CPU.
On such occasions, ICP HLOS driver can skip processing
input and output synx fences. Synx will signal CSL.

CRs-Fixed: 3351015
Change-Id: Ia2c36db3bdaf75e12e27484357350fb20f32fcbc
Signed-off-by: Karthik Anantha Ram <[email protected]>
Karthik Anantha Ram 2 years ago
parent
commit
7bbd2390ff

+ 24 - 10
drivers/cam_core/cam_context_utils.c

@@ -204,8 +204,11 @@ int cam_context_buf_done_from_hw(struct cam_context *ctx,
 	}
 
 	if (!req->num_out_map_entries) {
-		CAM_ERR(CAM_CTXT, "[%s][%d] no output fence to signal",
+		CAM_DBG(CAM_CTXT, "[%s][%d] no output fence to signal",
 			ctx->dev_name, ctx->ctx_id);
+		list_del_init(&req->list);
+		list_add_tail(&req->list, &ctx->free_req_list);
+		req->ctx = NULL;
 		spin_unlock(&ctx->lock);
 		return -EIO;
 	}
@@ -584,16 +587,15 @@ int32_t cam_context_prepare_dev_to_hw(struct cam_context *ctx,
 		}
 	}
 
-	if (req->num_in_map_entries > 0) {
-		spin_lock(&ctx->lock);
-		list_add_tail(&req->list, &ctx->pending_req_list);
-		spin_unlock(&ctx->lock);
-
-		if (cam_debug_ctx_req_list & ctx->dev_id)
-			CAM_INFO(CAM_CTXT,
-				"[%s][%d] : Moving req[%llu] from free_list to pending_list",
-				ctx->dev_name, ctx->ctx_id, req->request_id);
+	spin_lock(&ctx->lock);
+	list_add_tail(&req->list, &ctx->pending_req_list);
+	spin_unlock(&ctx->lock);
+	if (cam_debug_ctx_req_list & ctx->dev_id)
+		CAM_INFO(CAM_CTXT,
+			"[%s][%d] : Moving req[%llu] from free_list to pending_list",
+			ctx->dev_name, ctx->ctx_id, req->request_id);
 
+	if (req->num_in_map_entries > 0) {
 		for (j = 0; j < req->num_in_map_entries; j++) {
 			rc = cam_sync_check_valid(
 				req->in_map_entries[j].sync_id);
@@ -635,6 +637,18 @@ int32_t cam_context_prepare_dev_to_hw(struct cam_context *ctx,
 			CAM_DBG(CAM_CTXT, "register in fence cb: %d ret = %d",
 				req->in_map_entries[j].sync_id, rc);
 		}
+	} else {
+		struct cam_req_mgr_apply_request apply;
+
+		/* If there are no input fences submit request immediately */
+		apply.request_id = req->request_id;
+		mutex_lock(&ctx->sync_mutex);
+		rc = cam_context_apply_req_to_hw(req, &apply);
+		mutex_unlock(&ctx->sync_mutex);
+		if (rc)
+			CAM_ERR(CAM_CTXT,
+				"[%s][%d] : Failed to apply req: %llu with no input dependencies",
+				ctx->dev_name, ctx->ctx_id, req->request_id);
 	}
 
 	return rc;

+ 2 - 2
drivers/cam_icp/icp_hw/icp_hw_mgr/cam_icp_hw_mgr.c

@@ -5086,10 +5086,10 @@ static int cam_icp_mgr_process_io_cfg(struct cam_icp_hw_mgr *hw_mgr,
 		prepare_args->num_in_map_entries = 1;
 		ctx_data->hfi_frame_process.in_resource[index] = 0;
 	} else {
-		CAM_ERR(CAM_ICP, "No input fences");
+		CAM_DBG(CAM_ICP, "No input fences for req: %llu on  ctx_id: %u",
+			packet->header.request_id, ctx_data->ctx_id);
 		prepare_args->num_in_map_entries = 0;
 		ctx_data->hfi_frame_process.in_resource[index] = 0;
-		rc = -EINVAL;
 	}
 
 	return rc;