From: "Daniel Almeida" <daniel.almeida@collabora.com>
To: "Paul Kocialkowski" <paul.kocialkowski@bootlin.com>
Cc: linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev,
"Ezequiel Garcia" <ezequiel@vanguardiasur.com.ar>,
"Philipp Zabel" <p.zabel@pengutronix.de>,
"Mauro Carvalho Chehab" <mchehab@kernel.org>,
"Hans Verkuil" <hverkuil-cisco@xs4all.nl>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Nicolas Dufresne" <nicolas.dufresne@collabora.com>,
"Sebastian Fricke" <sebastian.fricke@collabora.com>,
"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH 1/4] media: vicodec: Disable (TRY_)DECODER_CMD for the stateless case
Date: Fri, 10 Nov 2023 21:06:15 +0000 [thread overview]
Message-ID: <667d-654e9b80-1-40e97880@22375103> (raw)
In-Reply-To: <20231109201640.340556-1-paul.kocialkowski@bootlin.com>
Hi Paul,
On Thursday, November 09, 2023 17:16 -03, Paul Kocialkowski <paul.kocialkowski@bootlin.com> wrote:
> The (TRY_)DECODER_CMD ioctls are only useful for stateful decoders and for
> stateless decoders that support holding capture buffers (which is not the case
> for this driver).
>
> Disable them when registering the stateless decoder.
>
> Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
> ---
> .../media/test-drivers/vicodec/vicodec-core.c | 19 +++++++++++++------
> 1 file changed, 13 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/media/test-drivers/vicodec/vicodec-core.c b/drivers/media/test-drivers/vicodec/vicodec-core.c
> index 6f0e20df74e9..8f7a2b153ee9 100644
> --- a/drivers/media/test-drivers/vicodec/vicodec-core.c
> +++ b/drivers/media/test-drivers/vicodec/vicodec-core.c
> @@ -1240,6 +1240,12 @@ static int vicodec_decoder_cmd(struct file *file, void *fh,
> struct vicodec_ctx *ctx = file2ctx(file);
> int ret;
>
> + /*
> + * This ioctl should not be used with a stateless codec that doesn't
> + * support holding buffers and the associated flush command.
> + */
> + WARN_ON(ctx->is_stateless);
> +
> ret = v4l2_m2m_ioctl_try_decoder_cmd(file, fh, dc);
> if (ret < 0)
> return ret;
> @@ -2025,7 +2031,7 @@ static const struct v4l2_m2m_ops m2m_ops = {
>
> static int register_instance(struct vicodec_dev *dev,
> struct vicodec_dev_instance *dev_instance,
> - const char *name, bool is_enc)
> + const char *name, bool is_enc, bool is_stateless)
> {
> struct video_device *vfd;
> int ret;
> @@ -2045,10 +2051,11 @@ static int register_instance(struct vicodec_dev *dev,
> strscpy(vfd->name, name, sizeof(vfd->name));
> vfd->device_caps = V4L2_CAP_STREAMING |
> (multiplanar ? V4L2_CAP_VIDEO_M2M_MPLANE : V4L2_CAP_VIDEO_M2M);
> - if (is_enc) {
> + if (is_enc || is_stateless) {
> v4l2_disable_ioctl(vfd, VIDIOC_DECODER_CMD);
> v4l2_disable_ioctl(vfd, VIDIOC_TRY_DECODER_CMD);
> - } else {
> + }
> + if (!is_enc) {
> v4l2_disable_ioctl(vfd, VIDIOC_ENCODER_CMD);
> v4l2_disable_ioctl(vfd, VIDIOC_TRY_ENCODER_CMD);
> }
> @@ -2107,17 +2114,17 @@ static int vicodec_probe(struct platform_device *pdev)
> platform_set_drvdata(pdev, dev);
>
> ret = register_instance(dev, &dev->stateful_enc, "stateful-encoder",
> - true);
> + true, false);
> if (ret)
> goto unreg_dev;
>
> ret = register_instance(dev, &dev->stateful_dec, "stateful-decoder",
> - false);
> + false, false);
> if (ret)
> goto unreg_sf_enc;
>
> ret = register_instance(dev, &dev->stateless_dec, "stateless-decoder",
> - false);
> + false, true);
> if (ret)
> goto unreg_sf_dec;
>
> --
> 2.42.1
>
>
> _______________________________________________
> Linux-rockchip mailing list
> Linux-rockchip@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip
Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
prev parent reply other threads:[~2023-11-10 21:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-09 20:16 [PATCH 1/4] media: vicodec: Disable (TRY_)DECODER_CMD for the stateless case Paul Kocialkowski
2023-11-09 20:16 ` [PATCH 2/4] media: visl: Hook the (TRY_)DECODER_CMD stateless ioctls Paul Kocialkowski
2023-11-10 21:06 ` Daniel Almeida
2023-11-09 20:16 ` [PATCH 3/4] media: verisilicon: " Paul Kocialkowski
2023-11-09 21:38 ` Nicolas Dufresne
2023-11-10 8:33 ` Paul Kocialkowski
2023-11-10 21:07 ` Daniel Almeida
2023-11-09 20:16 ` [PATCH 4/4] media: rkvdec: " Paul Kocialkowski
2023-11-10 21:08 ` Daniel Almeida
2023-11-10 21:06 ` Daniel Almeida [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=667d-654e9b80-1-40e97880@22375103 \
--to=daniel.almeida@collabora.com \
--cc=ezequiel@vanguardiasur.com.ar \
--cc=gregkh@linuxfoundation.org \
--cc=hverkuil-cisco@xs4all.nl \
--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=p.zabel@pengutronix.de \
--cc=paul.kocialkowski@bootlin.com \
--cc=sebastian.fricke@collabora.com \
--cc=thomas.petazzoni@bootlin.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