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

Commit 6edca313 authored by Karthik Anantha Ram's avatar Karthik Anantha Ram Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: isp: Add support to obtain frame index



This change captures the frame index as part of the IFE top
register space at every epoch event. The index is then notified
to userspace as part of shutter notification.

CRs-Fixed: 2524308
Change-Id: Iac510c452f9ceda86e9f7d69528f22f81e614974
Signed-off-by: default avatarKarthik Anantha Ram <kartanan@codeaurora.org>
parent fdb064ce
Loading
Loading
Loading
Loading
+36 −8
Original line number Diff line number Diff line
@@ -425,6 +425,7 @@ static void __cam_isp_ctx_send_sof_boot_timestamp(
	req_msg.u.frame_msg.timestamp = ctx_isp->boot_timestamp;
	req_msg.u.frame_msg.link_hdl = ctx_isp->base->link_hdl;
	req_msg.u.frame_msg.sof_status = sof_event_status;
	req_msg.u.frame_msg.frame_id_meta = ctx_isp->frame_id_meta;

	CAM_DBG(CAM_ISP,
		"request id:%lld frame number:%lld boot time stamp:0x%llx",
@@ -452,6 +453,7 @@ static void __cam_isp_ctx_send_sof_timestamp(
	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;
	req_msg.u.frame_msg.frame_id_meta = ctx_isp->frame_id_meta;

	CAM_DBG(CAM_ISP,
		"request id:%lld frame number:%lld SOF time stamp:0x%llx",
@@ -800,11 +802,20 @@ static int __cam_isp_ctx_notify_sof_in_activated_state(
	struct cam_isp_context *ctx_isp, void *evt_data)
{
	int rc = 0;
	uint64_t  request_id  = 0;
	struct cam_req_mgr_trigger_notify  notify;
	struct cam_context *ctx = ctx_isp->base;
	struct cam_ctx_request  *req;
	struct cam_isp_ctx_req  *req_isp;
	uint64_t  request_id  = 0;
	struct cam_isp_hw_epoch_event_data *epoch_done_event_data =
			(struct cam_isp_hw_epoch_event_data *)evt_data;

	if (!evt_data) {
		CAM_ERR(CAM_ISP, "invalid event data");
		return -EINVAL;
	}

	ctx_isp->frame_id_meta = epoch_done_event_data->frame_id_meta;

	/*
	 * notify reqmgr with sof signal. Note, due to scheduling delay
@@ -1019,11 +1030,19 @@ static int __cam_isp_ctx_reg_upd_in_sof(struct cam_isp_context *ctx_isp,
static int __cam_isp_ctx_epoch_in_applied(struct cam_isp_context *ctx_isp,
	void *evt_data)
{
	uint64_t request_id = 0;
	struct cam_ctx_request             *req;
	struct cam_isp_ctx_req             *req_isp;
	struct cam_context                 *ctx = ctx_isp->base;
	uint64_t  request_id = 0;
	struct cam_isp_hw_epoch_event_data *epoch_done_event_data =
		(struct cam_isp_hw_epoch_event_data *)evt_data;

	if (!evt_data) {
		CAM_ERR(CAM_ISP, "invalid event data");
		return -EINVAL;
	}

	ctx_isp->frame_id_meta = epoch_done_event_data->frame_id_meta;
	if (list_empty(&ctx->wait_req_list)) {
		/*
		 * If no wait req in epoch, this is an error case.
@@ -1180,10 +1199,19 @@ static int __cam_isp_ctx_buf_done_in_bubble(
static int __cam_isp_ctx_epoch_in_bubble_applied(
	struct cam_isp_context *ctx_isp, void *evt_data)
{
	uint64_t  request_id = 0;
	struct cam_ctx_request             *req;
	struct cam_isp_ctx_req             *req_isp;
	struct cam_context                 *ctx = ctx_isp->base;
	uint64_t  request_id = 0;
	struct cam_isp_hw_epoch_event_data *epoch_done_event_data =
		(struct cam_isp_hw_epoch_event_data *)evt_data;

	if (!evt_data) {
		CAM_ERR(CAM_ISP, "invalid event data");
		return -EINVAL;
	}

	ctx_isp->frame_id_meta = epoch_done_event_data->frame_id_meta;

	/*
	 * This means we missed the reg upd ack. So we need to
+25 −22
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 */

#ifndef _CAM_ISP_CONTEXT_H_
@@ -165,6 +165,8 @@ struct cam_isp_context_req_id_info {
 *
 * @base:                      Common context object pointer
 * @frame_id:                  Frame id tracking for the isp context
 * @frame_id_meta:             Frame id read every epoch for the ctx
 *                             meta from the sensor
 * @substate_actiavted:        Current substate for the activated state.
 * @process_bubble:            Atomic variable to check if ctx is still
 *                             processing bubble.
@@ -196,7 +198,8 @@ struct cam_isp_context {
	struct cam_context              *base;

	int64_t                          frame_id;
	enum cam_isp_ctx_activated_substate   substate_activated;
	uint32_t                         frame_id_meta;
	uint32_t                         substate_activated;
	atomic_t                         process_bubble;
	uint32_t                         bubble_frame_cnt;
	struct cam_ctx_ops              *substate_machine;
+31 −21
Original line number Diff line number Diff line
@@ -4826,10 +4826,13 @@ static int cam_isp_blob_core_cfg_update(
	list_for_each_entry(hw_mgr_res, &ctx->res_list_ife_src, list) {
		for (i = 0; i < CAM_ISP_HW_SPLIT_MAX; i++) {
			clk_rate = 0;
			if (!hw_mgr_res->hw_res[i] ||
				hw_mgr_res->res_id != CAM_ISP_HW_VFE_IN_CAMIF)
			if (!hw_mgr_res->hw_res[i])
				continue;

			if ((hw_mgr_res->res_id ==
				CAM_ISP_HW_VFE_IN_CAMIF) ||
				(hw_mgr_res->res_id ==
				CAM_ISP_HW_VFE_IN_PDLIB)) {
				hw_intf = hw_mgr_res->hw_res[i]->hw_intf;
				if (hw_intf && hw_intf->hw_ops.process_cmd) {
					vfe_core_config.node_res =
@@ -4837,21 +4840,25 @@ static int cam_isp_blob_core_cfg_update(

					memcpy(&vfe_core_config.core_config,
						core_config,
					sizeof(struct cam_isp_core_config));
						sizeof(
						struct cam_isp_core_config));

					rc = hw_intf->hw_ops.process_cmd(
						hw_intf->hw_priv,
						CAM_ISP_HW_CMD_CORE_CONFIG,
						&vfe_core_config,
						sizeof(
					struct cam_vfe_core_config_args));
						struct cam_vfe_core_config_args)
						);
					if (rc)
					CAM_ERR(CAM_ISP, "Core cfg parse fail");
						CAM_ERR(CAM_ISP,
						"Core cfg parse fail");
				} else {
					CAM_WARN(CAM_ISP, "NULL hw_intf!");
				}
			}
		}
	}

	return rc;
}
@@ -6429,6 +6436,9 @@ static int cam_ife_hw_mgr_handle_hw_epoch(
		if (!rc) {
			if (atomic_read(&ife_hw_mgr_ctx->overflow_pending))
				break;

			epoch_done_event_data.frame_id_meta =
				event_info->th_reg_val;
			ife_hw_irq_epoch_cb(ife_hw_mgr_ctx->common.cb_priv,
				CAM_ISP_HW_EVENT_EPOCH, &epoch_done_event_data);
		}
+2 −1
Original line number Diff line number Diff line
@@ -168,10 +168,11 @@ struct cam_isp_hw_reg_update_event_data {
 * struct cam_isp_hw_epoch_event_data - Event payload for CAM_HW_EVENT_EPOCH
 *
 * @timestamp:     Time stamp for the epoch event
 *
 * @frame_id_meta: Frame id value corresponding to this frame
 */
struct cam_isp_hw_epoch_event_data {
	uint64_t       timestamp;
	uint32_t       frame_id_meta;
};

/**
+3 −1
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 */

#ifndef _CAM_ISP_HW_H_
@@ -165,6 +165,7 @@ struct cam_isp_resource_node {
 * @res_id:         Unique resource ID
 * @hw_idx:         IFE hw index
 * @err_type:       Error type if any
 * @th_reg_val:     Any critical register value captured during th
 *
 */
struct cam_isp_hw_event_info {
@@ -172,6 +173,7 @@ struct cam_isp_hw_event_info {
	uint32_t                       res_id;
	uint32_t                       hw_idx;
	uint32_t                       err_type;
	uint32_t                       th_reg_val;
};

/*
Loading