From: Hans Verkuil <hverkuil@xs4all.nl>
To: Mauro Carvalho Chehab <m.chehab@samsung.com>
Cc: linux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com,
s.nawrocki@samsung.com, ismael.luceno@corp.bluecherry.net,
pete@sensoray.com, sakari.ailus@iki.fi,
Hans Verkuil <hans.verkuil@cisco.com>
Subject: Re: [REVIEWv3 PATCH 20/35] DocBook media: update VIDIOC_G/S/TRY_EXT_CTRLS.
Date: Thu, 13 Mar 2014 13:18:53 +0100 [thread overview]
Message-ID: <5321A22D.3030505@xs4all.nl> (raw)
In-Reply-To: <20140312112000.54ffb496@samsung.com>
On 03/12/14 15:20, Mauro Carvalho Chehab wrote:
> Em Mon, 17 Feb 2014 10:57:35 +0100
> Hans Verkuil <hverkuil@xs4all.nl> escreveu:
>
>> From: Hans Verkuil <hans.verkuil@cisco.com>
>>
>> Document the support for the new complex type controls.
>>
>> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
>> ---
>> .../DocBook/media/v4l/vidioc-g-ext-ctrls.xml | 43 ++++++++++++++++++----
>> 1 file changed, 35 insertions(+), 8 deletions(-)
>>
>> diff --git a/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml b/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml
>> index b3bb957..d946d6b 100644
>> --- a/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml
>> +++ b/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml
>> @@ -72,23 +72,30 @@ initialize the <structfield>id</structfield>,
>> <structfield>size</structfield> and <structfield>reserved2</structfield> fields
>> of each &v4l2-ext-control; and call the
>> <constant>VIDIOC_G_EXT_CTRLS</constant> ioctl. String controls controls
>> -must also set the <structfield>string</structfield> field.</para>
>> +must also set the <structfield>string</structfield> field. Controls
>> +of complex types (<constant>V4L2_CTRL_FLAG_IS_PTR</constant> is set)
>> +must set the <structfield>p</structfield> field.</para>
>
> Same notes I did to the other patches apply here:
> - s/complex/compound/
> - Let's not mix strings with compound types
> - etc
>
>> <para>If the <structfield>size</structfield> is too small to
>> receive the control result (only relevant for pointer-type controls
>> like strings), then the driver will set <structfield>size</structfield>
>> to a valid value and return an &ENOSPC;. You should re-allocate the
>> -string memory to this new size and try again. It is possible that the
>> -same issue occurs again if the string has grown in the meantime. It is
>> +memory to this new size and try again. For the string type it is possible that
>> +the same issue occurs again if the string has grown in the meantime. It is
>> recommended to call &VIDIOC-QUERYCTRL; first and use
>> <structfield>maximum</structfield>+1 as the new <structfield>size</structfield>
>> value. It is guaranteed that that is sufficient memory.
>> </para>
>>
>> + <para>Matrices are set and retrieved row-by-row. You cannot set a partial
>> +matrix, all elements have to be set or retrieved. The total size is calculated
>> +as <structfield>rows</structfield> * <structfield>cols</structfield> * <structfield>elem_size</structfield>.
>> +These values can be obtained by calling &VIDIOC-QUERY-EXT-CTRL;.</para>
>> +
>> <para>To change the value of a set of controls applications
>> initialize the <structfield>id</structfield>, <structfield>size</structfield>,
>> <structfield>reserved2</structfield> and
>> -<structfield>value/string</structfield> fields of each &v4l2-ext-control; and
>> +<structfield>value/value64/string/p</structfield> fields of each &v4l2-ext-control; and
>> call the <constant>VIDIOC_S_EXT_CTRLS</constant> ioctl. The controls
>> will only be set if <emphasis>all</emphasis> control values are
>> valid.</para>
>> @@ -96,11 +103,17 @@ valid.</para>
>> <para>To check if a set of controls have correct values applications
>> initialize the <structfield>id</structfield>, <structfield>size</structfield>,
>> <structfield>reserved2</structfield> and
>> -<structfield>value/string</structfield> fields of each &v4l2-ext-control; and
>> +<structfield>value/value64/string/p</structfield> fields of each &v4l2-ext-control; and
>> call the <constant>VIDIOC_TRY_EXT_CTRLS</constant> ioctl. It is up to
>> the driver whether wrong values are automatically adjusted to a valid
>> value or if an error is returned.</para>
>>
>> + <para>For matrices it is possible to only set or check only the first
>> +<constant>X</constant> elements by setting size to <constant>X * elem_size</constant>,
>> +where <structfield>elem_size</structfield> is obtained by calling &VIDIOC-QUERY-EXT-CTRL;.
>> +Matrix elements are set row-by-row. Matrix elements that are not explicitly
>> +set will be initialized to their default value.</para>
>> +
>
> That sounds confusing: what are the defaults?
>
> Also, what happens if the size is set to, let's say, 1,5 * elem_size?
>
> Will it fill one element, will it return an error (what error?) or will it
> fill two elements, the second one with some wrong value?
I would have to double-check but I think this may be a left-over from an earlier
version. I think the text is wrong and that you always have to set the full
matrix, for pretty much the reasons you mentioned as well. I've played around
with it, originally even being able to set a sub-matrix within the full matrix,
but you run into all sorts of complexities. For now the requirement is that
you set all values at once, later this might be relaxed but we need to have
a much better understanding of such use-cases.
Regards,
Hans
next prev parent reply other threads:[~2014-03-13 12:19 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-17 9:57 [REVIEWv3 PATCH 00/35] Add support for complex controls, use in solo/go7007 Hans Verkuil
2014-02-17 9:57 ` [REVIEWv3 PATCH 01/35] v4l2-ctrls: increase internal min/max/step/def to 64 bit Hans Verkuil
2014-02-17 9:57 ` [REVIEWv3 PATCH 02/35] v4l2-ctrls: add unit string Hans Verkuil
2014-02-17 9:57 ` [REVIEWv3 PATCH 03/35] v4l2-ctrls: use pr_info/cont instead of printk Hans Verkuil
2014-02-17 9:57 ` [REVIEWv3 PATCH 04/35] videodev2.h: add initial support for complex controls Hans Verkuil
2014-03-11 19:34 ` Mauro Carvalho Chehab
2014-03-11 20:23 ` Hans Verkuil
2014-03-11 23:48 ` Mauro Carvalho Chehab
2014-02-17 9:57 ` [REVIEWv3 PATCH 05/35] videodev2.h: add struct v4l2_query_ext_ctrl and VIDIOC_QUERY_EXT_CTRL Hans Verkuil
2014-03-11 19:42 ` Mauro Carvalho Chehab
2014-03-11 20:29 ` Hans Verkuil
2014-03-11 23:35 ` Mauro Carvalho Chehab
2014-02-17 9:57 ` [REVIEWv3 PATCH 06/35] v4l2-ctrls: add support for complex types Hans Verkuil
2014-03-11 20:14 ` Mauro Carvalho Chehab
2014-03-11 20:43 ` Hans Verkuil
2014-03-11 23:43 ` Mauro Carvalho Chehab
2014-02-17 9:57 ` [REVIEWv3 PATCH 07/35] v4l2: integrate support for VIDIOC_QUERY_EXT_CTRL Hans Verkuil
2014-02-17 9:57 ` [REVIEWv3 PATCH 08/35] v4l2-ctrls: create type_ops Hans Verkuil
2014-03-11 20:22 ` Mauro Carvalho Chehab
2014-03-11 20:49 ` Hans Verkuil
2014-03-11 23:56 ` Mauro Carvalho Chehab
2014-02-17 9:57 ` [REVIEWv3 PATCH 09/35] v4l2-ctrls: rewrite copy routines to operate on union v4l2_ctrl_ptr Hans Verkuil
2014-02-17 9:57 ` [REVIEWv3 PATCH 10/35] v4l2-ctrls: compare values only once Hans Verkuil
2014-02-17 9:57 ` [REVIEWv3 PATCH 11/35] v4l2-ctrls: prepare for matrix support: add cols & rows fields Hans Verkuil
2014-03-12 10:34 ` Mauro Carvalho Chehab
2014-02-17 9:57 ` [REVIEWv3 PATCH 12/35] v4l2-ctrls: replace cur by a union v4l2_ctrl_ptr Hans Verkuil
2014-03-12 10:38 ` Mauro Carvalho Chehab
2014-02-17 9:57 ` [REVIEWv3 PATCH 13/35] v4l2-ctrls: use 'new' to access pointer controls Hans Verkuil
2014-03-12 10:40 ` Mauro Carvalho Chehab
2014-02-17 9:57 ` [REVIEWv3 PATCH 14/35] v4l2-ctrls: prepare for matrix support Hans Verkuil
2014-03-12 10:42 ` Mauro Carvalho Chehab
2014-03-12 12:21 ` Hans Verkuil
2014-03-12 13:00 ` Mauro Carvalho Chehab
2014-03-12 13:00 ` Mauro Carvalho Chehab
2014-03-12 13:41 ` Hans Verkuil
2014-03-12 13:44 ` Sylwester Nawrocki
2014-02-17 9:57 ` [REVIEWv3 PATCH 15/35] v4l2-ctrls: type_ops can handle matrix elements Hans Verkuil
2014-02-17 9:57 ` [REVIEWv3 PATCH 16/35] v4l2-ctrls: add matrix support Hans Verkuil
2014-02-17 9:57 ` [REVIEWv3 PATCH 17/35] v4l2-ctrls: return elem_size instead of strlen Hans Verkuil
2014-02-17 9:57 ` [REVIEWv3 PATCH 18/35] v4l2-ctrl: fix error return of copy_to/from_user Hans Verkuil
2014-02-17 9:57 ` [REVIEWv3 PATCH 19/35] DocBook media: document VIDIOC_QUERY_EXT_CTRL Hans Verkuil
2014-03-12 14:13 ` Mauro Carvalho Chehab
2014-03-13 7:58 ` Hans Verkuil
2014-02-17 9:57 ` [REVIEWv3 PATCH 20/35] DocBook media: update VIDIOC_G/S/TRY_EXT_CTRLS Hans Verkuil
2014-03-12 14:20 ` Mauro Carvalho Chehab
2014-03-13 12:18 ` Hans Verkuil [this message]
2014-02-17 9:57 ` [REVIEWv3 PATCH 21/35] DocBook media: fix coding style in the control example code Hans Verkuil
2014-02-17 9:57 ` [REVIEWv3 PATCH 22/35] DocBook media: update control section Hans Verkuil
2014-02-19 23:15 ` Sakari Ailus
2014-03-12 14:27 ` Mauro Carvalho Chehab
2014-02-17 9:57 ` [REVIEWv3 PATCH 23/35] v4l2-controls.txt: update to the new way of accessing controls Hans Verkuil
2014-02-17 9:57 ` [REVIEWv3 PATCH 24/35] v4l2-ctrls/videodev2.h: add u8 and u16 types Hans Verkuil
2014-03-12 14:44 ` Mauro Carvalho Chehab
2014-02-17 9:57 ` [REVIEWv3 PATCH 25/35] DocBook media: document new u8 and u16 control types Hans Verkuil
2014-02-17 9:57 ` [REVIEWv3 PATCH 26/35] v4l2-ctrls: fix comments Hans Verkuil
2014-02-17 9:57 ` [REVIEWv3 PATCH 27/35] v4l2-ctrls/v4l2-controls.h: add MD controls Hans Verkuil
2014-02-17 9:57 ` [REVIEWv3 PATCH 28/35] DocBook media: document new motion detection controls Hans Verkuil
2014-02-17 9:57 ` [REVIEWv3 PATCH 29/35] v4l2: add a motion detection event Hans Verkuil
2014-02-17 9:57 ` [REVIEWv3 PATCH 30/35] DocBook: document new v4l " Hans Verkuil
2014-02-17 9:57 ` [REVIEWv3 PATCH 31/35] solo6x10: implement the new motion detection controls Hans Verkuil
2014-02-17 9:57 ` [REVIEWv3 PATCH 32/35] solo6x10: implement the motion detection event Hans Verkuil
2014-02-17 9:57 ` [REVIEWv3 PATCH 33/35] solo6x10: fix 'dma from stack' warning Hans Verkuil
2014-02-17 9:57 ` [REVIEWv3 PATCH 34/35] solo6x10: check dma_map_sg() return value Hans Verkuil
2014-02-17 9:57 ` [REVIEWv3 PATCH 35/35] go7007: add motion detection support Hans Verkuil
2014-02-19 8:28 ` [REVIEWv3 PATCH 00/35] Add support for complex controls, use in solo/go7007 Ricardo Ribalda Delgado
2014-02-19 8:54 ` Hans Verkuil
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=5321A22D.3030505@xs4all.nl \
--to=hverkuil@xs4all.nl \
--cc=hans.verkuil@cisco.com \
--cc=ismael.luceno@corp.bluecherry.net \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=m.chehab@samsung.com \
--cc=pete@sensoray.com \
--cc=s.nawrocki@samsung.com \
--cc=sakari.ailus@iki.fi \
/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