From 5bf029b886e9f1f5ddbff2ee5f1f3a48cfb93be7 Mon Sep 17 00:00:00 2001 From: Anubhav Rai Date: Wed, 11 Oct 2023 15:52:48 +0000 Subject: [PATCH] vi5: continue captures even after corr errors even if the channel encounters corr error, continue captures anticipating that channel might recover in future. This also prevents high CPU usage of the dequeue thread in corr error usecase. bug 4310063 Change-Id: I49a30f9f5583badf77ecd5c60b94009f786a0b7a Signed-off-by: Anubhav Rai Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2995411 (cherry picked from commit d8749afd649c213927bb49c1384f063f099dd083) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3007710 Reviewed-by: Ankur Pawar Reviewed-by: Bibek Basu GVS: Gerrit_Virtual_Submit --- drivers/media/platform/tegra/camera/vi/vi5_fops.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/tegra/camera/vi/vi5_fops.c b/drivers/media/platform/tegra/camera/vi/vi5_fops.c index be0c8503..3d29ee78 100644 --- a/drivers/media/platform/tegra/camera/vi/vi5_fops.c +++ b/drivers/media/platform/tegra/camera/vi/vi5_fops.c @@ -489,7 +489,8 @@ static void vi5_capture_dequeue(struct tegra_channel *chan, struct tegra_channel_buffer *buf) { int err = 0; - unsigned int vi_port = 0; + bool frame_err = false; + int vi_port = 0; int gang_prev_frame_id = 0; unsigned long flags; struct tegra_mc_vi *vi = chan->vi; @@ -526,8 +527,7 @@ static void vi5_capture_dequeue(struct tegra_channel *chan, "err_data %d\n", descr->status.frame_id, descr->status.flags, descr->status.err_data); - buf->vb2_state = VB2_BUF_STATE_ERROR; - goto done; + frame_err = true; } } else if (!vi_port) { gang_prev_frame_id = descr->status.frame_id; @@ -551,12 +551,14 @@ static void vi5_capture_dequeue(struct tegra_channel *chan, trace_tegra_channel_capture_frame("sof", &ts); vb->vb2_buf.timestamp = descr->status.sof_timestamp; - buf->vb2_state = VB2_BUF_STATE_DONE; + if (frame_err) + buf->vb2_state = VB2_BUF_STATE_ERROR; + else + buf->vb2_state = VB2_BUF_STATE_DONE; /* Read EOF from capture descriptor */ ts = ns_to_timespec64((s64)descr->status.eof_timestamp); trace_tegra_channel_capture_frame("eof", &ts); -done: goto rel_buf; uncorr_err: