Linux Media Controller development
 help / color / mirror / Atom feed
From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
To: Ezequiel Garcia <ezequiel@collabora.com>,
	Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	Tomasz Figa <tfiga@chromium.org>,
	kernel@collabora.com, Jonas Karlman <jonas@kwiboo.se>,
	Hans Verkuil <hverkuil@xs4all.nl>,
	Alexandre Courbot <acourbot@chromium.org>,
	Jeffrey Kardatzke <jkardatzke@chromium.org>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Maxime Ripard <mripard@kernel.org>,
	Jernej Skrabec <jernej.skrabec@siol.net>
Subject: Re: [PATCH v2 08/14] media: uapi: h264: Drop SLICE_PARAMS 'size' field
Date: Fri, 28 Aug 2020 10:21:15 -0400	[thread overview]
Message-ID: <acb8d609f1afff6b24210426baaf4fe52dc6f4ee.camel@collabora.com> (raw)
In-Reply-To: <bac2020eabb375a6c9dbc689c0c5a3f6eae16e1e.camel@collabora.com>

[-- Attachment #1: Type: text/plain, Size: 6829 bytes --]

Le jeudi 20 août 2020 à 04:32 -0300, Ezequiel Garcia a écrit :
> Hi Paul,
> 
> On Wed, 2020-08-19 at 15:54 +0200, Paul Kocialkowski wrote:
> > Hi,
> > 
> > On Fri 07 Aug 20, 11:44, Ezequiel Garcia wrote:
> > > On Thu, 2020-08-06 at 17:50 +0200, Paul Kocialkowski wrote:
> > > > Hi,
> > > > 
> > > > On Thu 06 Aug 20, 12:13, Ezequiel Garcia wrote:
> > > > > The SLICE_PARAMS control is intended for slice-based
> > > > > devices. In this mode, the OUTPUT buffer contains
> > > > > a single slice, and so the buffer's plane payload size
> > > > > can be used to query the slice size.
> > > > 
> > > > If we later extend the API for supporting multiple slices with dynamic array
> > > > controls, I guess we'll need to know the size of each slice in each control
> > > > elements. So I'd rather keep that even if it's indeed redundant with
> > > > vb2_get_plane_payload in single-slice mode.
> > > > 
> > > 
> > > If we later extend the API, another control (possibly
> > > another decoding mode?) shall be introduced.
> > > 
> > > This API covers single-slice-per-request as specified
> > > and documented in patch 9/14 "Clarify SLICE_BASED mode".
> > > 
> > > This is along the lines of the proposal drafted by Nicolas,
> > > see my reply: https://lkml.org/lkml/2020/8/5/791.
> > > 
> > > This applies to num_slices, slice size and slice start offset.
> > > 
> > > There are multiple ways of doing this.
> > 
> > If feels a bit problematic to remove these fields without a clear plan yet
> > on how to support multiple slices in the future. These may need to be added
> > again later, except that it will be too late and new controls will need to be
> > introduced.
> > 
> 
> As Nicolas and I have repeatedly mentioned we do have a plan :)
> 
> Nothing prevents us from implementing this now, but since it seems
> we don't have any need since the 1-slice-per-buffer is working well,
> there is no motivation for it.
> 
> As you well mention, it does require new controls. This is
> totally expected since new decoding semantics will need new controls.
> 
> Here's my version of the plan:
> 
> enum v4l2_mpeg_video_h264_decode_mode {
>         V4L2_MPEG_VIDEO_H264_DECODE_MODE_SLICE_BASED,
>         V4L2_MPEG_VIDEO_H264_DECODE_MODE_SLICE_ARRAY_BASED,
>         V4L2_MPEG_VIDEO_H264_DECODE_MODE_FRAME_BASED,
> };
> 
> #define V4L2_CID_MPEG_VIDEO_H264_SLICE_ARRAY    (V4L2_CID_MPEG_BASE+1008)
> 
> struct v4l2_ctrl_h264_slice_array {
>         __u16 num_slices;
> 
>         struct v4l2_ctrl_h264_slice slices[16];
> }

Well, ideally the new dynamic array control format can hold this
information for us, avoiding the 16 slice limit again, but that is
inded the plan.

> 
> struct v4l2_ctrl_h264_slice {
>         __u32 size;
>         __u32 start_byte_offset;
>         struct v4l2_ctrl_h264_slice_params params;
> }
> 
> Now, the _specific_ way this will be done is not under
> discussion at the moment.
> 
> > Also, could we consider adding more reserved fields to handle such future needs?
> > 
> 
> I have considered that (on each control), but I fail
> to see the reason for it. The same may be said of all controls,
> yet I don't think we bloat each one just in case. 
> 
> Thanks,
> Ezequiel
> 
> > Cheers,
> > 
> > Paul
> > 
> > > Thanks!
> > > Ezequiel
> > > 
> > > > What do you think?
> > > > 
> > > > Paul
> > > > 
> > > > > To reduce the API surface drop the size from the
> > > > > SLICE_PARAMS control.
> > > > > 
> > > > > A follow-up change will remove other members in SLICE_PARAMS
> > > > > so we don't need to add padding fields here.
> > > > > 
> > > > > Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
> > > > > ---
> > > > >  Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 3 ---
> > > > >  drivers/staging/media/sunxi/cedrus/cedrus_h264.c          | 7 +++----
> > > > >  include/media/h264-ctrls.h                                | 3 ---
> > > > >  3 files changed, 3 insertions(+), 10 deletions(-)
> > > > > 
> > > > > diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> > > > > index 427fc5727ec0..fff74b7bf32a 100644
> > > > > --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> > > > > +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> > > > > @@ -1760,9 +1760,6 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type -
> > > > >      :stub-columns: 0
> > > > >      :widths:       1 1 2
> > > > >  
> > > > > -    * - __u32
> > > > > -      - ``size``
> > > > > -      -
> > > > >      * - __u32
> > > > >        - ``start_byte_offset``
> > > > >          Offset (in bytes) from the beginning of the OUTPUT buffer to the start
> > > > > diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
> > > > > index a9ba78b15907..8b6f05aadbe8 100644
> > > > > --- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
> > > > > +++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
> > > > > @@ -324,17 +324,16 @@ static void cedrus_set_params(struct cedrus_ctx *ctx,
> > > > >  	struct vb2_buffer *src_buf = &run->src->vb2_buf;
> > > > >  	struct cedrus_dev *dev = ctx->dev;
> > > > >  	dma_addr_t src_buf_addr;
> > > > > -	u32 len = slice->size * 8;
> > > > > +	size_t slice_bytes = vb2_get_plane_payload(src_buf, 0);
> > > > >  	unsigned int pic_width_in_mbs;
> > > > >  	bool mbaff_pic;
> > > > >  	u32 reg;
> > > > >  
> > > > > -	cedrus_write(dev, VE_H264_VLD_LEN, len);
> > > > > +	cedrus_write(dev, VE_H264_VLD_LEN, slice_bytes * 8);
> > > > >  	cedrus_write(dev, VE_H264_VLD_OFFSET, 0);
> > > > >  
> > > > >  	src_buf_addr = vb2_dma_contig_plane_dma_addr(src_buf, 0);
> > > > > -	cedrus_write(dev, VE_H264_VLD_END,
> > > > > -		     src_buf_addr + vb2_get_plane_payload(src_buf, 0));
> > > > > +	cedrus_write(dev, VE_H264_VLD_END, src_buf_addr + slice_bytes);
> > > > >  	cedrus_write(dev, VE_H264_VLD_ADDR,
> > > > >  		     VE_H264_VLD_ADDR_VAL(src_buf_addr) |
> > > > >  		     VE_H264_VLD_ADDR_FIRST | VE_H264_VLD_ADDR_VALID |
> > > > > diff --git a/include/media/h264-ctrls.h b/include/media/h264-ctrls.h
> > > > > index 4f05ee265997..f74736fcfa00 100644
> > > > > --- a/include/media/h264-ctrls.h
> > > > > +++ b/include/media/h264-ctrls.h
> > > > > @@ -158,9 +158,6 @@ struct v4l2_h264_reference {
> > > > >  };
> > > > >  
> > > > >  struct v4l2_ctrl_h264_slice_params {
> > > > > -	/* Size in bytes, including header */
> > > > > -	__u32 size;
> > > > > -
> > > > >  	/* Offset in bytes to the start of slice in the OUTPUT buffer. */
> > > > >  	__u32 start_byte_offset;
> > > > >  
> > > > > -- 
> > > > > 2.27.0
> > > > > 
> 
> 

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  reply	other threads:[~2020-08-28 14:21 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-06 15:12 [PATCH v2 00/14] Clean H264 stateless uAPI Ezequiel Garcia
2020-08-06 15:12 ` [PATCH v2 01/14] media: uapi: h264: Update reference lists Ezequiel Garcia
2020-08-06 15:47   ` Paul Kocialkowski
2020-08-06 15:54     ` Jernej Škrabec
2020-08-07 14:33     ` Ezequiel Garcia
2020-08-08 19:12   ` Ezequiel Garcia
2020-08-06 15:12 ` [PATCH v2 02/14] media: uapi: h264: Further clarify scaling lists order Ezequiel Garcia
2020-08-06 15:12 ` [PATCH v2 03/14] media: uapi: h264: Split prediction weight parameters Ezequiel Garcia
2020-08-08 21:01   ` Jonas Karlman
2020-08-09 13:55     ` Ezequiel Garcia
2020-08-09 21:11       ` Jernej Škrabec
2020-08-10 12:57         ` Ezequiel Garcia
2020-08-10 14:55           ` Jonas Karlman
2020-08-10 15:28             ` Ezequiel Garcia
2020-08-10 16:57               ` Jonas Karlman
2020-08-10 20:04                 ` Ezequiel Garcia
2020-08-10 17:05           ` Jernej Škrabec
2020-08-10 19:30             ` Ezequiel Garcia
2020-08-10 19:34               ` Jernej Škrabec
2020-08-10 20:08                 ` Ezequiel Garcia
2020-08-11 22:06                 ` Ezequiel Garcia
2020-08-06 15:13 ` [PATCH v2 04/14] media: uapi: h264: Clarify pic_order_cnt_bit_size field Ezequiel Garcia
2020-08-06 15:13 ` [PATCH v2 05/14] media: uapi: h264: Increase size of 'first_mb_in_slice' field Ezequiel Garcia
2020-08-06 15:13 ` [PATCH v2 06/14] media: uapi: h264: Clean DPB entry interface Ezequiel Garcia
2020-08-06 15:13 ` [PATCH v2 07/14] media: uapi: h264: Increase size of DPB entry pic_num Ezequiel Garcia
2020-08-06 15:13 ` [PATCH v2 08/14] media: uapi: h264: Drop SLICE_PARAMS 'size' field Ezequiel Garcia
2020-08-06 15:50   ` Paul Kocialkowski
2020-08-07 14:44     ` Ezequiel Garcia
2020-08-19 13:54       ` Paul Kocialkowski
2020-08-20  7:32         ` Ezequiel Garcia
2020-08-28 14:21           ` Nicolas Dufresne [this message]
2020-08-06 15:13 ` [PATCH v2 09/14] media: uapi: h264: Clarify SLICE_BASED mode Ezequiel Garcia
2020-08-06 15:52   ` Paul Kocialkowski
2020-08-06 15:13 ` [PATCH v2 10/14] media: uapi: h264: Clean slice invariants syntax elements Ezequiel Garcia
2020-08-06 15:13 ` [PATCH v2 11/14] media: hantro: Don't require unneeded H264_SLICE_PARAMS Ezequiel Garcia
2020-08-06 15:13 ` [PATCH v2 12/14] media: rkvdec: " Ezequiel Garcia
2020-08-06 15:13 ` [PATCH v2 13/14] media: cedrus: h264: Properly configure reference field Ezequiel Garcia
2020-08-06 15:13 ` [PATCH v2 14/14] media: cedrus: h264: Fix frame list construction Ezequiel Garcia
2020-08-11 19:16 ` [PATCH v2 00/14] Clean H264 stateless uAPI Jernej Škrabec

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=acb8d609f1afff6b24210426baaf4fe52dc6f4ee.camel@collabora.com \
    --to=nicolas.dufresne@collabora.com \
    --cc=acourbot@chromium.org \
    --cc=ezequiel@collabora.com \
    --cc=hverkuil@xs4all.nl \
    --cc=jernej.skrabec@siol.net \
    --cc=jkardatzke@chromium.org \
    --cc=jonas@kwiboo.se \
    --cc=kernel@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mripard@kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=paul.kocialkowski@bootlin.com \
    --cc=tfiga@chromium.org \
    /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