Re: [PATCH v7 07/11] media: rkvdec: Add the VP9 backend

From: Chen-Yu Tsai
Date: Fri Oct 08 2021 - 06:30:46 EST


Hi,

On Thu, Sep 30, 2021 at 12:07 AM Andrzej Pietrasiewicz
<andrzej.p@xxxxxxxxxxxxx> wrote:
>
> From: Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx>
>
> The Rockchip VDEC supports VP9 profile 0 up to 4096x2304@30fps. Add
> a backend for this new format.
>
> Signed-off-by: Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx>
> Signed-off-by: Ezequiel Garcia <ezequiel@xxxxxxxxxxxxx>
> Signed-off-by: Adrian Ratiu <adrian.ratiu@xxxxxxxxxxxxx>
> Co-developed-by: Andrzej Pietrasiewicz <andrzej.p@xxxxxxxxxxxxx>
> Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@xxxxxxxxxxxxx>
> ---
> drivers/staging/media/rkvdec/Kconfig | 1 +
> drivers/staging/media/rkvdec/Makefile | 2 +-
> drivers/staging/media/rkvdec/rkvdec-vp9.c | 1078 +++++++++++++++++++++
> drivers/staging/media/rkvdec/rkvdec.c | 52 +-
> drivers/staging/media/rkvdec/rkvdec.h | 12 +-
> 5 files changed, 1137 insertions(+), 8 deletions(-)
> create mode 100644 drivers/staging/media/rkvdec/rkvdec-vp9.c
>

[...]

> diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c
> index 7131156c1f2c..6aa8aca66547 100644
> --- a/drivers/staging/media/rkvdec/rkvdec.c
> +++ b/drivers/staging/media/rkvdec/rkvdec.c

[...]

> @@ -319,7 +354,7 @@ static int rkvdec_s_output_fmt(struct file *file, void *priv,
> struct v4l2_m2m_ctx *m2m_ctx = ctx->fh.m2m_ctx;
> const struct rkvdec_coded_fmt_desc *desc;
> struct v4l2_format *cap_fmt;
> - struct vb2_queue *peer_vq;
> + struct vb2_queue *peer_vq, *vq;
> int ret;
>
> /*
> @@ -331,6 +366,15 @@ static int rkvdec_s_output_fmt(struct file *file, void *priv,
> if (vb2_is_busy(peer_vq))
> return -EBUSY;
>
> + /*
> + * Some codecs like VP9 can contain dynamic resolution changes which
> + * are currently not supported by the V4L2 API or driver, so return
> + * an error if userspace tries to reconfigure the output format.
> + */
> + vq = v4l2_m2m_get_vq(m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
> + if (vb2_is_busy(vq))
> + return -EINVAL;

This check is already done in rkvdec_s_fmt(), though it returns -EBUSY
instead. And I don't see similar changes to Hantro, so maybe this isn't
an API limitation as described in the comment? My recent patch [1] also
loosens the restrictions on this.

ChenYu

[1] https://lore.kernel.org/linux-media/20211008100423.739462-3-wenst@xxxxxxxxxxxx/

> +
> ret = rkvdec_s_fmt(file, priv, f, rkvdec_try_output_fmt);
> if (ret)
> return ret;