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

Commit 3619ae63 authored by Trishansh Bhardwaj's avatar Trishansh Bhardwaj Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: reqmgr: Logs v4l2 event queue failure



Kernel uses v4l2 events to communicate with userspace.
If userspace is not dequeuing events and kernel is pushing more events
then v4l2_event_queue fails silently.
This change uses v4l2 callbacks to log v4l2_event_queue failure.

CRs-Fixed: 2541894
Change-Id: I98f8f609f615104ec6dde569bf1f39de1eb368fc
Signed-off-by: default avatarTrishansh Bhardwaj <tbhardwa@codeaurora.org>
parent af27416f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -4437,7 +4437,8 @@ static void cam_icp_mgr_print_io_bufs(struct cam_packet *packet,
			rc = cam_mem_get_io_buf(io_cfg[i].mem_handle[j],
				mmu_hdl, &iova_addr, &src_buf_size);
			if (rc < 0) {
				CAM_ERR(CAM_UTIL, "get src buf address fail");
				CAM_ERR(CAM_UTIL,
					"get src buf address fail rc %d", rc);
				continue;
			}
			if (iova_addr >> 32) {
+2 −2
Original line number Diff line number Diff line
@@ -188,10 +188,10 @@ int cam_mem_get_io_buf(int32_t buf_handle, int32_t mmu_handle,

	idx = CAM_MEM_MGR_GET_HDL_IDX(buf_handle);
	if (idx >= CAM_MEM_BUFQ_MAX || idx <= 0)
		return -EINVAL;
		return -ENOENT;

	if (!tbl.bufq[idx].active)
		return -EINVAL;
		return -EAGAIN;

	mutex_lock(&tbl.bufq[idx].q_lock);
	if (buf_handle != tbl.bufq[idx].buf_handle) {
+44 −1
Original line number Diff line number Diff line
@@ -197,10 +197,53 @@ static struct v4l2_file_operations g_cam_fops = {
#endif
};

static void cam_v4l2_event_queue_notify_error(const struct v4l2_event *old,
	struct v4l2_event *new)
{
	struct cam_req_mgr_message *ev_header;

	ev_header = CAM_REQ_MGR_GET_PAYLOAD_PTR((*old),
		struct cam_req_mgr_message);
	switch (old->id) {
	case V4L_EVENT_CAM_REQ_MGR_SOF:
		CAM_ERR(CAM_CRM, "Failed to notify SOF event");
		CAM_ERR(CAM_CRM, "Sess %X FrameId %lld ReqId %lld link %X",
			ev_header->session_hdl,
			ev_header->u.frame_msg.frame_id,
			ev_header->u.frame_msg.request_id,
			ev_header->u.frame_msg.link_hdl);
		break;
	case V4L_EVENT_CAM_REQ_MGR_ERROR:
		CAM_ERR(CAM_CRM, "Failed to notify ERROR");
		CAM_ERR(CAM_CRM, "Sess %X ReqId %d Link %X Type %d",
			ev_header->u.err_msg.error_type,
			ev_header->u.err_msg.request_id,
			ev_header->u.err_msg.link_hdl,
			ev_header->u.err_msg.error_type);
		break;
	case V4L_EVENT_CAM_REQ_MGR_SOF_BOOT_TS:
		CAM_ERR(CAM_CRM, "Failed to notify BOOT_TS event");
		CAM_ERR(CAM_CRM, "Sess %X FrameId %lld ReqId %lld link %X",
			ev_header->session_hdl,
			ev_header->u.frame_msg.frame_id,
			ev_header->u.frame_msg.request_id,
			ev_header->u.frame_msg.link_hdl);
		break;
	default:
		CAM_ERR(CAM_CRM, "Failed to notify crm event id %d",
			old->id);
	}
}

static struct v4l2_subscribed_event_ops g_cam_v4l2_ops = {
	.merge = cam_v4l2_event_queue_notify_error,
};

static int cam_subscribe_event(struct v4l2_fh *fh,
	const struct v4l2_event_subscription *sub)
{
	return v4l2_event_subscribe(fh, sub, CAM_REQ_MGR_EVENT_MAX, NULL);
	return v4l2_event_subscribe(fh, sub, CAM_REQ_MGR_EVENT_MAX,
		&g_cam_v4l2_ops);
}

static int cam_unsubscribe_event(struct v4l2_fh *fh,
+16 −1
Original line number Diff line number Diff line
@@ -847,10 +847,25 @@ static int cam_sync_close(struct file *filep)
	return rc;
}

static void cam_sync_event_queue_notify_error(const struct v4l2_event *old,
	struct v4l2_event *new)
{
	struct cam_sync_ev_header *ev_header;

	ev_header = CAM_SYNC_GET_HEADER_PTR((*old));
	CAM_ERR(CAM_CRM, "Failed to notify event id %d fence %d statue %d",
		old->id, ev_header->sync_obj, ev_header->status);
}

static struct v4l2_subscribed_event_ops cam_sync_v4l2_ops = {
	.merge = cam_sync_event_queue_notify_error,
};

int cam_sync_subscribe_event(struct v4l2_fh *fh,
		const struct v4l2_event_subscription *sub)
{
	return v4l2_event_subscribe(fh, sub, CAM_SYNC_MAX_V4L2_EVENTS, NULL);
	return v4l2_event_subscribe(fh, sub, CAM_SYNC_MAX_V4L2_EVENTS,
		&cam_sync_v4l2_ops);
}

int cam_sync_unsubscribe_event(struct v4l2_fh *fh,