From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
To: Jianfeng Liu <liujianfeng1994@gmail.com>
Cc: detlev.casanova@collabora.com, heiko@sntech.de,
kernel@collabora.com, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
linux-rockchip@lists.infradead.org, mchehab@kernel.org,
nicolas.frattaroli@collabora.com, jonas@kwiboo.se,
benjamin.gaignard@collabora.com
Subject: Re: [PATCH 00/12] media: rkvdec: Add support for VDPU381 and VDPU383
Date: Mon, 28 Jul 2025 16:22:32 -0400 [thread overview]
Message-ID: <75207b49155acaa83e2ed0182fd1a78a9242aab7.camel@collabora.com> (raw)
In-Reply-To: <20250718093746.631072-1-liujianfeng1994@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2851 bytes --]
Le vendredi 18 juillet 2025 à 17:37 +0800, Jianfeng Liu a écrit :
> Hi,
>
> On Mon, 14 Jul 2025 22:46:10 +0800, Jianfeng Liu wrote:
> > You are right, the code of chromium should be fixed for frame size type
> > V4L2_FRMSIZE_TYPE_CONTINUOUS.
>
> I have just sent a cr at chromium[1] to fix this.
>
> > I have checked that this issue is not introduced by your series. After
> > reverting this commit[2] which adds Support High 10 and 4:2:2 profiles,
> > chromium can play video well on rk3399. I will investigate further.
>
> I found that this issue is caused by this code block[2]. Before adding
> .get_image_fmt, rkvdec_s_ctrl will just return 0. But now when detecting
> image format change(usually from RKVDEC_IMG_FMT_ANY to real video format
> like RKVDEC_IMG_FMT_420_8BIT), it will return -EBUSY, then I get green
> frame at chromium.
>
> After taking a look at hantro's code, I find that it is not necessary to
> let .s_ctrl return -EBUSY when format changes, here is a commit[3]
> disabling this check in hantro_set_fmt_cap. I have written a patch that
> can fix my issue with chromium, you can see it at the bottom of my mail.
>
> [1] https://chromium-review.googlesource.com/c/chromium/src/+/6767118
> [2]
> https://github.com/torvalds/linux/blob/v6.16-rc6/drivers/staging/media/rkvdec/rkvdec.c#L143-L146
> [3]
> https://github.com/torvalds/linux/commit/bbd267daf4fc831f58bf4a2530a8b64881779e6a
>
> diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec.c
> b/drivers/media/platform/rockchip/rkvdec/rkvdec.c
> index 5d86fb7cdd6..7800d159fad 100644
> --- a/drivers/media/platform/rockchip/rkvdec/rkvdec.c
> +++ b/drivers/media/platform/rockchip/rkvdec/rkvdec.c
> @@ -185,7 +185,6 @@ static int rkvdec_s_ctrl(struct v4l2_ctrl *ctrl)
> struct rkvdec_ctx *ctx = container_of(ctrl->handler, struct
> rkvdec_ctx, ctrl_hdl);
> const struct rkvdec_coded_fmt_desc *desc = ctx->coded_fmt_desc;
> enum rkvdec_image_fmt image_fmt;
> - struct vb2_queue *vq;
>
> /* Check if this change requires a capture format reset */
> if (!desc->ops->get_image_fmt)
> @@ -193,11 +192,6 @@ static int rkvdec_s_ctrl(struct v4l2_ctrl *ctrl)
>
> image_fmt = desc->ops->get_image_fmt(ctx, ctrl);
> if (rkvdec_image_fmt_changed(ctx, image_fmt)) {
> - vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx,
> - V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
> - if (vb2_is_busy(vq))
> - return -EBUSY;
> -
Hantro driver have extra code to protect against the fact that the queue format
may not match the currently allocated buffer size. This change alone seems
unsafe and may allow tricking the driver into buffer overflow. It believe some
further thought and care need to be put into this.
Nicolas
> ctx->image_fmt = image_fmt;
> rkvdec_reset_decoded_fmt(ctx);
> }
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
prev parent reply other threads:[~2025-07-28 20:22 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-08 15:19 Detlev Casanova
2025-07-08 15:19 ` [PATCH 01/12] media: rkvdec: Switch to using structs instead of writel Detlev Casanova
2025-07-08 15:19 ` [PATCH 02/12] media: rkvdec: Move cabac table to its own source file Detlev Casanova
2025-07-08 15:19 ` [PATCH 03/12] media: rkvdec: Use structs to represent the HW RPS Detlev Casanova
2025-07-08 15:19 ` [PATCH 04/12] media: rkvdec: Move h264 functions to common file Detlev Casanova
2025-07-08 15:19 ` [PATCH 05/12] media: rkvdec: Add per variant configuration Detlev Casanova
2025-07-08 15:19 ` [PATCH 06/12] media: rkvdec: Add RCB and SRAM support Detlev Casanova
2025-07-08 15:19 ` [PATCH 07/12] media: rkvdec: Support per-variant interrupt handler Detlev Casanova
2025-07-08 15:19 ` [PATCH 08/12] media: rkvdec: Enable all clocks without naming them Detlev Casanova
2025-07-08 15:19 ` [PATCH 09/12] media: rkvdec: Add H264 support for the VDPU381 variant Detlev Casanova
2025-07-08 15:19 ` [PATCH 10/12] media: rkvdec: Add H264 support for the VDPU383 variant Detlev Casanova
2025-07-08 15:19 ` [PATCH 11/12] media: rkvdec: Add HEVC support for the VDPU381 variant Detlev Casanova
2025-07-08 15:19 ` [PATCH 12/12] media: rkvdec: Add HEVC support for the VDPU383 variant Detlev Casanova
2025-07-13 14:25 ` Re:[PATCH 00/12] media: rkvdec: Add support for VDPU381 and VDPU383 Jianfeng Liu
2025-07-14 13:35 ` [PATCH " Detlev Casanova
2025-07-14 14:46 ` Jianfeng Liu
2025-07-18 9:37 ` Jianfeng Liu
2025-07-28 20:22 ` Nicolas Dufresne [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=75207b49155acaa83e2ed0182fd1a78a9242aab7.camel@collabora.com \
--to=nicolas.dufresne@collabora.com \
--cc=benjamin.gaignard@collabora.com \
--cc=detlev.casanova@collabora.com \
--cc=heiko@sntech.de \
--cc=jonas@kwiboo.se \
--cc=kernel@collabora.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=liujianfeng1994@gmail.com \
--cc=mchehab@kernel.org \
--cc=nicolas.frattaroli@collabora.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®