[PATCH 18/20] [media] dev-subdev.rst: make table fully visible on LaTeX

2016-08-18 Thread Mauro Carvalho Chehab
The table there is too big and doesn't have format hints for
LaTeX output.

Fix it.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/v4l/dev-subdev.rst | 9 +
 1 file changed, 9 insertions(+)

diff --git a/Documentation/media/uapi/v4l/dev-subdev.rst 
b/Documentation/media/uapi/v4l/dev-subdev.rst
index 5a112eb7a245..b1aed4541bca 100644
--- a/Documentation/media/uapi/v4l/dev-subdev.rst
+++ b/Documentation/media/uapi/v4l/dev-subdev.rst
@@ -204,9 +204,16 @@ list entity names and pad numbers).
 
 .. _sample-pipeline-config:
 
+.. raw:: latex
+
+\newline\newline\begin{adjustbox}{width=\columnwidth}
+
+.. tabularcolumns:: 
|p{4.5cm}|p{4.5cm}|p{4.5cm}|p{4.5cm}|p{4.5cm}|p{4.5cm}|p{4.5cm}|
+
 .. flat-table:: Sample Pipeline Configuration
 :header-rows:  1
 :stub-columns: 0
+:widths: 5 5 5 5 5 5 5
 
 
 -  .. row 1
@@ -288,7 +295,9 @@ list entity names and pad numbers).
 
-  *1280x960/SGRBG8_1X8*
 
+.. raw:: latex
 
+\end{adjustbox}\newline\newline
 
 1. Initial state. The sensor source pad format is set to its native 3MP
size and V4L2_MBUS_FMT_SGRBG8_1X8 media bus code. Formats on the
-- 
2.7.4


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 20/20] [media] diff-v4l.rst: Make capabilities table fit in LaTeX

2016-08-18 Thread Mauro Carvalho Chehab
This table has several troubles:
- a duplicated "struct" on its name;
- a reference to a V4L version 1 struct that will never
  point to something (as we got rid of V4L1 API a long
  time ago);
- misses hints for LaTeX output (column size and longtable
  style).

Fix them.

It should be noticed that the first column of this table is
not aligned with the rest. I suspect that this is a bug at
the flat-table extension.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/v4l/diff-v4l.rst | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/media/uapi/v4l/diff-v4l.rst 
b/Documentation/media/uapi/v4l/diff-v4l.rst
index e1e034df514c..93263e477127 100644
--- a/Documentation/media/uapi/v4l/diff-v4l.rst
+++ b/Documentation/media/uapi/v4l/diff-v4l.rst
@@ -95,7 +95,9 @@ and radio devices supporting a set of related functions like 
video
 capturing, video overlay and VBI capturing. See :ref:`open` for an
 introduction.
 
+.. tabularcolumns:: |p{5.5cm}|p{6.5cm}|p{5.5cm}
 
+.. cssclass:: longtable
 
 .. flat-table::
 :header-rows:  1
@@ -104,7 +106,7 @@ introduction.
 
 -  .. row 1
 
-   -  struct :c:type:`struct video_capability` ``type``
+   -  ``struct video_capability`` ``type``
 
-  struct :ref:`v4l2_capability `
  ``capabilities`` flags
-- 
2.7.4


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 17/20] [media] dev-rds.rst: adjust table dimentions for LaTeX

2016-08-18 Thread Mauro Carvalho Chehab
One of the tables has wrong column dimentions. Fix it.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/v4l/dev-rds.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/media/uapi/v4l/dev-rds.rst 
b/Documentation/media/uapi/v4l/dev-rds.rst
index 35117414c86b..841761a3ea59 100644
--- a/Documentation/media/uapi/v4l/dev-rds.rst
+++ b/Documentation/media/uapi/v4l/dev-rds.rst
@@ -170,7 +170,7 @@ RDS datastructures
 
 .. _v4l2-rds-block-codes:
 
-.. tabularcolumns:: |p{2.2cm}|p{2.2cm}|p{2.2cm}|p{10.9cm}|
+.. tabularcolumns:: |p{5.6cm}|p{2.0cm}|p{1.5cm}|p{7.0cm}|
 
 .. flat-table:: Block defines
 :header-rows:  0
-- 
2.7.4


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 19/20] [media] subdev-formats.rst: adjust most of the tables to fill in page

2016-08-18 Thread Mauro Carvalho Chehab
Fix mosto fo the tables there in order to make them fit at the
page size.

There are, however, two exceptions: RGB and YUV big tables,
where adding the raw latex adjustbox caused the tables to not
be properly formatted. I suspect that the problem is because
those are long tables, but not really sure.

The thing is that Sphinx lacks an "adjustbox" tag that would
avoid the raw latex hacks.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/v4l/subdev-formats.rst | 5575 ---
 1 file changed, 2806 insertions(+), 2769 deletions(-)

diff --git a/Documentation/media/uapi/v4l/subdev-formats.rst 
b/Documentation/media/uapi/v4l/subdev-formats.rst
index 265a6dc5fe92..7d9b55dd6e91 100644
--- a/Documentation/media/uapi/v4l/subdev-formats.rst
+++ b/Documentation/media/uapi/v4l/subdev-formats.rst
@@ -155,12 +155,16 @@ half of the green value) transferred first will be named
 
 The following tables list existing packed RGB formats.
 
+.. FIXME: I was unable to find a way to use adjustbox or landscape for this 
table!
+
+.. tabularcolumns:: 
|p{7.6cm}|p{1.6cm}|p{0.7cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{-1.0cm}|
 
 .. _v4l2-mbus-pixelcode-rgb:
 
 .. flat-table:: RGB formats
 :header-rows:  2
 :stub-columns: 0
+:widths: 36 7 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 
2 2 2
 
 
 -  .. row 1
@@ -249,45 +253,45 @@ The following tables list existing packed RGB formats.
-  0x1016
 
-
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-  r\ :sub:`3`
 
@@ -320,53 +324,53 @@ The following tables list existing packed RGB formats.
-  0x1001
 
-
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-  0
 
@@ -389,53 +393,53 @@ The following tables list existing packed RGB formats.
-
-
-
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-  g\ :sub:`3`
 
@@ -460,53 +464,53 @@ The following tables list existing packed RGB formats.
-  0x1002
 
-
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-  g\ :sub:`3`
 
@@ -529,53 +533,53 @@ The following tables list existing packed RGB formats.
-
-
-
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -

[PATCH 04/20] [media] extended-controls.rst: fix table sizes

2016-08-18 Thread Mauro Carvalho Chehab
Lots of tables at extended-controls.rst need explicit hints for
LaTeX to adjust their widths. Provide that.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/v4l/extended-controls.rst | 63 --
 1 file changed, 36 insertions(+), 27 deletions(-)

diff --git a/Documentation/media/uapi/v4l/extended-controls.rst 
b/Documentation/media/uapi/v4l/extended-controls.rst
index 782f7f3c2209..3f0f94a5eeed 100644
--- a/Documentation/media/uapi/v4l/extended-controls.rst
+++ b/Documentation/media/uapi/v4l/extended-controls.rst
@@ -291,6 +291,8 @@ Codec Control IDs
 
 
 
+.. tabularcolumns:: |p{6 cm}|p{11.5cm}|
+
 .. flat-table::
 :header-rows:  0
 :stub-columns: 0
@@ -964,6 +966,8 @@ Codec Control IDs
 
 
 
+.. tabularcolumns:: |p{9.0cm}|p{8.5cm}|
+
 .. flat-table::
 :header-rows:  0
 :stub-columns: 0
@@ -1671,6 +1675,8 @@ Codec Control IDs
 
 
 
+.. tabularcolumns:: |p{5.5cm}|p{12.0cm}|
+
 .. flat-table::
 :header-rows:  0
 :stub-columns: 0
@@ -1715,11 +1721,12 @@ Codec Control IDs
 
 
 
+.. tabularcolumns:: |p{14.0cm}|p{3.5cm}|
+
 .. flat-table::
 :header-rows:  0
 :stub-columns: 0
 
-
 -  .. row 1
 
-  ``V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_ENABLED``
@@ -1918,6 +1925,8 @@ Codec Control IDs
 
 
 
+.. tabularcolumns:: |p{10.3cm}|p{7.2cm}|
+
 .. flat-table::
 :header-rows:  0
 :stub-columns: 0
@@ -1967,17 +1976,16 @@ Codec Control IDs
 
 .. _v4l2-mpeg-video-h264-sei-fp-arrangement-type:
 
-``V4L2_CID_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE (enum 
v4l2_mpeg_video_h264_sei_fp_arrangement_type)``
+``V4L2_CID_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE`` ``(enum 
v4l2_mpeg_video_h264_sei_fp_arrangement_type)``
 Frame packing arrangement type for H264 SEI. Applicable to the H264
 encoder. Possible values are:
 
-
+.. tabularcolumns:: |p{12cm}|p{5.5cm}|
 
 .. flat-table::
 :header-rows:  0
 :stub-columns: 0
 
-
 -  .. row 1
 
-  ``V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_CHEKERBOARD``
@@ -2023,18 +2031,17 @@ Codec Control IDs
 
 .. _v4l2-mpeg-video-h264-fmo-map-type:
 
-``V4L2_CID_MPEG_VIDEO_H264_FMO_MAP_TYPE (enum 
v4l2_mpeg_video_h264_fmo_map_type)``
+``V4L2_CID_MPEG_VIDEO_H264_FMO_MAP_TYPE`` ``(enum 
v4l2_mpeg_video_h264_fmo_map_type)``
 When using FMO, the map type divides the image in different scan
 patterns of macroblocks. Applicable to the H264 encoder. Possible
 values are:
 
-
+.. tabularcolumns:: |p{12.5cm}|p{5.0cm}|
 
 .. flat-table::
 :header-rows:  0
 :stub-columns: 0
 
-
 -  .. row 1
 
-  ``V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_INTERLEAVED_SLICES``
@@ -2330,12 +2337,12 @@ MFC 5.1 Control IDs
 are:
 
 
+.. tabularcolumns:: |p{9.0cm}|p{8.5cm}|
 
 .. flat-table::
 :header-rows:  0
 :stub-columns: 0
 
-
 -  .. row 1
 
-  ``V4L2_MPEG_MFC51_FRAME_SKIP_MODE_DISABLED``
@@ -2455,6 +2462,8 @@ CX2341x Control IDs
 
 
 
+.. tabularcolumns:: |p{14.5cm}|p{3.0cm}|
+
 .. flat-table::
 :header-rows:  0
 :stub-columns: 0
@@ -2679,13 +2688,12 @@ VPX Control IDs
 The number of reference pictures for encoding P frames. Possible
 values are:
 
-
+.. tabularcolumns:: |p{7.9cm}|p{9.6cm}|
 
 .. flat-table::
 :header-rows:  0
 :stub-columns: 0
 
-
 -  .. row 1
 
-  ``V4L2_CID_MPEG_VIDEO_VPX_1_REF_FRAME``
@@ -2731,13 +2739,16 @@ VPX Control IDs
 ``V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_SEL (enum v4l2_vp8_golden_frame_sel)``
 Selects the golden frame for encoding. Possible values are:
 
+.. raw:: latex
 
+\begin{adjustbox}{width=\columnwidth}
+
+.. tabularcolumns:: |p{11.0cm}|p{10.0cm}|
 
 .. flat-table::
 :header-rows:  0
 :stub-columns: 0
 
-
 -  .. row 1
 
-  ``V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_USE_PREV``
@@ -2750,9 +2761,12 @@ VPX Control IDs
-  ``V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_USE_REF_PERIOD``
 
-  Use the previous specific frame indicated by
- V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_REF_PERIOD as a
+ ``V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_REF_PERIOD`` as a
  golden frame.
 
+.. raw:: latex
+
+\end{adjustbox}
 
 
 ``V4L2_CID_MPEG_VIDEO_VPX_MIN_QP (integer)``
@@ -2862,13 +2876,12 @@ Camera Control IDs
 Determines how the camera measures the amount of light available for
 the frame exposure. Possible values are:
 
-
+.. tabularcolumns:: |p{8.5cm}|p{9.0cm}|
 
 .. flat-table::
 :header-rows:  0
 :stub-columns: 0
 
-
 -  .. row 1
 
-  ``V4L2_EXPOSURE_METERING_AVERAGE``
@@ -2970,13 +2983,12 @@ Camera Control IDs
 control may stop updates of the ``V4L2_CID_AUTO_FOCUS_STATUS``
 control value.
 
-
+.. tabularcolumns:: |p{6.5cm}|p{11.0cm}|
 
 .. flat-table::
 :header-rows:  0
 :stub-columns: 0
 
-
 -  .. row 1
 
-  ``V4L2_AUTO_FOCUS_STATUS_IDLE``
@@ -3009,7 +3021,7 @@ Camera Control IDs
 ``V4L2_CID_AUTO_FOCUS_RANGE (enum v4l2_auto_focus_range)``
 Determines auto focus distance range 

[PATCH 11/20] [media] dev-overlay.rst: don't ident a note

2016-08-18 Thread Mauro Carvalho Chehab
There's one note there that it is indented for no good reason.
Fix it.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/v4l/dev-overlay.rst | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/Documentation/media/uapi/v4l/dev-overlay.rst 
b/Documentation/media/uapi/v4l/dev-overlay.rst
index d47a6bbc2e98..50e2d52fcae6 100644
--- a/Documentation/media/uapi/v4l/dev-overlay.rst
+++ b/Documentation/media/uapi/v4l/dev-overlay.rst
@@ -238,12 +238,12 @@ exceeded are undefined. [#f3]_
 :ref:`VIDIOC_S_FBUF `,
 :ref:`framebuffer-flags`).
 
-.. note::
+.. note::
 
-   This field was added in Linux 2.6.23, extending the
-   structure. However the :ref:`VIDIOC_[G|S|TRY]_FMT `
-   ioctls, which take a pointer to a :ref:`v4l2_format `
-   parent structure with padding bytes at the end, are not affected.
+   This field was added in Linux 2.6.23, extending the
+   structure. However the :ref:`VIDIOC_[G|S|TRY]_FMT `
+   ioctls, which take a pointer to a :ref:`v4l2_format `
+   parent structure with padding bytes at the end, are not affected.
 
 
 .. _v4l2-clip:
-- 
2.7.4


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 08/20] [media] pixfmt-packed-yuv.rst: adjust tables to fit in LaTeX

2016-08-18 Thread Mauro Carvalho Chehab
Adjust the table to fit at the LaTeX and PDF outputs, just like
what was done with pixfmt-packed-rgb.rst.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst | 26 ++
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst 
b/Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst
index 54716455f453..2ffcee5b383b 100644
--- a/Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst
+++ b/Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst
@@ -6,18 +6,19 @@
 Packed YUV formats
 **
 
-*man Packed YUV formats(2)*
-
-Packed YUV formats
-
-
 Description
 ===
 
 Similar to the packed RGB formats these formats store the Y, Cb and Cr
 component of each pixel in one 16 or 32 bit word.
 
+.. raw:: latex
 
+\newline\newline\begin{adjustbox}{width=\columnwidth}
+
+.. _rgb-formats:
+
+.. tabularcolumns:: 
|p{4.5cm}|p{3.3cm}|p{0.7cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{1.7cm}|
 
 .. flat-table:: Packed YUV Image Formats
 :header-rows:  2
@@ -309,8 +310,15 @@ component of each pixel in one 16 or 32 bit word.
 
-  Cr\ :sub:`0`
 
+.. raw:: latex
 
-Bit 7 is the most significant bit. The value of a = alpha bits is
-undefined when reading from the driver, ignored when writing to the
-driver, except when alpha blending has been negotiated for a
-:ref:`Video Overlay ` or :ref:`Video Output Overlay `.
+\end{adjustbox}\newline\newline
+
+.. note::
+
+#) Bit 7 is the most significant bit;
+
+#) The value of a = alpha bits is undefined when reading from the driver,
+   ignored when writing to the driver, except when alpha blending has
+   been negotiated for a :ref:`Video Overlay ` or
+   :ref:`Video Output Overlay `.
-- 
2.7.4


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 02/20] [media] docs-rst: add tabularcolumns to all tables

2016-08-18 Thread Mauro Carvalho Chehab
LaTeX doesn't handle too well auto-width on tables, and ReST
markup requires an special tag to give it the needed hints.

As we're using A4 paper, we have 17cm of useful spaces. As
most media tables have widths, let's use it to generate the
needed via the following perl script:

my ($line_size, $table_header, $has_cols) = (17.5, 0, 0);
my $out;
my $header = "";
my @widths = ();
sub round { $_[0] > 0 ? int($_[0] + .5) : -int(-$_[0] + .5) }
while (<>) {
if (!$table_header) {
$has_cols = 1 if (m/..\s+tabularcolumns::/);
if (m/..\s+flat-table::/) {
$table_header = 1;
$header = $_;
next;
}
$out .= $_;
next;
}
$header .= $_;
@widths = split(/ /, $1) if (m/:widths:\s+(.*)/);
if (m/^\n$/) {
if (!$has_cols && @widths) {
my ($tot, $t, $i) = (0, 0, 0);
foreach my $v(@widths) { $tot += $v; };
$out .= ".. tabularcolumns:: |";
for ($i = 0; $i < scalar @widths - 1; $i++) {
my $v = $widths[$i];
my $w = round(10 * ($v * $line_size) / $tot) / 
10;
$out .= sprintf "p{%.1fcm}|", $w;
$t += $w;
}
my $w = $line_size - $t;
$out .= sprintf "p{%.1fcm}|\n\n", $w;
}
$out .= $header;
$table_header = 0;
$has_cols = 0;
$header = "";
@widths = ();
}
}
print $out;

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst   |  4 
 .../media/uapi/cec/cec-ioc-adap-g-log-addrs.rst| 10 ++
 Documentation/media/uapi/cec/cec-ioc-dqevent.rst   | 10 ++
 Documentation/media/uapi/cec/cec-ioc-g-mode.rst|  6 ++
 Documentation/media/uapi/cec/cec-ioc-receive.rst   |  6 ++
 .../media/uapi/dvb/fe-diseqc-recv-slave-reply.rst  |  2 ++
 .../media/uapi/dvb/fe-diseqc-send-master-cmd.rst   |  2 ++
 Documentation/media/uapi/dvb/fe-get-info.rst   |  2 ++
 Documentation/media/uapi/dvb/fe-type-t.rst |  2 ++
 Documentation/media/uapi/gen-errors.rst|  2 ++
 .../media/uapi/mediactl/media-ioc-device-info.rst  |  2 ++
 .../media/uapi/mediactl/media-ioc-enum-entities.rst|  2 ++
 .../media/uapi/mediactl/media-ioc-enum-links.rst   |  6 ++
 .../media/uapi/mediactl/media-ioc-g-topology.rst   | 12 
 Documentation/media/uapi/rc/rc-tables.rst  |  2 ++
 Documentation/media/uapi/v4l/buffer.rst| 16 
 Documentation/media/uapi/v4l/dev-raw-vbi.rst   |  4 
 Documentation/media/uapi/v4l/dev-rds.rst   |  6 ++
 Documentation/media/uapi/v4l/dev-sdr.rst   |  2 ++
 Documentation/media/uapi/v4l/dev-sliced-vbi.rst| 18 ++
 Documentation/media/uapi/v4l/field-order.rst   |  2 ++
 Documentation/media/uapi/v4l/pixfmt-002.rst|  2 ++
 Documentation/media/uapi/v4l/pixfmt-003.rst|  4 
 Documentation/media/uapi/v4l/pixfmt-007.rst| 18 ++
 Documentation/media/uapi/v4l/pixfmt-013.rst|  2 ++
 Documentation/media/uapi/v4l/pixfmt-grey.rst   |  2 ++
 Documentation/media/uapi/v4l/pixfmt-m420.rst   |  2 ++
 Documentation/media/uapi/v4l/pixfmt-nv12.rst   |  2 ++
 Documentation/media/uapi/v4l/pixfmt-nv12m.rst  |  2 ++
 Documentation/media/uapi/v4l/pixfmt-nv16.rst   |  2 ++
 Documentation/media/uapi/v4l/pixfmt-nv16m.rst  |  2 ++
 Documentation/media/uapi/v4l/pixfmt-nv24.rst   |  2 ++
 Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst |  2 ++
 Documentation/media/uapi/v4l/pixfmt-reserved.rst   |  4 
 Documentation/media/uapi/v4l/pixfmt-sbggr16.rst|  2 ++
 Documentation/media/uapi/v4l/pixfmt-sbggr8.rst |  2 ++
 Documentation/media/uapi/v4l/pixfmt-sdr-cs08.rst   |  2 ++
 Documentation/media/uapi/v4l/pixfmt-sdr-cs14le.rst |  2 ++
 Documentation/media/uapi/v4l/pixfmt-sdr-cu08.rst   |  2 ++
 Documentation/media/uapi/v4l/pixfmt-sdr-cu16le.rst |  2 ++
 Documentation/media/uapi/v4l/pixfmt-sdr-ru12le.rst |  2 ++
 Documentation/media/uapi/v4l/pixfmt-sgbrg8.rst |  2 ++
 Documentation/media/uapi/v4l/pixfmt-sgrbg8.rst |  2 ++
 Documentation/media/uapi/v4l/pixfmt-srggb10.rst|  2 ++
 Documentation/media/uapi/v4l/pixfmt-srggb10p.rst   |  2 ++
 Documentation/media/uapi/v4l/pixfmt-srggb12.rst|  2 ++
 Documentation/media/uapi/v4l/pixfmt-srggb8.rst |  2 ++
 Documentation/media/uapi/v4l/pixfmt-uv8.rst|  2 ++
 

[PATCH 03/20] [media] control.rst: Fix table width

2016-08-18 Thread Mauro Carvalho Chehab
Manually adjust the table width for it to look nice on PDF output.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/v4l/control.rst | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/media/uapi/v4l/control.rst 
b/Documentation/media/uapi/v4l/control.rst
index 10ab53dd3163..e881cd1f30d6 100644
--- a/Documentation/media/uapi/v4l/control.rst
+++ b/Documentation/media/uapi/v4l/control.rst
@@ -191,10 +191,12 @@ Control IDs
 
 
 
+.. tabularcolumns:: |p{5.5cm}|p{12cm}|
+
 .. flat-table::
 :header-rows:  0
 :stub-columns: 0
-
+:widths: 11 24
 
 -  .. row 1
 
-- 
2.7.4


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 00/20] First part of LaTeX build fixes for the media book

2016-08-18 Thread Mauro Carvalho Chehab
This one fix most of the issues with LaTeX output for the media book at
the V4L2 book, before "Function Reference". So, up to page 181 of a 969
pages document.

There are still some things that I was not able to fix on this set:

- the ".. notes::" tag inside a table column are getting the wrong size.
This should be fixable by rewriting a LaTeX code at conf.py, but I was
unable to do that, as I'm not familiar with LaTeX syntax. Tried some
things, but gave up as it was taking a lot of time. So, I just moved on
to other things;

- The Sphinx ReST tables are incomplete for LaTeX. There are several
missing features:

1) All LaTeX tables with a line bigger than \columwidth require an extra
tag to describe column widthes (.. tabularcolumns::). Without that, it
will assume that all columns are the same. The :widths: parameter of
flat-table is silently ignored;

2) LaTex tables bigger than one page explicitly require a tag (..
cssclass:: longtable). Without that, the table will avance 'till the end
of the page;

3) Too wide tables require to use LaTeX adjustbox extension. As Sphinx
doesn't have support for it, the code should add a hack (via .. raw::
latex)

4) I got two tables where the latex tag (.. raw:: latex) didn't work. No
idea why.

5) Now, several tables have several tags to initialize a table:

.. raw:: latex

\newline\newline\begin{adjustbox}{width=\columnwidth}

.. tabularcolumns:: 
|p{7.6cm}|p{1.6cm}|p{0.7cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5
cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|

.. _v4l2-mbus-pixelcode-bayer:

.. cssclass: longtable

.. flat-table:: Bayer Formats
...

The order where those things happen matter. if the order gets wrong, the
tag won't do what it was expected to do.

If I got it right, cssclass should happen just before flat-table. If the
table has a tag, it should be after tabularcolumns. The raw::latex seems
to happen before all other tags.

There are also some troubles with Sphinx build system related to PDF
generation:

- It doesn't honour SPHINXDIRS when building PDF/LaTeX files;

- Sometimes, the flat-table extension crashes, when the ":widths:" or
".. tabularcolumns::" doesn't match the size of a table. When this
happens, it produces an incomplete LaTeX file until removing the
contents of Documentation/output.

I'll continue working on the LaTeX output fixups. I'll later check how
to solve the huge amount of warnings it outputs.

-

That's said, IMHO, the LaTeX/PDF output is very nice, as we can have
everything into a single file, and the output is great, IMHO.

Once the tables are resized with adjustbox, it is even easier to read
than HTML, as we can see the entire table altogether without needing
to scroll on the big ones.


Markus,

It would be great if you could look on the above issues for us and see
what could be done to improve it.


Mauro Carvalho Chehab (20):
  [media] docs-rst: re-generate typical_media_device.pdf
  [media] docs-rst: add tabularcolumns to all tables
  [media] control.rst: Fix table width
  [media] extended-controls.rst: fix table sizes
  [media] docs-rst: add column hints for pixfmt-002 and pixfmt-006
  [media] pixfmt-packed-rgb.rst: Fix cell spans
  [media] pixfmt-packed-rgb.rst: adjust tables to fit in LaTeX
  [media] pixfmt-packed-yuv.rst: adjust tables to fit in LaTeX
  [media] docs-rst: remove width hints from pixfmt byte order tables
  [media] buffer.rst: Adjust table columns for LaTeX output
  [media] dev-overlay.rst: don't ident a note
  [media] dev-raw-vbi.rst: add a footnote for the count limits
  [media] dev-raw-vbi.rst: adjust table columns for LaTeX output
  [media] docs-rst: re-generate vbi_525.pdf and vbi_625.pdf
  [media] dev-sliced-vbi.rst: use a footnote for VBI images
  [media] dev-sliced-vbi.rst: Adjust tables on LaTeX output
  [media] dev-rds.rst: adjust table dimentions for LaTeX
  [media] dev-subdev.rst: make table fully visible on LaTeX
  [media] subdev-formats.rst: adjust most of the tables to fill in page
  [media] diff-v4l.rst: Make capabilities table fit in LaTeX

 .../media/media_api_files/typical_media_device.pdf |  Bin 134268 -> 52895 bytes
 .../media/uapi/cec/cec-ioc-adap-g-caps.rst |4 +
 .../media/uapi/cec/cec-ioc-adap-g-log-addrs.rst|   10 +
 Documentation/media/uapi/cec/cec-ioc-dqevent.rst   |   10 +
 Documentation/media/uapi/cec/cec-ioc-g-mode.rst|6 +
 Documentation/media/uapi/cec/cec-ioc-receive.rst   |6 +
 .../media/uapi/dvb/fe-diseqc-recv-slave-reply.rst  |2 +
 .../media/uapi/dvb/fe-diseqc-send-master-cmd.rst   |2 +
 Documentation/media/uapi/dvb/fe-get-info.rst   |2 +
 Documentation/media/uapi/dvb/fe-type-t.rst |2 +
 Documentation/media/uapi/gen-errors.rst|2 +
 .../media/uapi/mediactl/media-ioc-device-info.rst  |2 +
 .../uapi/mediactl/media-ioc-enum-entities.rst  |2 +
 .../media/uapi/mediactl/media-ioc-enum-links.rst   |6 +
 

[PATCH 10/20] [media] buffer.rst: Adjust table columns for LaTeX output

2016-08-18 Thread Mauro Carvalho Chehab
The table columns are not properly displayed. Also, some
tables are too big to fit into just one page. So, fix them,
in order to better display the tables.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/v4l/buffer.rst | 20 ++--
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/Documentation/media/uapi/v4l/buffer.rst 
b/Documentation/media/uapi/v4l/buffer.rst
index 064bc03b7a1d..4d315b01c2a4 100644
--- a/Documentation/media/uapi/v4l/buffer.rst
+++ b/Documentation/media/uapi/v4l/buffer.rst
@@ -39,12 +39,14 @@ buffer.
 struct v4l2_buffer
 ==
 
-.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}|
+.. tabularcolumns:: |p{1.3cm}|p{2.5cm}|p{1.3cm}|p{12.0cm}|
+
+.. cssclass:: longtable
 
 .. flat-table:: struct v4l2_buffer
 :header-rows:  0
 :stub-columns: 0
-:widths:   1 1 1 2
+:widths:   1 2 1 10
 
 
 -  .. row 1
@@ -286,6 +288,8 @@ struct v4l2_plane
 
 .. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}|
 
+.. cssclass:: longtable
+
 .. flat-table::
 :header-rows:  0
 :stub-columns: 0
@@ -403,12 +407,14 @@ struct v4l2_plane
 enum v4l2_buf_type
 ==
 
-.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
+.. cssclass:: longtable
+
+.. tabularcolumns:: |p{7.2cm}|p{0.6cm}|p{9.7cm}|
 
 .. flat-table::
 :header-rows:  0
 :stub-columns: 0
-:widths:   3 1 4
+:widths:   4 1 9
 
 
 -  .. row 1
@@ -519,7 +525,9 @@ enum v4l2_buf_type
 Buffer Flags
 
 
-.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
+.. tabularcolumns:: |p{7.0cm}|p{2.2cm}|p{8.3cm}|
+
+.. cssclass:: longtable
 
 .. flat-table::
 :header-rows:  0
@@ -953,7 +961,7 @@ Timecode Types
 Timecode Flags
 --
 
-.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
+.. tabularcolumns:: |p{6.6cm}|p{1.4cm}|p{9.5cm}|
 
 .. flat-table::
 :header-rows:  0
-- 
2.7.4


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/20] [media] pixfmt-packed-rgb.rst: adjust tables to fit in LaTeX

2016-08-18 Thread Mauro Carvalho Chehab
Adjust the tables to fit at the LaTeX and PDF outputs.

Previously, we were displaying the long table in landscape,
but it makes harder to read on displays.

This time, let's use the adjustbox to shrink the size of those
long tables, as the table size can still be visible on screen,
and it is a way better to read in horizontal position and
visible if printed.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst | 37 ++
 1 file changed, 24 insertions(+), 13 deletions(-)

diff --git a/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst 
b/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst
index 3a7133fbec80..f7245f5e0854 100644
--- a/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst
+++ b/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst
@@ -6,11 +6,6 @@
 Packed RGB formats
 **
 
-*man Packed RGB formats(2)*
-
-Packed RGB formats
-
-
 Description
 ===
 
@@ -21,11 +16,12 @@ next to each other in memory.
 
 .. raw:: latex
 
-\begin{landscape}
-\begin{adjustbox}{width=\columnwidth}
+\newline\newline\begin{adjustbox}{width=\columnwidth}
 
 .. _rgb-formats:
 
+.. tabularcolumns:: 
|p{4.5cm}|p{3.3cm}|p{0.7cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{1.7cm}|
+
 .. flat-table:: Packed RGB Image Formats
 :header-rows:  2
 :stub-columns: 0
@@ -950,10 +946,9 @@ next to each other in memory.
 
 .. raw:: latex
 
-\end{adjustbox}
-\end{landscape}
+\end{adjustbox}\newline\newline
 
-Bit 7 is the most significant bit.
+.. note:: Bit 7 is the most significant bit.
 
 The usage and value of the alpha bits (a) in the ARGB and ABGR formats
 (collectively referred to as alpha formats) depend on the device type
@@ -983,13 +978,16 @@ devices and drivers must ignore those bits, for both
 Each cell is one byte.
 
 
+.. raw:: latex
 
-.. tabularcolumns:: 
|p{2.5cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{0.7cm}|
+\newline\newline\begin{adjustbox}{width=\columnwidth}
 
-.. flat-table::
+.. tabularcolumns:: 
|p{4.1cm}|p{1.1cm}|p{1.1cm}|p{1.1cm}|p{1.1cm}|p{1.1cm}|p{1.1cm}|p{1.1cm}|p{1.1cm}|p{1.1cm}|p{1.1cm}|p{1.1cm}|p{1.3cm}|
+
+.. flat-table:: RGB byte order
 :header-rows:  0
 :stub-columns: 0
-:widths:   2 1 1 1 1 1 1 1 1 1 1 1 1
+:widths:   11 3 3 3 3 3 3 3 3 3 3 3 3
 
 
 -  .. row 1
@@ -1104,6 +1102,9 @@ Each cell is one byte.
 
-  R\ :sub:`33`
 
+.. raw:: latex
+
+\end{adjustbox}\newline\newline
 
 Formats defined in :ref:`rgb-formats-deprecated` are deprecated and
 must not be used by new drivers. They are documented here for reference.
@@ -1113,6 +1114,13 @@ either the corresponding ARGB or XRGB format, depending 
on the driver.
 
 .. _rgb-formats-deprecated:
 
+.. raw:: latex
+
+\newline\newline
+\begin{adjustbox}{width=\columnwidth}
+
+.. tabularcolumns:: 
|p{4.2cm}|p{1.0cm}|p{0.7cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{1.7cm}|
+
 .. flat-table:: Deprecated Packed RGB Image Formats
 :header-rows:  2
 :stub-columns: 0
@@ -1477,6 +1485,9 @@ either the corresponding ARGB or XRGB format, depending 
on the driver.
 
-  b\ :sub:`0`
 
+.. raw:: latex
+
+\end{adjustbox}\newline\newline
 
 A test utility to determine which RGB formats a driver actually supports
 is available from the LinuxTV v4l-dvb repository. See
-- 
2.7.4


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] [media] pxa_camera: fix spelling mistake: "dequeud" -> "dequeued"

2016-08-18 Thread Colin King
From: Colin Ian King 

trivial fix to spelling mistake in pr_debug message

Signed-off-by: Colin Ian King 
---
 drivers/media/platform/soc_camera/pxa_camera.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/soc_camera/pxa_camera.c 
b/drivers/media/platform/soc_camera/pxa_camera.c
index 2aaf4a8..82c7be4 100644
--- a/drivers/media/platform/soc_camera/pxa_camera.c
+++ b/drivers/media/platform/soc_camera/pxa_camera.c
@@ -636,7 +636,7 @@ static void pxa_camera_wakeup(struct pxa_camera_dev *pcdev,
v4l2_get_timestamp(>ts);
vb->field_count++;
wake_up(>done);
-   dev_dbg(pcdev->soc_host.v4l2_dev.dev, "%s dequeud buffer (vb=0x%p)\n",
+   dev_dbg(pcdev->soc_host.v4l2_dev.dev, "%s dequeued buffer (vb=0x%p)\n",
__func__, vb);
 
if (list_empty(>capture)) {
-- 
2.8.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 15/20] [media] dev-sliced-vbi.rst: use a footnote for VBI images

2016-08-18 Thread Mauro Carvalho Chehab
Just like on dvb-raw-vbi.rst, the LaTeX output doesn't work
well with cell spans. Also, this is actually a note, so, move
it to a footnote.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/v4l/dev-sliced-vbi.rst | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Documentation/media/uapi/v4l/dev-sliced-vbi.rst 
b/Documentation/media/uapi/v4l/dev-sliced-vbi.rst
index 9f59ba6847ec..9f348e164782 100644
--- a/Documentation/media/uapi/v4l/dev-sliced-vbi.rst
+++ b/Documentation/media/uapi/v4l/dev-sliced-vbi.rst
@@ -155,8 +155,7 @@ struct v4l2_sliced_vbi_format
  service the driver chooses.
 
  Data services are defined in :ref:`vbi-services2`. Array indices
- map to ITU-R line numbers (see also :ref:`vbi-525` and
- :ref:`vbi-625`) as follows:
+ map to ITU-R line numbers\ [#f2]_ as follows:
 
 -  .. row 3
 
@@ -838,3 +837,6 @@ Line Identifiers for struct v4l2_mpeg_vbi_itv0_line id field
 .. [#f1]
According to :ref:`ETS 300 706 ` lines 6-22 of the first
field and lines 5-22 of the second field may carry Teletext data.
+
+.. [#f2]
+   See also :ref:`vbi-525` and :ref:`vbi-625`.
-- 
2.7.4


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 16/20] [media] dev-sliced-vbi.rst: Adjust tables on LaTeX output

2016-08-18 Thread Mauro Carvalho Chehab
Better format the tables in a way that will fit inside the
page.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/v4l/dev-sliced-vbi.rst | 34 +
 1 file changed, 24 insertions(+), 10 deletions(-)

diff --git a/Documentation/media/uapi/v4l/dev-sliced-vbi.rst 
b/Documentation/media/uapi/v4l/dev-sliced-vbi.rst
index 9f348e164782..074aa3798152 100644
--- a/Documentation/media/uapi/v4l/dev-sliced-vbi.rst
+++ b/Documentation/media/uapi/v4l/dev-sliced-vbi.rst
@@ -105,7 +105,9 @@ which may return ``EBUSY`` can be the
 struct v4l2_sliced_vbi_format
 -
 
-.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|
+.. tabularcolumns:: |p{1.0cm}|p{4.5cm}|p{4.0cm}|p{4.0cm}|p{4.0cm}|
+
+.. cssclass:: longtable
 
 .. flat-table::
 :header-rows:  0
@@ -242,16 +244,20 @@ struct v4l2_sliced_vbi_format
-  ``reserved``\ [2]
 
-  :cspan:`2` This array is reserved for future extensions.
+
  Applications and drivers must set it to zero.
 
 
-
 .. _vbi-services2:
 
 Sliced VBI services
 ---
 
-.. tabularcolumns:: |p{4.4cm}|p{2.2cm}|p{2.2cm}|p{4.4cm}|p{4.3cm}|
+.. raw:: latex
+
+\newline\newline\begin{adjustbox}{width=\columnwidth}
+
+.. tabularcolumns:: |p{5.0cm}|p{1.4cm}|p{3.0cm}|p{2.5cm}|p{9.0cm}|
 
 .. flat-table::
 :header-rows:  1
@@ -277,7 +283,9 @@ Sliced VBI services
 
-  0x0001
 
-   -  :ref:`ets300706`, :ref:`itu653`
+   -  :ref:`ets300706`,
+
+ :ref:`itu653`
 
-  PAL/SECAM line 7-22, 320-335 (second field 7-22)
 
@@ -316,7 +324,9 @@ Sliced VBI services
 
-  0x4000
 
-   -  :ref:`itu1119`, :ref:`en300294`
+   -  :ref:`itu1119`,
+
+ :ref:`en300294`
 
-  PAL/SECAM line 23
 
@@ -344,6 +354,10 @@ Sliced VBI services
 
-  :cspan:`2` Set of services applicable to 625 line systems.
 
+.. raw:: latex
+
+\end{adjustbox}\newline\newline
+
 
 Drivers may return an ``EINVAL`` error code when applications attempt to
 read or write data without prior format negotiation, after switching the
@@ -561,7 +575,7 @@ number).
 struct v4l2_mpeg_vbi_fmt_ivtv
 -
 
-.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}|
+.. tabularcolumns:: |p{1.0cm}|p{3.5cm}|p{1.0cm}|p{11.5cm}|
 
 .. flat-table::
 :header-rows:  0
@@ -661,7 +675,7 @@ Magic Constants for struct v4l2_mpeg_vbi_fmt_ivtv magic 
field
 struct v4l2_mpeg_vbi_itv0
 -
 
-.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
+.. tabularcolumns:: |p{4.4cm}|p{2.4cm}|p{10.7cm}|
 
 .. flat-table::
 :header-rows:  0
@@ -687,9 +701,9 @@ struct v4l2_mpeg_vbi_itv0
  ::
 
  linemask[0] b0: line  6 first field
- linemask[0] b17:line 23 first field
- linemask[0] b18:line  6 second field
- linemask[0] b31:line 19 second field
+ linemask[0] b17:line 23 first field
+ linemask[0] b18:line  6 second field
+ linemask[0] b31:line 19 second field
  linemask[1] b0: line 20 second field
  linemask[1] b3: line 23 second field
  linemask[1] b4-b31: unused and set to 0
-- 
2.7.4


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 06/20] [media] pixfmt-packed-rgb.rst: Fix cell spans

2016-08-18 Thread Mauro Carvalho Chehab
There is an extra column just before eack pack of bits, to
improve table reading, but the header file didn't take this
into account.

Fix it.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst | 78 --
 1 file changed, 42 insertions(+), 36 deletions(-)

diff --git a/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst 
b/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst
index 8997b51ac230..3a7133fbec80 100644
--- a/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst
+++ b/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst
@@ -39,10 +39,13 @@ next to each other in memory.
-
-  :cspan:`7` Byte 0 in memory
 
+   -
-  :cspan:`7` Byte 1
 
+   -
-  :cspan:`7` Byte 2
 
+   -
-  :cspan:`7` Byte 3
 
 -  .. row 2
@@ -205,13 +208,13 @@ next to each other in memory.
-  b\ :sub:`0`
 
-
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-  r\ :sub:`3`
 
@@ -285,7 +288,7 @@ next to each other in memory.
-  b\ :sub:`0`
 
-
-   -  -
+   -
 
-  r\ :sub:`4`
 
@@ -388,7 +391,7 @@ next to each other in memory.
-  'XR15' | (1 << 31)
 
-
-   -  -
+   -
 
-  r\ :sub:`4`
 
@@ -620,34 +623,34 @@ next to each other in memory.
 
-  r\ :sub:`0`
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
 -  .. _V4L2-PIX-FMT-ABGR32:
 
@@ -781,21 +784,21 @@ next to each other in memory.
-  r\ :sub:`0`
 
-
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
 -  .. _V4L2-PIX-FMT-ARGB32:
 
@@ -878,21 +881,21 @@ next to each other in memory.
-  'BX24'
 
-
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-   -  -
+   -
 
-
-  r\ :sub:`7`
@@ -1124,10 +1127,13 @@ either the corresponding ARGB or XRGB format, depending 
on the driver.
-
-  :cspan:`7` Byte 0 in memory
 
+   -
-  :cspan:`7` Byte 1
 
+   -
-  :cspan:`7` Byte 2
 
+   -
-  :cspan:`7` Byte 3
 
 -  .. row 2
-- 
2.7.4


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 14/20] [media] docs-rst: re-generate vbi_525.pdf and vbi_625.pdf

2016-08-18 Thread Mauro Carvalho Chehab
Originally, each image were one page big, causing them to be
displayed on separate pages at the PDF output. Re-generate
them from the gif files.

Signed-off-by: Mauro Carvalho Chehab 
---
 .../media/uapi/v4l/dev-raw-vbi_files/vbi_525.pdf  | Bin 3395 -> 3706 bytes
 .../media/uapi/v4l/dev-raw-vbi_files/vbi_625.pdf  | Bin 3683 -> 3996 bytes
 2 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/Documentation/media/uapi/v4l/dev-raw-vbi_files/vbi_525.pdf 
b/Documentation/media/uapi/v4l/dev-raw-vbi_files/vbi_525.pdf
index 
9e72c25b208db6c7844ed85fe9742324602c0a5c..0bae28385dfa119b6d3718e2e6cf6dc411ad0f67
 100644
GIT binary patch
literal 3706
zcmd5}Z6@(2h8
z*+SKrC=x(Ia!2~$Yc__(Tnqr~9nA*;EQ1vcs^T$N5EvnZU8)Oq0|PlM8ZQdi1DkMw
zB_0P5a5%tEHQJ6BA%uqu00grcfSe$ni2qiyGyYXpb^cy(REQNJ;3Kiv(Q2~`AcRD!
zERZ7Y;8FJAJ`NjXI?<3Jv(+&{0Z#<6K>>gu#eAzOq)-IGx7N*aF0GHP8xm$Fy;;aq
zHF=2wgepuNc~H2@Li=~+zsZHH)|1w-7=l%`7Pe%Zf
z03kbGIG-1xBI`RlaOA|3Fg>SL*Mr4a@fyLv=gS%;Us~Wt7cOdw&1C43gL_L7ca1v4
zv(LE==Uz=*N+q_ec9@BdW#aZ@X9V5QW;Hu?j?{L>~aLJ*Kl81h|4^lSmE_xa_
zWR~Mwdm=mc==O(3%A6xZR{6P7MULVx&@}m<{G-2zHcQgZo-Ld&@BT+I-x^9YZi@2^
zax1krv+=QN3H8An@1N`l)I|HqERC2Wva0BkOMW-RwEZ}z;$CY;!0>B(mmo~=Afr2_
zJjSJ2-?pF`l=aAZ2wj@=>z6~yr32l(^yvYwlBv(o7%OZ`UZ1fXiC#y1kQnP|}C
zWW$L*$n(#Zn`WN=J)ej!mA-1>$!!(*Qqf=>aH9s;#c!cs@qzo
zm5d$K`U|vgPo2Dg%1xG79F_Dn;ZQA)=gYyf*2&{d&)2>j_v((n8tfZay=S*0Enae|
zl(O0S_`>s54)l^SiN(W247W?#>b;OqKM^R$v{IGL-OW!+OKe!hzH&?%!L+bDR&-ku
zC^u5-AKuv)AToVyfX-ZA=Irz7Jh>OwaIHJ*yPrc<8QXdWR
z*AdRGd;WgY@PfoTP=;|%#
zXwnll+Ol&?c@#{oA+`_2b{u0u2TN;T#AEqzkwu7M54T8;jz99jl*k5LV34rUPa>^j^zTE@qm
z%+j_eTqIUzbX=o;`ruL9#1-2qKJlwNHztbm{1{MLTK#I}o7tG|d|X?A)?
zHjY)7khIYudoiKc$UU1iiBT$-zkEJil-F*!RhCaULHTUnp#8@f;VVqFu}
zoCcy!N0rqLMP~lKeInn&^4@Q2(G~kSMR%^l0DQ30bE}D6#{Z=LM
zBiaK_}?g3hp?4*Qpo>_w_2qr#5Xm%addKOT$jx88<0t5cBlin#5^~k~3dtqp!3k
zWl*($n6~PAPLI}a?!OyHe_eI%zH+Qk>X#yc;VWCLZEc*7
z=4y=>CL9SPjl1=s$w@v+2RDR`(WcR(LEe_Re<%2T@V!wJ
zS^w)VMr8-%yjyPS<@r%8YYwBc?&&0#2QJU_*%*Ts$rki?Qfd92eIAn5pY1tI5?8zc
z*3tZXuO8@I|3igd@x9Ba_VYUJW~r?uCX)oS$$+l@R_?q;cil$!AKfHuPQhQY2I`IQ
zJCoM|e|IPr!`v1tulVy%7t5MkgX^=|N7oA3((U-`kEeG?8n#rkh5G%Lmb#l!DV{
zHd6~j(++f29UE9oaafmnb=S$w{f7IC*Oz2$|0oe_mwEe2lMK-l6P8E1Udw9*
zJzjbB&59J>{9r*SREl_+F3LS%1sYzHW@rM;G(Y9FmO3YJuTLx4BEcOlGo%_-Q>)
zOMZz9nkX3Fc3Xn7I-(g_R-zeGv*K%F7bKU~pCYx__L(ub-!K)jFGy)41^tE3Q>?$V~apK}v-=hYt~jI8alITmrZ@iaBwRNJ9C+X(QOV|Df2qkr#-qh7gb
zBrm<&&1hj9ZlxSCu+OOwMA_=Cb8Ek56^cGwkVF_X+y_-i>jPF}McTKwTHmI$r3!iy
zkZoaV8Jd%yX_eo8CV2mu`~cBCiimF2xOXH?+U@Rg{`t*6imJk1UBHh>nz~tE?el;AOGgs)a$^a?0F^LN3B5USHF6C<
zPeVhaPB!i_!uv!9zrNoNkUhTFnD-H+)cP9sZ%$C-gvcB-(d*a_dG}yss0U-|p&}4Q3mI1YJCK-OXAAmkDe1h4(f!3f4?&872-r90f#a+cJOdS{R`v+eUbnG

literal 3395
zcmZWsc|4SB8*V|Giouv->YGF2pvV=8#K4Vcq>gD6}{P}eR@w_p0``}_J
zluPkf5~8DWqLMHXLhEZUY9~PMyt;$j2*YBcEiWQs
z*54#@R+pUAJtZXaPkClGF1ZUw_nj=P^yQ4#31ZAwqW479I@KR
z<*stZqTWEDjH_;6_(idUxklP*l0y-9PCL0v3?%z5#RFE>{c|!#nWV&-N9(ltRqi54
z_#OIqcjgffV<_=CPTV`(^0|oRT0Xgphsg|UDtl-({=E9VrrfJNL(whexoHxH*R=bZ
zeP?Jr-m#=?#YBNUG%=NcvX&@RJ^&*M0oa~+0ZJ+Q1575-j;CraOSG|-eC#JcS#09#
z+Q5hjO0c3tFwe@o9F=$x%-c$|36*@jaTkm#Nyye}BAv%PGG}SKNQ5!HTMdm%Pj>1Q
zWIxmAj2>N3mY}4a6|_F?nx5a%q_*{`F+I-vzAt

[PATCH 12/20] [media] dev-raw-vbi.rst: add a footnote for the count limits

2016-08-18 Thread Mauro Carvalho Chehab
There's a bug with LaTeX output on flat-tables with Sphinx 1.4.5
that prevents references at a cell span to be broken. As the
text is indeed too long, it makes sense to place the reference
to the pictures showing the VBI limits as a footnote.

That makes the text easier to read and also solves the issue
with LaTeX output.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/v4l/dev-raw-vbi.rst | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/Documentation/media/uapi/v4l/dev-raw-vbi.rst 
b/Documentation/media/uapi/v4l/dev-raw-vbi.rst
index 95de08b8fbf2..859b5bc8abbb 100644
--- a/Documentation/media/uapi/v4l/dev-raw-vbi.rst
+++ b/Documentation/media/uapi/v4l/dev-raw-vbi.rst
@@ -196,10 +196,9 @@ and always returns default parameters as 
:ref:`VIDIOC_G_FMT ` does
  driver. Anyway, drivers may not support single field capturing and
  return both count values non-zero.
 
- Both ``count`` values set to zero, or line numbers outside the
- bounds depicted in :ref:`vbi-525` and :ref:`vbi-625`, or a
- field image covering lines of two fields, are invalid and shall
- not be returned by the driver.
+ Both ``count`` values set to zero, or line numbers are outside the
+ bounds depicted\ [#f4]_, or a field image covering lines of two
+ fields, are invalid and shall not be returned by the driver.
 
  To initialize the ``start`` and ``count`` fields, applications
  must first determine the current video standard selection. The
@@ -352,3 +351,6 @@ another process.
Most VBI services transmit on both fields, but some have different
semantics depending on the field number. These cannot be reliable
decoded or encoded when ``V4L2_VBI_UNSYNC`` is set.
+
+.. [#f4]
+   The valid values ar shown at :ref:`vbi-525` and :ref:`vbi-625`.
-- 
2.7.4


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 13/20] [media] dev-raw-vbi.rst: adjust table columns for LaTeX output

2016-08-18 Thread Mauro Carvalho Chehab
Add the needed tags to fix LaTeX output of the tables there.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/v4l/dev-raw-vbi.rst | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Documentation/media/uapi/v4l/dev-raw-vbi.rst 
b/Documentation/media/uapi/v4l/dev-raw-vbi.rst
index 859b5bc8abbb..1b59239c7fb7 100644
--- a/Documentation/media/uapi/v4l/dev-raw-vbi.rst
+++ b/Documentation/media/uapi/v4l/dev-raw-vbi.rst
@@ -102,7 +102,9 @@ and always returns default parameters as :ref:`VIDIOC_G_FMT 
` does
 
 .. _v4l2-vbi-format:
 
-.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
+.. tabularcolumns:: |p{2.4cm}|p{4.4cm}|p{10.7cm}|
+
+.. cssclass:: longtable
 
 .. flat-table:: struct v4l2_vbi_format
 :header-rows:  0
@@ -228,7 +230,7 @@ and always returns default parameters as :ref:`VIDIOC_G_FMT 
` does
 
 .. _vbifmt-flags:
 
-.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
+.. tabularcolumns:: |p{4.0cm}|p{1.5cm}|p{12.0cm}|
 
 .. flat-table:: Raw VBI Format Flags
 :header-rows:  0
-- 
2.7.4


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/20] [media] docs-rst: remove width hints from pixfmt byte order tables

2016-08-18 Thread Mauro Carvalho Chehab
Those hints are wrong, and doesn't really improve the look
of those tables. So, keep them only when they're useful.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/v4l/pixfmt-grey.rst |  7 ---
 Documentation/media/uapi/v4l/pixfmt-m420.rst |  6 --
 Documentation/media/uapi/v4l/pixfmt-nv12.rst |  6 --
 Documentation/media/uapi/v4l/pixfmt-nv12m.rst|  5 -
 Documentation/media/uapi/v4l/pixfmt-nv12mt.rst   |  2 --
 Documentation/media/uapi/v4l/pixfmt-nv16.rst |  7 ---
 Documentation/media/uapi/v4l/pixfmt-nv16m.rst|  7 ---
 Documentation/media/uapi/v4l/pixfmt-nv24.rst |  7 ---
 Documentation/media/uapi/v4l/pixfmt-sbggr16.rst  |  8 
 Documentation/media/uapi/v4l/pixfmt-sbggr8.rst   |  6 --
 Documentation/media/uapi/v4l/pixfmt-sdr-cs08.rst |  7 ---
 Documentation/media/uapi/v4l/pixfmt-sdr-cs14le.rst   |  7 ---
 Documentation/media/uapi/v4l/pixfmt-sdr-cu08.rst |  8 
 Documentation/media/uapi/v4l/pixfmt-sdr-cu16le.rst   |  6 --
 Documentation/media/uapi/v4l/pixfmt-sdr-ru12le.rst   |  3 ---
 Documentation/media/uapi/v4l/pixfmt-sgbrg8.rst   |  3 ---
 Documentation/media/uapi/v4l/pixfmt-sgrbg8.rst   |  3 ---
 Documentation/media/uapi/v4l/pixfmt-srggb10.rst  |  3 ---
 Documentation/media/uapi/v4l/pixfmt-srggb10alaw8.rst |  2 --
 Documentation/media/uapi/v4l/pixfmt-srggb10p.rst | 12 
 Documentation/media/uapi/v4l/pixfmt-srggb12.rst  |  3 ---
 Documentation/media/uapi/v4l/pixfmt-srggb8.rst   |  3 ---
 Documentation/media/uapi/v4l/pixfmt-uv8.rst  |  3 ---
 Documentation/media/uapi/v4l/pixfmt-uyvy.rst |  3 ---
 Documentation/media/uapi/v4l/pixfmt-vyuy.rst |  3 ---
 Documentation/media/uapi/v4l/pixfmt-y10.rst  |  3 ---
 Documentation/media/uapi/v4l/pixfmt-y10b.rst |  8 
 Documentation/media/uapi/v4l/pixfmt-y12.rst  |  3 ---
 Documentation/media/uapi/v4l/pixfmt-y12i.rst |  5 -
 Documentation/media/uapi/v4l/pixfmt-y16-be.rst   |  3 ---
 Documentation/media/uapi/v4l/pixfmt-y16.rst  |  3 ---
 Documentation/media/uapi/v4l/pixfmt-y41p.rst |  3 ---
 Documentation/media/uapi/v4l/pixfmt-y8i.rst  |  3 ---
 Documentation/media/uapi/v4l/pixfmt-yuv410.rst   |  3 ---
 Documentation/media/uapi/v4l/pixfmt-yuv411p.rst  |  3 ---
 Documentation/media/uapi/v4l/pixfmt-yuv420.rst   |  3 ---
 Documentation/media/uapi/v4l/pixfmt-yuv420m.rst  |  3 ---
 Documentation/media/uapi/v4l/pixfmt-yuv422m.rst  |  3 ---
 Documentation/media/uapi/v4l/pixfmt-yuv422p.rst  |  3 ---
 Documentation/media/uapi/v4l/pixfmt-yuv444m.rst  |  3 ---
 Documentation/media/uapi/v4l/pixfmt-yuyv.rst |  3 ---
 Documentation/media/uapi/v4l/pixfmt-yvyu.rst |  3 ---
 Documentation/media/uapi/v4l/pixfmt-z16.rst  |  3 ---
 43 files changed, 8 insertions(+), 183 deletions(-)

diff --git a/Documentation/media/uapi/v4l/pixfmt-grey.rst 
b/Documentation/media/uapi/v4l/pixfmt-grey.rst
index 844fb67320be..fef58ca50f66 100644
--- a/Documentation/media/uapi/v4l/pixfmt-grey.rst
+++ b/Documentation/media/uapi/v4l/pixfmt-grey.rst
@@ -6,8 +6,6 @@
 V4L2_PIX_FMT_GREY ('GREY')
 **
 
-*man V4L2_PIX_FMT_GREY(2)*
-
 Grey-scale image
 
 
@@ -20,14 +18,9 @@ which simply contains no Cb or Cr data.
 **Byte Order.**
 Each cell is one byte.
 
-
-
-.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}|
-
 .. flat-table::
 :header-rows:  0
 :stub-columns: 0
-:widths:   2 1 1 1 1
 
 
 -  .. row 1
diff --git a/Documentation/media/uapi/v4l/pixfmt-m420.rst 
b/Documentation/media/uapi/v4l/pixfmt-m420.rst
index ff0ed7abfef3..f4a21a8a6dcc 100644
--- a/Documentation/media/uapi/v4l/pixfmt-m420.rst
+++ b/Documentation/media/uapi/v4l/pixfmt-m420.rst
@@ -6,8 +6,6 @@
 V4L2_PIX_FMT_M420 ('M420')
 **
 
-*man V4L2_PIX_FMT_M420(2)*
-
 Format with ?? horizontal and vertical chroma resolution, also known as
 YUV 4:2:0. Hybrid plane line-interleaved layout.
 
@@ -32,13 +30,9 @@ the CbCr lines.
 Each cell is one byte.
 
 
-
-.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}|
-
 .. flat-table::
 :header-rows:  0
 :stub-columns: 0
-:widths:   2 1 1 1 1
 
 
 -  .. row 1
diff --git a/Documentation/media/uapi/v4l/pixfmt-nv12.rst 
b/Documentation/media/uapi/v4l/pixfmt-nv12.rst
index a5b70b8a1273..6bbdc01362af 100644
--- a/Documentation/media/uapi/v4l/pixfmt-nv12.rst
+++ b/Documentation/media/uapi/v4l/pixfmt-nv12.rst
@@ -7,7 +7,6 @@
 V4L2_PIX_FMT_NV12 ('NV12'), V4L2_PIX_FMT_NV21 ('NV21')
 **
 
-*man V4L2_PIX_FMT_NV12(2)*
 
 V4L2_PIX_FMT_NV21
 Formats with ?? horizontal and vertical chroma resolution, also known as
@@ -36,14 +35,9 @@ many pad bytes after its rows.
 Each cell is one byte.
 
 
-
-.. tabularcolumns:: 

[PATCH] docs-rst: add support for LaTeX output

2016-08-18 Thread Mauro Carvalho Chehab
Sphinx supports LaTeX output. Sometimes, it is interesting to
call it directly, instead of also generating a PDF. As it comes
for free, add a target for it.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/DocBook/Makefile | 1 +
 Documentation/Makefile.sphinx  | 7 ++-
 Makefile   | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
index a91c96522379..a558dfcc9e2d 100644
--- a/Documentation/DocBook/Makefile
+++ b/Documentation/DocBook/Makefile
@@ -72,6 +72,7 @@ installmandocs: mandocs
 
 # no-op for the DocBook toolchain
 epubdocs:
+latexdocs:
 
 ###
 #External programs used
diff --git a/Documentation/Makefile.sphinx b/Documentation/Makefile.sphinx
index ba4efb1f68f3..894cfaa41f55 100644
--- a/Documentation/Makefile.sphinx
+++ b/Documentation/Makefile.sphinx
@@ -66,12 +66,16 @@ quiet_cmd_sphinx = SPHINX  $@ --> file://$(abspath 
$(BUILDDIR)/$3/$4);
 htmldocs:
@$(foreach var,$(SPHINXDIRS),$(call 
loop_cmd,sphinx,html,$(var),,$(var)))
 
-pdfdocs:
+latexdocs:
 ifeq ($(HAVE_PDFLATEX),0)
$(warning The 'xelatex' command was not found. Make sure you have it 
installed and in PATH to produce PDF output.)
@echo "  SKIPSphinx $@ target."
 else # HAVE_PDFLATEX
@$(call loop_cmd,sphinx,latex,.,latex,.)
+endif # HAVE_PDFLATEX
+
+pdfdocs: latexdocs
+ifneq ($(HAVE_PDFLATEX),0)
$(Q)$(MAKE) PDFLATEX=xelatex LATEXOPTS="-interaction=nonstopmode" -C 
$(BUILDDIR)/latex
 endif # HAVE_PDFLATEX
 
@@ -95,6 +99,7 @@ endif # HAVE_SPHINX
 dochelp:
@echo  ' Linux kernel internal documentation in different formats 
(Sphinx):'
@echo  '  htmldocs- HTML'
+   @echo  '  latexdocs   - LaTeX'
@echo  '  pdfdocs - PDF'
@echo  '  epubdocs- EPUB'
@echo  '  xmldocs - XML'
diff --git a/Makefile b/Makefile
index 70de1448c571..0fa3feb6f74e 100644
--- a/Makefile
+++ b/Makefile
@@ -1432,7 +1432,7 @@ $(help-board-dirs): help-%:
 
 # Documentation targets
 # ---
-DOC_TARGETS := xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs 
epubdocs cleandocs
+DOC_TARGETS := xmldocs sgmldocs psdocs latexdocs pdfdocs htmldocs mandocs 
installmandocs epubdocs cleandocs
 PHONY += $(DOC_TARGETS)
 $(DOC_TARGETS): scripts_basic FORCE
$(Q)$(MAKE) $(build)=scripts build_docproc build_check-lc_ctype
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/20] [media] docs-rst: add column hints for pixfmt-002 and pixfmt-006

2016-08-18 Thread Mauro Carvalho Chehab
Add column hints for LaTeX to format columns on the tables inside
pixfmt-002.rst and pixfmt-006.rst.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/v4l/pixfmt-002.rst | 4 +++-
 Documentation/media/uapi/v4l/pixfmt-006.rst | 5 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/Documentation/media/uapi/v4l/pixfmt-002.rst 
b/Documentation/media/uapi/v4l/pixfmt-002.rst
index 27d4e78760ba..368da55e5f07 100644
--- a/Documentation/media/uapi/v4l/pixfmt-002.rst
+++ b/Documentation/media/uapi/v4l/pixfmt-002.rst
@@ -7,7 +7,9 @@ Single-planar format structure
 
 .. _v4l2-pix-format:
 
-.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
+.. tabularcolumns:: |p{4.0cm}|p{2.5cm}|p{11.0cm}|
+
+.. cssclass:: longtable
 
 .. flat-table:: struct v4l2_pix_format
 :header-rows:  0
diff --git a/Documentation/media/uapi/v4l/pixfmt-006.rst 
b/Documentation/media/uapi/v4l/pixfmt-006.rst
index 1c8321f9b1fb..56b691300158 100644
--- a/Documentation/media/uapi/v4l/pixfmt-006.rst
+++ b/Documentation/media/uapi/v4l/pixfmt-006.rst
@@ -25,6 +25,7 @@ needs to be filled in.
colorspaces except for BT.2020 which uses limited range R'G'B'
quantization.
 
+.. tabularcolumns:: |p{6.0cm}|p{11.5cm}|
 
 .. _v4l2-colorspace:
 
@@ -183,6 +184,8 @@ needs to be filled in.
 
 .. _v4l2-ycbcr-encoding:
 
+.. tabularcolumns:: |p{6.5cm}|p{11.0cm}|
+
 .. flat-table:: V4L2 Y'CbCr Encodings
 :header-rows:  1
 :stub-columns: 0
@@ -252,6 +255,8 @@ needs to be filled in.
 
 .. _v4l2-quantization:
 
+.. tabularcolumns:: |p{6.5cm}|p{11.0cm}|
+
 .. flat-table:: V4L2 Quantization Methods
 :header-rows:  1
 :stub-columns: 0
-- 
2.7.4


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


cron job: media_tree daily build: WARNINGS

2016-08-18 Thread Hans Verkuil
This message is generated daily by a cron job that builds media_tree for
the kernels and architectures in the list below.

Results of the daily build of media_tree:

date:   Fri Aug 19 04:00:16 CEST 2016
git branch: test
git hash:   b6aa39228966e0d3f0bc3306be1892f87792903a
gcc version:i686-linux-gcc (GCC) 5.4.0
sparse version: v0.5.0-56-g7647c77
smatch version: v0.5.0-3428-gdfe27cf
host hardware:  x86_64
host os:4.6.0-164

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-multi: OK
linux-git-blackfin-bf561: OK
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.36.4-i686: OK
linux-2.6.37.6-i686: OK
linux-2.6.38.8-i686: OK
linux-2.6.39.4-i686: OK
linux-3.0.60-i686: OK
linux-3.1.10-i686: OK
linux-3.2.37-i686: OK
linux-3.3.8-i686: OK
linux-3.4.27-i686: OK
linux-3.5.7-i686: OK
linux-3.6.11-i686: WARNINGS
linux-3.7.4-i686: WARNINGS
linux-3.8-i686: WARNINGS
linux-3.9.2-i686: WARNINGS
linux-3.10.1-i686: WARNINGS
linux-3.11.1-i686: WARNINGS
linux-3.12.23-i686: WARNINGS
linux-3.13.11-i686: WARNINGS
linux-3.14.9-i686: WARNINGS
linux-3.15.2-i686: WARNINGS
linux-3.16.7-i686: WARNINGS
linux-3.17.8-i686: WARNINGS
linux-3.18.7-i686: WARNINGS
linux-3.19-i686: WARNINGS
linux-4.0-i686: WARNINGS
linux-4.1.1-i686: WARNINGS
linux-4.2-i686: WARNINGS
linux-4.3-i686: WARNINGS
linux-4.4-i686: WARNINGS
linux-4.5-i686: WARNINGS
linux-4.6-i686: WARNINGS
linux-4.7-i686: WARNINGS
linux-4.8-rc1-i686: WARNINGS
linux-2.6.36.4-x86_64: OK
linux-2.6.37.6-x86_64: OK
linux-2.6.38.8-x86_64: OK
linux-2.6.39.4-x86_64: OK
linux-3.0.60-x86_64: OK
linux-3.1.10-x86_64: OK
linux-3.2.37-x86_64: OK
linux-3.3.8-x86_64: OK
linux-3.4.27-x86_64: OK
linux-3.5.7-x86_64: OK
linux-3.6.11-x86_64: WARNINGS
linux-3.7.4-x86_64: WARNINGS
linux-3.8-x86_64: WARNINGS
linux-3.9.2-x86_64: WARNINGS
linux-3.10.1-x86_64: WARNINGS
linux-3.11.1-x86_64: WARNINGS
linux-3.12.23-x86_64: WARNINGS
linux-3.13.11-x86_64: WARNINGS
linux-3.14.9-x86_64: WARNINGS
linux-3.15.2-x86_64: WARNINGS
linux-3.16.7-x86_64: WARNINGS
linux-3.17.8-x86_64: WARNINGS
linux-3.18.7-x86_64: WARNINGS
linux-3.19-x86_64: WARNINGS
linux-4.0-x86_64: WARNINGS
linux-4.1.1-x86_64: WARNINGS
linux-4.2-x86_64: WARNINGS
linux-4.3-x86_64: WARNINGS
linux-4.4-x86_64: WARNINGS
linux-4.5-x86_64: WARNINGS
linux-4.6-x86_64: WARNINGS
linux-4.7-x86_64: WARNINGS
linux-4.8-rc1-x86_64: WARNINGS
apps: WARNINGS
spec-git: OK
sparse: WARNINGS
smatch: WARNINGS

Detailed results are available here:

http://www.xs4all.nl/~hverkuil/logs/Friday.log

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Friday.tar.bz2

The Media Infrastructure API from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/index.html
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/20] First part of LaTeX build fixes for the media book

2016-08-18 Thread Mauro Carvalho Chehab
Em Thu, 18 Aug 2016 13:15:29 -0300
Mauro Carvalho Chehab  escreveu:

> This one fix most of the issues with LaTeX output for the media book at
> the V4L2 book, before "Function Reference". So, up to page 181 of a 969
> pages document.
> 
> There are still some things that I was not able to fix on this set:
> 
> - the ".. notes::" tag inside a table column are getting the wrong size.
> This should be fixable by rewriting a LaTeX code at conf.py, but I was
> unable to do that, as I'm not familiar with LaTeX syntax. Tried some
> things, but gave up as it was taking a lot of time. So, I just moved on
> to other things;
> 
> - The Sphinx ReST tables are incomplete for LaTeX. There are several
> missing features:
> 
> 1) All LaTeX tables with a line bigger than \columwidth require an extra
> tag to describe column widthes (.. tabularcolumns::). Without that, it
> will assume that all columns are the same. The :widths: parameter of
> flat-table is silently ignored;
> 
> 2) LaTex tables bigger than one page explicitly require a tag (..
> cssclass:: longtable). Without that, the table will avance 'till the end
> of the page;
> 
> 3) Too wide tables require to use LaTeX adjustbox extension. As Sphinx
> doesn't have support for it, the code should add a hack (via .. raw::
> latex)
> 
> 4) I got two tables where the latex tag (.. raw:: latex) didn't work. No
> idea why.
> 
> 5) Now, several tables have several tags to initialize a table:
> 
>   .. raw:: latex
> 
>   \newline\newline\begin{adjustbox}{width=\columnwidth}
> 
>   .. tabularcolumns:: 
> |p{7.6cm}|p{1.6cm}|p{0.7cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5
> cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|
> 
>   .. _v4l2-mbus-pixelcode-bayer:
> 
>   .. cssclass: longtable
> 
>   .. flat-table:: Bayer Formats
> ...
> 
> The order where those things happen matter. if the order gets wrong, the
> tag won't do what it was expected to do.
> 
> If I got it right, cssclass should happen just before flat-table. If the
> table has a tag, it should be after tabularcolumns. The raw::latex seems
> to happen before all other tags.

There is one additional issue I forgot to mention: when cell spans
are used, on the spanned cell, LaTeX does the wrong thing: 
sometimes, it expects manual line breaks. Also, it doesn't
justify the spanned columns.

> 
> There are also some troubles with Sphinx build system related to PDF
> generation:
> 
> - It doesn't honour SPHINXDIRS when building PDF/LaTeX files;
> 
> - Sometimes, the flat-table extension crashes, when the ":widths:" or
> ".. tabularcolumns::" doesn't match the size of a table. When this
> happens, it produces an incomplete LaTeX file until removing the
> contents of Documentation/output.
> 
> I'll continue working on the LaTeX output fixups. I'll later check how
> to solve the huge amount of warnings it outputs.
> 
> -
> 
> That's said, IMHO, the LaTeX/PDF output is very nice, as we can have
> everything into a single file, and the output is great, IMHO.
> 
> Once the tables are resized with adjustbox, it is even easier to read
> than HTML, as we can see the entire table altogether without needing
> to scroll on the big ones.
> 
> 
> Markus,
> 
> It would be great if you could look on the above issues for us and see
> what could be done to improve it.
> 
> 
> Mauro Carvalho Chehab (20):
>   [media] docs-rst: re-generate typical_media_device.pdf
>   [media] docs-rst: add tabularcolumns to all tables
>   [media] control.rst: Fix table width
>   [media] extended-controls.rst: fix table sizes
>   [media] docs-rst: add column hints for pixfmt-002 and pixfmt-006
>   [media] pixfmt-packed-rgb.rst: Fix cell spans
>   [media] pixfmt-packed-rgb.rst: adjust tables to fit in LaTeX
>   [media] pixfmt-packed-yuv.rst: adjust tables to fit in LaTeX
>   [media] docs-rst: remove width hints from pixfmt byte order tables
>   [media] buffer.rst: Adjust table columns for LaTeX output
>   [media] dev-overlay.rst: don't ident a note
>   [media] dev-raw-vbi.rst: add a footnote for the count limits
>   [media] dev-raw-vbi.rst: adjust table columns for LaTeX output
>   [media] docs-rst: re-generate vbi_525.pdf and vbi_625.pdf
>   [media] dev-sliced-vbi.rst: use a footnote for VBI images
>   [media] dev-sliced-vbi.rst: Adjust tables on LaTeX output
>   [media] dev-rds.rst: adjust table dimentions for LaTeX
>   [media] dev-subdev.rst: make table fully visible on LaTeX
>   [media] subdev-formats.rst: adjust most of the tables to fill in page
>   [media] diff-v4l.rst: Make capabilities table fit in LaTeX
> 
>  .../media/media_api_files/typical_media_device.pdf |  Bin 134268 -> 52895 
> bytes
>  .../media/uapi/cec/cec-ioc-adap-g-caps.rst |4 +
>  .../media/uapi/cec/cec-ioc-adap-g-log-addrs.rst|   10 +
>  Documentation/media/uapi/cec/cec-ioc-dqevent.rst   |   10 +
>  Documentation/media/uapi/cec/cec-ioc-g-mode.rst|6 +
>  

Re: [PATCH 1/7] doc-rst: generic way to build only sphinx sub-folders

2016-08-18 Thread Jonathan Corbet
On Sat, 13 Aug 2016 16:12:42 +0200
Markus Heiser  wrote:

> Add a generic way to build only a reST sub-folder with or
> without a individual *build-theme*.
> 
> * control *sub-folders* by environment SPHINXDIRS
> * control *build-theme* by environment SPHINX_CONF
> 
> Folders with a conf.py file, matching $(srctree)/Documentation/*/conf.py
> can be build and distributed *stand-alone*. E.g. to compile only the
> html of 'media' and 'gpu' folder use::
> 
>   make SPHINXDIRS="media gpu" htmldocs
> 
> To use an additional sphinx-build configuration (*build-theme*) set the
> name of the configuration file to SPHINX_CONF. E.g. to compile only the
> html of 'media' with the *nit-picking* build use::
> 
>   make SPHINXDIRS=media SPHINX_CONF=conf_nitpick.py htmldocs
> 
> With this, the Documentation/conf.py is read first and updated with the
> configuration values from the Documentation/media/conf_nitpick.py.

So this patch appears to have had the undocumented effect of moving HTML
output from Documentation/output/html to Documentation/output.  I am
assuming that was not the intended result?

I'm not sure that we actually need the format-specific subfolders, but we
should be consistent across all the formats and in the documentation and,
as of this patch, we're not.

jon
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/9] Prepare Sphinx to build media PDF books

2016-08-18 Thread Jonathan Corbet
On Tue, 16 Aug 2016 13:25:34 -0300
Mauro Carvalho Chehab  wrote:

> I think this patch series belong to docs-next. Feel free to merge them there, 
> if
> you agree. There's one extra patch that touches Documentation/conf.py,
> re-adding the media book to the PDF build, but IMHO this one would be better
> to be merged via the media tree, after the fixes inside the media 
> documentation
> to fix the build.

It's now in docs-next.  I was able to build some nice-looking docs with it
without too much (additional) pain...

The conf.py patch makes me a bit nervous, in that I feel like I spent a
fair amount of time explaining docs merge conflicts to Linus during the
merge window, and would rather not do that again.  Can we keep it aside,
with the idea that one of us will put it in toward the end of the 4.9
merge window?

Meanwhile, let's see how this xelatex thing works out.  Thanks for making
all this work!

jon
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC PATCH 0/5] doc-rst: improvements Sphinx's C-domain

2016-08-18 Thread Jonathan Corbet
On Mon, 15 Aug 2016 16:08:23 +0200
Markus Heiser  wrote:

> this is my approach to eliminate some distortions we have with the c/cpp 
> Sphinx
> domains. The C domain is simple: it assumes that all functions, enums, etc
> are global, e. g. there should be just one function called "ioctl", or "open".
> With the 'name' option e.g.:
> 
> .. c:function:: int ioctl( int fd, int request )
>:name: VIDIOC_LOG_STATUS
> 
> we can rename those functions. Another nice feature around this *global*
> namespace topic is, that the *duplicate C object description* warnings for
> function declarations are moved to the nitpicky mode.

So these all look reasonable to me.  A lot of it seems aimed at making the
media docs go better; Mauro, have you tried it out and does it, indeed,
have this effect?

Thanks,

jon
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCHv6] support for AD5820 camera auto-focus coil

2016-08-18 Thread Sakari Ailus
Hi Pavel,

On Thu, Aug 18, 2016 at 12:45:39PM +0200, Pavel Machek wrote:
> On Thu 2016-08-11 14:16:34, Sakari Ailus wrote:
> > On Tue, Aug 09, 2016 at 01:23:23AM +0200, Pavel Machek wrote:
> > > On Wed 2016-08-10 15:01:05, Sakari Ailus wrote:
> > > > On Mon, Aug 08, 2016 at 11:41:32PM +0200, Pavel Machek wrote:
> > > > > On Mon 2016-08-08 11:09:56, Sakari Ailus wrote:
> > > > > > On Fri, Aug 05, 2016 at 12:26:11PM +0200, Pavel Machek wrote:
> > > > > > > 
> > > > > > > This adds support for AD5820 autofocus coil, found for example in
> > > > > > > Nokia N900 smartphone.
> > > > > > 
> > > > > > Thanks, Pavel!
> > > > > > 
> > > > > > Let's use V4L2_CID_FOCUS_ABSOLUTE, as is in the patch. If we get 
> > > > > > something
> > > > > > better in the future, we'll switch to that then.
> > > > > > 
> > > > > > I've applied this to ad5820 branch in my tree.
> > > > > 
> > > > > Thanks. If I understands things correctly, both DTS patch and this 
> > > > > patch are
> > > > > waiting in your tree, so we should be good to go for 4.9 (unless some 
> > > > > unexpected
> > > > > problems surface)?
> > > > 
> > > > Yeah. I just compiled it but haven't tested it. I presume it'll work. 
> > > > :-)
> > > 
> > > I'm testing it on n900. I guess simpler hardware with ad5820 would be 
> > > better for the
> > > test...
> > > 
> > > What hardware do you have?
> > 
> > N900. What else could it be? :-) :-)
> 
> Heh. Basically anything is easier to develop for than n900 :-(.

Is it?

I actually find the old Nokia devices very practical. It's easy to boot your
own kernel and things just work... until musb broke a bit recently. It
requires reconnecting the usb cable again to function.

I have to admit I mostly use an N9.

> 
> Ok, for real testing, Ivaylo's camera patchset is useful, so that you
> have picture to work with, plus your subdevs for omap3 patchset (which
> needs a forward port).
> 
> I have patches against v4.7, if you are interested.

They should be pretty close to mainline. The rebase should be very easy.

Patches against media-tree master branch would always be better naturally.
:-)

> 
> I guess subdevs for omap3 should be merged at this point. Do you have
> any plans to do that, or should I take a look?

What's still missing? I think I've yet to check the et8ek8 driver and the
device tree description is missing. That's what comes to mind right now.

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCHv6] support for AD5820 camera auto-focus coil

2016-08-18 Thread Pavel Machek
Hi!

> > Heh. Basically anything is easier to develop for than n900 :-(.
> 
> Is it?
> 
> I actually find the old Nokia devices very practical. It's easy to boot your
> own kernel and things just work... until musb broke a bit recently. It
> requires reconnecting the usb cable again to function.
> 
> I have to admit I mostly use an N9.

Well, yes, I guess it sucks less than most phones, but...

I wish I had working .5TB drive, and CPU fast enough to compile kernel
in say hour, and enough memory to run emacs and g++ at the same time,
ethernet connection, working RTC and real keyboard and monitor...

Development would be way easier if I could just disconnect the N900
peripherals and connect them to the PC. Ok, I can dream, right?


> > I guess subdevs for omap3 should be merged at this point. Do you have
> > any plans to do that, or should I take a look?
> 
> What's still missing? I think I've yet to check the et8ek8 driver and the
> device tree description is missing. That's what comes to mind right now.

et8ek8 driver is important, yes. But there's the support for parsing
sub-devices from the dt missing, too. This stuff (I believe it is
originally from you).

Best regards,
Pavel

diff --git a/drivers/media/platform/omap3isp/isp.c 
b/drivers/media/platform/omap3isp/isp.c
index 5d54e2c..23d484c 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -2098,10 +2151,51 @@ static int isp_of_parse_node(struct device *dev, struct 
device_node *node,
return 0;
 }
 
+static int isp_of_parse_node(struct device *dev, struct device_node *node,
+struct v4l2_async_notifier *notifier,
+u32 group_id, bool link)
+{
+   struct isp_async_subdev *isd;
+
+   isd = devm_kzalloc(dev, sizeof(*isd), GFP_KERNEL);
+   if (!isd) {
+   of_node_put(node);
+   return -ENOMEM;
+   }
+
+   notifier->subdevs[notifier->num_subdevs] = >asd;
+
+   if (link) {
+   if (isp_of_parse_node_endpoint(dev, node, isd)) {
+   of_node_put(node);
+   return -EINVAL;
+   }
+
+   isd->asd.match.of.node = of_graph_get_remote_port_parent(node);
+   of_node_put(node);
+   } else {
+   isd->asd.match.of.node = node;
+   }
+
+   if (!isd->asd.match.of.node) {
+   dev_warn(dev, "bad remote port parent\n");
+   return -EINVAL;
+   }
+
+   isd->asd.match_type = V4L2_ASYNC_MATCH_OF;
+   isd->group_id = group_id;
+   notifier->num_subdevs++;
+
+   return 0;
+}
+
 static int isp_of_parse_nodes(struct device *dev,
  struct v4l2_async_notifier *notifier)
 {
struct device_node *node = NULL;
+   int ret;
+   unsigned int flash = 0;
+   u32 group_id = 0;
 
notifier->subdevs = devm_kcalloc(
dev, ISP_MAX_SUBDEVS, sizeof(*notifier->subdevs), GFP_KERNEL);
@@ -2110,30 +2204,57 @@ static int isp_of_parse_nodes(struct device *dev,
 
while (notifier->num_subdevs < ISP_MAX_SUBDEVS &&
   (node = of_graph_get_next_endpoint(dev->of_node, node))) {
-   struct isp_async_subdev *isd;
+   ret = isp_of_parse_node(dev, node, notifier, group_id++, true);
+   if (ret)
+   return ret;
+   }
 
-   isd = devm_kzalloc(dev, sizeof(*isd), GFP_KERNEL);
-   if (!isd) {
-   of_node_put(node);
-   return -ENOMEM;
-   }
+   while (notifier->num_subdevs < ISP_MAX_SUBDEVS &&
+  (node = of_parse_phandle(dev->of_node, "ti,camera-flashes",
+   flash++))) {
+   struct device_node *sensor_node =
+   of_parse_phandle(dev->of_node, "ti,camera-flashes",
+flash++);
+   unsigned int i;
+   u32 flash_group_id;
+
+   if (!sensor_node)
+   return -EINVAL;
 
-   notifier->subdevs[notifier->num_subdevs] = >asd;
+   for (i = 0; i < notifier->num_subdevs; i++) {
+   struct isp_async_subdev *isd = container_of(
+   notifier->subdevs[i], struct isp_async_subdev,
+   asd);
 
-   if (isp_of_parse_node(dev, node, isd)) {
-   of_node_put(node);
-   return -EINVAL;
+   if (!isd->bus)
+   continue;
+
+   dev_dbg(dev, "match \"%s\", \"%s\"\n",sensor_node->name,
+   isd->asd.match.of.node->name);
+
+   if (sensor_node != isd->asd.match.of.node)
+   continue;
+
+

Re: Adding Linux support for the Ion Video 2 PC analog video capture device (em28xx)

2016-08-18 Thread Alexandre-Xavier Labonté-Lamoureux
Hi Mauro!

Thank you for your help.

I made the change that you suggested. It fixed the video freeze. I
still have issues though. There is a huge green bar at the bottom of
the screen and the colors don't work correctly.

On my Atari Flashback, the screen is in black and white:
http://imgur.com/a/U6Shv

I tried on my Nintendo 64 to see if I would get the same result, what
I got is a disco effect: https://youtu.be/WLlqJ7T3y4g
As you can see, it goes through the whole range of color hues. The
frame rate is low, but that's my screen recorder's fault.

What should I do next?

Best regards,
Alexandre-Xavier

On Thu, Aug 18, 2016 at 5:29 AM, Mauro Carvalho Chehab
 wrote:
> Em Wed, 17 Aug 2016 15:26:40 -0400
> Alexandre-Xavier Labonté-Lamoureux   escreveu:
>
>> Hi,
>>
>> I have an Ion Video 2 PC and a StarTech svid2usb23 (id: 0xeb1a,
>> 0x5051). I have documented them here:
>> https://linuxtv.org/wiki/index.php/Ion_Video_2_PC
>>
>> I can get them to be recognized by patching the em28xx driver. I use
>> "EM2860_BOARD_TVP5150_REFERENCE_DESIGN".
>> (The patch can be found here:
>> https://www.linuxtv.org/wiki/index.php/Ion_Video_2_PC#Making_it_work)
>>
>> Yet, it almost works, there is only one bug.
>>
>> When I plug something yellow composite input of the device, it
>> captures one frame then stops. If I disconnect the composite video so
>> that there is no video input, then it starts capturing frames again.
>> So the device doesn't want to capture video when there is input, it
>> only captures frames when their is nothing connected to it.
>>
>> I can see that it stops capturing frames by looking at the frame
>> counter in qv4l2.
>> I have made a video about this problem: https://youtu.be/z96OfgHGDao?t=40s
>> You can see what I explained in the previous paragraph at 1:58 in the video.
>>
>> These are the chips inside the Ion Video 2 PC:
>> * Empia EM2860
>> * Empia EMP202
>> * 5150AM1
>>
>> What would be the next thing to do to make it work? Thanks.
>
> It seems that you're using some game console to generate images.
> Those usually output video in progressive mode, instead of using
> interlaced mode. Maybe that's the cause of the issues you're
> having.
>
> You could try to write a quick hack by patching em28xx_v4l2_init, at
> drivers/media/usb/em28xx/em28xx-video.c.
>
> Seek for those lines:
>
> if (dev->board.is_webcam)
> v4l2->progressive = true;
>
> And comment the first one. If this works, then we may add a modprobe
> parameter (like saa7134) or something else to fix it.
>
> Thanks,
> Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5 08/12] [media] vivid: Fix YUV555 and YUV565 handling

2016-08-18 Thread Ricardo Ribalda Delgado
precalculate_color() had a optimization that avoided duplicated
conversion for YUV formats. This optimization did not take into
consideration YUV444, YUV555, YUV565 or limited range quantization.

This patch keeps the optimization, but fixes the wrong handling.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/common/v4l2-tpg/v4l2-tpg-core.c | 19 ---
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c 
b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
index 920c8495f3dd..7364ced09abc 100644
--- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
+++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
@@ -795,6 +795,8 @@ static void precalculate_color(struct tpg_data *tpg, int k)
int r = tpg_colors[col].r;
int g = tpg_colors[col].g;
int b = tpg_colors[col].b;
+   int y, cb, cr;
+   bool ycbcr_valid = false;
 
if (k == TPG_COLOR_TEXTBG) {
col = tpg_get_textbg_color(tpg);
@@ -871,7 +873,6 @@ static void precalculate_color(struct tpg_data *tpg, int k)
 tpg->saturation != 128 || tpg->hue) &&
tpg->color_enc != TGP_COLOR_ENC_LUMA) {
/* Implement these operations */
-   int y, cb, cr;
int tmp_cb, tmp_cr;
 
/* First convert to YCbCr */
@@ -888,13 +889,10 @@ static void precalculate_color(struct tpg_data *tpg, int 
k)
 
cb = (128 << 4) + (tmp_cb * tpg->contrast * tpg->saturation) / 
(128 * 128);
cr = (128 << 4) + (tmp_cr * tpg->contrast * tpg->saturation) / 
(128 * 128);
-   if (tpg->color_enc == TGP_COLOR_ENC_YCBCR) {
-   tpg->colors[k][0] = clamp(y >> 4, 1, 254);
-   tpg->colors[k][1] = clamp(cb >> 4, 1, 254);
-   tpg->colors[k][2] = clamp(cr >> 4, 1, 254);
-   return;
-   }
-   ycbcr_to_color(tpg, y, cb, cr, , , );
+   if (tpg->color_enc == TGP_COLOR_ENC_YCBCR)
+   ycbcr_valid = true;
+   else
+   ycbcr_to_color(tpg, y, cb, cr, , , );
} else if ((tpg->brightness != 128 || tpg->contrast != 128) &&
   tpg->color_enc == TGP_COLOR_ENC_LUMA) {
r = (16 << 4) + ((r - (16 << 4)) * tpg->contrast) / 128;
@@ -915,9 +913,8 @@ static void precalculate_color(struct tpg_data *tpg, int k)
case TGP_COLOR_ENC_YCBCR:
{
/* Convert to YCbCr */
-   int y, cb, cr;
-
-   color_to_ycbcr(tpg, r, g, b, , , );
+   if (!ycbcr_valid)
+   color_to_ycbcr(tpg, r, g, b, , , );
 
if (tpg->real_quantization == V4L2_QUANTIZATION_LIM_RANGE) {
y = clamp(y, 16 << 4, 235 << 4);
-- 
2.8.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5 04/12] [media] vivid: Code refactor for color encoding

2016-08-18 Thread Ricardo Ribalda Delgado
Replace is_yuv with color_enc Which can be used by other
color encodings such us HSV.

This change should ease the review of the following patches.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/common/v4l2-tpg/v4l2-tpg-core.c   | 49 +++
 drivers/media/platform/vivid/vivid-core.h   |  2 +-
 drivers/media/platform/vivid/vivid-vid-common.c | 52 -
 include/media/v4l2-tpg.h|  7 +++-
 4 files changed, 66 insertions(+), 44 deletions(-)

diff --git a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c 
b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
index 1684810cab83..c4153307bfc5 100644
--- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
+++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
@@ -237,13 +237,13 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
case V4L2_PIX_FMT_GREY:
case V4L2_PIX_FMT_Y16:
case V4L2_PIX_FMT_Y16_BE:
-   tpg->is_yuv = false;
+   tpg->color_enc = TGP_COLOR_ENC_RGB;
break;
case V4L2_PIX_FMT_YUV444:
case V4L2_PIX_FMT_YUV555:
case V4L2_PIX_FMT_YUV565:
case V4L2_PIX_FMT_YUV32:
-   tpg->is_yuv = true;
+   tpg->color_enc = TGP_COLOR_ENC_YCBCR;
break;
case V4L2_PIX_FMT_YUV420M:
case V4L2_PIX_FMT_YVU420M:
@@ -256,7 +256,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
tpg->hdownsampling[1] = 2;
tpg->hdownsampling[2] = 2;
tpg->planes = 3;
-   tpg->is_yuv = true;
+   tpg->color_enc = TGP_COLOR_ENC_YCBCR;
break;
case V4L2_PIX_FMT_YUV422M:
case V4L2_PIX_FMT_YVU422M:
@@ -268,7 +268,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
tpg->hdownsampling[1] = 2;
tpg->hdownsampling[2] = 2;
tpg->planes = 3;
-   tpg->is_yuv = true;
+   tpg->color_enc = TGP_COLOR_ENC_YCBCR;
break;
case V4L2_PIX_FMT_NV16M:
case V4L2_PIX_FMT_NV61M:
@@ -280,7 +280,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
tpg->hdownsampling[1] = 1;
tpg->hmask[1] = ~1;
tpg->planes = 2;
-   tpg->is_yuv = true;
+   tpg->color_enc = TGP_COLOR_ENC_YCBCR;
break;
case V4L2_PIX_FMT_NV12M:
case V4L2_PIX_FMT_NV21M:
@@ -292,7 +292,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
tpg->hdownsampling[1] = 1;
tpg->hmask[1] = ~1;
tpg->planes = 2;
-   tpg->is_yuv = true;
+   tpg->color_enc = TGP_COLOR_ENC_YCBCR;
break;
case V4L2_PIX_FMT_YUV444M:
case V4L2_PIX_FMT_YVU444M:
@@ -302,21 +302,21 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
tpg->vdownsampling[2] = 1;
tpg->hdownsampling[1] = 1;
tpg->hdownsampling[2] = 1;
-   tpg->is_yuv = true;
+   tpg->color_enc = TGP_COLOR_ENC_YCBCR;
break;
case V4L2_PIX_FMT_NV24:
case V4L2_PIX_FMT_NV42:
tpg->vdownsampling[1] = 1;
tpg->hdownsampling[1] = 1;
tpg->planes = 2;
-   tpg->is_yuv = true;
+   tpg->color_enc = TGP_COLOR_ENC_YCBCR;
break;
case V4L2_PIX_FMT_YUYV:
case V4L2_PIX_FMT_UYVY:
case V4L2_PIX_FMT_YVYU:
case V4L2_PIX_FMT_VYUY:
tpg->hmask[0] = ~1;
-   tpg->is_yuv = true;
+   tpg->color_enc = TGP_COLOR_ENC_YCBCR;
break;
default:
return false;
@@ -775,7 +775,8 @@ static void precalculate_color(struct tpg_data *tpg, int k)
 * Remember that r, g and b are still in the 0 - 0xff0 range.
 */
if (tpg->real_rgb_range == V4L2_DV_RGB_RANGE_LIMITED &&
-   tpg->rgb_range == V4L2_DV_RGB_RANGE_FULL && !tpg->is_yuv) {
+   tpg->rgb_range == V4L2_DV_RGB_RANGE_FULL &&
+   tpg->color_enc == TGP_COLOR_ENC_RGB) {
/*
 * Convert from full range (which is what r, g and b are)
 * to limited range (which is the 'real' RGB range), which
@@ -785,7 +786,9 @@ static void precalculate_color(struct tpg_data *tpg, int k)
g = (g * 219) / 255 + (16 << 4);
b = (b * 219) / 255 + (16 << 4);
} else if (tpg->real_rgb_range != V4L2_DV_RGB_RANGE_LIMITED &&
-  tpg->rgb_range == V4L2_DV_RGB_RANGE_LIMITED && !tpg->is_yuv) 
{
+  tpg->rgb_range == V4L2_DV_RGB_RANGE_LIMITED &&
+  tpg->color_enc == TGP_COLOR_ENC_RGB) {
+
/*
 * Clamp r, g and b to the limited range and convert to full
 * range since that's what we deliver.
@@ 

Re: [PATCH] v4l: rcar-fcp: Don't force users to check for disabled FCP support

2016-08-18 Thread Niklas Söderlund
On 2016-08-17 16:32:08 +0300, Laurent Pinchart wrote:
> The rcar_fcp_enable() function immediately returns successfully when the
> FCP device pointer is NULL to avoid forcing the users to check the FCP
> device manually before every call. However, the stub version of the
> function used when the FCP driver is disabled returns -ENOSYS
> unconditionally, resulting in a different API contract for the two
> versions of the function.
> 
> As a user that requires FCP support will fail at probe time when calling
> rcar_fcp_get() if the FCP driver is disabled, the stub version of the
> rcar_fcp_enable() function will only be called with a NULL FCP device.
> We can thus return 0 unconditionally to align the behaviour with the
> normal version of the function.
> 
> Reported-by: Sergei Shtylyov 
> Signed-off-by: Laurent Pinchart 

Works on Koelsch with shmobile_defconfig.

Tested-by: Niklas Söderlund 

> ---
>  include/media/rcar-fcp.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/media/rcar-fcp.h b/include/media/rcar-fcp.h
> index 4c7fc77eaf29..8723f05c6321 100644
> --- a/include/media/rcar-fcp.h
> +++ b/include/media/rcar-fcp.h
> @@ -29,7 +29,7 @@ static inline struct rcar_fcp_device *rcar_fcp_get(const 
> struct device_node *np)
>  static inline void rcar_fcp_put(struct rcar_fcp_device *fcp) { }
>  static inline int rcar_fcp_enable(struct rcar_fcp_device *fcp)
>  {
> - return -ENOSYS;
> + return 0;
>  }
>  static inline void rcar_fcp_disable(struct rcar_fcp_device *fcp) { }
>  #endif
> -- 
> Regards,
> 
> Laurent Pinchart
> 

-- 
Regards,
Niklas Söderlund
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5 06/12] [media] vivid: Rename variable

2016-08-18 Thread Ricardo Ribalda Delgado
r_y and g_u now also contain the H and V components on the HSV formats.
Rename the variables to reflect this.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/common/v4l2-tpg/v4l2-tpg-core.c | 209 +-
 1 file changed, 105 insertions(+), 104 deletions(-)

diff --git a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c 
b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
index 67e0aaf067b7..0aeabe92ff32 100644
--- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
+++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
@@ -1012,7 +1012,7 @@ static void gen_twopix(struct tpg_data *tpg,
 {
unsigned offset = odd * tpg->twopixelsize[0] / 2;
u8 alpha = tpg->alpha_component;
-   u8 r_y, g_u, b_v;
+   u8 r_y_h, g_u_s, b_v;
 
if (tpg->alpha_red_only && color != TPG_COLOR_CSC_RED &&
   color != TPG_COLOR_100_RED &&
@@ -1020,161 +1020,161 @@ static void gen_twopix(struct tpg_data *tpg,
alpha = 0;
if (color == TPG_COLOR_RANDOM)
precalculate_color(tpg, color);
-   r_y = tpg->colors[color][0]; /* R or precalculated Y, H */
-   g_u = tpg->colors[color][1]; /* G or precalculated U, V */
+   r_y_h = tpg->colors[color][0]; /* R or precalculated Y, H */
+   g_u_s = tpg->colors[color][1]; /* G or precalculated U, V */
b_v = tpg->colors[color][2]; /* B or precalculated V */
 
switch (tpg->fourcc) {
case V4L2_PIX_FMT_GREY:
-   buf[0][offset] = r_y;
+   buf[0][offset] = r_y_h;
break;
case V4L2_PIX_FMT_Y16:
/*
-* Ideally both bytes should be set to r_y, but then you won't
+* Ideally both bytes should be set to r_y_h, but then you won't
 * be able to detect endian problems. So keep it 0 except for
-* the corner case where r_y is 0xff so white really will be
+* the corner case where r_y_h is 0xff so white really will be
 * white (0x).
 */
-   buf[0][offset] = r_y == 0xff ? r_y : 0;
-   buf[0][offset+1] = r_y;
+   buf[0][offset] = r_y_h == 0xff ? r_y_h : 0;
+   buf[0][offset+1] = r_y_h;
break;
case V4L2_PIX_FMT_Y16_BE:
/* See comment for V4L2_PIX_FMT_Y16 above */
-   buf[0][offset] = r_y;
-   buf[0][offset+1] = r_y == 0xff ? r_y : 0;
+   buf[0][offset] = r_y_h;
+   buf[0][offset+1] = r_y_h == 0xff ? r_y_h : 0;
break;
case V4L2_PIX_FMT_YUV422M:
case V4L2_PIX_FMT_YUV422P:
case V4L2_PIX_FMT_YUV420:
case V4L2_PIX_FMT_YUV420M:
-   buf[0][offset] = r_y;
+   buf[0][offset] = r_y_h;
if (odd) {
-   buf[1][0] = (buf[1][0] + g_u) / 2;
+   buf[1][0] = (buf[1][0] + g_u_s) / 2;
buf[2][0] = (buf[2][0] + b_v) / 2;
buf[1][1] = buf[1][0];
buf[2][1] = buf[2][0];
break;
}
-   buf[1][0] = g_u;
+   buf[1][0] = g_u_s;
buf[2][0] = b_v;
break;
case V4L2_PIX_FMT_YVU422M:
case V4L2_PIX_FMT_YVU420:
case V4L2_PIX_FMT_YVU420M:
-   buf[0][offset] = r_y;
+   buf[0][offset] = r_y_h;
if (odd) {
buf[1][0] = (buf[1][0] + b_v) / 2;
-   buf[2][0] = (buf[2][0] + g_u) / 2;
+   buf[2][0] = (buf[2][0] + g_u_s) / 2;
buf[1][1] = buf[1][0];
buf[2][1] = buf[2][0];
break;
}
buf[1][0] = b_v;
-   buf[2][0] = g_u;
+   buf[2][0] = g_u_s;
break;
 
case V4L2_PIX_FMT_NV12:
case V4L2_PIX_FMT_NV12M:
case V4L2_PIX_FMT_NV16:
case V4L2_PIX_FMT_NV16M:
-   buf[0][offset] = r_y;
+   buf[0][offset] = r_y_h;
if (odd) {
-   buf[1][0] = (buf[1][0] + g_u) / 2;
+   buf[1][0] = (buf[1][0] + g_u_s) / 2;
buf[1][1] = (buf[1][1] + b_v) / 2;
break;
}
-   buf[1][0] = g_u;
+   buf[1][0] = g_u_s;
buf[1][1] = b_v;
break;
case V4L2_PIX_FMT_NV21:
case V4L2_PIX_FMT_NV21M:
case V4L2_PIX_FMT_NV61:
case V4L2_PIX_FMT_NV61M:
-   buf[0][offset] = r_y;
+   buf[0][offset] = r_y_h;
if (odd) {
buf[1][0] = (buf[1][0] + b_v) / 2;
-   buf[1][1] = (buf[1][1] + g_u) / 2;
+   buf[1][1] = (buf[1][1] + g_u_s) / 2;
   

[PATCH v5 07/12] [media] vivid: Introduce TPG_COLOR_ENC_LUMA

2016-08-18 Thread Ricardo Ribalda Delgado
Simplifies handling of Gray formats.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/common/v4l2-tpg/v4l2-tpg-core.c   | 26 +++--
 drivers/media/platform/vivid/vivid-vid-common.c |  6 +++---
 include/media/v4l2-tpg.h|  1 +
 3 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c 
b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
index 0aeabe92ff32..920c8495f3dd 100644
--- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
+++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
@@ -234,10 +234,12 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
case V4L2_PIX_FMT_XBGR32:
case V4L2_PIX_FMT_ARGB32:
case V4L2_PIX_FMT_ABGR32:
+   tpg->color_enc = TGP_COLOR_ENC_RGB;
+   break;
case V4L2_PIX_FMT_GREY:
case V4L2_PIX_FMT_Y16:
case V4L2_PIX_FMT_Y16_BE:
-   tpg->color_enc = TGP_COLOR_ENC_RGB;
+   tpg->color_enc = TGP_COLOR_ENC_LUMA;
break;
case V4L2_PIX_FMT_YUV444:
case V4L2_PIX_FMT_YUV555:
@@ -823,9 +825,9 @@ static void precalculate_color(struct tpg_data *tpg, int k)
g <<= 4;
b <<= 4;
}
-   if (tpg->qual == TPG_QUAL_GRAY || tpg->fourcc == V4L2_PIX_FMT_GREY ||
-   tpg->fourcc == V4L2_PIX_FMT_Y16 ||
-   tpg->fourcc == V4L2_PIX_FMT_Y16_BE) {
+
+   if (tpg->qual == TPG_QUAL_GRAY ||
+   tpg->color_enc ==  TGP_COLOR_ENC_LUMA) {
/* Rec. 709 Luma function */
/* (0.2126, 0.7152, 0.0722) * (255 * 256) */
r = g = b = (13879 * r + 46688 * g + 4713 * b) >> 16;
@@ -865,8 +867,9 @@ static void precalculate_color(struct tpg_data *tpg, int k)
b = (b - (16 << 4)) * 255 / 219;
}
 
-   if (tpg->brightness != 128 || tpg->contrast != 128 ||
-   tpg->saturation != 128 || tpg->hue) {
+   if ((tpg->brightness != 128 || tpg->contrast != 128 ||
+tpg->saturation != 128 || tpg->hue) &&
+   tpg->color_enc != TGP_COLOR_ENC_LUMA) {
/* Implement these operations */
int y, cb, cr;
int tmp_cb, tmp_cr;
@@ -892,6 +895,10 @@ static void precalculate_color(struct tpg_data *tpg, int k)
return;
}
ycbcr_to_color(tpg, y, cb, cr, , , );
+   } else if ((tpg->brightness != 128 || tpg->contrast != 128) &&
+  tpg->color_enc == TGP_COLOR_ENC_LUMA) {
+   r = (16 << 4) + ((r - (16 << 4)) * tpg->contrast) / 128;
+   r += (tpg->brightness << 4) - (128 << 4);
}
 
switch (tpg->color_enc) {
@@ -942,6 +949,11 @@ static void precalculate_color(struct tpg_data *tpg, int k)
tpg->colors[k][2] = cr;
break;
}
+   case TGP_COLOR_ENC_LUMA:
+   {
+   tpg->colors[k][0] = r >> 4;
+   break;
+   }
case TGP_COLOR_ENC_RGB:
{
if (tpg->real_quantization == V4L2_QUANTIZATION_LIM_RANGE) {
@@ -1983,6 +1995,8 @@ static const char *tpg_color_enc_str(enum tgp_color_enc
return "HSV";
case TGP_COLOR_ENC_YCBCR:
return "Y'CbCr";
+   case TGP_COLOR_ENC_LUMA:
+   return "Luma";
case TGP_COLOR_ENC_RGB:
default:
return "R'G'B";
diff --git a/drivers/media/platform/vivid/vivid-vid-common.c 
b/drivers/media/platform/vivid/vivid-vid-common.c
index 20822b5111b3..e0df44151461 100644
--- a/drivers/media/platform/vivid/vivid-vid-common.c
+++ b/drivers/media/platform/vivid/vivid-vid-common.c
@@ -184,7 +184,7 @@ struct vivid_fmt vivid_formats[] = {
.fourcc   = V4L2_PIX_FMT_GREY,
.vdownsampling = { 1 },
.bit_depth = { 8 },
-   .color_enc = TGP_COLOR_ENC_YCBCR,
+   .color_enc = TGP_COLOR_ENC_LUMA,
.planes   = 1,
.buffers = 1,
},
@@ -192,7 +192,7 @@ struct vivid_fmt vivid_formats[] = {
.fourcc   = V4L2_PIX_FMT_Y16,
.vdownsampling = { 1 },
.bit_depth = { 16 },
-   .color_enc = TGP_COLOR_ENC_YCBCR,
+   .color_enc = TGP_COLOR_ENC_LUMA,
.planes   = 1,
.buffers = 1,
},
@@ -200,7 +200,7 @@ struct vivid_fmt vivid_formats[] = {
.fourcc   = V4L2_PIX_FMT_Y16_BE,
.vdownsampling = { 1 },
.bit_depth = { 16 },
-   .color_enc = TGP_COLOR_ENC_YCBCR,
+   .color_enc = TGP_COLOR_ENC_LUMA,
.planes   = 1,
.buffers = 1,
},
diff --git a/include/media/v4l2-tpg.h b/include/media/v4l2-tpg.h
index 4a40f9b79053..8abed92317e8 100644
--- a/include/media/v4l2-tpg.h
+++ b/include/media/v4l2-tpg.h
@@ -91,6 +91,7 @@ enum 

[PATCH v5 05/12] [media] vivid: Add support for HSV formats

2016-08-18 Thread Ricardo Ribalda Delgado
This patch adds support for V4L2_PIX_FMT_HSV24 and V4L2_PIX_FMT_HSV32.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/common/v4l2-tpg/v4l2-tpg-core.c   | 93 +++--
 drivers/media/platform/vivid/vivid-vid-common.c | 14 
 include/media/v4l2-tpg.h|  1 +
 3 files changed, 104 insertions(+), 4 deletions(-)

diff --git a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c 
b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
index c4153307bfc5..67e0aaf067b7 100644
--- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
+++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
@@ -318,6 +318,10 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
tpg->hmask[0] = ~1;
tpg->color_enc = TGP_COLOR_ENC_YCBCR;
break;
+   case V4L2_PIX_FMT_HSV24:
+   case V4L2_PIX_FMT_HSV32:
+   tpg->color_enc = TGP_COLOR_ENC_HSV;
+   break;
default:
return false;
}
@@ -351,6 +355,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
break;
case V4L2_PIX_FMT_RGB24:
case V4L2_PIX_FMT_BGR24:
+   case V4L2_PIX_FMT_HSV24:
tpg->twopixelsize[0] = 2 * 3;
break;
case V4L2_PIX_FMT_BGR666:
@@ -361,6 +366,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
case V4L2_PIX_FMT_ARGB32:
case V4L2_PIX_FMT_ABGR32:
case V4L2_PIX_FMT_YUV32:
+   case V4L2_PIX_FMT_HSV32:
tpg->twopixelsize[0] = 2 * 4;
break;
case V4L2_PIX_FMT_NV12:
@@ -490,6 +496,64 @@ static inline int linear_to_rec709(int v)
return tpg_linear_to_rec709[v];
 }
 
+static void color_to_hsv(struct tpg_data *tpg, int r, int g, int b,
+  int *h, int *s, int *v)
+{
+   int max_rgb, min_rgb, diff_rgb;
+   int aux;
+   int third;
+
+   r >>= 4;
+   g >>= 4;
+   b >>= 4;
+
+   /* Value */
+   max_rgb = max3(r, g, b);
+   *v = max_rgb;
+   if (!max_rgb) {
+   *h = 0;
+   *s = 0;
+   return;
+   }
+
+   /* Saturation */
+   min_rgb = min3(r, g, b);
+   diff_rgb = max_rgb - min_rgb;
+   aux = 255 * diff_rgb;
+   aux += max_rgb / 2;
+   aux /= max_rgb;
+   *s = aux;
+   if (!aux) {
+   *h = 0;
+   return;
+   }
+
+   /* Hue */
+   if (max_rgb == r) {
+   aux =  g - b;
+   third = 0;
+   } else if (max_rgb == g) {
+   aux =  b - r;
+   third = 60;
+   } else {
+   aux =  r - g;
+   third = 120;
+   }
+
+   aux *= 30;
+   aux += diff_rgb / 2;
+   aux /= diff_rgb;
+   aux += third;
+
+   /* Clamp Hue */
+   if (aux < 0)
+   aux += 180;
+   else if (aux > 180)
+   aux -= 180;
+   *h = aux;
+
+}
+
 static void rgb2ycbcr(const int m[3][3], int r, int g, int b,
int y_offset, int *y, int *cb, int *cr)
 {
@@ -830,7 +894,19 @@ static void precalculate_color(struct tpg_data *tpg, int k)
ycbcr_to_color(tpg, y, cb, cr, , , );
}
 
-   if (tpg->color_enc == TGP_COLOR_ENC_YCBCR) {
+   switch (tpg->color_enc) {
+   case TGP_COLOR_ENC_HSV:
+   {
+   int h, s, v;
+
+   color_to_hsv(tpg, r, g, b, , , );
+   tpg->colors[k][0] = h;
+   tpg->colors[k][1] = s;
+   tpg->colors[k][2] = v;
+   break;
+   }
+   case TGP_COLOR_ENC_YCBCR:
+   {
/* Convert to YCbCr */
int y, cb, cr;
 
@@ -864,7 +940,10 @@ static void precalculate_color(struct tpg_data *tpg, int k)
tpg->colors[k][0] = y;
tpg->colors[k][1] = cb;
tpg->colors[k][2] = cr;
-   } else {
+   break;
+   }
+   case TGP_COLOR_ENC_RGB:
+   {
if (tpg->real_quantization == V4L2_QUANTIZATION_LIM_RANGE) {
r = (r * 219) / 255 + (16 << 4);
g = (g * 219) / 255 + (16 << 4);
@@ -914,6 +993,8 @@ static void precalculate_color(struct tpg_data *tpg, int k)
tpg->colors[k][0] = r;
tpg->colors[k][1] = g;
tpg->colors[k][2] = b;
+   break;
+   }
}
 }
 
@@ -939,8 +1020,8 @@ static void gen_twopix(struct tpg_data *tpg,
alpha = 0;
if (color == TPG_COLOR_RANDOM)
precalculate_color(tpg, color);
-   r_y = tpg->colors[color][0]; /* R or precalculated Y */
-   g_u = tpg->colors[color][1]; /* G or precalculated U */
+   r_y = tpg->colors[color][0]; /* R or precalculated Y, H */
+   g_u = tpg->colors[color][1]; /* G or precalculated U, V */
b_v = tpg->colors[color][2]; /* B or precalculated V */
 
switch 

[PATCH v5 12/12] [media] vivid: Add support for HSV encoding

2016-08-18 Thread Ricardo Ribalda Delgado
Support HSV encoding. Most of the logic is replicated from ycbcr_enc.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/common/v4l2-tpg/v4l2-tpg-core.c   | 25 +
 drivers/media/platform/vivid/vivid-core.h   |  1 +
 drivers/media/platform/vivid/vivid-ctrls.c  | 25 +
 drivers/media/platform/vivid/vivid-vid-cap.c| 17 +++--
 drivers/media/platform/vivid/vivid-vid-common.c |  2 ++
 drivers/media/platform/vivid/vivid-vid-out.c|  1 +
 include/media/v4l2-tpg.h| 15 +++
 7 files changed, 76 insertions(+), 10 deletions(-)

diff --git a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c 
b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
index ed37ae307cac..28d7b072d867 100644
--- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
+++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
@@ -504,6 +504,7 @@ static void color_to_hsv(struct tpg_data *tpg, int r, int 
g, int b,
int max_rgb, min_rgb, diff_rgb;
int aux;
int third;
+   int third_size;
 
r >>= 4;
g >>= 4;
@@ -530,30 +531,36 @@ static void color_to_hsv(struct tpg_data *tpg, int r, int 
g, int b,
return;
}
 
+   third_size = (tpg->real_hsv_enc == V4L2_HSV_ENC_180) ? 60 : 85;
+
/* Hue */
if (max_rgb == r) {
aux =  g - b;
third = 0;
} else if (max_rgb == g) {
aux =  b - r;
-   third = 60;
+   third = third_size;
} else {
aux =  r - g;
-   third = 120;
+   third = third_size * 2;
}
 
-   aux *= 30;
+   aux *= third_size / 2;
aux += diff_rgb / 2;
aux /= diff_rgb;
aux += third;
 
/* Clamp Hue */
-   if (aux < 0)
-   aux += 180;
-   else if (aux > 180)
-   aux -= 180;
-   *h = aux;
+   if (tpg->real_hsv_enc == V4L2_HSV_ENC_180) {
+   if (aux < 0)
+   aux += 180;
+   else if (aux > 180)
+   aux -= 180;
+   } else {
+   aux = aux & 0xff;
+   }
 
+   *h = aux;
 }
 
 static void rgb2ycbcr(const int m[3][3], int r, int g, int b,
@@ -1928,6 +1935,7 @@ static void tpg_recalc(struct tpg_data *tpg)
tpg->recalc_lines = true;
tpg->real_xfer_func = tpg->xfer_func;
tpg->real_ycbcr_enc = tpg->ycbcr_enc;
+   tpg->real_hsv_enc = tpg->hsv_enc;
tpg->real_quantization = tpg->quantization;
 
if (tpg->xfer_func == V4L2_XFER_FUNC_DEFAULT)
@@ -2018,6 +2026,7 @@ void tpg_log_status(struct tpg_data *tpg)
pr_info("tpg colorspace: %d\n", tpg->colorspace);
pr_info("tpg transfer function: %d/%d\n", tpg->xfer_func, 
tpg->real_xfer_func);
pr_info("tpg Y'CbCr encoding: %d/%d\n", tpg->ycbcr_enc, 
tpg->real_ycbcr_enc);
+   pr_info("tpg HSV encoding: %d/%d\n", tpg->hsv_enc, tpg->real_hsv_enc);
pr_info("tpg quantization: %d/%d\n", tpg->quantization, 
tpg->real_quantization);
pr_info("tpg RGB range: %d/%d\n", tpg->rgb_range, tpg->real_rgb_range);
 }
diff --git a/drivers/media/platform/vivid/vivid-core.h 
b/drivers/media/platform/vivid/vivid-core.h
index b59b49456d45..5cdf95bdc4d1 100644
--- a/drivers/media/platform/vivid/vivid-core.h
+++ b/drivers/media/platform/vivid/vivid-core.h
@@ -346,6 +346,7 @@ struct vivid_dev {
struct v4l2_dv_timings  dv_timings_out;
u32 colorspace_out;
u32 ycbcr_enc_out;
+   u32 hsv_enc_out;
u32 quantization_out;
u32 xfer_func_out;
u32 service_set_out;
diff --git a/drivers/media/platform/vivid/vivid-ctrls.c 
b/drivers/media/platform/vivid/vivid-ctrls.c
index aceb38d9f7e7..34731f71cc00 100644
--- a/drivers/media/platform/vivid/vivid-ctrls.c
+++ b/drivers/media/platform/vivid/vivid-ctrls.c
@@ -79,6 +79,7 @@
 #define VIVID_CID_MAX_EDID_BLOCKS  (VIVID_CID_VIVID_BASE + 40)
 #define VIVID_CID_PERCENTAGE_FILL  (VIVID_CID_VIVID_BASE + 41)
 #define VIVID_CID_REDUCED_FPS  (VIVID_CID_VIVID_BASE + 42)
+#define VIVID_CID_HSV_ENC  (VIVID_CID_VIVID_BASE + 43)
 
 #define VIVID_CID_STD_SIGNAL_MODE  (VIVID_CID_VIVID_BASE + 60)
 #define VIVID_CID_STANDARD (VIVID_CID_VIVID_BASE + 61)
@@ -378,6 +379,14 @@ static int vivid_vid_cap_s_ctrl(struct v4l2_ctrl *ctrl)
vivid_send_source_change(dev, HDMI);
vivid_send_source_change(dev, WEBCAM);
break;
+   case VIVID_CID_HSV_ENC:
+   tpg_s_hsv_enc(>tpg, ctrl->val ? V4L2_HSV_ENC_256 :
+V4L2_HSV_ENC_180);
+   

[PATCH v5 00/12] Add HSV format

2016-08-18 Thread Ricardo Ribalda Delgado
HSV formats are extremely useful for image segmentation. This set of
patches makes v4l2 aware of this kind of formats.

Vivid changes have been divided to ease the reviewing process.

We are working on patches for Gstreamer and OpenCV that will make use
of these formats.

We still need to decide if and how we will support HUE range 0-255


Changelog:
It is rebased on top of 
https://git.linuxtv.org/hverkuil/media_tree.git/commit/?h=sycc

v5: Suggested-by: Philipp Zabel 
-Redo "Local optimization for clamp" based on compiler output

Suggested by Hans Verkuil  and
- Start hsv encoding values at 128
- Fix documentation 
- Change MAP_QUANTIZATION_DEFAULT

v4:  
Suggested by Hans Verkuil  and
- Rename YUV to YCBCR
- Fix numerical error

Suggested by Hans Verkuil  and
Laurent Pinchart 
-Implement hsv_encoding for supporting 0-255 range


v3:  
-Fix wrong handling of some YUV formats when brightness != 128

Suggested by Laurent Pinchart 
-Remove unneeded empty lines on .rst file
Thanks!

Suggested by Hans Verkuil 
-Rebase over master and docs-next
-Introduce TPG_COLOR_ENC_LUMA for gray formats
-CodeStyle
Thanks!

v2:
Suggested by Mauro Carvalho Chehab ,
-Rebase on top of docs-next (port documentation to .rst)

Ricardo Ribalda Delgado (12):
  [media] videodev2.h Add HSV formats
  [media] Documentation: Add HSV format
  [media] Documentation: Add Ricardo Ribalda
  [media] vivid: Code refactor for color encoding
  [media] vivid: Add support for HSV formats
  [media] vivid: Rename variable
  [media] vivid: Introduce TPG_COLOR_ENC_LUMA
  [media] vivid: Fix YUV555 and YUV565 handling
  [media] vivid: Local optimization
  [media] videodev2.h Add HSV encoding
  [media] Documentation: Add HSV encodings
  [media] vivid: Add support for HSV encoding

 Documentation/media/uapi/v4l/hsv-formats.rst   |  19 +
 Documentation/media/uapi/v4l/pixfmt-002.rst|  12 +-
 Documentation/media/uapi/v4l/pixfmt-003.rst|  14 +-
 Documentation/media/uapi/v4l/pixfmt-006.rst|  41 +-
 Documentation/media/uapi/v4l/pixfmt-packed-hsv.rst | 159 
 Documentation/media/uapi/v4l/pixfmt.rst|   1 +
 Documentation/media/uapi/v4l/v4l2.rst  |   9 +
 Documentation/media/videodev2.h.rst.exceptions |   4 +
 drivers/media/common/v4l2-tpg/v4l2-tpg-core.c  | 411 ++---
 drivers/media/platform/vivid/vivid-core.h  |   3 +-
 drivers/media/platform/vivid/vivid-ctrls.c |  25 ++
 drivers/media/platform/vivid/vivid-vid-cap.c   |  17 +-
 drivers/media/platform/vivid/vivid-vid-common.c|  68 ++--
 drivers/media/platform/vivid/vivid-vid-out.c   |   1 +
 drivers/media/v4l2-core/v4l2-ioctl.c   |   2 +
 include/media/v4l2-tpg.h   |  24 +-
 include/uapi/linux/videodev2.h |  36 +-
 17 files changed, 664 insertions(+), 182 deletions(-)
 create mode 100644 Documentation/media/uapi/v4l/hsv-formats.rst
 create mode 100644 Documentation/media/uapi/v4l/pixfmt-packed-hsv.rst

-- 
2.8.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5 10/12] [media] videodev2.h Add HSV encoding

2016-08-18 Thread Ricardo Ribalda Delgado
Some hardware maps the Hue between 0 and 255 instead of 0-179. Support
this format with a new field hsv_enc.

Signed-off-by: Ricardo Ribalda Delgado 
---
 include/uapi/linux/videodev2.h | 32 +++-
 1 file changed, 27 insertions(+), 5 deletions(-)

diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 58ed8aedc196..71a4c3c13ee0 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -335,6 +335,19 @@ enum v4l2_ycbcr_encoding {
 };
 
 /*
+ * enum v4l2_hsv_encoding values should not collide with the ones from
+ * enum v4l2_ycbcr_encoding.
+ */
+enum v4l2_hsv_encoding {
+
+   /* Hue mapped to 0 - 179 */
+   V4L2_HSV_ENC_180= 128,
+
+   /* Hue mapped to 0-255 */
+   V4L2_HSV_ENC_256= 129,
+};
+
+/*
  * Determine how YCBCR_ENC_DEFAULT should map to a proper Y'CbCr encoding.
  * This depends on the colorspace.
  */
@@ -362,9 +375,10 @@ enum v4l2_quantization {
  * This depends on whether the image is RGB or not, the colorspace and the
  * Y'CbCr encoding.
  */
-#define V4L2_MAP_QUANTIZATION_DEFAULT(is_rgb, colsp, ycbcr_enc) \
-   (((is_rgb) && (colsp) == V4L2_COLORSPACE_BT2020) ? 
V4L2_QUANTIZATION_LIM_RANGE : \
-(((is_rgb) || (ycbcr_enc) == V4L2_YCBCR_ENC_XV601 || \
+#define V4L2_MAP_QUANTIZATION_DEFAULT(is_rgb_or_yuv, colsp, ycbcr_enc) \
+   (((is_rgb_or_yuv) && (colsp) == V4L2_COLORSPACE_BT2020) ? \
+V4L2_QUANTIZATION_LIM_RANGE : \
+(((is_rgb_or_yuv) || (ycbcr_enc) == V4L2_YCBCR_ENC_XV601 || \
  (ycbcr_enc) == V4L2_YCBCR_ENC_XV709 || (colsp) == 
V4L2_COLORSPACE_JPEG) || \
  (colsp) == V4L2_COLORSPACE_ADOBERGB || (colsp) == 
V4L2_COLORSPACE_SRGB ? \
 V4L2_QUANTIZATION_FULL_RANGE : V4L2_QUANTIZATION_LIM_RANGE))
@@ -460,7 +474,12 @@ struct v4l2_pix_format {
__u32   colorspace; /* enum v4l2_colorspace */
__u32   priv;   /* private data, depends on 
pixelformat */
__u32   flags;  /* format flags 
(V4L2_PIX_FMT_FLAG_*) */
-   __u32   ycbcr_enc;  /* enum v4l2_ycbcr_encoding */
+   union {
+   /* enum v4l2_ycbcr_encoding */
+   __u32   ycbcr_enc;
+   /* enum v4l2_hsv_encoding */
+   __u32   hsv_enc;
+   };
__u32   quantization;   /* enum v4l2_quantization */
__u32   xfer_func;  /* enum v4l2_xfer_func */
 };
@@ -1993,7 +2012,10 @@ struct v4l2_pix_format_mplane {
struct v4l2_plane_pix_formatplane_fmt[VIDEO_MAX_PLANES];
__u8num_planes;
__u8flags;
-   __u8ycbcr_enc;
+union {
+   __u8ycbcr_enc;
+   __u8hsv_enc;
+   };
__u8quantization;
__u8xfer_func;
__u8reserved[7];
-- 
2.8.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5 02/12] [media] Documentation: Add HSV format

2016-08-18 Thread Ricardo Ribalda Delgado
Describe the HSV formats

Signed-off-by: Ricardo Ribalda Delgado 
---
 Documentation/media/uapi/v4l/hsv-formats.rst   |  19 +++
 Documentation/media/uapi/v4l/pixfmt-packed-hsv.rst | 158 +
 Documentation/media/uapi/v4l/pixfmt.rst|   1 +
 Documentation/media/uapi/v4l/v4l2.rst  |   5 +
 4 files changed, 183 insertions(+)
 create mode 100644 Documentation/media/uapi/v4l/hsv-formats.rst
 create mode 100644 Documentation/media/uapi/v4l/pixfmt-packed-hsv.rst

diff --git a/Documentation/media/uapi/v4l/hsv-formats.rst 
b/Documentation/media/uapi/v4l/hsv-formats.rst
new file mode 100644
index ..f0f2615eaa95
--- /dev/null
+++ b/Documentation/media/uapi/v4l/hsv-formats.rst
@@ -0,0 +1,19 @@
+.. -*- coding: utf-8; mode: rst -*-
+
+.. _hsv-formats:
+
+***
+HSV Formats
+***
+
+These formats store the color information of the image
+in a geometrical representation. The colors are mapped into a
+cylinder, where the angle is the HUE, the height is the VALUE
+and the distance to the center is the SATURATION. This is a very
+useful format for image segmentation algorithms.
+
+
+.. toctree::
+:maxdepth: 1
+
+pixfmt-packed-hsv
diff --git a/Documentation/media/uapi/v4l/pixfmt-packed-hsv.rst 
b/Documentation/media/uapi/v4l/pixfmt-packed-hsv.rst
new file mode 100644
index ..60ac821e309d
--- /dev/null
+++ b/Documentation/media/uapi/v4l/pixfmt-packed-hsv.rst
@@ -0,0 +1,158 @@
+.. -*- coding: utf-8; mode: rst -*-
+
+.. _packed-hsv:
+
+**
+Packed HSV formats
+**
+
+*man Packed HSV formats(2)*
+
+Packed HSV formats
+
+
+Description
+===
+
+The *hue* (h) is measured in degrees, one LSB represents two degrees.
+The *saturation* (s) and the *value* (v) are measured in percentage of the
+cylinder: 0 being the smallest value and 255 the maximum.
+
+
+The values are packed in 24 or 32 bit formats.
+
+
+.. flat-table:: Packed HSV Image Formats
+:header-rows:  2
+:stub-columns: 0
+
+-  .. row 1
+
+   -  Identifier
+   -  Code
+   -
+   -  :cspan:`7` Byte 0 in memory
+   -
+   -  :cspan:`7` Byte 1
+   -
+   -  :cspan:`7` Byte 2
+   -
+   -  :cspan:`7` Byte 3
+
+-  .. row 2
+
+   -
+   -
+   -  Bit
+   -  7
+   -  6
+   -  5
+   -  4
+   -  3
+   -  2
+   -  1
+   -  0
+   -
+   -  7
+   -  6
+   -  5
+   -  4
+   -  3
+   -  2
+   -  1
+   -  0
+   -
+   -  7
+   -  6
+   -  5
+   -  4
+   -  3
+   -  2
+   -  1
+   -  0
+   -
+   -  7
+   -  6
+   -  5
+   -  4
+   -  3
+   -  2
+   -  1
+   -  0
+
+-  .. _V4L2-PIX-FMT-HSV32:
+
+   -  ``V4L2_PIX_FMT_HSV32``
+   -  'HSV4'
+   -
+   -  -
+   -  -
+   -  -
+   -  -
+   -  -
+   -  -
+   -  -
+   -  -
+   -
+   -  h\ :sub:`7`
+   -  h\ :sub:`6`
+   -  h\ :sub:`5`
+   -  h\ :sub:`4`
+   -  h\ :sub:`3`
+   -  h\ :sub:`2`
+   -  h\ :sub:`1`
+   -  h\ :sub:`0`
+   -
+   -  s\ :sub:`7`
+   -  s\ :sub:`6`
+   -  s\ :sub:`5`
+   -  s\ :sub:`4`
+   -  s\ :sub:`3`
+   -  s\ :sub:`2`
+   -  s\ :sub:`1`
+   -  s\ :sub:`0`
+   -
+   -  v\ :sub:`7`
+   -  v\ :sub:`6`
+   -  v\ :sub:`5`
+   -  v\ :sub:`4`
+   -  v\ :sub:`3`
+   -  v\ :sub:`2`
+   -  v\ :sub:`1`
+   -  v\ :sub:`0`
+
+-  .. _V4L2-PIX-FMT-HSV24:
+
+   -  ``V4L2_PIX_FMT_HSV24``
+   -  'HSV3'
+   -
+   -  h\ :sub:`7`
+   -  h\ :sub:`6`
+   -  h\ :sub:`5`
+   -  h\ :sub:`4`
+   -  h\ :sub:`3`
+   -  h\ :sub:`2`
+   -  h\ :sub:`1`
+   -  h\ :sub:`0`
+   -
+   -  s\ :sub:`7`
+   -  s\ :sub:`6`
+   -  s\ :sub:`5`
+   -  s\ :sub:`4`
+   -  s\ :sub:`3`
+   -  s\ :sub:`2`
+   -  s\ :sub:`1`
+   -  s\ :sub:`0`
+   -
+   -  v\ :sub:`7`
+   -  v\ :sub:`6`
+   -  v\ :sub:`5`
+   -  v\ :sub:`4`
+   -  v\ :sub:`3`
+   -  v\ :sub:`2`
+   -  v\ :sub:`1`
+   -  v\ :sub:`0`
+   -
+   -
+
+Bit 7 is the most significant bit.
diff --git a/Documentation/media/uapi/v4l/pixfmt.rst 
b/Documentation/media/uapi/v4l/pixfmt.rst
index 81222a99f7ce..1d2270422345 100644
--- a/Documentation/media/uapi/v4l/pixfmt.rst
+++ b/Documentation/media/uapi/v4l/pixfmt.rst
@@ -29,6 +29,7 @@ see also :ref:`VIDIOC_G_FBUF `.)
 pixfmt-indexed
 pixfmt-rgb
 yuv-formats
+hsv-formats
 depth-formats
 pixfmt-013
 sdr-formats
diff --git a/Documentation/media/uapi/v4l/v4l2.rst 
b/Documentation/media/uapi/v4l/v4l2.rst
index 5e41a8505301..36c6d0dc3859 100644
--- a/Documentation/media/uapi/v4l/v4l2.rst
+++ b/Documentation/media/uapi/v4l/v4l2.rst
@@ -89,6 +89,11 @@ part can be used and distributed without restrictions.
 Revision History
 

[PATCH v5 11/12] [media] Documentation: Add HSV encodings

2016-08-18 Thread Ricardo Ribalda Delgado
Describe the hsv_enc field and its use.

Signed-off-by: Ricardo Ribalda Delgado 
---
 Documentation/media/uapi/v4l/pixfmt-002.rst| 12 ++-
 Documentation/media/uapi/v4l/pixfmt-003.rst| 14 ++--
 Documentation/media/uapi/v4l/pixfmt-006.rst| 41 --
 Documentation/media/uapi/v4l/pixfmt-packed-hsv.rst |  3 +-
 Documentation/media/videodev2.h.rst.exceptions |  4 +++
 5 files changed, 68 insertions(+), 6 deletions(-)

diff --git a/Documentation/media/uapi/v4l/pixfmt-002.rst 
b/Documentation/media/uapi/v4l/pixfmt-002.rst
index fae9b2d40a85..9a59e87b590f 100644
--- a/Documentation/media/uapi/v4l/pixfmt-002.rst
+++ b/Documentation/media/uapi/v4l/pixfmt-002.rst
@@ -177,6 +177,16 @@ Single-planar format structure
 
 -  .. row 13
 
+   -  enum :ref:`v4l2_hsv_encoding `
+
+   -  ``hsv_enc``
+
+   -  This information supplements the ``colorspace`` and must be set by
+ the driver for capture streams and by the application for output
+ streams, see :ref:`colorspaces`.
+
+-  .. row 14
+
-  enum :ref:`v4l2_quantization `
 
-  ``quantization``
@@ -185,7 +195,7 @@ Single-planar format structure
  the driver for capture streams and by the application for output
  streams, see :ref:`colorspaces`.
 
--  .. row 14
+-  .. row 15
 
-  enum :ref:`v4l2_xfer_func `
 
diff --git a/Documentation/media/uapi/v4l/pixfmt-003.rst 
b/Documentation/media/uapi/v4l/pixfmt-003.rst
index 25c54872fbe1..f212d1feaaa0 100644
--- a/Documentation/media/uapi/v4l/pixfmt-003.rst
+++ b/Documentation/media/uapi/v4l/pixfmt-003.rst
@@ -138,6 +138,16 @@ describing all planes of that format.
 
 -  .. row 10
 
+   -  enum :ref:`v4l2_hsv_encoding `
+
+   -  ``hsv_enc``
+
+   -  This information supplements the ``colorspace`` and must be set by
+ the driver for capture streams and by the application for output
+ streams, see :ref:`colorspaces`.
+
+-  .. row 11
+
-  enum :ref:`v4l2_quantization `
 
-  ``quantization``
@@ -146,7 +156,7 @@ describing all planes of that format.
  the driver for capture streams and by the application for output
  streams, see :ref:`colorspaces`.
 
--  .. row 11
+-  .. row 12
 
-  enum :ref:`v4l2_xfer_func `
 
@@ -156,7 +166,7 @@ describing all planes of that format.
  the driver for capture streams and by the application for output
  streams, see :ref:`colorspaces`.
 
--  .. row 12
+-  .. row 13
 
-  __u8
 
diff --git a/Documentation/media/uapi/v4l/pixfmt-006.rst 
b/Documentation/media/uapi/v4l/pixfmt-006.rst
index 94271c8a3f68..b95099226e52 100644
--- a/Documentation/media/uapi/v4l/pixfmt-006.rst
+++ b/Documentation/media/uapi/v4l/pixfmt-006.rst
@@ -19,9 +19,18 @@ colorspace field of struct :ref:`v4l2_pix_format 
`
 or struct :ref:`v4l2_pix_format_mplane `
 needs to be filled in.
 
+.. _hsv-colorspace:
+
+On :ref:`HSV formats ` the *Hue* is defined as the angle on
+the cylindrical color representation. Usually this angle is measured in
+degrees, i.e. 0-360. When we map this angle value into 8 bits, there are
+two basic ways to do it: Divide the angular value by 2 (0-179), or use the
+whole range, 0-255, dividing the angular value by 1.41. The
+:ref:`v4l2_hsv_encoding ` field specify which encoding is 
used.
+
 .. note:: The default R'G'B' quantization is full range for all
colorspaces except for BT.2020 which uses limited range R'G'B'
-   quantization.
+   quantization. :ref:`HSV formats ` are always full range.
 
 
 .. _v4l2-colorspace:
@@ -242,6 +251,34 @@ needs to be filled in.
 
 
 
+.. _v4l2-hsv-encoding:
+
+.. flat-table:: V4L2 HSV Encodings
+:header-rows:  1
+:stub-columns: 0
+
+
+-  .. row 1
+
+   -  Identifier
+
+   -  Details
+
+-  .. row 2
+
+   -  ``V4L2_HSV_ENC_180``
+
+   -  For the Hue, each LSB is two degrees.
+
+-  .. row 3
+
+   -  ``V4L2_HSV_ENC_256``
+
+   -  For the Hue, the 360 degrees are mapped into 8 bits, i.e. each
+  LSB is roughly 1.41 degrees.
+
+
+
 .. _v4l2-quantization:
 
 .. flat-table:: V4L2 Quantization Methods
@@ -261,7 +298,7 @@ needs to be filled in.
 
-  Use the default quantization encoding as defined by the
  colorspace. This is always full range for R'G'B' (except for the
- BT.2020 colorspace) and usually limited range for Y'CbCr.
+ BT.2020 colorspace) and HSV. It is usually limited range for Y'CbCr.
 
 -  .. row 3
 
diff --git a/Documentation/media/uapi/v4l/pixfmt-packed-hsv.rst 
b/Documentation/media/uapi/v4l/pixfmt-packed-hsv.rst
index 60ac821e309d..c0239fd2c216 100644
--- a/Documentation/media/uapi/v4l/pixfmt-packed-hsv.rst
+++ b/Documentation/media/uapi/v4l/pixfmt-packed-hsv.rst
@@ -14,7 +14,8 @@ Packed HSV formats
 Description
 ===
 
-The *hue* (h) is measured in degrees, one LSB represents two degrees.
+The *hue* 

[PATCH v5 09/12] [media] vivid: Local optimization

2016-08-18 Thread Ricardo Ribalda Delgado
Avoid duplicated clamps when possible.

Suggested-by: Philipp Zabel 
Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/common/v4l2-tpg/v4l2-tpg-core.c | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c 
b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
index 7364ced09abc..ed37ae307cac 100644
--- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
+++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
@@ -916,14 +916,18 @@ static void precalculate_color(struct tpg_data *tpg, int 
k)
if (!ycbcr_valid)
color_to_ycbcr(tpg, r, g, b, , , );
 
+   y >>= 4;
+   cb >>= 4;
+   cr >>= 4;
if (tpg->real_quantization == V4L2_QUANTIZATION_LIM_RANGE) {
-   y = clamp(y, 16 << 4, 235 << 4);
-   cb = clamp(cb, 16 << 4, 240 << 4);
-   cr = clamp(cr, 16 << 4, 240 << 4);
+   y = clamp(y, 16, 235);
+   cb = clamp(cb, 16, 240);
+   cr = clamp(cr, 16, 240);
+   } else {
+   y = clamp(y, 1, 254);
+   cb = clamp(cb, 1, 254);
+   cr = clamp(cr, 1, 254);
}
-   y = clamp(y >> 4, 1, 254);
-   cb = clamp(cb >> 4, 1, 254);
-   cr = clamp(cr >> 4, 1, 254);
switch (tpg->fourcc) {
case V4L2_PIX_FMT_YUV444:
y >>= 4;
-- 
2.8.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5 03/12] [media] Documentation: Add Ricardo Ribalda

2016-08-18 Thread Ricardo Ribalda Delgado
My initials were on the Changelog, but there was no link to my name.

Signed-off-by: Ricardo Ribalda Delgado 
---
 Documentation/media/uapi/v4l/v4l2.rst | 4 
 1 file changed, 4 insertions(+)

diff --git a/Documentation/media/uapi/v4l/v4l2.rst 
b/Documentation/media/uapi/v4l/v4l2.rst
index 36c6d0dc3859..cf4a40ff7e14 100644
--- a/Documentation/media/uapi/v4l/v4l2.rst
+++ b/Documentation/media/uapi/v4l/v4l2.rst
@@ -68,6 +68,10 @@ Authors, in alphabetical order:
 
   - SDR API.
 
+- Ribalda, Ricardo
+
+  - Introduce HSV formats and other minor changes.
+
 - Rubli, Martin
 
   - Designed and documented the VIDIOC_ENUM_FRAMESIZES and 
VIDIOC_ENUM_FRAMEINTERVALS ioctls.
-- 
2.8.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5 01/12] [media] videodev2.h Add HSV formats

2016-08-18 Thread Ricardo Ribalda Delgado
These formats store the color information of the image
in a geometrical representation. The colors are mapped into a
cylinder, where the angle is the HUE, the height is the VALUE
and the distance to the center is the SATURATION. This is a very
useful format for image segmentation algorithms.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/v4l2-core/v4l2-ioctl.c | 2 ++
 include/uapi/linux/videodev2.h   | 4 
 2 files changed, 6 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c 
b/drivers/media/v4l2-core/v4l2-ioctl.c
index 51a0fa144392..16b211f7212b 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1238,6 +1238,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
case V4L2_PIX_FMT_TM6000:   descr = "A/V + VBI Mux Packet"; break;
case V4L2_PIX_FMT_CIT_YYVYUY:   descr = "GSPCA CIT YYVYUY"; break;
case V4L2_PIX_FMT_KONICA420:descr = "GSPCA KONICA420"; break;
+   case V4L2_PIX_FMT_HSV24:descr = "24-bit HSV 8-8-8"; break;
+   case V4L2_PIX_FMT_HSV32:descr = "32-bit XHSV 8-8-8-8"; break;
case V4L2_SDR_FMT_CU8:  descr = "Complex U8"; break;
case V4L2_SDR_FMT_CU16LE:   descr = "Complex U16LE"; break;
case V4L2_SDR_FMT_CS8:  descr = "Complex S8"; break;
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 8c5468cf43e3..58ed8aedc196 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -585,6 +585,10 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_SRGGB12 v4l2_fourcc('R', 'G', '1', '2') /* 12  RGRG.. 
GBGB.. */
 #define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16  BGBG.. 
GRGR.. */
 
+/* HSV formats */
+#define V4L2_PIX_FMT_HSV24 v4l2_fourcc('H', 'S', 'V', '3')
+#define V4L2_PIX_FMT_HSV32 v4l2_fourcc('H', 'S', 'V', '4')
+
 /* compressed formats */
 #define V4L2_PIX_FMT_MJPEGv4l2_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG   
*/
 #define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG 
*/
-- 
2.8.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: pwc over musb: 100% frame drop (lost) on high resolution stream

2016-08-18 Thread Matwey V. Kornilov
Any ideas?

2016-08-04 23:08 GMT+03:00 Matwey V. Kornilov :
> When DMA is not used, I see the same behavior: lots of zero-length
> packages received.
>
> Can It be related to some kind of USB overflow due to long input data
> processing with disabled IRQ?
> When HCD_BC is used then part of processing is postponed and this can
> explain greater throughput due to better latency.
>
> 2016-08-04 22:58 GMT+03:00 Matwey V. Kornilov :
>> I've just found that in such cases, when DMA actual length is zero,
>> both cppi41_channel->prog_len and txstate.residue equal 960 at
>> musb_cppi41 line 225:
>>
>> http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/tree/drivers/usb/musb/musb_cppi41.c#n225
>>
>> 2016-08-04 22:08 GMT+03:00 Matwey V. Kornilov :
>>> I've just found that dma->actual_len equals to zero in most cases at
>>> musb_host.c line 1946.
>>> And this produces zero-length packages.
>>>
>>> http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/tree/drivers/usb/musb/musb_host.c#n1946
>>>
>>> Any ideas why?
>>>
>>> 2016-08-04 19:57 GMT+03:00 Matwey V. Kornilov :
 I've just found that many packages in URBs have zero actual_length (It
 is a question why).
 Then the following end of frame criteria leads to `frame underflow' 
 message:

 if (flen < pdev->vlast_packet_size) {
 /* Shorter packet... end of frame */
 if (pdev->vsync == 2)
 pwc_frame_complete(pdev);
 if (pdev->fill_buf == NULL)
 pdev->fill_buf = 
 pwc_get_next_fill_buf(pdev);
 if (pdev->fill_buf) {
 pdev->fill_buf->filled = 0;
 pdev->vsync = 1;
 }
 }

 2016-08-01 21:16 GMT+03:00 Matwey V. Kornilov :
> pwc module output with trace=511 is the following:
>
> [   24.793109] usbcore: registered new interface driver Philips webcam
> [   29.276979] pwc: Unsupported pixel format
> [   29.277055] pwc: pwc_vidioc_fill_fmt() width=640, height=480,
> bytesperline=640, sizeimage=460800, pixelformat=YU12
> [   29.277090] pwc: Trying to set format to: width=640 height=480
> fps=15 format=YU12
> [   29.277123] pwc: set_video_mode(640x480 @ 30, pixfmt 32315559).
> [   29.277145] pwc: decode_size = 5.
> [   29.277180] pwc: frame_size=63120, vframes=15, vsize=5, vbandlength=526
> [   29.277204] pwc: Set resolution to 640x480
> [   29.277225] pwc: pwc_set_video_mode(), return=0
> [   29.277256] pwc: pwc_vidioc_fill_fmt() width=640, height=480,
> bytesperline=640, sizeimage=460800, pixelformat=YU12
> [   29.277306] pwc: ioctl(VIDIOC_G_FMT) return size 640x480
> [   29.277337] pwc: pwc_vidioc_fill_fmt() width=640, height=480,
> bytesperline=640, sizeimage=460800, pixelformat=YU12
> [   29.277449] pwc: set_video_mode(640x480 @ 10, pixfmt 32315559).
> [   29.277475] pwc: decode_size = 5.
> [   29.278726] pwc: frame_size=94560, vframes=10, vsize=5, vbandlength=788
> [   29.278750] pwc: Set resolution to 640x480
> [   29.300374] pwc: set_video_mode(640x480 @ 10, pixfmt 32315559).
> [   29.300420] pwc: decode_size = 5.
> [   29.441759] pwc: frame_size=94560, vframes=10, vsize=5, vbandlength=788
> [   29.441792] pwc: Set resolution to 640x480
> [   29.441824] pwc: Setting alternate interface 9
> [   29.455061] pwc: Allocated URB at 0xc9b83600
> [   29.455850] pwc: Allocated URB at 0xc9b83400
> [   29.456040] pwc: Allocated URB at 0xc9b83200
> [   29.456271] pwc: URB 0xc9b83600 submitted.
> [   29.456310] pwc: URB 0xc9b83400 submitted.
> [   29.456341] pwc: URB 0xc9b83200 submitted.
> [   29.456362] pwc: << pwc_isoc_init()
> [   30.078550] pwc: Frame buffer underflow (20076 bytes); discarded.
> [   30.170543] pwc: Frame buffer underflow (12428 bytes); discarded.
> [   30.272538] pwc: Frame buffer underflow (14340 bytes); discarded.
> [   30.374541] pwc: Frame buffer underflow (16252 bytes); discarded.
> [   30.476535] pwc: Frame buffer underflow (18164 bytes); discarded.
> [   30.578532] pwc: Frame buffer underflow (20076 bytes); discarded.
> [   30.670538] pwc: Frame buffer underflow (12428 bytes); discarded.
> [   30.772544] pwc: Frame buffer underflow (14340 bytes); discarded.
> [   30.874547] pwc: Frame buffer underflow (16252 bytes); discarded.
> [   30.976552] pwc: Frame buffer underflow (18164 bytes); discarded.
> [   31.078536] pwc: Frame buffer underflow (20076 bytes); discarded.
> [   31.170533] pwc: Frame buffer underflow (12428 bytes); discarded.
> [   31.272549] pwc: Frame buffer underflow (14340 bytes); discarded.
> 

[PATCH] v4l: vsp1: Fix tri-planar format support through DRM API

2016-08-18 Thread Laurent Pinchart
The vsp1 driver supports tri-planar formats, but the DRM API only passes
two memory addresses. Add a third one.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_drm.c | 6 +++---
 include/media/vsp1.h   | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_drm.c 
b/drivers/media/platform/vsp1/vsp1_drm.c
index 0a98a3c49b73..f76131b192a4 100644
--- a/drivers/media/platform/vsp1/vsp1_drm.c
+++ b/drivers/media/platform/vsp1/vsp1_drm.c
@@ -276,12 +276,12 @@ int vsp1_du_atomic_update(struct device *dev, unsigned 
int rpf_index,
}
 
dev_dbg(vsp1->dev,
-   "%s: RPF%u: (%u,%u)/%ux%u -> (%u,%u)/%ux%u (%08x), pitch %u dma 
{ %pad, %pad } zpos %u\n",
+   "%s: RPF%u: (%u,%u)/%ux%u -> (%u,%u)/%ux%u (%08x), pitch %u dma 
{ %pad, %pad, %pad } zpos %u\n",
__func__, rpf_index,
cfg->src.left, cfg->src.top, cfg->src.width, cfg->src.height,
cfg->dst.left, cfg->dst.top, cfg->dst.width, cfg->dst.height,
cfg->pixelformat, cfg->pitch, >mem[0], >mem[1],
-   cfg->zpos);
+   >mem[2], cfg->zpos);
 
/* Store the format, stride, memory buffer address, crop and compose
 * rectangles and Z-order position and for the input.
@@ -301,7 +301,7 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int 
rpf_index,
 
rpf->mem.addr[0] = cfg->mem[0];
rpf->mem.addr[1] = cfg->mem[1];
-   rpf->mem.addr[2] = 0;
+   rpf->mem.addr[2] = cfg->mem[2];
 
vsp1->drm->inputs[rpf_index].crop = cfg->src;
vsp1->drm->inputs[rpf_index].compose = cfg->dst;
diff --git a/include/media/vsp1.h b/include/media/vsp1.h
index 9322d9775fb7..458b400373d4 100644
--- a/include/media/vsp1.h
+++ b/include/media/vsp1.h
@@ -26,7 +26,7 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int width,
 struct vsp1_du_atomic_config {
u32 pixelformat;
unsigned int pitch;
-   dma_addr_t mem[2];
+   dma_addr_t mem[3];
struct v4l2_rect src;
struct v4l2_rect dst;
unsigned int alpha;
-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCHv6] support for AD5820 camera auto-focus coil

2016-08-18 Thread Pavel Machek
On Thu 2016-08-11 14:16:34, Sakari Ailus wrote:
> On Tue, Aug 09, 2016 at 01:23:23AM +0200, Pavel Machek wrote:
> > On Wed 2016-08-10 15:01:05, Sakari Ailus wrote:
> > > On Mon, Aug 08, 2016 at 11:41:32PM +0200, Pavel Machek wrote:
> > > > On Mon 2016-08-08 11:09:56, Sakari Ailus wrote:
> > > > > On Fri, Aug 05, 2016 at 12:26:11PM +0200, Pavel Machek wrote:
> > > > > > 
> > > > > > This adds support for AD5820 autofocus coil, found for example in
> > > > > > Nokia N900 smartphone.
> > > > > 
> > > > > Thanks, Pavel!
> > > > > 
> > > > > Let's use V4L2_CID_FOCUS_ABSOLUTE, as is in the patch. If we get 
> > > > > something
> > > > > better in the future, we'll switch to that then.
> > > > > 
> > > > > I've applied this to ad5820 branch in my tree.
> > > > 
> > > > Thanks. If I understands things correctly, both DTS patch and this 
> > > > patch are
> > > > waiting in your tree, so we should be good to go for 4.9 (unless some 
> > > > unexpected
> > > > problems surface)?
> > > 
> > > Yeah. I just compiled it but haven't tested it. I presume it'll work. :-)
> > 
> > I'm testing it on n900. I guess simpler hardware with ad5820 would be 
> > better for the
> > test...
> > 
> > What hardware do you have?
> 
> N900. What else could it be? :-) :-)

Heh. Basically anything is easier to develop for than n900 :-(.

Ok, for real testing, Ivaylo's camera patchset is useful, so that you
have picture to work with, plus your subdevs for omap3 patchset (which
needs a forward port).

I have patches against v4.7, if you are interested.

I guess subdevs for omap3 should be merged at this point. Do you have
any plans to do that, or should I take a look?

Best regards,

Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] [media] v4l: omap_vout: vrfb: Convert to dmaengine

2016-08-18 Thread Peter Ujfalusi
The dmaengine driver for sDMA now have support for interleaved transfer.
This trasnfer type was open coded with the legacy omap-dma API, but now
we can move it to dmaengine.

Signed-off-by: Peter Ujfalusi 
---
The dmaengine driver for sDMA now have support for interleaved transfer.
This trasnfer type was open coded with the legacy omap-dma API, but now
we can move it to dmaengine.

Signed-off-by: Peter Ujfalusi 
---
Hi,

I do not have access to any hardware where I could test if the conversion works
correctly. I think it should. The dmaengine part looks fine to me - not that
this means too much as I have written it ;)
Based on debugging the code with starring at it I think the old and the new way
would end up setting up the DMA in a same way. However the dmaengine driver will
set CSDP_DST_PACKED | CSDP_SRC_PACKED.

Laurent: would you be able to test this?

Regards,
Peter

 drivers/media/platform/omap/omap_vout_vrfb.c | 133 ---
 drivers/media/platform/omap/omap_voutdef.h   |   6 +-
 2 files changed, 83 insertions(+), 56 deletions(-)

diff --git a/drivers/media/platform/omap/omap_vout_vrfb.c 
b/drivers/media/platform/omap/omap_vout_vrfb.c
index b8638e4e1627..957ff7621652 100644
--- a/drivers/media/platform/omap/omap_vout_vrfb.c
+++ b/drivers/media/platform/omap/omap_vout_vrfb.c
@@ -16,7 +16,6 @@
 #include 
 #include 

-#include 
 #include 

 #include "omap_voutdef.h"
@@ -63,7 +62,7 @@ static int omap_vout_allocate_vrfb_buffers(struct 
omap_vout_device *vout,
 /*
  * Wakes up the application once the DMA transfer to VRFB space is completed.
  */
-static void omap_vout_vrfb_dma_tx_callback(int lch, u16 ch_status, void *data)
+static void omap_vout_vrfb_dma_tx_callback(void *data)
 {
struct vid_vrfb_dma *t = (struct vid_vrfb_dma *) data;

@@ -94,6 +93,7 @@ int omap_vout_setup_vrfb_bufs(struct platform_device *pdev, 
int vid_num,
int ret = 0, i, j;
struct omap_vout_device *vout;
struct video_device *vfd;
+   dma_cap_mask_t mask;
int image_width, image_height;
int vrfb_num_bufs = VRFB_NUM_BUFS;
struct v4l2_device *v4l2_dev = platform_get_drvdata(pdev);
@@ -131,17 +131,26 @@ int omap_vout_setup_vrfb_bufs(struct platform_device 
*pdev, int vid_num,
/*
 * Request and Initialize DMA, for DMA based VRFB transfer
 */
-   vout->vrfb_dma_tx.dev_id = OMAP_DMA_NO_DEVICE;
-   vout->vrfb_dma_tx.dma_ch = -1;
-   vout->vrfb_dma_tx.req_status = DMA_CHAN_ALLOTED;
-   ret = omap_request_dma(vout->vrfb_dma_tx.dev_id, "VRFB DMA TX",
-   omap_vout_vrfb_dma_tx_callback,
-   (void *) >vrfb_dma_tx, >vrfb_dma_tx.dma_ch);
-   if (ret < 0) {
+   dma_cap_zero(mask);
+   dma_cap_set(DMA_INTERLEAVE, mask);
+   vout->vrfb_dma_tx.chan = dma_request_chan_by_mask();
+   if (IS_ERR(vout->vrfb_dma_tx.chan)) {
vout->vrfb_dma_tx.req_status = DMA_CHAN_NOT_ALLOTED;
+   } else {
+   size_t xt_size = sizeof(struct dma_interleaved_template) +
+sizeof(struct data_chunk);
+
+   vout->vrfb_dma_tx.xt = kzalloc(xt_size, GFP_KERNEL);
+   if (!vout->vrfb_dma_tx.xt) {
+   dma_release_channel(vout->vrfb_dma_tx.chan);
+   vout->vrfb_dma_tx.req_status = DMA_CHAN_NOT_ALLOTED;
+   }
+   }
+
+   if (vout->vrfb_dma_tx.req_status == DMA_CHAN_NOT_ALLOTED)
dev_info(>dev, ": failed to allocate DMA Channel for"
" video%d\n", vfd->minor);
-   }
+
init_waitqueue_head(>vrfb_dma_tx.wait);

/* statically allocated the VRFB buffer is done through
@@ -176,7 +185,9 @@ void omap_vout_release_vrfb(struct omap_vout_device *vout)

if (vout->vrfb_dma_tx.req_status == DMA_CHAN_ALLOTED) {
vout->vrfb_dma_tx.req_status = DMA_CHAN_NOT_ALLOTED;
-   omap_free_dma(vout->vrfb_dma_tx.dma_ch);
+   kfree(vout->vrfb_dma_tx.xt);
+   dmaengine_terminate_sync(vout->vrfb_dma_tx.chan);
+   dma_release_channel(vout->vrfb_dma_tx.chan);
}
 }

@@ -218,70 +229,84 @@ int omap_vout_vrfb_buffer_setup(struct omap_vout_device 
*vout,
 }

 int omap_vout_prepare_vrfb(struct omap_vout_device *vout,
-   struct videobuf_buffer *vb)
+  struct videobuf_buffer *vb)
 {
-   dma_addr_t dmabuf;
-   struct vid_vrfb_dma *tx;
+   struct dma_async_tx_descriptor *tx;
+   enum dma_ctrl_flags flags;
+   struct dma_chan *chan = vout->vrfb_dma_tx.chan;
+   struct dma_device *dmadev = chan->device;
+   struct dma_interleaved_template *xt = vout->vrfb_dma_tx.xt;
+   dma_cookie_t cookie;
+   enum dma_status status;
enum dss_rotation rotation;
-   u32 dest_frame_index = 0, src_element_index = 0;
-   u32 

Re: Adding Linux support for the Ion Video 2 PC analog video capture device (em28xx)

2016-08-18 Thread Mauro Carvalho Chehab
Em Wed, 17 Aug 2016 15:26:40 -0400
Alexandre-Xavier Labonté-Lamoureux   escreveu:

> Hi,
> 
> I have an Ion Video 2 PC and a StarTech svid2usb23 (id: 0xeb1a,
> 0x5051). I have documented them here:
> https://linuxtv.org/wiki/index.php/Ion_Video_2_PC
> 
> I can get them to be recognized by patching the em28xx driver. I use
> "EM2860_BOARD_TVP5150_REFERENCE_DESIGN".
> (The patch can be found here:
> https://www.linuxtv.org/wiki/index.php/Ion_Video_2_PC#Making_it_work)
> 
> Yet, it almost works, there is only one bug.
> 
> When I plug something yellow composite input of the device, it
> captures one frame then stops. If I disconnect the composite video so
> that there is no video input, then it starts capturing frames again.
> So the device doesn't want to capture video when there is input, it
> only captures frames when their is nothing connected to it.
> 
> I can see that it stops capturing frames by looking at the frame
> counter in qv4l2.
> I have made a video about this problem: https://youtu.be/z96OfgHGDao?t=40s
> You can see what I explained in the previous paragraph at 1:58 in the video.
> 
> These are the chips inside the Ion Video 2 PC:
> * Empia EM2860
> * Empia EMP202
> * 5150AM1
> 
> What would be the next thing to do to make it work? Thanks.

It seems that you're using some game console to generate images.
Those usually output video in progressive mode, instead of using
interlaced mode. Maybe that's the cause of the issues you're
having.

You could try to write a quick hack by patching em28xx_v4l2_init, at 
drivers/media/usb/em28xx/em28xx-video.c.

Seek for those lines:

if (dev->board.is_webcam)
v4l2->progressive = true;

And comment the first one. If this works, then we may add a modprobe
parameter (like saa7134) or something else to fix it.

Thanks,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH for v4.8] cec-edid: check for IEEE identifier

2016-08-18 Thread Hans Verkuil
The cec_get_edid_spa_location() function did not verify that the IEEE
identifier in the Vendor Specific Data Block matched the HDMI-LLC
identifier. This could result in the wrong VSDB block being returned.

For example, for HDMI 2.0 EDIDs there is also a HDMI Forum VSDB.

So check the IEEE identifier as well.

Signed-off-by: Hans Verkuil 
---
diff --git a/drivers/media/cec-edid.c b/drivers/media/cec-edid.c
index 7001824..5719b99 100644
--- a/drivers/media/cec-edid.c
+++ b/drivers/media/cec-edid.c
@@ -70,7 +70,10 @@ static unsigned int cec_get_edid_spa_location(const u8 
*edid, unsigned int size)
u8 tag = edid[i] >> 5;
u8 len = edid[i] & 0x1f;

-   if (tag == 3 && len >= 5 && i + len <= end)
+   if (tag == 3 && len >= 5 && i + len <= end &&
+   edid[i + 1] == 0x03 &&
+   edid[i + 2] == 0x0c &&
+   edid[i + 3] == 0x00)
return i + 4;
i += len + 1;
} while (i < end);


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html