linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Maxime Jourdan <mjourdan@baylibre.com>
Cc: Hans Verkuil <hans.verkuil@cisco.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Tomasz Figa <tfiga@chromium.org>,
	Linux Media Mailing List <linux-media@vger.kernel.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Stanimir Varbanov <stanimir.varbanov@linaro.org>,
	Tiffany Lin <tiffany.lin@mediatek.com>,
	Andrew-CT Chen <andrew-ct.chen@mediatek.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Kamil Debski <kamil@wypas.org>,
	Jeongtae Park <jtp.park@samsung.com>,
	Andrzej Hajda <a.hajda@samsung.com>
Subject: Re: [RFC PATCH 0/5] Add enum_fmt flag for coded formats with dynamic resolution switching
Date: Wed, 24 Jul 2019 12:34:46 +0200	[thread overview]
Message-ID: <0d38eaa1-7496-74ef-985c-86f7c489a4e7@xs4all.nl> (raw)
In-Reply-To: <CAMO6naxJDopbY6LA+J4Ts4KzPSyodaXWVjKWsB27Ntm13Daikw@mail.gmail.com>

On 7/24/19 12:32 PM, Maxime Jourdan wrote:
> On Thu, Jul 18, 2019 at 11:22 AM Hans Verkuil <hverkuil@xs4all.nl> wrote:
>>
>> On 7/18/19 10:39 AM, Maxime Jourdan wrote:
>>> On Mon, Jul 15, 2019 at 2:37 PM Hans Verkuil <hverkuil@xs4all.nl> wrote:
>>>>
>>>> On 6/11/19 10:13 AM, Hans Verkuil wrote:
>>>>> On 6/9/19 4:38 PM, Maxime Jourdan wrote:
>>>>>> Hello,
>>>>>>
>>>>>> This RFC proposes a new format flag - V4L2_FMT_FLAG_DYN_RESOLUTION - used
>>>>>> to tag coded formats for which the device supports dynamic resolution
>>>>>> switching, via V4L2_EVENT_SOURCE_CHANGE.
>>>>>> This includes the initial "source change" where the device is able to
>>>>>> tell userspace about the coded resolution and the DPB size (which
>>>>>> sometimes translates to V4L2_CID_MIN_BUFFERS_FOR_CAPTURE).
>>>>>
>>>>> Shouldn't the initial source change still be there? The amlogic decoder
>>>>> is capable of determining the resolution of the stream, right? It just
>>>>> can't handle mid-stream changes.
>>>>
>>>> I've been thinking about this a bit more: there are three different HW capabilities:
>>>>
>>>> 1) The hardware cannot parse the resolution at all and userspace has to tell it
>>>> via S_FMT.
>>>>
>>>> 2) The hardware can parse the initial resolution, but is not able to handle
>>>> mid-stream resolution changes.
>>>>
>>>> 3) The hardware can parse the initial resolution and all following mid-stream
>>>> resolution changes.
>>>>
>>>> We can consider 2 the default situation.
>>>>
>>>> In case of 1 the SOURCE_CHANGE event is absent and userspace cannot subscribe
>>>> to it. Question: do we want to flag this with the format as well? I.e. with a
>>>> V4L2_FMT_FLAG_MANUAL_RESOLUTION? I think just not implementing the SOURCE_CHANGE
>>>> event (and documenting this) is sufficient.
>>>>
>>>
>>> I think that not implementing SOURCE_CHANGE is sufficient as well. The
>>> issue (in my case), is that the amlogic decoder _does_ support the
>>> event (case 3) for anything recent (H264, HEVC, VP9), but not for e.g
>>> MPEG 1/2 (case 1).
>>>
>>> A possible solution would be to create 2 separate devices, one
>>> implementing the event, the other not. Do you think this is reasonable
>>> ? This would discard the need for all the proposed flags, unless there
>>> are other decoder drivers that fall in case 2.
>>
>> I don't think it is a good idea to create two device nodes, that's really
>> confusing. Instead I think we just need a V4L2_FMT_FLAG_MANUAL_RESOLUTION
>> flag.
>>
> 
> I guess I just feel bad about adding a flag (MANUAL_RESOLUTION) for
> what is basically a problem with one compression standard for one
> driver, with the root cause being bad firmware design. Then again I
> don't see a way around it, and case 1 & 2 are indeed two possibilities
> that need their own flag.
> 
> I'll prepare 2 new patch series if that is okay with you:
>  - DYN_RESOLUTION format flag updated series (in this current RFC,
> there are issues with the explanation of the flag in the doc)

Wait with this: I'm about to post a consolidated series with all
outstanding patches for codecs. That includes this series.

>  - Adding MANUAL_RESOLUTION format flag
> 
>> BTW, what happens if the application sets the format to e.g. 640x480 but
>> the MPEG file is a different resolution? Does the decoder fail to produce
>> anything? Or does it internally parse the resolution from the bitstream
>> and start decoding it? What if the bitstream resolution is larger than the
>> resolution set with S_FMT? Does it check for the buffer size?
>>
>> I just want to make sure it won't write past the end of the buffer.
>>
> 
> I tested this case a long while ago.The DMAs are programmed with the
> allocated VB2 buffers, so you get cropped pictures (and no DMA
> overflow).

Good to know.

Regards,

	Hans

> 
> 
>> Regards,
>>
>>         Hans
>>
>>>
>>>> In case of 3 the format sets the V4L2_FMT_FLAG_DYN_RESOLUTION flag.
>>>>
>>>> What do you think?
>>>>
>>>> Regards,
>>>>
>>>>         Hans


  reply	other threads:[~2019-07-24 10:34 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-09 14:38 [RFC PATCH 0/5] Add enum_fmt flag for coded formats with dynamic resolution switching Maxime Jourdan
2019-06-09 14:38 ` [RFC PATCH 1/5] media: videodev2: add V4L2_FMT_FLAG_DYN_RESOLUTION Maxime Jourdan
2019-06-10  3:48   ` Tomasz Figa
2019-06-11  8:08     ` Hans Verkuil
2019-06-11 16:46     ` Maxime Jourdan
2019-07-03  9:24       ` Tomasz Figa
2019-06-11  8:00   ` Hans Verkuil
2019-06-09 14:38 ` [RFC PATCH 2/5] media: venus: vdec: flag OUTPUT formats with V4L2_FMT_FLAG_DYN_RESOLUTION Maxime Jourdan
2019-06-11  8:06   ` Hans Verkuil
2019-06-09 14:38 ` [RFC PATCH 3/5] media: s5p_mfc_dec: " Maxime Jourdan
2019-06-09 14:38 ` [RFC PATCH 4/5] media: mtk-vcodec: " Maxime Jourdan
2019-06-09 14:38 ` [RFC PATCH 5/5] media: vicodec: flag vdec/stateful " Maxime Jourdan
2019-06-11  8:13 ` [RFC PATCH 0/5] Add enum_fmt flag for coded formats with dynamic resolution switching Hans Verkuil
2019-06-11 17:02   ` Maxime Jourdan
2019-07-15 12:37   ` Hans Verkuil
2019-07-18  8:39     ` Maxime Jourdan
2019-07-18  9:22       ` Hans Verkuil
2019-07-24 10:32         ` Maxime Jourdan
2019-07-24 10:34           ` Hans Verkuil [this message]
2019-07-19  2:45     ` Tomasz Figa
2019-07-19  8:41       ` Hans Verkuil
2019-07-24  4:09         ` Tomasz Figa

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=0d38eaa1-7496-74ef-985c-86f7c489a4e7@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=a.hajda@samsung.com \
    --cc=andrew-ct.chen@mediatek.com \
    --cc=hans.verkuil@cisco.com \
    --cc=jtp.park@samsung.com \
    --cc=kamil@wypas.org \
    --cc=kyungmin.park@samsung.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=mjourdan@baylibre.com \
    --cc=stanimir.varbanov@linaro.org \
    --cc=tfiga@chromium.org \
    --cc=tiffany.lin@mediatek.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).