Skip to contentSkip to conversation

v4l2-mediabus.h & documentation updates

PATCH In review Hans Verkuil 2 participants 8 messages Dec 5, 2014 – Dec 7, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover v4l2-mediabus.h & documentation updates

These patches change the type of the two new fields in struct v4l2_mbus_framefmt from __u32 to __u16, as per Sakari's suggestion. We don't need 4 bytes per field for this, and this way we save one __u32.

It also updates docbook with the new fields (I somehow missed that) and documents the new vivid controls in vivid.txt.

Regards,

Hans

#1 lore raw

PATCH 1/4 v4l2-mediabus.h: use two __u16 instead of two __u32

From: Hans Verkuil <[email protected]>

The ycbcr_enc and quantization fields do not need a __u32. Switch to two __u16 types, thus preserving alignment and avoiding holes in the struct. This makes one more __u32 available for future expansion.

Suggested by Sakari Ailus.

---
 include/uapi/linux/v4l2-mediabus.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
include/uapi/linux/v4l2-mediabus.h +3 -3
index 5a86d8e..26db206 100644
@@ -31,9 +31,9 @@ struct v4l2_mbus_framefmt {
 	__u32			code;
 	__u32			field;
 	__u32			colorspace;
-	__u32			ycbcr_enc;
-	__u32			quantization;
-	__u32			reserved[5];
+	__u16			ycbcr_enc;
+	__u16			quantization;
+	__u32			reserved[6];
 };
 
 #ifndef __KERNEL__
Signature · 1 line
2.1.3
#2 lore raw

PATCH 2/4 DocBook media: add missing ycbcr_enc and quantization fields

In reply to Hans Verkuil

From: Hans Verkuil <[email protected]>

I forgot to add these fields to the relevant structs.

---
 Documentation/DocBook/media/v4l/pixfmt.xml         | 36 ++++++++++++++++++++--
 Documentation/DocBook/media/v4l/subdev-formats.xml | 18 ++++++++++-
 2 files changed, 51 insertions(+), 3 deletions(-)
Documentation/DocBook/media/v4l/pixfmt.xml +34 -2
index ccf6053..d5eca4b 100644
@@ -138,9 +138,25 @@ applicable values.</para></entry>
 	<row>
 	  <entry>__u32</entry>
 	  <entry><structfield>flags</structfield></entry>
-	    <entry>Flags set by the application or driver, see <xref
+	  <entry>Flags set by the application or driver, see <xref
 linkend="format-flags" />.</entry>
 	</row>
+	<row>
+	  <entry>&v4l2-ycbcr-encoding;</entry>
+	  <entry><structfield>ycbcr_enc</structfield></entry>
+	  <entry>This information supplements the
+<structfield>colorspace</structfield> and must be set by the driver for
+capture streams and by the application for output streams,
+see <xref linkend="colorspaces" />.</entry>
+	</row>
+	<row>
+	  <entry>&v4l2-quantization;</entry>
+	  <entry><structfield>quantization</structfield></entry>
+	  <entry>This information supplements the
+<structfield>colorspace</structfield> and must be set by the driver for
+capture streams and by the application for output streams,
+see <xref linkend="colorspaces" />.</entry>
+	</row>
       </tbody>
     </tgroup>
   </table>
@@ -232,9 +248,25 @@ codes can be used.</entry>
 	  <entry>Flags set by the application or driver, see <xref
 linkend="format-flags" />.</entry>
 	</row>
+	<row>
+	  <entry>&v4l2-ycbcr-encoding;</entry>
+	  <entry><structfield>ycbcr_enc</structfield></entry>
+	  <entry>This information supplements the
+<structfield>colorspace</structfield> and must be set by the driver for
+capture streams and by the application for output streams,
+see <xref linkend="colorspaces" />.</entry>
+	</row>
+	<row>
+	  <entry>&v4l2-quantization;</entry>
+	  <entry><structfield>quantization</structfield></entry>
+	  <entry>This information supplements the
+<structfield>colorspace</structfield> and must be set by the driver for
+capture streams and by the application for output streams,
+see <xref linkend="colorspaces" />.</entry>
+	</row>
         <row>
           <entry>__u8</entry>
-          <entry><structfield>reserved[10]</structfield></entry>
+          <entry><structfield>reserved[8]</structfield></entry>
           <entry>Reserved for future extensions. Should be zeroed by the
            application.</entry>
         </row>
Documentation/DocBook/media/v4l/subdev-formats.xml +17 -1
index 18730b9..c5ea868 100644
@@ -34,8 +34,24 @@
 	  <xref linkend="colorspaces" /> for details.</entry>
 	</row>
 	<row>
+	  <entry>&v4l2-ycbcr-encoding;</entry>
+	  <entry><structfield>ycbcr_enc</structfield></entry>
+	  <entry>This information supplements the
+<structfield>colorspace</structfield> and must be set by the driver for
+capture streams and by the application for output streams,
+see <xref linkend="colorspaces" />.</entry>
+	</row>
+	<row>
+	  <entry>&v4l2-quantization;</entry>
+	  <entry><structfield>quantization</structfield></entry>
+	  <entry>This information supplements the
+<structfield>colorspace</structfield> and must be set by the driver for
+capture streams and by the application for output streams,
+see <xref linkend="colorspaces" />.</entry>
+	</row>
+	<row>
 	  <entry>__u32</entry>
-	  <entry><structfield>reserved</structfield>[7]</entry>
+	  <entry><structfield>reserved</structfield>[6]</entry>
 	  <entry>Reserved for future extensions. Applications and drivers must
 	  set the array to zero.</entry>
 	</row>
Signature · 1 line
2.1.3
#3 lore raw

PATCH 3/4 DocBook media: update version number and document changes.

In reply to Hans Verkuil

From: Hans Verkuil <[email protected]>

---
 Documentation/DocBook/media/v4l/compat.xml |  6 ++++++
 Documentation/DocBook/media/v4l/v4l2.xml   | 11 ++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)
Documentation/DocBook/media/v4l/compat.xml +6 -0
index 0a2debf..518bc56 100644
@@ -2576,6 +2576,12 @@ fields changed from _s32 to _u32.
 	  <para>Added <constant>V4L2_CID_PAN_SPEED</constant> and
  <constant>V4L2_CID_TILT_SPEED</constant> camera controls.</para>
 	</listitem>
+	<listitem>
+	  <para>Rewrote Colorspace chapter, added new &v4l2-ycbcr-encoding;
+and &v4l2-quantization; fields to &v4l2-pix-format;, &v4l2-pix-format-mplane;
+and &v4l2-mbus-framefmt;.
+	  </para>
+	</listitem>
       </orderedlist>
     </section>
 
Documentation/DocBook/media/v4l/v4l2.xml +10 -1
index 7cfe618..e6cfd7e 100644
@@ -152,6 +152,15 @@ structs, ioctls) must be noted in more detail in the history chapter
 applications. -->
 
       <revision>
+	<revnumber>3.18</revnumber>
+	<date>2014-12-05</date>
+	<authorinitials>hv</authorinitials>
+	<revremark>Rewrote Colorspace chapter, added new &v4l2-ycbcr-encoding; and &v4l2-quantization; fields
+to &v4l2-pix-format;, &v4l2-pix-format-mplane; and &v4l2-mbus-framefmt;.
+	</revremark>
+      </revision>
+
+      <revision>
 	<revnumber>3.17</revnumber>
 	<date>2014-08-04</date>
 	<authorinitials>lp, hv</authorinitials>
@@ -539,7 +548,7 @@ and discussions on the V4L mailing list.</revremark>
 </partinfo>
 
 <title>Video for Linux Two API Specification</title>
- <subtitle>Revision 3.17</subtitle>
+ <subtitle>Revision 3.18</subtitle>
 
   <chapter id="common">
     &sub-common;
Signature · 1 line
2.1.3
#4 lore raw

Re: [PATCH for v3.19 3/4] DocBook media: update version number and document changes.

Quoted 30 lines · Hans Verkuil

From: Hans Verkuil <[email protected]>

---
 Documentation/DocBook/media/v4l/compat.xml |  6 ++++++
 Documentation/DocBook/media/v4l/v4l2.xml   | 11 ++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)
Documentation/DocBook/media/v4l/compat.xml +6 -0
index 0a2debf..518bc56 100644
@@ -2576,6 +2576,12 @@ fields changed from _s32 to _u32.
 	  <para>Added <constant>V4L2_CID_PAN_SPEED</constant> and
  <constant>V4L2_CID_TILT_SPEED</constant> camera controls.</para>
 	</listitem>
+	<listitem>
+	  <para>Rewrote Colorspace chapter, added new &v4l2-ycbcr-encoding;
+and &v4l2-quantization; fields to &v4l2-pix-format;, &v4l2-pix-format-mplane;
+and &v4l2-mbus-framefmt;.
+	  </para>
+	</listitem>
       </orderedlist>
     </section>
 
Documentation/DocBook/media/v4l/v4l2.xml +0 -0
index 7cfe618..e6cfd7e 100644

Documentation/DocBook/media/v4l/v4l2.xml structs, ioctls) must be noted in more detail in the history chapter · line 155

Quoted 4 lines
Documentation/DocBook/media/v4l/v4l2.xml +1 -0
@@ -152,6 +152,15 @@ structs, ioctls) must be noted in more detail in the history chapter
 applications. -->
 
       <revision>
+	<revnumber>3.18</revnumber>

Oops, should be 3.19.

Will repost with the right version numbers.

Regards,

Hans

Quoted 21 lines
Documentation/DocBook/media/v4l/v4l2.xml +9 -1
+	<date>2014-12-05</date>
+	<authorinitials>hv</authorinitials>
+	<revremark>Rewrote Colorspace chapter, added new &v4l2-ycbcr-encoding; and &v4l2-quantization; fields
+to &v4l2-pix-format;, &v4l2-pix-format-mplane; and &v4l2-mbus-framefmt;.
+	</revremark>
+      </revision>
+
+      <revision>
 	<revnumber>3.17</revnumber>
 	<date>2014-08-04</date>
 	<authorinitials>lp, hv</authorinitials>
@@ -539,7 +548,7 @@ and discussions on the V4L mailing list.</revremark>
 </partinfo>
 
 <title>Video for Linux Two API Specification</title>
- <subtitle>Revision 3.17</subtitle>
+ <subtitle>Revision 3.18</subtitle>
 
   <chapter id="common">
     &sub-common;
#5 lore raw

PATCH v2 3/4 DocBook media: update version number and document changes.

In reply to Hans Verkuil

Update the version to 3.19.

---
 Documentation/DocBook/media/v4l/compat.xml | 12 ++++++++++++
 Documentation/DocBook/media/v4l/v4l2.xml   | 11 ++++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)
Documentation/DocBook/media/v4l/compat.xml +12 -0
index 0a2debf..350dfb3 100644
@@ -2579,6 +2579,18 @@ fields changed from _s32 to _u32.
       </orderedlist>
     </section>
 
+    <section>
+      <title>V4L2 in Linux 3.19</title>
+      <orderedlist>
+	<listitem>
+	  <para>Rewrote Colorspace chapter, added new &v4l2-ycbcr-encoding;
+and &v4l2-quantization; fields to &v4l2-pix-format;, &v4l2-pix-format-mplane;
+and &v4l2-mbus-framefmt;.
+	  </para>
+	</listitem>
+      </orderedlist>
+    </section>
+
     <section id="other">
       <title>Relation of V4L2 to other Linux multimedia APIs</title>
 
Documentation/DocBook/media/v4l/v4l2.xml +10 -1
index 7cfe618..ac0f8d9 100644
@@ -152,6 +152,15 @@ structs, ioctls) must be noted in more detail in the history chapter
 applications. -->
 
       <revision>
+	<revnumber>3.19</revnumber>
+	<date>2014-12-05</date>
+	<authorinitials>hv</authorinitials>
+	<revremark>Rewrote Colorspace chapter, added new &v4l2-ycbcr-encoding; and &v4l2-quantization; fields
+to &v4l2-pix-format;, &v4l2-pix-format-mplane; and &v4l2-mbus-framefmt;.
+	</revremark>
+      </revision>
+
+      <revision>
 	<revnumber>3.17</revnumber>
 	<date>2014-08-04</date>
 	<authorinitials>lp, hv</authorinitials>
@@ -539,7 +548,7 @@ and discussions on the V4L mailing list.</revremark>
 </partinfo>
 
 <title>Video for Linux Two API Specification</title>
- <subtitle>Revision 3.17</subtitle>
+ <subtitle>Revision 3.19</subtitle>
 
   <chapter id="common">
     &sub-common;
Signature · 1 line
2.1.3
#6 lore raw

PATCH 4/4 vivid.txt: document new controls

In reply to Hans Verkuil

From: Hans Verkuil <[email protected]>

Document the new 'Y'CbCr Encoding' and 'Quantization' controls.

---
 Documentation/video4linux/vivid.txt | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
Documentation/video4linux/vivid.txt +15 -0
index e5a940e..6cfc854 100644
@@ -640,6 +640,21 @@ Colorspace: selects which colorspace should be used when generating the image.
 	Changing the colorspace will result in the V4L2_EVENT_SOURCE_CHANGE
 	to be sent since it emulates a detected colorspace change.
 
+Y'CbCr Encoding: selects which Y'CbCr encoding should be used when generating
+	a Y'CbCr image.	This only applies if the CSC Colorbar test pattern is
+	selected, and if the format is set to a Y'CbCr format as opposed to an
+	RGB format.
+
+	Changing the Y'CbCr encoding will result in the V4L2_EVENT_SOURCE_CHANGE
+	to be sent since it emulates a detected colorspace change.
+
+Quantization: selects which quantization should be used for the RGB or Y'CbCr
+	encoding when generating the test pattern. This only applies if the CSC
+	Colorbar test pattern is selected.
+
+	Changing the quantization will result in the V4L2_EVENT_SOURCE_CHANGE
+	to be sent since it emulates a detected colorspace change.
+
 Limited RGB Range (16-235): selects if the RGB range of the HDMI source should
 	be limited or full range. This combines with the Digital Video 'Rx RGB
 	Quantization Range' control and can be used to test what happens if
Signature · 1 line
2.1.3
Acked-by on the v1 series
#7 lore raw
In reply to Hans Verkuil
Quoted 6 lines · Hans Verkuil

These patches change the type of the two new fields in struct v4l2_mbus_framefmt from __u32 to __u16, as per Sakari's suggestion. We don't need 4 bytes per field for this, and this way we save one __u32.

It also updates docbook with the new fields (I somehow missed that) and documents the new vivid controls in vivid.txt.

For the set:

Signature · 2 lines
Sakari Ailus
e-mail: [email protected]	XMPP: [email protected]