From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Aakarsh Jain <aakarsh.jain@samsung.com>,
linux-arm-kernel@lists.infradead.org,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: andrzej.hajda@intel.com, mchehab@kernel.org,
hverkuil-cisco@xs4all.nl, krzysztof.kozlowski+dt@linaro.org,
linux-samsung-soc@vger.kernel.org, gost.dev@samsung.com,
aswani.reddy@samsung.com, pankaj.dubey@samsung.com
Subject: Re: [Patch v2] media: s5p-mfc: Support for handling RET_ENC_BUFFER_FULL interrupt
Date: Fri, 21 Mar 2025 08:35:09 +0100 [thread overview]
Message-ID: <33f85cd5-8387-4358-b2d4-29f8877a7e2e@samsung.com> (raw)
In-Reply-To: <20250305055308.111300-2-aakarsh.jain@samsung.com>
On 05.03.2025 06:53, Aakarsh Jain wrote:
> When output encoded buffer size provided by userspace
> is insufficient with current encoding parameters, it
> leads to RET_ENC_BUFFER_FULL interrupt which was not
> handled in IRQ handler.
>
> On handling of RET_ENC_BUFFER_FULL interrupt leads to
> NAL_ABORT command from host to risc which in turn leads
> to RET_NAL_ABORT interrupt. On receiving RET_NAL_ABORT
> driver clears workbit and VB2 queues for cleaner closing
> of MFC instance.
>
> When user encounters "Call on DQBUF after unrecoverable
> error", userspace should close fd and restart with larger
> output encoder buffer size.
>
> Signed-off-by: Aakarsh Jain <aakarsh.jain@samsung.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
> changelog:
> v1->v2
> Patch link: https://patchwork.kernel.org/project/linux-media/patch/20250228065952.14375-1-aakarsh.jain@samsung.com/
> Fixed build errors reported by Media CI robot.
> .../media/platform/samsung/s5p-mfc/regs-mfc-v6.h | 1 +
> drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c | 14 ++++++++++++++
> .../platform/samsung/s5p-mfc/s5p_mfc_common.h | 1 +
> .../platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c | 5 +++++
> 4 files changed, 21 insertions(+)
>
> diff --git a/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v6.h b/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v6.h
> index fa49fe580e1a..075a58b50b8c 100644
> --- a/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v6.h
> +++ b/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v6.h
> @@ -45,6 +45,7 @@
> #define S5P_FIMV_H2R_CMD_WAKEUP_V6 8
> #define S5P_FIMV_CH_LAST_FRAME_V6 9
> #define S5P_FIMV_H2R_CMD_FLUSH_V6 10
> +#define S5P_FIMV_H2R_CMD_NAL_ABORT_V6 11
> /* RMVME: REALLOC used? */
> #define S5P_FIMV_CH_FRAME_START_REALLOC_V6 5
>
> diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c
> index 5f80931f056d..e764cab2485c 100644
> --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c
> +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c
> @@ -739,6 +739,20 @@ static irqreturn_t s5p_mfc_irq(int irq, void *priv)
> ctx->state = MFCINST_RUNNING;
> goto irq_cleanup_hw;
>
> + case S5P_MFC_R2H_CMD_ENC_BUFFER_FUL_RET:
> + ctx->state = MFCINST_NAL_ABORT;
> + s5p_mfc_hw_call(dev->mfc_ops, clear_int_flags, dev);
> + set_work_bit(ctx);
> + WARN_ON(test_and_clear_bit(0, &dev->hw_lock) == 0);
> + s5p_mfc_hw_call(dev->mfc_ops, try_run, dev);
> + break;
> +
> + case S5P_MFC_R2H_CMD_NAL_ABORT_RET:
> + ctx->state = MFCINST_ERROR;
> + s5p_mfc_cleanup_queue(&ctx->dst_queue, &ctx->vq_dst);
> + s5p_mfc_cleanup_queue(&ctx->src_queue, &ctx->vq_src);
> + goto irq_cleanup_hw;
> +
> default:
> mfc_debug(2, "Unknown int reason\n");
> s5p_mfc_hw_call(dev->mfc_ops, clear_int_flags, dev);
> diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h
> index 3cc2a4f5c40a..86c316c1ff8f 100644
> --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h
> +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h
> @@ -141,6 +141,7 @@ enum s5p_mfc_inst_state {
> MFCINST_RES_CHANGE_INIT,
> MFCINST_RES_CHANGE_FLUSH,
> MFCINST_RES_CHANGE_END,
> + MFCINST_NAL_ABORT,
> };
>
> /*
> diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c
> index 4cf12f33d706..356adfddcfcf 100644
> --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c
> +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c
> @@ -2229,6 +2229,11 @@ static void s5p_mfc_try_run_v6(struct s5p_mfc_dev *dev)
> case MFCINST_HEAD_PRODUCED:
> ret = s5p_mfc_run_init_enc_buffers(ctx);
> break;
> + case MFCINST_NAL_ABORT:
> + mfc_write(dev, ctx->inst_no, S5P_FIMV_INSTANCE_ID_V6);
> + s5p_mfc_hw_call(dev->mfc_cmds, cmd_host2risc,
> + dev, S5P_FIMV_H2R_CMD_NAL_ABORT_V6, NULL);
> + break;
> default:
> ret = -EAGAIN;
> }
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
prev parent reply other threads:[~2025-03-21 7:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20250305055904epcas5p45828c732019a847a0852c26d9ef9f2db@epcas5p4.samsung.com>
2025-03-05 5:53 ` [Patch v3] media: s5p-mfc: Corrected NV12M/NV21M plane-sizes Aakarsh Jain
[not found] ` <CGME20250305055908epcas5p222e192cc21512ac178543445184a2519@epcas5p2.samsung.com>
2025-03-05 5:53 ` [Patch v2] media: s5p-mfc: Support for handling RET_ENC_BUFFER_FULL interrupt Aakarsh Jain
2025-03-21 7:35 ` Marek Szyprowski [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=33f85cd5-8387-4358-b2d4-29f8877a7e2e@samsung.com \
--to=m.szyprowski@samsung.com \
--cc=aakarsh.jain@samsung.com \
--cc=andrzej.hajda@intel.com \
--cc=aswani.reddy@samsung.com \
--cc=gost.dev@samsung.com \
--cc=hverkuil-cisco@xs4all.nl \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=pankaj.dubey@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®