diff mbox

[RFCv2,API,04/28] DocBook: make the G/S/TRY_FMT specification more strict.

Message ID 5c449812e54fff0816282e712ab9e24c8b278cb6.1347023744.git.hans.verkuil@cisco.com (mailing list archive)
State New, archived
Headers show

Commit Message

Hans Verkuil Sept. 7, 2012, 1:29 p.m. UTC
From: Hans Verkuil <hans.verkuil@cisco.com>

- S/TRY_FMT should always succeed, unless an invalid type field is passed in.
- TRY_FMT should give the same result as S_FMT, all other things being equal.
- ENUMFMT may return different formats for different inputs or outputs.

This was decided during the 2012 Media Workshop.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml |    3 +++
 Documentation/DocBook/media/v4l/vidioc-g-fmt.xml    |    9 ++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

Comments

Sylwester Nawrocki Sept. 7, 2012, 8 p.m. UTC | #1
On 09/07/2012 03:29 PM, Hans Verkuil wrote:
> From: Hans Verkuil<hans.verkuil@cisco.com>
>
> - S/TRY_FMT should always succeed, unless an invalid type field is passed in.
> - TRY_FMT should give the same result as S_FMT, all other things being equal.
> - ENUMFMT may return different formats for different inputs or outputs.
>
> This was decided during the 2012 Media Workshop.
>
> Signed-off-by: Hans Verkuil<hans.verkuil@cisco.com>

Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>

A typo managed to snick in below...

> ---
>   Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml |    3 +++
>   Documentation/DocBook/media/v4l/vidioc-g-fmt.xml    |    9 ++++++---
>   2 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml b/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml
> index 81ebe48..0bd3324 100644
> --- a/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml
> +++ b/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml
> @@ -58,6 +58,9 @@ structure. Drivers fill the rest of the structure or return an
>   incrementing by one until<errorcode>EINVAL</errorcode>  is
>   returned.</para>
>
> +<para>Note that after switching input or output the list of enumerated image
> +formats may be different.</para>
> +
>       <table pgwide="1" frame="none" id="v4l2-fmtdesc">
>         <title>struct<structname>v4l2_fmtdesc</structname></title>
>         <tgroup cols="3">
> diff --git a/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml b/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml
> index 52acff1..9ef279a 100644
> --- a/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml
> +++ b/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml
> @@ -81,7 +81,7 @@ the application calls the<constant>VIDIOC_S_FMT</constant>  ioctl
>   with a pointer to a<structname>v4l2_format</structname>  structure
>   the driver checks
>   and adjusts the parameters against hardware abilities. Drivers
> -should not return an error code unless the input is ambiguous, this is
> +should not return an error code unless the<structfield>type</structfield>  field is invalid, this is
>   a mechanism to fathom device capabilities and to approach parameters
>   acceptable for both the application and driver. On success the driver
>   may program the hardware, allocate resources and generally prepare for
> @@ -107,6 +107,10 @@ disabling I/O or possibly time consuming hardware preparations.
>   Although strongly recommended drivers are not required to implement
>   this ioctl.</para>
>
> +<para>The format as returned by<constant>VIDIOC_TRY_FMT</constant>
> +must be identical to what<constant>VIDIOC_S_FMT</constant>  returns for
> +the same input or output.</para>
> +
>       <table pgwide="1" frame="none" id="v4l2-format">
>         <title>struct<structname>v4l2_format</structname></title>
>         <tgroup cols="4">
> @@ -187,8 +191,7 @@ capture and output devices.</entry>
>   	<term><errorcode>EINVAL</errorcode></term>
>   	<listitem>
>   	<para>The&v4l2-format;<structfield>type</structfield>
> -field is invalid, the requested buffer type not supported, or the
> -format is not supported with this buffer type.</para>
> +field is invalia or the requested buffer type not supported.</para>

invalia -> invalid

>   	</listitem>
>         </varlistentry>
>       </variablelist>

--

Regards,
Sylwester
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Laurent Pinchart Sept. 13, 2012, 2:18 a.m. UTC | #2
On Friday 07 September 2012 15:29:04 Hans Verkuil wrote:
> From: Hans Verkuil <hans.verkuil@cisco.com>
> 
> - S/TRY_FMT should always succeed, unless an invalid type field is passed
> in. - TRY_FMT should give the same result as S_FMT, all other things being
> equal. - ENUMFMT may return different formats for different inputs or
> outputs.
> 
> This was decided during the 2012 Media Workshop.
> 
> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>

With the typo fix reported by Sylwester,

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
diff mbox

Patch

diff --git a/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml b/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml
index 81ebe48..0bd3324 100644
--- a/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml
@@ -58,6 +58,9 @@  structure. Drivers fill the rest of the structure or return an
 incrementing by one until <errorcode>EINVAL</errorcode> is
 returned.</para>
 
+    <para>Note that after switching input or output the list of enumerated image
+formats may be different.</para>
+
     <table pgwide="1" frame="none" id="v4l2-fmtdesc">
       <title>struct <structname>v4l2_fmtdesc</structname></title>
       <tgroup cols="3">
diff --git a/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml b/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml
index 52acff1..9ef279a 100644
--- a/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml
@@ -81,7 +81,7 @@  the application calls the <constant>VIDIOC_S_FMT</constant> ioctl
 with a pointer to a <structname>v4l2_format</structname> structure
 the driver checks
 and adjusts the parameters against hardware abilities. Drivers
-should not return an error code unless the input is ambiguous, this is
+should not return an error code unless the <structfield>type</structfield> field is invalid, this is
 a mechanism to fathom device capabilities and to approach parameters
 acceptable for both the application and driver. On success the driver
 may program the hardware, allocate resources and generally prepare for
@@ -107,6 +107,10 @@  disabling I/O or possibly time consuming hardware preparations.
 Although strongly recommended drivers are not required to implement
 this ioctl.</para>
 
+    <para>The format as returned by <constant>VIDIOC_TRY_FMT</constant>
+must be identical to what <constant>VIDIOC_S_FMT</constant> returns for
+the same input or output.</para>
+
     <table pgwide="1" frame="none" id="v4l2-format">
       <title>struct <structname>v4l2_format</structname></title>
       <tgroup cols="4">
@@ -187,8 +191,7 @@  capture and output devices.</entry>
 	<term><errorcode>EINVAL</errorcode></term>
 	<listitem>
 	  <para>The &v4l2-format; <structfield>type</structfield>
-field is invalid, the requested buffer type not supported, or the
-format is not supported with this buffer type.</para>
+field is invalia or the requested buffer type not supported.</para>
 	</listitem>
       </varlistentry>
     </variablelist>