linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maxime Jourdan <mjourdan@baylibre.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
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: Tue, 11 Jun 2019 19:02:03 +0200	[thread overview]
Message-ID: <CAMO6naxt-t64fzO__b__0gtJ6FzxvcXCqy3ygvi6bvtMPy9kTA@mail.gmail.com> (raw)
In-Reply-To: <907e0560-3b46-04c9-52ef-6c6ff7140876@xs4all.nl>

On Tue, Jun 11, 2019 at 10:13 AM Hans Verkuil <hverkuil@xs4all.nl> 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.
>

Well, no, not for older compressed formats like MPEG2. Sorry that this
wasn't clear all along. If it did, then the meson vdec wouldn't fail
current v4l2 compliance on the dqevent(V4L2_EVENT_SOURCE_CHANGE).
Userspace is expected to S_FMT the coded resolution before starting up
the capture. If the bitstream has a different resolution than the
format set, then you end up with cropped images. There's no risk for
dma overflow since those are configured to write at most up to buffer
capacity.

To be more precise: the firmware does report back the coded
resolution, but by that time it's too late as it has already begun
consuming the bitstream and decoding to buffers regardless.

For newer compressed formats (H264, HEVC, VP9), the firmware will
pause and notify a source change only, but with the older formats it's
more like "Hey, I decoded frames, by the way here is the coded
resolution".

Regards,
Maxime

> Regards,
>
>         Hans
>
> > This flag is mainly aimed at stateful decoder drivers.
> >
> > This RFC is motivated by my development on the amlogic video decoder
> > driver, which does not support dynamic resolution switching for older
> > coded formats (MPEG 1/2, MPEG 4 part II, H263). It does however support
> > it for the newer formats (H264, HEVC, VP9).
> >
> > The specification regarding stateful video decoders should be amended
> > to include that, in the absence of this flag for a certain format,
> > userspace is expected to extract the coded resolution and allocate
> > a sufficient amount of capture buffers on its own.
> > I understand that this point may be tricky, since older kernels with
> > close-to-spec drivers would not have this flag available, yet would
> > fully support dynamic resolution switching.
> > However, with the spec not merged in yet, I wanted to have your opinion
> > on this late addition.
> >
> > The RFC patches also adds support for this flag for the 4 following
> > stateful decoder drivers:
> >  - venus
> >  - s5p-mfc
> >  - mtk-vcodec
> >  - vicodec
> >
> > Maxime Jourdan (5):
> >   media: videodev2: add V4L2_FMT_FLAG_DYN_RESOLUTION
> >   media: venus: vdec: flag OUTPUT formats with
> >     V4L2_FMT_FLAG_DYN_RESOLUTION
> >   media: s5p_mfc_dec: flag OUTPUT formats with
> >     V4L2_FMT_FLAG_DYN_RESOLUTION
> >   media: mtk-vcodec: flag OUTPUT formats with
> >     V4L2_FMT_FLAG_DYN_RESOLUTION
> >   media: vicodec: flag vdec/stateful OUTPUT formats with
> >     V4L2_FMT_FLAG_DYN_RESOLUTION
> >
> >  Documentation/media/uapi/v4l/vidioc-enum-fmt.rst   |  7 +++++++
> >  drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c |  4 ++++
> >  drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h |  1 +
> >  drivers/media/platform/qcom/venus/core.h           |  1 +
> >  drivers/media/platform/qcom/venus/vdec.c           | 11 +++++++++++
> >  drivers/media/platform/s5p-mfc/s5p_mfc_common.h    |  1 +
> >  drivers/media/platform/s5p-mfc/s5p_mfc_dec.c       | 13 +++++++++++++
> >  drivers/media/platform/vicodec/vicodec-core.c      |  2 ++
> >  include/uapi/linux/videodev2.h                     |  5 +++--
> >  9 files changed, 43 insertions(+), 2 deletions(-)
> >
>

  reply	other threads:[~2019-06-11 17:02 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 [this message]
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
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=CAMO6naxt-t64fzO__b__0gtJ6FzxvcXCqy3ygvi6bvtMPy9kTA@mail.gmail.com \
    --to=mjourdan@baylibre.com \
    --cc=a.hajda@samsung.com \
    --cc=andrew-ct.chen@mediatek.com \
    --cc=hans.verkuil@cisco.com \
    --cc=hverkuil@xs4all.nl \
    --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=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).