All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org,
	Alexandre Courbot <acourbot@chromium.org>,
	Hans Verkuil <hans.verkuil@cisco.com>
Subject: Re: [PATCHv17 01/34] Documentation: v4l: document request API
Date: Tue, 14 Aug 2018 05:21:56 -0300	[thread overview]
Message-ID: <20180814052156.4c961226@coco.lan> (raw)
In-Reply-To: <0203cfbe-ae51-a94b-08c8-0a31a59486f0@xs4all.nl>

Em Fri, 10 Aug 2018 09:20:48 +0200
Hans Verkuil <hverkuil@xs4all.nl> escreveu:

> On 08/09/2018 07:43 PM, Mauro Carvalho Chehab wrote:
> > Em Sat,  4 Aug 2018 14:44:53 +0200
> > Hans Verkuil <hverkuil@xs4all.nl> escreveu:
> >   
> >> From: Alexandre Courbot <acourbot@chromium.org>
> >>
> >> Document the request API for V4L2 devices, and amend the documentation
> >> of system calls influenced by it.  
> > 
> > It follows some comments. Most are nitpicks. There are just two ones
> > that aren't:
> > 	- a problem at the tables changes on Documentation/
> > 	- a question with regards to MEDIA_IOC_REQUEST_ALLOC ioctl.  
> 
> I'll fix all the smaller comments and in this reply only address these
> two topics.
> 
> > 
> > I'll keep reviewing this patch series.
> > 
> > PS.: I lost entirely my first review to this doc... I hope I didn't
> > forget anything when re-typing my comments.
> >   
> >>
> >> Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
> >> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
> >> ---
> >>  .../media/uapi/mediactl/media-controller.rst  |   1 +
> >>  .../media/uapi/mediactl/media-funcs.rst       |   6 +
> >>  .../uapi/mediactl/media-ioc-request-alloc.rst |  78 ++++++
> >>  .../uapi/mediactl/media-request-ioc-queue.rst |  82 ++++++
> >>  .../mediactl/media-request-ioc-reinit.rst     |  51 ++++
> >>  .../media/uapi/mediactl/request-api.rst       | 247 ++++++++++++++++++
> >>  .../uapi/mediactl/request-func-close.rst      |  49 ++++
> >>  .../uapi/mediactl/request-func-ioctl.rst      |  68 +++++
> >>  .../media/uapi/mediactl/request-func-poll.rst |  77 ++++++
> >>  Documentation/media/uapi/v4l/buffer.rst       |  21 +-
> >>  .../media/uapi/v4l/vidioc-g-ext-ctrls.rst     |  94 ++++---
> >>  Documentation/media/uapi/v4l/vidioc-qbuf.rst  |  32 ++-
> >>  .../media/videodev2.h.rst.exceptions          |   1 +
> >>  13 files changed, 771 insertions(+), 36 deletions(-)
> >>  create mode 100644 Documentation/media/uapi/mediactl/media-ioc-request-alloc.rst
> >>  create mode 100644 Documentation/media/uapi/mediactl/media-request-ioc-queue.rst
> >>  create mode 100644 Documentation/media/uapi/mediactl/media-request-ioc-reinit.rst
> >>  create mode 100644 Documentation/media/uapi/mediactl/request-api.rst
> >>  create mode 100644 Documentation/media/uapi/mediactl/request-func-close.rst
> >>  create mode 100644 Documentation/media/uapi/mediactl/request-func-ioctl.rst
> >>  create mode 100644 Documentation/media/uapi/mediactl/request-func-poll.rst
> >>  
> 
> <snip>
> 
> >> +.. c:type:: media_request_alloc
> >> +
> >> +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
> >> +
> >> +.. flat-table:: struct media_request_alloc
> >> +    :header-rows:  0
> >> +    :stub-columns: 0
> >> +    :widths:       1 1 2
> >> +
> >> +    *  -  __s32
> >> +       -  ``fd``
> >> +       -  The file descriptor of the request.  
> > 
> > It should be mentioned that the struct should be zeroed before calling
> > the Kernel, but I is overkill to have a struct to pass just one value.
> > 
> > I mean, if this has just one value inside the struct, it is a way better
> > to declare it as:
> > 
> > .. c:function:: int ioctl( int fd, MEDIA_IOC_REQUEST_ALLOC, s32 &argp )
> > 
> > Even if we later need more stuff, the size of a new MEDIA_IOC_REQUEST_ALLOC
> > will be bigger, and then (and only then) we can add extra stuff.
> > 
> > Or are you foreseen any new fields there in short term?  
> 
> The first version just had a s32 argument, not a struct. The main reason for
> going back to a struct was indeed to make it easier to add new fields in the
> future. I don't foresee any, but then, you never do.
> 
> I don't have a particularly strong opinion on this one way or another, but
> if we change it back to a s32 argument, then I want the opinion of others as
> well.

I'll comment it on patch 02/34.

> 
> <snip>
> 
> >> @@ -110,15 +130,13 @@ still cause this situation.
> >>  .. flat-table:: struct v4l2_ext_control
> >>      :header-rows:  0
> >>      :stub-columns: 0
> >> -    :widths:       1 1 1 2
> >> +    :widths:       1 1 3  
> > 
> > This is wrong: you can't change widths without changing the preceeding
> > .. tabularcolumns tag.
> > 
> > You probably didn't test PDF generation for this table.
> > 
> > Also, the change is this table doesn't belong to this patch. It is
> > a (doubtful) optimization at the table, not related to requests API.
> >   
> >>  
> >>      * - __u32
> >>        - ``id``
> >> -      -
> >>        - Identifies the control, set by the application.
> >>      * - __u32
> >>        - ``size``
> >> -      -
> >>        - The total size in bytes of the payload of this control. This is
> >>  	normally 0, but for pointer controls this should be set to the
> >>  	size of the memory containing the payload, or that will receive
> >> @@ -135,51 +153,43 @@ still cause this situation.
> >>  	   *length* of the string may well be much smaller.
> >>      * - __u32
> >>        - ``reserved2``\ [1]
> >> -      -
> >>        - Reserved for future extensions. Drivers and applications must set
> >>  	the array to zero.
> >> -    * - union
> >> +    * - union {  
> > 
> > Adding { and } at the end sounds ok...
> >   
> >>        - (anonymous)
> >> -    * -
> >> -      - __s32
> >> +    * - __s32
> >>        - ``value``
> >>        - New value or current value. Valid if this control is not of type
> >>  	``V4L2_CTRL_TYPE_INTEGER64`` and ``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is
> >>  	not set.
> >> -    * -
> >> -      - __s64
> >> +    * - __s64
> >>        - ``value64``
> >>        - New value or current value. Valid if this control is of type
> >>  	``V4L2_CTRL_TYPE_INTEGER64`` and ``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is
> >>  	not set.
> >> -    * -
> >> -      - char *
> >> +    * - char *
> >>        - ``string``
> >>        - A pointer to a string. Valid if this control is of type
> >>  	``V4L2_CTRL_TYPE_STRING``.
> >> -    * -
> >> -      - __u8 *
> >> +    * - __u8 *
> >>        - ``p_u8``
> >>        - A pointer to a matrix control of unsigned 8-bit values. Valid if
> >>  	this control is of type ``V4L2_CTRL_TYPE_U8``.
> >> -    * -
> >> -      - __u16 *
> >> +    * - __u16 *
> >>        - ``p_u16``
> >>        - A pointer to a matrix control of unsigned 16-bit values. Valid if
> >>  	this control is of type ``V4L2_CTRL_TYPE_U16``.
> >> -    * -
> >> -      - __u32 *
> >> +    * - __u32 *
> >>        - ``p_u32``
> >>        - A pointer to a matrix control of unsigned 32-bit values. Valid if
> >>  	this control is of type ``V4L2_CTRL_TYPE_U32``.
> >> -    * -
> >> -      - void *
> >> +    * - void *
> >>        - ``ptr``
> >>        - A pointer to a compound type which can be an N-dimensional array
> >>  	and/or a compound type (the control's type is >=
> >>  	``V4L2_CTRL_COMPOUND_TYPES``). Valid if
> >>  	``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is set for this control.
> >> -
> >> +    * - }  
> > 
> > ... however, removing the extra cell is not, because it will break the
> > indent inside the union's elements. The best way to keep them indented
> > is to use a separate cell (at least on DocBook). 
> > 
> > You could come with some other solution that would add a fixed amount
> > of spaces for all the elements inside the union, but I guess the
> > easiest way to do that is by having a separate column.  
> 
> The problem is that that extra cell makes the table hard to read: the last column
> with the actual description gets squashed leading to narrow hard to read columns.
> 
> The only reason for doing this is a stupid union.
> 
> I'll experiment a bit more with this.

We used this since DocBook for all tables with unions. The conversion
kept this. I remember I did some experiments on that time trying to
do it on some other way, but didn't spend too much time on seeking
for an alternative, as this was not the top priority at the conversion.

I don't doubt that some other way to indent unions (and nested structs)
would be possible.

Anyway, this change is unrelated to Request API itself. For this patch
series, please keep the extra cell. Just touch what's required for the
request API itself.

Feel free to experiment some other options and submit a separate
patch series, if you find a better way. In this case, please double 
check the docs, as I guess there were a lot more tables using this 
trick to indent unions and nested structs.

> 
> >   
> >>  
> >>  .. tabularcolumns:: |p{4.0cm}|p{2.2cm}|p{2.1cm}|p{8.2cm}|
> >>  
> >> @@ -190,12 +200,11 @@ still cause this situation.
> >>  .. flat-table:: struct v4l2_ext_controls
> >>      :header-rows:  0
> >>      :stub-columns: 0
> >> -    :widths:       1 1 2 1
> >> +    :widths:       1 1 3  
> > 
> > Same comments I made for the past table apply here as well.  
> 
> Regards,
> 
> 	Hans



Thanks,
Mauro

  reply	other threads:[~2018-08-14 11:08 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-04 12:44 [PATCHv17 00/34] Request API Hans Verkuil
2018-08-04 12:44 ` [PATCHv17 01/34] Documentation: v4l: document request API Hans Verkuil
2018-08-06 23:44   ` Pavel Machek
2018-08-09 17:43   ` Mauro Carvalho Chehab
2018-08-10  7:20     ` Hans Verkuil
2018-08-14  8:21       ` Mauro Carvalho Chehab [this message]
2018-08-14  7:57     ` Hans Verkuil
2018-08-14  8:48       ` Mauro Carvalho Chehab
2018-08-14  9:51         ` Hans Verkuil
2018-08-14 12:18           ` Mauro Carvalho Chehab
2018-08-04 12:44 ` [PATCHv17 02/34] uapi/linux/media.h: add " Hans Verkuil
2018-08-09 17:53   ` Mauro Carvalho Chehab
2018-08-10  7:21     ` Hans Verkuil
2018-08-14  8:46       ` Mauro Carvalho Chehab
2018-08-14  9:57         ` Hans Verkuil
2018-08-14 12:34           ` Mauro Carvalho Chehab
2018-08-04 12:44 ` [PATCHv17 03/34] media-request: implement media requests Hans Verkuil
2018-08-09 18:37   ` Mauro Carvalho Chehab
2018-08-10  7:28     ` Hans Verkuil
2018-08-14 13:33   ` Hans Verkuil
2018-08-04 12:44 ` [PATCHv17 04/34] media: doc: Add media-request.h header to documentation build Hans Verkuil
2018-08-09 18:43   ` Mauro Carvalho Chehab
2018-08-04 12:44 ` [PATCHv17 05/34] media-request: add media_request_get_by_fd Hans Verkuil
2018-08-09 19:55   ` Mauro Carvalho Chehab
2018-08-10  7:32     ` Hans Verkuil
2018-08-14  9:00       ` Mauro Carvalho Chehab
2018-08-04 12:44 ` [PATCHv17 06/34] media-request: add media_request_object_find Hans Verkuil
2018-08-09 19:56   ` Mauro Carvalho Chehab
2018-08-04 12:44 ` [PATCHv17 07/34] v4l2-device.h: add v4l2_device_supports_requests() helper Hans Verkuil
2018-08-09 19:57   ` Mauro Carvalho Chehab
2018-08-04 12:45 ` [PATCHv17 08/34] v4l2-dev: lock req_queue_mutex Hans Verkuil
2018-08-09 20:03   ` Mauro Carvalho Chehab
2018-08-10  7:39     ` Hans Verkuil
2018-08-14  8:09       ` Mauro Carvalho Chehab
2018-08-14 12:00     ` Hans Verkuil
2018-08-14 12:39       ` Mauro Carvalho Chehab
2018-08-04 12:45 ` [PATCHv17 09/34] videodev2.h: add request_fd field to v4l2_ext_controls Hans Verkuil
2018-08-09 20:04   ` Mauro Carvalho Chehab
2018-08-04 12:45 ` [PATCHv17 10/34] v4l2-ctrls: v4l2_ctrl_add_handler: add from_other_dev Hans Verkuil
2018-08-09 20:10   ` Mauro Carvalho Chehab
2018-08-04 12:45 ` [PATCHv17 11/34] v4l2-ctrls: prepare internal structs for request API Hans Verkuil
2018-08-09 20:16   ` Mauro Carvalho Chehab
2018-08-10  7:41     ` Hans Verkuil
2018-08-04 12:45 ` [PATCHv17 12/34] v4l2-ctrls: alloc memory for p_req Hans Verkuil
2018-08-09 20:19   ` Mauro Carvalho Chehab
2018-08-10  7:41     ` Hans Verkuil
2018-08-04 12:45 ` [PATCHv17 13/34] v4l2-ctrls: use ref in helper instead of ctrl Hans Verkuil
2018-08-09 20:22   ` Mauro Carvalho Chehab
2018-08-04 12:45 ` [PATCHv17 14/34] v4l2-ctrls: add core request support Hans Verkuil
2018-08-13 10:55   ` Mauro Carvalho Chehab
2018-08-14  8:34     ` Hans Verkuil
2018-08-14  8:59       ` Mauro Carvalho Chehab
2018-08-04 12:45 ` [PATCHv17 15/34] v4l2-ctrls: support g/s_ext_ctrls for requests Hans Verkuil
2018-08-13 11:05   ` Mauro Carvalho Chehab
2018-08-04 12:45 ` [PATCHv17 16/34] v4l2-ctrls: add v4l2_ctrl_request_hdl_find/put/ctrl_find functions Hans Verkuil
2018-08-13 11:07   ` Mauro Carvalho Chehab
2018-08-14  8:45     ` Hans Verkuil
2018-08-14  8:55       ` Mauro Carvalho Chehab
2018-08-14 10:50         ` Hans Verkuil
2018-08-04 12:45 ` [PATCHv17 17/34] vb2: store userspace data in vb2_v4l2_buffer Hans Verkuil
2018-08-13 11:15   ` Mauro Carvalho Chehab
2018-08-04 12:45 ` [PATCHv17 18/34] davinci_vpfe: remove bogus vb2->state check Hans Verkuil
2018-08-13 11:17   ` Mauro Carvalho Chehab
2018-08-04 12:45 ` [PATCHv17 19/34] vb2: drop VB2_BUF_STATE_PREPARED, use bool prepared/synced instead Hans Verkuil
2018-08-13 11:30   ` Mauro Carvalho Chehab
2018-08-14  8:58     ` Hans Verkuil
2018-08-14  9:06       ` Mauro Carvalho Chehab
2018-08-04 12:45 ` [PATCHv17 20/34] videodev2.h: Add request_fd field to v4l2_buffer Hans Verkuil
2018-08-13 11:41   ` Mauro Carvalho Chehab
2018-08-04 12:45 ` [PATCHv17 21/34] vb2: add init_buffer buffer op Hans Verkuil
2018-08-13 11:56   ` Mauro Carvalho Chehab
2018-08-04 12:45 ` [PATCHv17 22/34] videobuf2-core: embed media_request_object Hans Verkuil
2018-08-13 11:58   ` Mauro Carvalho Chehab
2018-08-04 12:45 ` [PATCHv17 23/34] videobuf2-core: integrate with media requests Hans Verkuil
2018-08-13 12:09   ` Mauro Carvalho Chehab
2018-08-04 12:45 ` [PATCHv17 24/34] videobuf2-v4l2: " Hans Verkuil
2018-08-13 14:30   ` Mauro Carvalho Chehab
2018-08-04 12:45 ` [PATCHv17 25/34] videobuf2-core: add request helper functions Hans Verkuil
2018-08-13 14:50   ` Mauro Carvalho Chehab
2018-08-14  7:22     ` Hans Verkuil
2018-08-04 12:45 ` [PATCHv17 26/34] videobuf2-v4l2: add vb2_request_queue/validate helpers Hans Verkuil
2018-08-13 14:53   ` Mauro Carvalho Chehab
2018-08-14  7:19     ` Hans Verkuil
2018-08-14  7:49       ` Mauro Carvalho Chehab
2018-08-04 12:45 ` [PATCHv17 27/34] videobuf2-core: add uses_requests/qbuf flags Hans Verkuil
2018-08-13 14:55   ` Mauro Carvalho Chehab
2018-08-04 12:45 ` [PATCHv17 28/34] videobuf2-v4l2: refuse qbuf if queue uses requests or vv Hans Verkuil
2018-08-13 14:56   ` Mauro Carvalho Chehab
2018-08-04 12:45 ` [PATCHv17 29/34] v4l2-mem2mem: add vb2_m2m_request_queue Hans Verkuil
2018-08-13 15:02   ` Mauro Carvalho Chehab
2018-08-14  7:26     ` Hans Verkuil
2018-08-04 12:45 ` [PATCHv17 30/34] vim2m: use workqueue Hans Verkuil
2018-08-13 15:05   ` Mauro Carvalho Chehab
2018-08-14  7:28     ` Hans Verkuil
2018-08-14  7:41       ` Mauro Carvalho Chehab
2018-08-04 12:45 ` [PATCHv17 31/34] vim2m: support requests Hans Verkuil
2018-08-06 21:02   ` Ezequiel Garcia
2018-08-13 15:08   ` Mauro Carvalho Chehab
2018-08-04 12:45 ` [PATCHv17 32/34] vivid: add mc Hans Verkuil
2018-08-13 15:09   ` Mauro Carvalho Chehab
2018-08-04 12:45 ` [PATCHv17 33/34] vivid: add request support Hans Verkuil
2018-08-13 15:11   ` Mauro Carvalho Chehab
2018-08-04 12:45 ` [PATCHv17 34/34] RFC: media-requests: add debugfs node Hans Verkuil
2018-08-13 15:15   ` Mauro Carvalho Chehab
2018-08-14  7:33     ` Hans Verkuil
2018-08-14  7:43       ` Mauro Carvalho Chehab

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=20180814052156.4c961226@coco.lan \
    --to=mchehab+samsung@kernel.org \
    --cc=acourbot@chromium.org \
    --cc=hans.verkuil@cisco.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.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 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.