devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jianfeng Liu <liujianfeng1994@gmail.com>
To: detlev.casanova@collabora.com
Cc: andy.yan@rock-chips.com, benjamin.gaignard@collabora.com,
	boris.brezillon@collabora.com, conor+dt@kernel.org,
	daniel.almeida@collabora.com, devicetree@vger.kernel.org,
	didi.debian@cknow.org, dsimic@manjaro.org,
	ezequiel@vanguardiasur.com.ar, gregkh@linuxfoundation.org,
	heiko@sntech.de, hverkuil-cisco@xs4all.nl, jonas@kwiboo.se,
	knaerzche@gmail.com, krzk+dt@kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	linux-rockchip@lists.infradead.org,
	linux-staging@lists.linux.dev, mchehab@kernel.org,
	nicolas.dufresne@collabora.com, paul.kocialkowski@bootlin.com,
	robh@kernel.org, sebastian.reichel@collabora.com
Subject: Re: [PATCH v2 2/4] media: rockchip: Introduce the rkvdec2 driver
Date: Thu, 20 Jun 2024 01:46:23 +0800	[thread overview]
Message-ID: <20240619174623.270706-1-liujianfeng1994@gmail.com> (raw)
In-Reply-To: <20240619150029.59730-3-detlev.casanova@collabora.com>

Hi Detlev,

On Wed, 19 Jun 2024 10:57:19 -0400, Detlev Casanova wrote:
>+	if (!(sps->flags & V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY))
>+		height *= 2;
>+
>+	if (width > ctx->coded_fmt.fmt.pix_mp.width ||
>+	    height > ctx->coded_fmt.fmt.pix_mp.height)
>+		return -EINVAL;

I did further invesatigation on chromium. I find that before real video
is decoded, chromium will call VIDIOC_STREAMON twice with value of
sps->flags 0:

At the first time width and height are 16; ctx->coded_fmt.fmt.pix_mp.width
and coded_fmt.fmt.pix_mp.height are 16, which are the min size of decoder;
At the second time width and height are still 16; while
coded_fmt.fmt.pix_mp.width is 1920 and coded_fmt.fmt.pix_mp.height is
1088, which are the real size of video.

So VIDIOC_STREAMON will fall at the first time call because sps->flags is
0 so V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY is not set, and then height is
doubled to 32 which is larger than 16.

What do you think if we skip doubling height if sps->flags is 0 and at the
same time V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY is not set? The following hack
did fix my chromium:

--- a/drivers/staging/media/rkvdec2/rkvdec2-h264.c
+++ b/drivers/staging/media/rkvdec2/rkvdec2-h264.c
@@ -767,7 +767,7 @@ static int rkvdec2_h264_validate_sps(struct rkvdec2_ctx *ctx,
         * which is half the final height (see (7-18) in the
         * specification)
         */
-       if (!(sps->flags & V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY))
+       if (!(sps->flags & V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY) && sps->flags)
                height *= 2;
 
        if (width > ctx->coded_fmt.fmt.pix_mp.width ||

Best regards
Jianfeng

  reply	other threads:[~2024-06-19 17:46 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-19 14:57 [PATCH v2 0/4] media: rockchip: Add rkvdec2 driver Detlev Casanova
2024-06-19 14:57 ` [PATCH v2 1/4] media: rockchip: Move H264 CABAC table to header file Detlev Casanova
2024-06-19 14:57 ` [PATCH v2 2/4] media: rockchip: Introduce the rkvdec2 driver Detlev Casanova
2024-06-19 17:46   ` Jianfeng Liu [this message]
2024-06-20 14:07     ` Detlev Casanova
2024-06-20 15:03     ` Nicolas Dufresne
2024-06-20 17:38       ` Jianfeng Liu
2024-06-20 10:30   ` Krzysztof Kozlowski
2024-06-20 13:41     ` Sebastian Reichel
2024-06-21  6:10       ` Krzysztof Kozlowski
2024-06-19 14:57 ` [PATCH v2 3/4] media: dt-bindings: rockchip: Document RK3588 Video Decoder bindings Detlev Casanova
2024-06-19 17:37   ` Conor Dooley
2024-06-19 14:57 ` [PATCH v2 4/4] arm64: dts: rockchip: Add rkvdec2 Video Decoder on rk3588(s) Detlev Casanova
2024-06-19 15:28   ` Jonas Karlman
2024-06-19 17:19     ` Alex Bee
2024-06-19 18:06       ` Jonas Karlman
2024-06-20 13:31         ` Detlev Casanova
2024-06-24  9:16           ` Jonas Karlman
2024-06-27 20:56             ` Detlev Casanova
2024-06-27 22:39               ` Jonas Karlman
2024-06-28 13:31                 ` Detlev Casanova
2024-07-26 15:26                 ` Detlev Casanova
2024-07-26 19:55                   ` Jonas Karlman
2024-06-19 15:34   ` Heiko Stübner
2024-06-20 10:24   ` Krzysztof Kozlowski

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=20240619174623.270706-1-liujianfeng1994@gmail.com \
    --to=liujianfeng1994@gmail.com \
    --cc=andy.yan@rock-chips.com \
    --cc=benjamin.gaignard@collabora.com \
    --cc=boris.brezillon@collabora.com \
    --cc=conor+dt@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=detlev.casanova@collabora.com \
    --cc=devicetree@vger.kernel.org \
    --cc=didi.debian@cknow.org \
    --cc=dsimic@manjaro.org \
    --cc=ezequiel@vanguardiasur.com.ar \
    --cc=gregkh@linuxfoundation.org \
    --cc=heiko@sntech.de \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=jonas@kwiboo.se \
    --cc=knaerzche@gmail.com \
    --cc=krzk+dt@kernel.org \
    --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=linux-staging@lists.linux.dev \
    --cc=mchehab@kernel.org \
    --cc=nicolas.dufresne@collabora.com \
    --cc=paul.kocialkowski@bootlin.com \
    --cc=robh@kernel.org \
    --cc=sebastian.reichel@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;
as well as URLs for NNTP newsgroup(s).