All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Philipp Zabel <p.zabel@pengutronix.de>,
	linux-media@vger.kernel.org,
	Nicolas Dufresne <nicolas@ndufresne.ca>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>, kernel@pengutronix.de
Subject: Re: [PATCH 1/7] media: coda: set output buffer bytesused to appease v4l2-compliance
Date: Tue, 26 Apr 2022 07:52:09 +0200	[thread overview]
Message-ID: <63c20ead-6c83-64ab-3178-7629d5df5008@xs4all.nl> (raw)
In-Reply-To: <2d160491ffdba0642e2bda6096524d10ad2b647d.camel@pengutronix.de>

On 21/04/2022 12:24, Philipp Zabel wrote:
> Hi Hans,
> 
> On Do, 2022-04-21 at 11:44 +0200, Hans Verkuil wrote:
>> On 04/04/2022 18:35, Philipp Zabel wrote:
>>> The V4L2 specification states:
>>>
>>>  "If the application sets this to 0 for an output stream, then bytesused
>>>   will be set to the size of the buffer (see the length field of this
>>>   struct) by the driver."
>>>
>>> Since we set allow_zero_bytesused, we have to handle this ourselves.
>>>
>>> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
>>> ---
>>>  drivers/media/platform/chips-media/coda-bit.c | 3 +++
>>>  1 file changed, 3 insertions(+)
>>>
>>> diff --git a/drivers/media/platform/chips-media/coda-bit.c b/drivers/media/platform/chips-media/coda-bit.c
>>> index c484c008ab02..705a179ea8f0 100644
>>> --- a/drivers/media/platform/chips-media/coda-bit.c
>>> +++ b/drivers/media/platform/chips-media/coda-bit.c
>>> @@ -381,6 +381,9 @@ void coda_fill_bitstream(struct coda_ctx *ctx, struct list_head *buffer_list)
>>>  		/* Dump empty buffers */
>>>  		if (!vb2_get_plane_payload(&src_buf->vb2_buf, 0)) {
>>>  			src_buf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx);
>>> +			vb2_set_plane_payload(&src_buf->vb2_buf, 0,
>>> +					      vb2_plane_size(&src_buf->vb2_buf,
>>> +							     0));
>>
>> Would it be possible to stop using allow_zero_bytesused altogether?
>>
>> Are there still applications that rely on zero-sized output buffers to stop the
>> decoder?
> 
> This was used by GStreamer 1.8. The code is still left in current
> versions, but is never executed unless the decoder stop command fails:
> 
> https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/main/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videodec.c#L446-454
> 
> Whether there are still any applications using GStreamer 1.8 for V4L2
> video decoding on devices that get kernel updates, I don't know.
> 
>> I'm not actually sure that I want this in the driver, perhaps v4l2-compliance
>> can be modified to turn a fail into a warn if the driver is the coda driver.
> 
> Same for nxp/imx-jpeg, qcom/venus and samsung/s5p-mfc?

Yes for venus and s5p, but why would imx-jpeg use this? It makes no sense
for a jpeg codec. I think it should just be removed for imx-jpeg.

IMHO, once a decoder supports the STOP command, it should no longer set
allow_zero_bytesused to true. But that decision is up to you for the coda
driver.

Regards,

	Hans

> 
>> Patching the driver is hiding the fact that the coda driver does something
>> non-standard for legacy reasons. It doesn't make sense either to change
>> bytesused to the buffer size since there really is nothing in the buffer.
>>
>> v4l2-compliance already has checks for two drivers, search for is_vivid and
>> is_uvcvideo.
> 
> Ok.
> 
>> I'm skipping this patch for now.
> 
> regards
> Philipp


  reply	other threads:[~2022-04-26  5:52 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-04 16:35 [PATCH 1/7] media: coda: set output buffer bytesused to appease v4l2-compliance Philipp Zabel
2022-04-04 16:35 ` [PATCH 2/7] media: coda: disable encoder cmd ioctl on decoder and vice versa Philipp Zabel
2022-04-05 14:07   ` Nicolas Dufresne
2022-04-04 16:35 ` [PATCH 3/7] media: coda: disable encoder ioctls for decoder devices Philipp Zabel
2022-04-05 14:13   ` Nicolas Dufresne
2022-04-04 16:35 ` [PATCH 4/7] media: coda: disable stateful encoder ioctls for jpeg encoder Philipp Zabel
2022-04-05 14:14   ` Nicolas Dufresne
2022-04-04 16:35 ` [PATCH 5/7] media: coda: fix default JPEG colorimetry Philipp Zabel
2022-04-05 14:15   ` Nicolas Dufresne
2022-04-21 10:02   ` Hans Verkuil
2022-04-21 10:38     ` Philipp Zabel
2022-04-21 11:06       ` Hans Verkuil
2022-04-26  9:21         ` Philipp Zabel
2022-04-21 14:54     ` Philipp Zabel
2022-04-21 15:28       ` Philipp Zabel
2022-04-04 16:35 ` [PATCH 6/7] media: coda: enable capture G_PARM for stateful encoder Philipp Zabel
2022-04-05 14:19   ` Nicolas Dufresne
2022-04-21 10:30   ` Hans Verkuil
2022-04-21 14:58     ` Philipp Zabel
2022-04-25  5:34       ` Hans Verkuil
2022-04-04 16:35 ` [PATCH 7/7] media: coda: enable capture S_PARM " Philipp Zabel
2022-04-05 14:22   ` Nicolas Dufresne
2022-04-05 15:03     ` Philipp Zabel
2022-04-05 16:00       ` Nicolas Dufresne
2022-04-05 14:05 ` [PATCH 1/7] media: coda: set output buffer bytesused to appease v4l2-compliance Nicolas Dufresne
2022-04-21  9:44 ` Hans Verkuil
2022-04-21 10:24   ` Philipp Zabel
2022-04-26  5:52     ` Hans Verkuil [this message]
2022-04-26  9:32       ` 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=63c20ead-6c83-64ab-3178-7629d5df5008@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=kernel@pengutronix.de \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=nicolas@ndufresne.ca \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.