From: Ezequiel Garcia <ezequiel@collabora.com>
To: Jonas Karlman <jonas@kwiboo.se>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-rockchip@lists.infradead.org
Cc: Hans Verkuil <hverkuil@xs4all.nl>,
Philipp Zabel <p.zabel@pengutronix.de>,
Nicolas Dufresne <nicolas.dufresne@collabora.com>,
kernel@collabora.com
Subject: Re: [PATCH 1/2] rkvdec: h264: Refuse to decode unsupported bitstream
Date: Mon, 06 Jul 2020 16:19:33 -0300 [thread overview]
Message-ID: <bcbd94c1fb4eea06e9e6014c10d6993faa3e3d4f.camel@collabora.com> (raw)
In-Reply-To: <551304f5-88bd-a673-a0ef-47af65700fe7@kwiboo.se>
On Mon, 2020-07-06 at 09:45 +0000, Jonas Karlman wrote:
> On 2020-06-26 19:11, Ezequiel Garcia wrote:
> > The hardware only supports 4:2:2, 4:2:0 or 4:0:0 (monochrome),
> > 8-bit or 10-bit depth content.
> >
> > Verify that the PPS refers to a supported bitstream, and refuse
>
> This should be SPS not PPS, same for hantro patch.
>
Yup.
> > unsupported bitstreams by failing at TRY_EXT_CTRLS time.
> >
> > The driver is currently broken on 10-bit and 4:2:2
> > so disallow those as well.
> >
> > Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
> > ---
> > drivers/staging/media/rkvdec/rkvdec.c | 27 +++++++++++++++++++++++++++
> > 1 file changed, 27 insertions(+)
> >
> > diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c
> > index 225eeca73356..0f81b47792f6 100644
> > --- a/drivers/staging/media/rkvdec/rkvdec.c
> > +++ b/drivers/staging/media/rkvdec/rkvdec.c
> > @@ -27,6 +27,32 @@
> > #include "rkvdec.h"
> > #include "rkvdec-regs.h"
> >
> > +static int rkvdec_try_ctrl(struct v4l2_ctrl *ctrl)
> > +{
> > + if (ctrl->id == V4L2_CID_MPEG_VIDEO_H264_SPS) {
> > + const struct v4l2_ctrl_h264_sps *sps = ctrl->p_cur.p;
>
> This should be p_new and not p_cur to validate the new ctrl value, same for hantro patch.
>
> With both fixed this and the hantro patch is,
>
> Reviewed-by: Jonas Karlman <jonas@kwiboo.se>
>
Ah, nice catch. Will fix.
Thanks,
Ezequiel
> Regards,
> Jonas
>
> > + /*
> > + * TODO: The hardware supports 10-bit and 4:2:2 profiles,
> > + * but it's currently broken in the driver.
> > + * Reject them for now, until it's fixed.
> > + */
> > + if (sps->chroma_format_idc > 1)
> > + /* Only 4:0:0 and 4:2:0 are supported */
> > + return -EINVAL;
> > + if (sps->bit_depth_luma_minus8 != sps->bit_depth_chroma_minus8)
> > + /* Luma and chroma bit depth mismatch */
> > + return -EINVAL;
> > + if (sps->bit_depth_luma_minus8 != 0)
> > + /* Only 8-bit is supported */
> > + return -EINVAL;
> > + }
> > + return 0;
> > +}
> > +
> > +static const struct v4l2_ctrl_ops rkvdec_ctrl_ops = {
> > + .try_ctrl = rkvdec_try_ctrl,
> > +};
> > +
> > static const struct rkvdec_ctrl_desc rkvdec_h264_ctrl_descs[] = {
> > {
> > .per_request = true,
> > @@ -42,6 +68,7 @@ static const struct rkvdec_ctrl_desc rkvdec_h264_ctrl_descs[] = {
> > .per_request = true,
> > .mandatory = true,
> > .cfg.id = V4L2_CID_MPEG_VIDEO_H264_SPS,
> > + .cfg.ops = &rkvdec_ctrl_ops,
> > },
> > {
> > .per_request = true,
> >
next prev parent reply other threads:[~2020-07-06 19:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-26 17:11 [PATCH 0/2] media: hantro/rkvdec handle unsupported H.264 bitstreams Ezequiel Garcia
2020-06-26 17:11 ` [PATCH 1/2] rkvdec: h264: Refuse to decode unsupported bitstream Ezequiel Garcia
2020-07-06 9:45 ` Jonas Karlman
2020-07-06 19:19 ` Ezequiel Garcia [this message]
2020-06-26 17:11 ` [PATCH 2/2] hantro: " Ezequiel Garcia
2020-06-29 9:12 ` Philipp Zabel
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=bcbd94c1fb4eea06e9e6014c10d6993faa3e3d4f.camel@collabora.com \
--to=ezequiel@collabora.com \
--cc=hverkuil@xs4all.nl \
--cc=jonas@kwiboo.se \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=nicolas.dufresne@collabora.com \
--cc=p.zabel@pengutronix.de \
/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®