Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d62c87c8 authored by Jeyaprakash Soundrapandian's avatar Jeyaprakash Soundrapandian Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: icp: Signal all fences when request is done." into dev/msm-4.9-camx

parents c533dbba cdd6a5ec
Loading
Loading
Loading
Loading
+15 −23
Original line number Diff line number Diff line
@@ -28,48 +28,40 @@
int cam_context_buf_done_from_hw(struct cam_context *ctx,
	void *done_event_data, uint32_t bubble_state)
{
	int rc = 0;
	int i, j;
	int j;
	struct cam_ctx_request *req;
	struct cam_hw_done_event_data *done =
		(struct cam_hw_done_event_data *)done_event_data;

	if (list_empty(&ctx->active_req_list)) {
		pr_err("Buf done with no active request\n");
		rc = -EINVAL;
		goto end;
		return -EIO;
	}

	req = list_first_entry(&ctx->active_req_list,
		struct cam_ctx_request, list);

	for (i = 0; i < done->num_handles; i++) {
		for (j = 0; j < req->num_out_map_entries; j++) {
			if (done->resource_handle[i] ==
				req->out_map_entries[j].resource_handle)
				break;
	if (done->request_id != req->request_id) {
		pr_err("mismatch: done request [%lld], active request [%lld]\n",
			done->request_id, req->request_id);
		return -EIO;
	}

		if (j == req->num_out_map_entries) {
			pr_err("Can not find matching lane handle 0x%x\n",
				done->resource_handle[i]);
			rc = -EINVAL;
			continue;
	if (!req->num_out_map_entries) {
		pr_err("active request with no output fence objects to signal\n");
		return -EIO;
	}

	list_del_init(&req->list);
	for (j = 0; j < req->num_out_map_entries; j++) {
		cam_sync_signal(req->out_map_entries[j].sync_id,
			CAM_SYNC_STATE_SIGNALED_SUCCESS);
		req->num_out_acked++;
		req->out_map_entries[j].sync_id = -1;
	}

	if (req->num_out_acked == req->num_out_map_entries) {
		list_del_init(&req->list);
	list_add_tail(&req->list, &ctx->free_req_list);
	}

end:
	return rc;
	return 0;
}

int cam_context_apply_req_to_hw(struct cam_context *ctx,
+3 −1
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ struct cam_hw_update_entry {
 * struct cam_hw_fence_map_entry - Entry for the resource to sync id map
 *
 * @resrouce_handle:       Resource port id for the buffer
 * @sync_id:               Synce id
 * @sync_id:               Sync id
 *
 */
struct cam_hw_fence_map_entry {
@@ -65,12 +65,14 @@ struct cam_hw_fence_map_entry {
 * @num_handles:           number of handles in the event
 * @resrouce_handle:       list of the resource handle
 * @timestamp:             time stamp
 * @request_id:            request identifier
 *
 */
struct cam_hw_done_event_data {
	uint32_t           num_handles;
	uint32_t           resource_handle[CAM_NUM_OUT_PER_COMP_IRQ_MAX];
	struct timeval     timestamp;
	uint64_t           request_id;
};

/**
+6 −21
Original line number Diff line number Diff line
@@ -100,7 +100,7 @@ static int cam_icp_mgr_process_msg_frame_process(uint32_t *msg_ptr)
{
	int i;
	uint32_t idx;
	uint32_t request_id;
	uint64_t request_id;
	struct cam_icp_hw_ctx_data *ctx_data = NULL;
	struct hfi_msg_ipebps_async_ack *ioconfig_ack = NULL;
	struct hfi_msg_frame_process_done *frame_done;
@@ -119,12 +119,9 @@ static int cam_icp_mgr_process_msg_frame_process(uint32_t *msg_ptr)
		pr_err("result : %u\n", frame_done->result);
		return -EIO;
	}
	ICP_DBG("result : %u\n", frame_done->result);

	ctx_data = (struct cam_icp_hw_ctx_data *)ioconfig_ack->user_data1;
	request_id = ioconfig_ack->user_data2;
	ICP_DBG("ctx : %pK, request_id :%d\n",
		(void *)ctx_data->context_priv, request_id);

	hfi_frame_process = &ctx_data->hfi_frame_process;
	for (i = 0; i < CAM_FRAME_CMD_MAX; i++)
@@ -132,22 +129,17 @@ static int cam_icp_mgr_process_msg_frame_process(uint32_t *msg_ptr)
			break;

	if (i >= CAM_FRAME_CMD_MAX) {
		pr_err("unable to find pkt in ctx data for req_id =%d\n",
		pr_err("unable to find pkt in ctx data for req_id =%lld\n",
			request_id);
		return -EINVAL;
	}
	idx = i;

	/* send event to ctx this needs to be done in msg handler */
	buf_data.num_handles = hfi_frame_process->num_out_resources[idx];
	for (i = 0; i < buf_data.num_handles; i++)
		buf_data.resource_handle[i] =
			hfi_frame_process->out_resource[idx][i];

	buf_data.request_id = hfi_frame_process->request_id[idx];
	ctx_data->ctxt_event_cb(ctx_data->context_priv, 0, &buf_data);

	/* now release memory for hfi frame process command */
	ICP_DBG("matching request id: %d\n",
	ICP_DBG("matching request id: %lld\n",
			hfi_frame_process->request_id[idx]);
	mutex_lock(&ctx_data->hfi_frame_process.lock);
	hfi_frame_process->request_id[idx] = 0;
@@ -1195,8 +1187,6 @@ static int cam_icp_mgr_prepare_hw_update(void *hw_mgr_priv,
		}

		prepare_args->out_map_entries[j].sync_id = io_cfg_ptr[i].fence;
		prepare_args->out_map_entries[j++].resource_handle =
							io_cfg_ptr[i].fence;
		prepare_args->num_out_map_entries++;
		ICP_DBG(" out fence = %x index = %d\n", io_cfg_ptr[i].fence, i);
	}
@@ -1243,13 +1233,8 @@ static int cam_icp_mgr_prepare_hw_update(void *hw_mgr_priv,
	mutex_unlock(&ctx_data->hfi_frame_process.lock);

	ctx_data->hfi_frame_process.request_id[idx] = packet->header.request_id;
	ICP_DBG("slot[%d]: %d\n", idx,
		ctx_data->hfi_frame_process.request_id[idx]);
	ctx_data->hfi_frame_process.num_out_resources[idx] =
				prepare_args->num_out_map_entries;
	for (i = 0; i < prepare_args->num_out_map_entries; i++)
		ctx_data->hfi_frame_process.out_resource[idx][i] =
			prepare_args->out_map_entries[i].resource_handle;

	hfi_cmd = (struct hfi_cmd_ipebps_async *)
			&ctx_data->hfi_frame_process.hfi_frame_cmd[idx];
@@ -1263,7 +1248,7 @@ static int cam_icp_mgr_prepare_hw_update(void *hw_mgr_priv,

	prepare_args->priv = &ctx_data->hfi_frame_process.request_id[idx];

	ICP_DBG("slot : %d, hfi_cmd : %pK, request : %d\n",	idx,
	ICP_DBG("slot : %d, hfi_cmd : %pK, request : %lld\n", idx,
		(void *)hfi_cmd,
		ctx_data->hfi_frame_process.request_id[idx]);

+1 −1
Original line number Diff line number Diff line
@@ -100,7 +100,7 @@ struct hfi_frame_process_info {
	void *bitmap;
	size_t bits;
	struct mutex lock;
	int32_t request_id[CAM_FRAME_CMD_MAX];
	uint64_t request_id[CAM_FRAME_CMD_MAX];
	uint32_t num_out_resources[CAM_FRAME_CMD_MAX];
	uint32_t out_resource[CAM_FRAME_CMD_MAX][CAM_MAX_OUT_RES];
};