All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] Stateless FWHT de-staging
@ 2020-11-26 13:27 Hans Verkuil
  2020-11-26 13:27 ` [PATCH 1/6] vicodec: add V4L2_ prefix before FWHT_VERSION and FWHT_FL_* Hans Verkuil
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Hans Verkuil @ 2020-11-26 13:27 UTC (permalink / raw)
  To: linux-media; +Cc: Ezequiel Garcia

This series sits on top of Ezequiel's H.264 de-staging series:

https://patchwork.linuxtv.org/project/linux-media/cover/20201126093618.137292-1-ezequiel@collabora.com/

The first patch does a rename of the FWHT version and FWHT flags,
since these will become part of the public API. No other changes
in this patch.

The second patch moves all the FWHT-related API elements to the
public headers and deletes include/media/fwht-ctrls.h.

The third moves the FWHT stateless documentation to
ext-ctrls-codec-stateless.rst (no other changes).

The 4th and 5th patches clean up some formatting issues, not
related to FWHT.

The final patch documents V4L2_CTRL_TYPE_FWHT_PARAMS and p_fwht_params
and improves the V4L2_PIX_FMT_FWHT_STATELESS description.

Regards,

        Hans

Hans Verkuil (6):
  vicodec: add V4L2_ prefix before FWHT_VERSION and FWHT_FL_*
  vicodec: mark the stateless FWHT API as stable
  ext-ctrls-codec.rst: move FWHT docs to ext-ctrls-codec-stateless.rst
  pixfmt-compressed.rst: fix 'bullet' formatting
  vidioc-g-ext-ctrls.rst: add missing 'struct' before the types
  userspace-api/media: finalize stateless FWHT codec docs

 .../media/v4l/ext-ctrls-codec-stateless.rst   | 120 +++++++++++++++++
 .../media/v4l/ext-ctrls-codec.rst             | 121 ------------------
 .../media/v4l/pixfmt-compressed.rst           |  12 +-
 .../media/v4l/vidioc-g-ext-ctrls.rst          |  18 ++-
 .../media/v4l/vidioc-queryctrl.rst            |   6 +
 .../media/videodev2.h.rst.exceptions          |   1 +
 .../media/test-drivers/vicodec/codec-fwht.c   |  13 +-
 .../media/test-drivers/vicodec/codec-fwht.h   |  32 -----
 .../test-drivers/vicodec/codec-v4l2-fwht.c    |  88 ++++++-------
 .../media/test-drivers/vicodec/vicodec-core.c |  46 +++----
 drivers/media/v4l2-core/v4l2-ctrls.c          |  20 ++-
 include/media/fwht-ctrls.h                    |  31 -----
 include/media/v4l2-ctrls.h                    |   1 -
 include/uapi/linux/v4l2-controls.h            |  70 ++++++++++
 include/uapi/linux/videodev2.h                |   3 +
 15 files changed, 310 insertions(+), 272 deletions(-)
 delete mode 100644 include/media/fwht-ctrls.h

-- 
2.29.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/6] vicodec: add V4L2_ prefix before FWHT_VERSION and FWHT_FL_*
  2020-11-26 13:27 [PATCH 0/6] Stateless FWHT de-staging Hans Verkuil
@ 2020-11-26 13:27 ` Hans Verkuil
  2020-11-26 13:27 ` [PATCH 2/6] vicodec: mark the stateless FWHT API as stable Hans Verkuil
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Hans Verkuil @ 2020-11-26 13:27 UTC (permalink / raw)
  To: linux-media; +Cc: Ezequiel Garcia, Hans Verkuil

No other changes. This patch is preparation for promoting the
stateless FWHT codec API as a stable public API.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
 .../media/v4l/ext-ctrls-codec.rst             | 32 +++----
 .../media/test-drivers/vicodec/codec-fwht.c   | 12 +--
 .../media/test-drivers/vicodec/codec-fwht.h   | 40 ++++-----
 .../test-drivers/vicodec/codec-v4l2-fwht.c    | 88 +++++++++----------
 .../media/test-drivers/vicodec/vicodec-core.c | 40 ++++-----
 5 files changed, 106 insertions(+), 106 deletions(-)

diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
index e815fffd1cd8..34173ed326fc 100644
--- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
+++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
@@ -2284,52 +2284,52 @@ FWHT Flags
     :stub-columns: 0
     :widths:       3 1 4
 
-    * - ``FWHT_FL_IS_INTERLACED``
+    * - ``V4L2_FWHT_FL_IS_INTERLACED``
       - 0x00000001
       - Set if this is an interlaced format
-    * - ``FWHT_FL_IS_BOTTOM_FIRST``
+    * - ``V4L2_FWHT_FL_IS_BOTTOM_FIRST``
       - 0x00000002
       - Set if this is a bottom-first (NTSC) interlaced format
-    * - ``FWHT_FL_IS_ALTERNATE``
+    * - ``V4L2_FWHT_FL_IS_ALTERNATE``
       - 0x00000004
       - Set if each 'frame' contains just one field
-    * - ``FWHT_FL_IS_BOTTOM_FIELD``
+    * - ``V4L2_FWHT_FL_IS_BOTTOM_FIELD``
       - 0x00000008
-      - If FWHT_FL_IS_ALTERNATE was set, then this is set if this 'frame' is the
+      - If V4L2_FWHT_FL_IS_ALTERNATE was set, then this is set if this 'frame' is the
 	bottom field, else it is the top field.
-    * - ``FWHT_FL_LUMA_IS_UNCOMPRESSED``
+    * - ``V4L2_FWHT_FL_LUMA_IS_UNCOMPRESSED``
       - 0x00000010
       - Set if the luma plane is uncompressed
-    * - ``FWHT_FL_CB_IS_UNCOMPRESSED``
+    * - ``V4L2_FWHT_FL_CB_IS_UNCOMPRESSED``
       - 0x00000020
       - Set if the cb plane is uncompressed
-    * - ``FWHT_FL_CR_IS_UNCOMPRESSED``
+    * - ``V4L2_FWHT_FL_CR_IS_UNCOMPRESSED``
       - 0x00000040
       - Set if the cr plane is uncompressed
-    * - ``FWHT_FL_CHROMA_FULL_HEIGHT``
+    * - ``V4L2_FWHT_FL_CHROMA_FULL_HEIGHT``
       - 0x00000080
       - Set if the chroma plane has the same height as the luma plane,
 	else the chroma plane is half the height of the luma plane
-    * - ``FWHT_FL_CHROMA_FULL_WIDTH``
+    * - ``V4L2_FWHT_FL_CHROMA_FULL_WIDTH``
       - 0x00000100
       - Set if the chroma plane has the same width as the luma plane,
 	else the chroma plane is half the width of the luma plane
-    * - ``FWHT_FL_ALPHA_IS_UNCOMPRESSED``
+    * - ``V4L2_FWHT_FL_ALPHA_IS_UNCOMPRESSED``
       - 0x00000200
       - Set if the alpha plane is uncompressed
-    * - ``FWHT_FL_I_FRAME``
+    * - ``V4L2_FWHT_FL_I_FRAME``
       - 0x00000400
       - Set if this is an I-frame
-    * - ``FWHT_FL_COMPONENTS_NUM_MSK``
+    * - ``V4L2_FWHT_FL_COMPONENTS_NUM_MSK``
       - 0x00070000
       - A 4-values flag - the number of components - 1
-    * - ``FWHT_FL_PIXENC_YUV``
+    * - ``V4L2_FWHT_FL_PIXENC_YUV``
       - 0x00080000
       - Set if the pixel encoding is YUV
-    * - ``FWHT_FL_PIXENC_RGB``
+    * - ``V4L2_FWHT_FL_PIXENC_RGB``
       - 0x00100000
       - Set if the pixel encoding is RGB
-    * - ``FWHT_FL_PIXENC_HSV``
+    * - ``V4L2_FWHT_FL_PIXENC_HSV``
       - 0x00180000
       - Set if the pixel encoding is HSV
 
diff --git a/drivers/media/test-drivers/vicodec/codec-fwht.c b/drivers/media/test-drivers/vicodec/codec-fwht.c
index 31faf319e508..5dbf76fd8185 100644
--- a/drivers/media/test-drivers/vicodec/codec-fwht.c
+++ b/drivers/media/test-drivers/vicodec/codec-fwht.c
@@ -920,7 +920,7 @@ bool fwht_decode_frame(struct fwht_cframe *cf, u32 hdr_flags,
 	if (!decode_plane(cf, &rlco, height, width, ref->luma, ref_stride,
 			  ref->luma_alpha_step, dst->luma, dst_stride,
 			  dst->luma_alpha_step,
-			  hdr_flags & FWHT_FL_LUMA_IS_UNCOMPRESSED,
+			  hdr_flags & V4L2_FWHT_FL_LUMA_IS_UNCOMPRESSED,
 			  end_of_rlco_buf))
 		return false;
 
@@ -928,21 +928,21 @@ bool fwht_decode_frame(struct fwht_cframe *cf, u32 hdr_flags,
 		u32 h = height;
 		u32 w = width;
 
-		if (!(hdr_flags & FWHT_FL_CHROMA_FULL_HEIGHT))
+		if (!(hdr_flags & V4L2_FWHT_FL_CHROMA_FULL_HEIGHT))
 			h /= 2;
-		if (!(hdr_flags & FWHT_FL_CHROMA_FULL_WIDTH))
+		if (!(hdr_flags & V4L2_FWHT_FL_CHROMA_FULL_WIDTH))
 			w /= 2;
 
 		if (!decode_plane(cf, &rlco, h, w, ref->cb, ref_chroma_stride,
 				  ref->chroma_step, dst->cb, dst_chroma_stride,
 				  dst->chroma_step,
-				  hdr_flags & FWHT_FL_CB_IS_UNCOMPRESSED,
+				  hdr_flags & V4L2_FWHT_FL_CB_IS_UNCOMPRESSED,
 				  end_of_rlco_buf))
 			return false;
 		if (!decode_plane(cf, &rlco, h, w, ref->cr, ref_chroma_stride,
 				  ref->chroma_step, dst->cr, dst_chroma_stride,
 				  dst->chroma_step,
-				  hdr_flags & FWHT_FL_CR_IS_UNCOMPRESSED,
+				  hdr_flags & V4L2_FWHT_FL_CR_IS_UNCOMPRESSED,
 				  end_of_rlco_buf))
 			return false;
 	}
@@ -951,7 +951,7 @@ bool fwht_decode_frame(struct fwht_cframe *cf, u32 hdr_flags,
 		if (!decode_plane(cf, &rlco, height, width, ref->alpha, ref_stride,
 				  ref->luma_alpha_step, dst->alpha, dst_stride,
 				  dst->luma_alpha_step,
-				  hdr_flags & FWHT_FL_ALPHA_IS_UNCOMPRESSED,
+				  hdr_flags & V4L2_FWHT_FL_ALPHA_IS_UNCOMPRESSED,
 				  end_of_rlco_buf))
 			return false;
 	return true;
diff --git a/drivers/media/test-drivers/vicodec/codec-fwht.h b/drivers/media/test-drivers/vicodec/codec-fwht.h
index b6fec2b1cbca..78e2841762fb 100644
--- a/drivers/media/test-drivers/vicodec/codec-fwht.h
+++ b/drivers/media/test-drivers/vicodec/codec-fwht.h
@@ -56,37 +56,37 @@
 #define FWHT_MAGIC1 0x4f4f4f4f
 #define FWHT_MAGIC2 0xffffffff
 
-#define FWHT_VERSION 3
+#define V4L2_FWHT_VERSION 3
 
 /* Set if this is an interlaced format */
-#define FWHT_FL_IS_INTERLACED		BIT(0)
+#define V4L2_FWHT_FL_IS_INTERLACED		BIT(0)
 /* Set if this is a bottom-first (NTSC) interlaced format */
-#define FWHT_FL_IS_BOTTOM_FIRST		BIT(1)
+#define V4L2_FWHT_FL_IS_BOTTOM_FIRST		BIT(1)
 /* Set if each 'frame' contains just one field */
-#define FWHT_FL_IS_ALTERNATE		BIT(2)
+#define V4L2_FWHT_FL_IS_ALTERNATE		BIT(2)
 /*
- * If FWHT_FL_IS_ALTERNATE was set, then this is set if this
+ * If V4L2_FWHT_FL_IS_ALTERNATE was set, then this is set if this
  * 'frame' is the bottom field, else it is the top field.
  */
-#define FWHT_FL_IS_BOTTOM_FIELD		BIT(3)
+#define V4L2_FWHT_FL_IS_BOTTOM_FIELD		BIT(3)
 /* Set if this frame is uncompressed */
-#define FWHT_FL_LUMA_IS_UNCOMPRESSED	BIT(4)
-#define FWHT_FL_CB_IS_UNCOMPRESSED	BIT(5)
-#define FWHT_FL_CR_IS_UNCOMPRESSED	BIT(6)
-#define FWHT_FL_CHROMA_FULL_HEIGHT	BIT(7)
-#define FWHT_FL_CHROMA_FULL_WIDTH	BIT(8)
-#define FWHT_FL_ALPHA_IS_UNCOMPRESSED	BIT(9)
-#define FWHT_FL_I_FRAME			BIT(10)
+#define V4L2_FWHT_FL_LUMA_IS_UNCOMPRESSED	BIT(4)
+#define V4L2_FWHT_FL_CB_IS_UNCOMPRESSED	BIT(5)
+#define V4L2_FWHT_FL_CR_IS_UNCOMPRESSED	BIT(6)
+#define V4L2_FWHT_FL_CHROMA_FULL_HEIGHT	BIT(7)
+#define V4L2_FWHT_FL_CHROMA_FULL_WIDTH	BIT(8)
+#define V4L2_FWHT_FL_ALPHA_IS_UNCOMPRESSED	BIT(9)
+#define V4L2_FWHT_FL_I_FRAME			BIT(10)
 
 /* A 4-values flag - the number of components - 1 */
-#define FWHT_FL_COMPONENTS_NUM_MSK	GENMASK(18, 16)
-#define FWHT_FL_COMPONENTS_NUM_OFFSET	16
+#define V4L2_FWHT_FL_COMPONENTS_NUM_MSK	GENMASK(18, 16)
+#define V4L2_FWHT_FL_COMPONENTS_NUM_OFFSET	16
 
-#define FWHT_FL_PIXENC_MSK	GENMASK(20, 19)
-#define FWHT_FL_PIXENC_OFFSET	19
-#define FWHT_FL_PIXENC_YUV	(1 << FWHT_FL_PIXENC_OFFSET)
-#define FWHT_FL_PIXENC_RGB	(2 << FWHT_FL_PIXENC_OFFSET)
-#define FWHT_FL_PIXENC_HSV	(3 << FWHT_FL_PIXENC_OFFSET)
+#define V4L2_FWHT_FL_PIXENC_MSK	GENMASK(20, 19)
+#define V4L2_FWHT_FL_PIXENC_OFFSET	19
+#define V4L2_FWHT_FL_PIXENC_YUV	(1 << V4L2_FWHT_FL_PIXENC_OFFSET)
+#define V4L2_FWHT_FL_PIXENC_RGB	(2 << V4L2_FWHT_FL_PIXENC_OFFSET)
+#define V4L2_FWHT_FL_PIXENC_HSV	(3 << V4L2_FWHT_FL_PIXENC_OFFSET)
 
 /*
  * A macro to calculate the needed padding in order to make sure
diff --git a/drivers/media/test-drivers/vicodec/codec-v4l2-fwht.c b/drivers/media/test-drivers/vicodec/codec-v4l2-fwht.c
index b6e39fbd8ad5..0c83678fcdad 100644
--- a/drivers/media/test-drivers/vicodec/codec-v4l2-fwht.c
+++ b/drivers/media/test-drivers/vicodec/codec-v4l2-fwht.c
@@ -11,34 +11,34 @@
 #include "codec-v4l2-fwht.h"
 
 static const struct v4l2_fwht_pixfmt_info v4l2_fwht_pixfmts[] = {
-	{ V4L2_PIX_FMT_YUV420,  1, 3, 2, 1, 1, 2, 2, 3, 3, FWHT_FL_PIXENC_YUV},
-	{ V4L2_PIX_FMT_YVU420,  1, 3, 2, 1, 1, 2, 2, 3, 3, FWHT_FL_PIXENC_YUV},
-	{ V4L2_PIX_FMT_YUV422P, 1, 2, 1, 1, 1, 2, 1, 3, 3, FWHT_FL_PIXENC_YUV},
-	{ V4L2_PIX_FMT_NV12,    1, 3, 2, 1, 2, 2, 2, 3, 2, FWHT_FL_PIXENC_YUV},
-	{ V4L2_PIX_FMT_NV21,    1, 3, 2, 1, 2, 2, 2, 3, 2, FWHT_FL_PIXENC_YUV},
-	{ V4L2_PIX_FMT_NV16,    1, 2, 1, 1, 2, 2, 1, 3, 2, FWHT_FL_PIXENC_YUV},
-	{ V4L2_PIX_FMT_NV61,    1, 2, 1, 1, 2, 2, 1, 3, 2, FWHT_FL_PIXENC_YUV},
-	{ V4L2_PIX_FMT_NV24,    1, 3, 1, 1, 2, 1, 1, 3, 2, FWHT_FL_PIXENC_YUV},
-	{ V4L2_PIX_FMT_NV42,    1, 3, 1, 1, 2, 1, 1, 3, 2, FWHT_FL_PIXENC_YUV},
-	{ V4L2_PIX_FMT_YUYV,    2, 2, 1, 2, 4, 2, 1, 3, 1, FWHT_FL_PIXENC_YUV},
-	{ V4L2_PIX_FMT_YVYU,    2, 2, 1, 2, 4, 2, 1, 3, 1, FWHT_FL_PIXENC_YUV},
-	{ V4L2_PIX_FMT_UYVY,    2, 2, 1, 2, 4, 2, 1, 3, 1, FWHT_FL_PIXENC_YUV},
-	{ V4L2_PIX_FMT_VYUY,    2, 2, 1, 2, 4, 2, 1, 3, 1, FWHT_FL_PIXENC_YUV},
-	{ V4L2_PIX_FMT_BGR24,   3, 3, 1, 3, 3, 1, 1, 3, 1, FWHT_FL_PIXENC_RGB},
-	{ V4L2_PIX_FMT_RGB24,   3, 3, 1, 3, 3, 1, 1, 3, 1, FWHT_FL_PIXENC_RGB},
-	{ V4L2_PIX_FMT_HSV24,   3, 3, 1, 3, 3, 1, 1, 3, 1, FWHT_FL_PIXENC_HSV},
-	{ V4L2_PIX_FMT_BGR32,   4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_RGB},
-	{ V4L2_PIX_FMT_XBGR32,  4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_RGB},
-	{ V4L2_PIX_FMT_ABGR32,  4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_RGB},
-	{ V4L2_PIX_FMT_RGB32,   4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_RGB},
-	{ V4L2_PIX_FMT_XRGB32,  4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_RGB},
-	{ V4L2_PIX_FMT_ARGB32,  4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_RGB},
-	{ V4L2_PIX_FMT_BGRX32,  4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_RGB},
-	{ V4L2_PIX_FMT_BGRA32,  4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_RGB},
-	{ V4L2_PIX_FMT_RGBX32,  4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_RGB},
-	{ V4L2_PIX_FMT_RGBA32,  4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_RGB},
-	{ V4L2_PIX_FMT_HSV32,   4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_HSV},
-	{ V4L2_PIX_FMT_GREY,    1, 1, 1, 1, 0, 1, 1, 1, 1, FWHT_FL_PIXENC_RGB},
+	{ V4L2_PIX_FMT_YUV420,  1, 3, 2, 1, 1, 2, 2, 3, 3, V4L2_FWHT_FL_PIXENC_YUV},
+	{ V4L2_PIX_FMT_YVU420,  1, 3, 2, 1, 1, 2, 2, 3, 3, V4L2_FWHT_FL_PIXENC_YUV},
+	{ V4L2_PIX_FMT_YUV422P, 1, 2, 1, 1, 1, 2, 1, 3, 3, V4L2_FWHT_FL_PIXENC_YUV},
+	{ V4L2_PIX_FMT_NV12,    1, 3, 2, 1, 2, 2, 2, 3, 2, V4L2_FWHT_FL_PIXENC_YUV},
+	{ V4L2_PIX_FMT_NV21,    1, 3, 2, 1, 2, 2, 2, 3, 2, V4L2_FWHT_FL_PIXENC_YUV},
+	{ V4L2_PIX_FMT_NV16,    1, 2, 1, 1, 2, 2, 1, 3, 2, V4L2_FWHT_FL_PIXENC_YUV},
+	{ V4L2_PIX_FMT_NV61,    1, 2, 1, 1, 2, 2, 1, 3, 2, V4L2_FWHT_FL_PIXENC_YUV},
+	{ V4L2_PIX_FMT_NV24,    1, 3, 1, 1, 2, 1, 1, 3, 2, V4L2_FWHT_FL_PIXENC_YUV},
+	{ V4L2_PIX_FMT_NV42,    1, 3, 1, 1, 2, 1, 1, 3, 2, V4L2_FWHT_FL_PIXENC_YUV},
+	{ V4L2_PIX_FMT_YUYV,    2, 2, 1, 2, 4, 2, 1, 3, 1, V4L2_FWHT_FL_PIXENC_YUV},
+	{ V4L2_PIX_FMT_YVYU,    2, 2, 1, 2, 4, 2, 1, 3, 1, V4L2_FWHT_FL_PIXENC_YUV},
+	{ V4L2_PIX_FMT_UYVY,    2, 2, 1, 2, 4, 2, 1, 3, 1, V4L2_FWHT_FL_PIXENC_YUV},
+	{ V4L2_PIX_FMT_VYUY,    2, 2, 1, 2, 4, 2, 1, 3, 1, V4L2_FWHT_FL_PIXENC_YUV},
+	{ V4L2_PIX_FMT_BGR24,   3, 3, 1, 3, 3, 1, 1, 3, 1, V4L2_FWHT_FL_PIXENC_RGB},
+	{ V4L2_PIX_FMT_RGB24,   3, 3, 1, 3, 3, 1, 1, 3, 1, V4L2_FWHT_FL_PIXENC_RGB},
+	{ V4L2_PIX_FMT_HSV24,   3, 3, 1, 3, 3, 1, 1, 3, 1, V4L2_FWHT_FL_PIXENC_HSV},
+	{ V4L2_PIX_FMT_BGR32,   4, 4, 1, 4, 4, 1, 1, 4, 1, V4L2_FWHT_FL_PIXENC_RGB},
+	{ V4L2_PIX_FMT_XBGR32,  4, 4, 1, 4, 4, 1, 1, 4, 1, V4L2_FWHT_FL_PIXENC_RGB},
+	{ V4L2_PIX_FMT_ABGR32,  4, 4, 1, 4, 4, 1, 1, 4, 1, V4L2_FWHT_FL_PIXENC_RGB},
+	{ V4L2_PIX_FMT_RGB32,   4, 4, 1, 4, 4, 1, 1, 4, 1, V4L2_FWHT_FL_PIXENC_RGB},
+	{ V4L2_PIX_FMT_XRGB32,  4, 4, 1, 4, 4, 1, 1, 4, 1, V4L2_FWHT_FL_PIXENC_RGB},
+	{ V4L2_PIX_FMT_ARGB32,  4, 4, 1, 4, 4, 1, 1, 4, 1, V4L2_FWHT_FL_PIXENC_RGB},
+	{ V4L2_PIX_FMT_BGRX32,  4, 4, 1, 4, 4, 1, 1, 4, 1, V4L2_FWHT_FL_PIXENC_RGB},
+	{ V4L2_PIX_FMT_BGRA32,  4, 4, 1, 4, 4, 1, 1, 4, 1, V4L2_FWHT_FL_PIXENC_RGB},
+	{ V4L2_PIX_FMT_RGBX32,  4, 4, 1, 4, 4, 1, 1, 4, 1, V4L2_FWHT_FL_PIXENC_RGB},
+	{ V4L2_PIX_FMT_RGBA32,  4, 4, 1, 4, 4, 1, 1, 4, 1, V4L2_FWHT_FL_PIXENC_RGB},
+	{ V4L2_PIX_FMT_HSV32,   4, 4, 1, 4, 4, 1, 1, 4, 1, V4L2_FWHT_FL_PIXENC_HSV},
+	{ V4L2_PIX_FMT_GREY,    1, 1, 1, 1, 0, 1, 1, 1, 1, V4L2_FWHT_FL_PIXENC_RGB},
 };
 
 bool v4l2_fwht_validate_fmt(const struct v4l2_fwht_pixfmt_info *info,
@@ -251,25 +251,25 @@ int v4l2_fwht_encode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out)
 	p_hdr = (struct fwht_cframe_hdr *)p_out;
 	p_hdr->magic1 = FWHT_MAGIC1;
 	p_hdr->magic2 = FWHT_MAGIC2;
-	p_hdr->version = htonl(FWHT_VERSION);
+	p_hdr->version = htonl(V4L2_FWHT_VERSION);
 	p_hdr->width = htonl(state->visible_width);
 	p_hdr->height = htonl(state->visible_height);
-	flags |= (info->components_num - 1) << FWHT_FL_COMPONENTS_NUM_OFFSET;
+	flags |= (info->components_num - 1) << V4L2_FWHT_FL_COMPONENTS_NUM_OFFSET;
 	flags |= info->pixenc;
 	if (encoding & FWHT_LUMA_UNENCODED)
-		flags |= FWHT_FL_LUMA_IS_UNCOMPRESSED;
+		flags |= V4L2_FWHT_FL_LUMA_IS_UNCOMPRESSED;
 	if (encoding & FWHT_CB_UNENCODED)
-		flags |= FWHT_FL_CB_IS_UNCOMPRESSED;
+		flags |= V4L2_FWHT_FL_CB_IS_UNCOMPRESSED;
 	if (encoding & FWHT_CR_UNENCODED)
-		flags |= FWHT_FL_CR_IS_UNCOMPRESSED;
+		flags |= V4L2_FWHT_FL_CR_IS_UNCOMPRESSED;
 	if (encoding & FWHT_ALPHA_UNENCODED)
-		flags |= FWHT_FL_ALPHA_IS_UNCOMPRESSED;
+		flags |= V4L2_FWHT_FL_ALPHA_IS_UNCOMPRESSED;
 	if (!(encoding & FWHT_FRAME_PCODED))
-		flags |= FWHT_FL_I_FRAME;
+		flags |= V4L2_FWHT_FL_I_FRAME;
 	if (rf.height_div == 1)
-		flags |= FWHT_FL_CHROMA_FULL_HEIGHT;
+		flags |= V4L2_FWHT_FL_CHROMA_FULL_HEIGHT;
 	if (rf.width_div == 1)
-		flags |= FWHT_FL_CHROMA_FULL_WIDTH;
+		flags |= V4L2_FWHT_FL_CHROMA_FULL_WIDTH;
 	p_hdr->flags = htonl(flags);
 	p_hdr->colorspace = htonl(state->colorspace);
 	p_hdr->xfer_func = htonl(state->xfer_func);
@@ -299,9 +299,9 @@ int v4l2_fwht_decode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out)
 	info = state->info;
 
 	version = ntohl(state->header.version);
-	if (!version || version > FWHT_VERSION) {
+	if (!version || version > V4L2_FWHT_VERSION) {
 		pr_err("version %d is not supported, current version is %d\n",
-		       version, FWHT_VERSION);
+		       version, V4L2_FWHT_VERSION);
 		return -EINVAL;
 	}
 
@@ -317,10 +317,10 @@ int v4l2_fwht_decode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out)
 	flags = ntohl(state->header.flags);
 
 	if (version >= 2) {
-		if ((flags & FWHT_FL_PIXENC_MSK) != info->pixenc)
+		if ((flags & V4L2_FWHT_FL_PIXENC_MSK) != info->pixenc)
 			return -EINVAL;
-		components_num = 1 + ((flags & FWHT_FL_COMPONENTS_NUM_MSK) >>
-				FWHT_FL_COMPONENTS_NUM_OFFSET);
+		components_num = 1 + ((flags & V4L2_FWHT_FL_COMPONENTS_NUM_MSK) >>
+				V4L2_FWHT_FL_COMPONENTS_NUM_OFFSET);
 	}
 
 	if (components_num != info->components_num)
@@ -333,8 +333,8 @@ int v4l2_fwht_decode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out)
 	cf.rlc_data = (__be16 *)p_in;
 	cf.size = ntohl(state->header.size);
 
-	hdr_width_div = (flags & FWHT_FL_CHROMA_FULL_WIDTH) ? 1 : 2;
-	hdr_height_div = (flags & FWHT_FL_CHROMA_FULL_HEIGHT) ? 1 : 2;
+	hdr_width_div = (flags & V4L2_FWHT_FL_CHROMA_FULL_WIDTH) ? 1 : 2;
+	hdr_height_div = (flags & V4L2_FWHT_FL_CHROMA_FULL_HEIGHT) ? 1 : 2;
 	if (hdr_width_div != info->width_div ||
 	    hdr_height_div != info->height_div)
 		return -EINVAL;
diff --git a/drivers/media/test-drivers/vicodec/vicodec-core.c b/drivers/media/test-drivers/vicodec/vicodec-core.c
index 0e115683f8da..084b75c226c5 100644
--- a/drivers/media/test-drivers/vicodec/vicodec-core.c
+++ b/drivers/media/test-drivers/vicodec/vicodec-core.c
@@ -200,14 +200,14 @@ static void copy_cap_to_ref(const u8 *cap, const struct v4l2_fwht_pixfmt_info *i
 
 static bool validate_by_version(unsigned int flags, unsigned int version)
 {
-	if (!version || version > FWHT_VERSION)
+	if (!version || version > V4L2_FWHT_VERSION)
 		return false;
 
 	if (version >= 2) {
 		unsigned int components_num = 1 +
-			((flags & FWHT_FL_COMPONENTS_NUM_MSK) >>
-			 FWHT_FL_COMPONENTS_NUM_OFFSET);
-		unsigned int pixenc = flags & FWHT_FL_PIXENC_MSK;
+			((flags & V4L2_FWHT_FL_COMPONENTS_NUM_MSK) >>
+			 V4L2_FWHT_FL_COMPONENTS_NUM_OFFSET);
+		unsigned int pixenc = flags & V4L2_FWHT_FL_PIXENC_MSK;
 
 		if (components_num == 0 || components_num > 4 || !pixenc)
 			return false;
@@ -219,18 +219,18 @@ static bool validate_stateless_params_flags(const struct v4l2_ctrl_fwht_params *
 					    const struct v4l2_fwht_pixfmt_info *cur_info)
 {
 	unsigned int width_div =
-		(params->flags & FWHT_FL_CHROMA_FULL_WIDTH) ? 1 : 2;
+		(params->flags & V4L2_FWHT_FL_CHROMA_FULL_WIDTH) ? 1 : 2;
 	unsigned int height_div =
-		(params->flags & FWHT_FL_CHROMA_FULL_HEIGHT) ? 1 : 2;
+		(params->flags & V4L2_FWHT_FL_CHROMA_FULL_HEIGHT) ? 1 : 2;
 	unsigned int components_num = 3;
 	unsigned int pixenc = 0;
 
 	if (params->version < 3)
 		return false;
 
-	components_num = 1 + ((params->flags & FWHT_FL_COMPONENTS_NUM_MSK) >>
-			      FWHT_FL_COMPONENTS_NUM_OFFSET);
-	pixenc = (params->flags & FWHT_FL_PIXENC_MSK);
+	components_num = 1 + ((params->flags & V4L2_FWHT_FL_COMPONENTS_NUM_MSK) >>
+			      V4L2_FWHT_FL_COMPONENTS_NUM_OFFSET);
+	pixenc = (params->flags & V4L2_FWHT_FL_PIXENC_MSK);
 	if (v4l2_fwht_validate_fmt(cur_info, width_div, height_div,
 				    components_num, pixenc))
 		return true;
@@ -278,7 +278,7 @@ static int device_process(struct vicodec_ctx *ctx,
 		 * set the reference buffer from the reference timestamp
 		 * only if this is a P-frame
 		 */
-		if (!(ntohl(ctx->state.header.flags) & FWHT_FL_I_FRAME)) {
+		if (!(ntohl(ctx->state.header.flags) & V4L2_FWHT_FL_I_FRAME)) {
 			struct vb2_buffer *ref_vb2_buf;
 			int ref_buf_idx;
 			struct vb2_queue *vq_cap =
@@ -331,7 +331,7 @@ static int device_process(struct vicodec_ctx *ctx,
 			copy_cap_to_ref(p_dst, ctx->state.info, &ctx->state);
 
 		vb2_set_plane_payload(&dst_vb->vb2_buf, 0, q_dst->sizeimage);
-		if (ntohl(ctx->state.header.flags) & FWHT_FL_I_FRAME)
+		if (ntohl(ctx->state.header.flags) & V4L2_FWHT_FL_I_FRAME)
 			dst_vb->flags |= V4L2_BUF_FLAG_KEYFRAME;
 		else
 			dst_vb->flags |= V4L2_BUF_FLAG_PFRAME;
@@ -480,16 +480,16 @@ static const struct v4l2_fwht_pixfmt_info *
 info_from_header(const struct fwht_cframe_hdr *p_hdr)
 {
 	unsigned int flags = ntohl(p_hdr->flags);
-	unsigned int width_div = (flags & FWHT_FL_CHROMA_FULL_WIDTH) ? 1 : 2;
-	unsigned int height_div = (flags & FWHT_FL_CHROMA_FULL_HEIGHT) ? 1 : 2;
+	unsigned int width_div = (flags & V4L2_FWHT_FL_CHROMA_FULL_WIDTH) ? 1 : 2;
+	unsigned int height_div = (flags & V4L2_FWHT_FL_CHROMA_FULL_HEIGHT) ? 1 : 2;
 	unsigned int components_num = 3;
 	unsigned int pixenc = 0;
 	unsigned int version = ntohl(p_hdr->version);
 
 	if (version >= 2) {
-		components_num = 1 + ((flags & FWHT_FL_COMPONENTS_NUM_MSK) >>
-				FWHT_FL_COMPONENTS_NUM_OFFSET);
-		pixenc = (flags & FWHT_FL_PIXENC_MSK);
+		components_num = 1 + ((flags & V4L2_FWHT_FL_COMPONENTS_NUM_MSK) >>
+				V4L2_FWHT_FL_COMPONENTS_NUM_OFFSET);
+		pixenc = (flags & V4L2_FWHT_FL_PIXENC_MSK);
 	}
 	return v4l2_fwht_find_nth_fmt(width_div, height_div,
 				     components_num, pixenc, 0);
@@ -522,8 +522,8 @@ static void update_capture_data_from_header(struct vicodec_ctx *ctx)
 	const struct fwht_cframe_hdr *p_hdr = &ctx->state.header;
 	const struct v4l2_fwht_pixfmt_info *info = info_from_header(p_hdr);
 	unsigned int flags = ntohl(p_hdr->flags);
-	unsigned int hdr_width_div = (flags & FWHT_FL_CHROMA_FULL_WIDTH) ? 1 : 2;
-	unsigned int hdr_height_div = (flags & FWHT_FL_CHROMA_FULL_HEIGHT) ? 1 : 2;
+	unsigned int hdr_width_div = (flags & V4L2_FWHT_FL_CHROMA_FULL_WIDTH) ? 1 : 2;
+	unsigned int hdr_height_div = (flags & V4L2_FWHT_FL_CHROMA_FULL_HEIGHT) ? 1 : 2;
 
 	/*
 	 * This function should not be used by a stateless codec since
@@ -657,8 +657,8 @@ static int job_ready(void *priv)
 	if (!is_header_valid(&ctx->state.header) && ctx->comp_has_frame)
 		return 1;
 	flags = ntohl(ctx->state.header.flags);
-	hdr_width_div = (flags & FWHT_FL_CHROMA_FULL_WIDTH) ? 1 : 2;
-	hdr_height_div = (flags & FWHT_FL_CHROMA_FULL_HEIGHT) ? 1 : 2;
+	hdr_width_div = (flags & V4L2_FWHT_FL_CHROMA_FULL_WIDTH) ? 1 : 2;
+	hdr_height_div = (flags & V4L2_FWHT_FL_CHROMA_FULL_HEIGHT) ? 1 : 2;
 
 	if (ntohl(ctx->state.header.width) != q_dst->visible_width ||
 	    ntohl(ctx->state.header.height) != q_dst->visible_height ||
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/6] vicodec: mark the stateless FWHT API as stable
  2020-11-26 13:27 [PATCH 0/6] Stateless FWHT de-staging Hans Verkuil
  2020-11-26 13:27 ` [PATCH 1/6] vicodec: add V4L2_ prefix before FWHT_VERSION and FWHT_FL_* Hans Verkuil
@ 2020-11-26 13:27 ` Hans Verkuil
  2020-11-26 13:27 ` [PATCH 3/6] ext-ctrls-codec.rst: move FWHT docs to ext-ctrls-codec-stateless.rst Hans Verkuil
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Hans Verkuil @ 2020-11-26 13:27 UTC (permalink / raw)
  To: linux-media; +Cc: Ezequiel Garcia, Hans Verkuil

This patch finalizes the move of the stateless FWHT to a
stable public API:

Rename V4L2_CID_MPEG_VIDEO_FWHT_PARAMS to V4L2_CID_STATELESS_FWHT_PARAMS.

Move the contents of fwht-ctrls.h to v4l2-controls.h.

Move the public parts of drivers/media/test-drivers/vicodec/codec-fwht.h
to v4l2-controls.h.

Add V4L2_CTRL_TYPE_FWHT_PARAMS control initialization and validation.

Add p_fwht_params to struct v4l2_ext_control.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
 .../media/test-drivers/vicodec/codec-fwht.c   |  1 +
 .../media/test-drivers/vicodec/codec-fwht.h   | 32 ---------
 .../media/test-drivers/vicodec/vicodec-core.c |  6 +-
 drivers/media/v4l2-core/v4l2-ctrls.c          | 20 +++++-
 include/media/fwht-ctrls.h                    | 31 --------
 include/media/v4l2-ctrls.h                    |  1 -
 include/uapi/linux/v4l2-controls.h            | 70 +++++++++++++++++++
 include/uapi/linux/videodev2.h                |  3 +
 8 files changed, 95 insertions(+), 69 deletions(-)
 delete mode 100644 include/media/fwht-ctrls.h

diff --git a/drivers/media/test-drivers/vicodec/codec-fwht.c b/drivers/media/test-drivers/vicodec/codec-fwht.c
index 5dbf76fd8185..1ce682e1b85c 100644
--- a/drivers/media/test-drivers/vicodec/codec-fwht.c
+++ b/drivers/media/test-drivers/vicodec/codec-fwht.c
@@ -11,6 +11,7 @@
 
 #include <linux/string.h>
 #include <linux/kernel.h>
+#include <linux/videodev2.h>
 #include "codec-fwht.h"
 
 #define OVERFLOW_BIT BIT(14)
diff --git a/drivers/media/test-drivers/vicodec/codec-fwht.h b/drivers/media/test-drivers/vicodec/codec-fwht.h
index 78e2841762fb..0eab24020e9e 100644
--- a/drivers/media/test-drivers/vicodec/codec-fwht.h
+++ b/drivers/media/test-drivers/vicodec/codec-fwht.h
@@ -56,38 +56,6 @@
 #define FWHT_MAGIC1 0x4f4f4f4f
 #define FWHT_MAGIC2 0xffffffff
 
-#define V4L2_FWHT_VERSION 3
-
-/* Set if this is an interlaced format */
-#define V4L2_FWHT_FL_IS_INTERLACED		BIT(0)
-/* Set if this is a bottom-first (NTSC) interlaced format */
-#define V4L2_FWHT_FL_IS_BOTTOM_FIRST		BIT(1)
-/* Set if each 'frame' contains just one field */
-#define V4L2_FWHT_FL_IS_ALTERNATE		BIT(2)
-/*
- * If V4L2_FWHT_FL_IS_ALTERNATE was set, then this is set if this
- * 'frame' is the bottom field, else it is the top field.
- */
-#define V4L2_FWHT_FL_IS_BOTTOM_FIELD		BIT(3)
-/* Set if this frame is uncompressed */
-#define V4L2_FWHT_FL_LUMA_IS_UNCOMPRESSED	BIT(4)
-#define V4L2_FWHT_FL_CB_IS_UNCOMPRESSED	BIT(5)
-#define V4L2_FWHT_FL_CR_IS_UNCOMPRESSED	BIT(6)
-#define V4L2_FWHT_FL_CHROMA_FULL_HEIGHT	BIT(7)
-#define V4L2_FWHT_FL_CHROMA_FULL_WIDTH	BIT(8)
-#define V4L2_FWHT_FL_ALPHA_IS_UNCOMPRESSED	BIT(9)
-#define V4L2_FWHT_FL_I_FRAME			BIT(10)
-
-/* A 4-values flag - the number of components - 1 */
-#define V4L2_FWHT_FL_COMPONENTS_NUM_MSK	GENMASK(18, 16)
-#define V4L2_FWHT_FL_COMPONENTS_NUM_OFFSET	16
-
-#define V4L2_FWHT_FL_PIXENC_MSK	GENMASK(20, 19)
-#define V4L2_FWHT_FL_PIXENC_OFFSET	19
-#define V4L2_FWHT_FL_PIXENC_YUV	(1 << V4L2_FWHT_FL_PIXENC_OFFSET)
-#define V4L2_FWHT_FL_PIXENC_RGB	(2 << V4L2_FWHT_FL_PIXENC_OFFSET)
-#define V4L2_FWHT_FL_PIXENC_HSV	(3 << V4L2_FWHT_FL_PIXENC_OFFSET)
-
 /*
  * A macro to calculate the needed padding in order to make sure
  * both luma and chroma components resolutions are rounded up to
diff --git a/drivers/media/test-drivers/vicodec/vicodec-core.c b/drivers/media/test-drivers/vicodec/vicodec-core.c
index 084b75c226c5..025f3ff77302 100644
--- a/drivers/media/test-drivers/vicodec/vicodec-core.c
+++ b/drivers/media/test-drivers/vicodec/vicodec-core.c
@@ -1746,7 +1746,7 @@ static int vicodec_try_ctrl(struct v4l2_ctrl *ctrl)
 			V4L2_BUF_TYPE_VIDEO_CAPTURE);
 
 	switch (ctrl->id) {
-	case V4L2_CID_MPEG_VIDEO_FWHT_PARAMS:
+	case V4L2_CID_STATELESS_FWHT_PARAMS:
 		if (!q_dst->info)
 			return -EINVAL;
 		params = ctrl->p_new.p_fwht_params;
@@ -1799,7 +1799,7 @@ static int vicodec_s_ctrl(struct v4l2_ctrl *ctrl)
 	case V4L2_CID_FWHT_P_FRAME_QP:
 		ctx->state.p_frame_qp = ctrl->val;
 		return 0;
-	case V4L2_CID_MPEG_VIDEO_FWHT_PARAMS:
+	case V4L2_CID_STATELESS_FWHT_PARAMS:
 		params = ctrl->p_new.p_fwht_params;
 		update_header_from_stateless_params(ctx, params);
 		ctx->state.ref_frame_ts = params->backward_ref_ts;
@@ -1815,7 +1815,7 @@ static const struct v4l2_ctrl_ops vicodec_ctrl_ops = {
 
 static const struct v4l2_ctrl_config vicodec_ctrl_stateless_state = {
 	.ops		= &vicodec_ctrl_ops,
-	.id		= V4L2_CID_MPEG_VIDEO_FWHT_PARAMS,
+	.id		= V4L2_CID_STATELESS_FWHT_PARAMS,
 	.elem_size      = sizeof(struct v4l2_ctrl_fwht_params),
 };
 
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
index 88231ba7b0fa..5cbe0ffbf501 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -943,7 +943,6 @@ const char *v4l2_ctrl_get_name(u32 id)
 	case V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME:		return "Force Key Frame";
 	case V4L2_CID_MPEG_VIDEO_MPEG2_SLICE_PARAMS:		return "MPEG-2 Slice Parameters";
 	case V4L2_CID_MPEG_VIDEO_MPEG2_QUANTIZATION:		return "MPEG-2 Quantization Matrices";
-	case V4L2_CID_MPEG_VIDEO_FWHT_PARAMS:			return "FWHT Stateless Parameters";
 	case V4L2_CID_FWHT_I_FRAME_QP:				return "FWHT I-Frame QP Value";
 	case V4L2_CID_FWHT_P_FRAME_QP:				return "FWHT P-Frame QP Value";
 
@@ -1185,6 +1184,7 @@ const char *v4l2_ctrl_get_name(u32 id)
 	case V4L2_CID_STATELESS_H264_PRED_WEIGHTS:		return "H264 Prediction Weight Table";
 	case V4L2_CID_STATELESS_H264_SLICE_PARAMS:		return "H264 Slice Parameters";
 	case V4L2_CID_STATELESS_H264_DECODE_PARAMS:		return "H264 Decode Parameters";
+	case V4L2_CID_STATELESS_FWHT_PARAMS:			return "FWHT Stateless Parameters";
 	default:
 		return NULL;
 	}
@@ -1433,7 +1433,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
 	case V4L2_CID_MPEG_VIDEO_MPEG2_QUANTIZATION:
 		*type = V4L2_CTRL_TYPE_MPEG2_QUANTIZATION;
 		break;
-	case V4L2_CID_MPEG_VIDEO_FWHT_PARAMS:
+	case V4L2_CID_STATELESS_FWHT_PARAMS:
 		*type = V4L2_CTRL_TYPE_FWHT_PARAMS;
 		break;
 	case V4L2_CID_STATELESS_H264_SPS:
@@ -1627,6 +1627,7 @@ static void std_init_compound(const struct v4l2_ctrl *ctrl, u32 idx,
 {
 	struct v4l2_ctrl_mpeg2_slice_params *p_mpeg2_slice_params;
 	struct v4l2_ctrl_vp8_frame_header *p_vp8_frame_header;
+	struct v4l2_ctrl_fwht_params *p_fwht_params;
 	void *p = ptr.p + idx * ctrl->elem_size;
 
 	if (ctrl->p_def.p_const)
@@ -1653,6 +1654,12 @@ static void std_init_compound(const struct v4l2_ctrl *ctrl, u32 idx,
 		p_vp8_frame_header = p;
 		p_vp8_frame_header->num_dct_parts = 1;
 		break;
+	case V4L2_CTRL_TYPE_FWHT_PARAMS:
+		p_fwht_params = p;
+		p_fwht_params->version = V4L2_FWHT_VERSION;
+		p_fwht_params->width = 1280;
+		p_fwht_params->height = 720;
+		break;
 	}
 }
 
@@ -1755,6 +1762,9 @@ static void std_log(const struct v4l2_ctrl *ctrl)
 	case V4L2_CTRL_TYPE_H264_PRED_WEIGHTS:
 		pr_cont("H264_PRED_WEIGHTS");
 		break;
+	case V4L2_CTRL_TYPE_FWHT_PARAMS:
+		pr_cont("FWHT_PARAMS");
+		break;
 	default:
 		pr_cont("unknown type %d", ctrl->type);
 		break;
@@ -1798,6 +1808,7 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx,
 {
 	struct v4l2_ctrl_mpeg2_slice_params *p_mpeg2_slice_params;
 	struct v4l2_ctrl_vp8_frame_header *p_vp8_frame_header;
+	struct v4l2_ctrl_fwht_params *p_fwht_params;
 	struct v4l2_ctrl_h264_sps *p_h264_sps;
 	struct v4l2_ctrl_h264_pps *p_h264_pps;
 	struct v4l2_ctrl_h264_pred_weights *p_h264_pred_weights;
@@ -1857,6 +1868,11 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx,
 		break;
 
 	case V4L2_CTRL_TYPE_FWHT_PARAMS:
+		p_fwht_params = p;
+		if (p_fwht_params->version < V4L2_FWHT_VERSION)
+			return -EINVAL;
+		if (!p_fwht_params->width || !p_fwht_params->height)
+			return -EINVAL;
 		break;
 
 	case V4L2_CTRL_TYPE_H264_SPS:
diff --git a/include/media/fwht-ctrls.h b/include/media/fwht-ctrls.h
deleted file mode 100644
index a918b49609e1..000000000000
--- a/include/media/fwht-ctrls.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * These are the FWHT state controls for use with stateless FWHT
- * codec drivers.
- *
- * It turns out that these structs are not stable yet and will undergo
- * more changes. So keep them private until they are stable and ready to
- * become part of the official public API.
- */
-
-#ifndef _FWHT_CTRLS_H_
-#define _FWHT_CTRLS_H_
-
-#define V4L2_CTRL_TYPE_FWHT_PARAMS 0x0105
-
-#define V4L2_CID_MPEG_VIDEO_FWHT_PARAMS	(V4L2_CID_CODEC_BASE + 292)
-
-struct v4l2_ctrl_fwht_params {
-	__u64 backward_ref_ts;
-	__u32 version;
-	__u32 width;
-	__u32 height;
-	__u32 flags;
-	__u32 colorspace;
-	__u32 xfer_func;
-	__u32 ycbcr_enc;
-	__u32 quantization;
-};
-
-
-#endif
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index d25b38f78229..167ca8c8424f 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -18,7 +18,6 @@
  * This will move to the public headers once this API is fully stable.
  */
 #include <media/mpeg2-ctrls.h>
-#include <media/fwht-ctrls.h>
 #include <media/vp8-ctrls.h>
 #include <media/hevc-ctrls.h>
 
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
index 3f24663fba4a..823b214aac0c 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -1565,6 +1565,76 @@ struct v4l2_ctrl_h264_decode_params {
 };
 
 
+/* Stateless FWHT control, used by the vicodec driver */
+
+/* Current FWHT version */
+#define V4L2_FWHT_VERSION			3
+
+/* Set if this is an interlaced format */
+#define V4L2_FWHT_FL_IS_INTERLACED		BIT(0)
+/* Set if this is a bottom-first (NTSC) interlaced format */
+#define V4L2_FWHT_FL_IS_BOTTOM_FIRST		BIT(1)
+/* Set if each 'frame' contains just one field */
+#define V4L2_FWHT_FL_IS_ALTERNATE		BIT(2)
+/*
+ * If V4L2_FWHT_FL_IS_ALTERNATE was set, then this is set if this
+ * 'frame' is the bottom field, else it is the top field.
+ */
+#define V4L2_FWHT_FL_IS_BOTTOM_FIELD		BIT(3)
+/* Set if the Y' plane is uncompressed */
+#define V4L2_FWHT_FL_LUMA_IS_UNCOMPRESSED	BIT(4)
+/* Set if the Cb plane is uncompressed */
+#define V4L2_FWHT_FL_CB_IS_UNCOMPRESSED		BIT(5)
+/* Set if the Cr plane is uncompressed */
+#define V4L2_FWHT_FL_CR_IS_UNCOMPRESSED		BIT(6)
+/* Set if the chroma plane is full height, if cleared it is half height */
+#define V4L2_FWHT_FL_CHROMA_FULL_HEIGHT		BIT(7)
+/* Set if the chroma plane is full width, if cleared it is half width */
+#define V4L2_FWHT_FL_CHROMA_FULL_WIDTH		BIT(8)
+/* Set if the alpha plane is uncompressed */
+#define V4L2_FWHT_FL_ALPHA_IS_UNCOMPRESSED	BIT(9)
+/* Set if this is an I Frame */
+#define V4L2_FWHT_FL_I_FRAME			BIT(10)
+
+/* A 4-values flag - the number of components - 1 */
+#define V4L2_FWHT_FL_COMPONENTS_NUM_MSK		GENMASK(18, 16)
+#define V4L2_FWHT_FL_COMPONENTS_NUM_OFFSET	16
+
+/* A 4-values flag - the pixel encoding type */
+#define V4L2_FWHT_FL_PIXENC_MSK			GENMASK(20, 19)
+#define V4L2_FWHT_FL_PIXENC_OFFSET		19
+#define V4L2_FWHT_FL_PIXENC_YUV			(1 << V4L2_FWHT_FL_PIXENC_OFFSET)
+#define V4L2_FWHT_FL_PIXENC_RGB			(2 << V4L2_FWHT_FL_PIXENC_OFFSET)
+#define V4L2_FWHT_FL_PIXENC_HSV			(3 << V4L2_FWHT_FL_PIXENC_OFFSET)
+
+#define V4L2_CID_STATELESS_FWHT_PARAMS		(V4L2_CID_CODEC_STATELESS_BASE + 100)
+/**
+ * struct v4l2_ctrl_fwht_params - FWHT parameters
+ *
+ * @backward_ref_ts: timestamp of the V4L2 capture buffer to use as reference.
+ * The timestamp refers to the timestamp field in struct v4l2_buffer.
+ * Use v4l2_timeval_to_ns() to convert the struct timeval to a __u64.
+ * @version: must be V4L2_FWHT_VERSION.
+ * @width: width of frame.
+ * @height: height of frame.
+ * @flags: FWHT flags (see V4L2_FWHT_FL_*).
+ * @colorspace: the colorspace (enum v4l2_colorspace).
+ * @xfer_func: the transfer function (enum v4l2_xfer_func).
+ * @ycbcr_enc: the Y'CbCr encoding (enum v4l2_ycbcr_encoding).
+ * @quantization: the quantization (enum v4l2_quantization).
+ */
+struct v4l2_ctrl_fwht_params {
+	__u64 backward_ref_ts;
+	__u32 version;
+	__u32 width;
+	__u32 height;
+	__u32 flags;
+	__u32 colorspace;
+	__u32 xfer_func;
+	__u32 ycbcr_enc;
+	__u32 quantization;
+};
+
 /* MPEG-compression definitions kept for backwards compatibility */
 #ifndef __KERNEL__
 #define V4L2_CTRL_CLASS_MPEG            V4L2_CTRL_CLASS_CODEC
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 76231ca6e101..e40e95be79f9 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -1740,6 +1740,7 @@ struct v4l2_ext_control {
 		struct v4l2_ctrl_h264_pred_weights __user *p_h264_pred_weights;
 		struct v4l2_ctrl_h264_slice_params __user *p_h264_slice_params;
 		struct v4l2_ctrl_h264_decode_params __user *p_h264_decode_params;
+		struct v4l2_ctrl_fwht_params __user *p_fwht_params;
 		void __user *ptr;
 	};
 } __attribute__ ((packed));
@@ -1793,6 +1794,8 @@ enum v4l2_ctrl_type {
 	V4L2_CTRL_TYPE_H264_SLICE_PARAMS    = 0x0203,
 	V4L2_CTRL_TYPE_H264_DECODE_PARAMS   = 0x0204,
 	V4L2_CTRL_TYPE_H264_PRED_WEIGHTS    = 0x0205,
+
+	V4L2_CTRL_TYPE_FWHT_PARAMS	    = 0x0220,
 };
 
 /*  Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/6] ext-ctrls-codec.rst: move FWHT docs to ext-ctrls-codec-stateless.rst
  2020-11-26 13:27 [PATCH 0/6] Stateless FWHT de-staging Hans Verkuil
  2020-11-26 13:27 ` [PATCH 1/6] vicodec: add V4L2_ prefix before FWHT_VERSION and FWHT_FL_* Hans Verkuil
  2020-11-26 13:27 ` [PATCH 2/6] vicodec: mark the stateless FWHT API as stable Hans Verkuil
@ 2020-11-26 13:27 ` Hans Verkuil
  2020-11-26 13:27 ` [PATCH 4/6] pixfmt-compressed.rst: fix 'bullet' formatting Hans Verkuil
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Hans Verkuil @ 2020-11-26 13:27 UTC (permalink / raw)
  To: linux-media; +Cc: Ezequiel Garcia, Hans Verkuil

Move the documentation for the stateless FWHT codec to
ext-ctrls-codec-stateless.rst since that is the proper place
for the stable stateless API documentation.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
 .../media/v4l/ext-ctrls-codec-stateless.rst   | 120 +++++++++++++++++
 .../media/v4l/ext-ctrls-codec.rst             | 121 ------------------
 2 files changed, 120 insertions(+), 121 deletions(-)

diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst
index 12f3308fd2b3..01e3b1a3fb99 100644
--- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst
+++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst
@@ -671,3 +671,123 @@ Stateless Codec Control ID
       - Selecting this value specifies that H264 slices are expected
         to be prefixed by Annex B start codes. According to :ref:`h264`
         valid start codes can be 3-bytes 0x000001 or 4-bytes 0x00000001.
+
+
+.. _codec-stateless-fwht:
+
+``V4L2_CID_STATELESS_FWHT_PARAMS (struct)``
+    Specifies the FWHT (Fast Walsh Hadamard Transform) parameters (as extracted
+    from the bitstream) for the associated FWHT data. This includes the necessary
+    parameters for configuring a stateless hardware decoding pipeline for FWHT.
+    This codec is specific to the vicodec test driver.
+
+.. c:type:: v4l2_ctrl_fwht_params
+
+.. cssclass:: longtable
+
+.. tabularcolumns:: |p{1.4cm}|p{4.3cm}|p{11.8cm}|
+
+.. flat-table:: struct v4l2_ctrl_fwht_params
+    :header-rows:  0
+    :stub-columns: 0
+    :widths:       1 1 2
+
+    * - __u64
+      - ``backward_ref_ts``
+      - Timestamp of the V4L2 capture buffer to use as backward reference, used
+        with P-coded frames. The timestamp refers to the
+	``timestamp`` field in struct :c:type:`v4l2_buffer`. Use the
+	:c:func:`v4l2_timeval_to_ns()` function to convert the struct
+	:c:type:`timeval` in struct :c:type:`v4l2_buffer` to a __u64.
+    * - __u32
+      - ``version``
+      - The version of the codec. Set to ``V4L2_FWHT_VERSION``.
+    * - __u32
+      - ``width``
+      - The width of the frame.
+    * - __u32
+      - ``height``
+      - The height of the frame.
+    * - __u32
+      - ``flags``
+      - The flags of the frame, see :ref:`fwht-flags`.
+    * - __u32
+      - ``colorspace``
+      - The colorspace of the frame, from enum :c:type:`v4l2_colorspace`.
+    * - __u32
+      - ``xfer_func``
+      - The transfer function, from enum :c:type:`v4l2_xfer_func`.
+    * - __u32
+      - ``ycbcr_enc``
+      - The Y'CbCr encoding, from enum :c:type:`v4l2_ycbcr_encoding`.
+    * - __u32
+      - ``quantization``
+      - The quantization range, from enum :c:type:`v4l2_quantization`.
+
+
+
+.. _fwht-flags:
+
+FWHT Flags
+==========
+
+.. cssclass:: longtable
+
+.. tabularcolumns:: |p{6.8cm}|p{2.4cm}|p{8.3cm}|
+
+.. flat-table::
+    :header-rows:  0
+    :stub-columns: 0
+    :widths:       3 1 4
+
+    * - ``V4L2_FWHT_FL_IS_INTERLACED``
+      - 0x00000001
+      - Set if this is an interlaced format.
+    * - ``V4L2_FWHT_FL_IS_BOTTOM_FIRST``
+      - 0x00000002
+      - Set if this is a bottom-first (NTSC) interlaced format.
+    * - ``V4L2_FWHT_FL_IS_ALTERNATE``
+      - 0x00000004
+      - Set if each 'frame' contains just one field.
+    * - ``V4L2_FWHT_FL_IS_BOTTOM_FIELD``
+      - 0x00000008
+      - If V4L2_FWHT_FL_IS_ALTERNATE was set, then this is set if this 'frame' is the
+	bottom field, else it is the top field.
+    * - ``V4L2_FWHT_FL_LUMA_IS_UNCOMPRESSED``
+      - 0x00000010
+      - Set if the Y' (luma) plane is uncompressed.
+    * - ``V4L2_FWHT_FL_CB_IS_UNCOMPRESSED``
+      - 0x00000020
+      - Set if the Cb plane is uncompressed.
+    * - ``V4L2_FWHT_FL_CR_IS_UNCOMPRESSED``
+      - 0x00000040
+      - Set if the Cr plane is uncompressed.
+    * - ``V4L2_FWHT_FL_CHROMA_FULL_HEIGHT``
+      - 0x00000080
+      - Set if the chroma plane has the same height as the luma plane,
+	else the chroma plane is half the height of the luma plane.
+    * - ``V4L2_FWHT_FL_CHROMA_FULL_WIDTH``
+      - 0x00000100
+      - Set if the chroma plane has the same width as the luma plane,
+	else the chroma plane is half the width of the luma plane.
+    * - ``V4L2_FWHT_FL_ALPHA_IS_UNCOMPRESSED``
+      - 0x00000200
+      - Set if the alpha plane is uncompressed.
+    * - ``V4L2_FWHT_FL_I_FRAME``
+      - 0x00000400
+      - Set if this is an I-frame.
+    * - ``V4L2_FWHT_FL_COMPONENTS_NUM_MSK``
+      - 0x00070000
+      - The number of color components - 1.
+    * - ``V4L2_FWHT_FL_PIXENC_MSK``
+      - 0x00180000
+      - The mask for the pixel encoding.
+    * - ``V4L2_FWHT_FL_PIXENC_YUV``
+      - 0x00080000
+      - Set if the pixel encoding is YUV.
+    * - ``V4L2_FWHT_FL_PIXENC_RGB``
+      - 0x00100000
+      - Set if the pixel encoding is RGB.
+    * - ``V4L2_FWHT_FL_PIXENC_HSV``
+      - 0x00180000
+      - Set if the pixel encoding is HSV.
diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
index 34173ed326fc..454ecd9a0f83 100644
--- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
+++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
@@ -2213,127 +2213,6 @@ enum v4l2_mpeg_mfc51_video_force_frame_type -
       - Force a non-coded frame.
 
 
-.. _v4l2-mpeg-fwht:
-
-``V4L2_CID_MPEG_VIDEO_FWHT_PARAMS (struct)``
-    Specifies the fwht parameters (as extracted from the bitstream) for the
-    associated FWHT data. This includes the necessary parameters for
-    configuring a stateless hardware decoding pipeline for FWHT.
-
-    .. note::
-
-       This compound control is not yet part of the public kernel API and
-       it is expected to change.
-
-.. c:type:: v4l2_ctrl_fwht_params
-
-.. cssclass:: longtable
-
-.. tabularcolumns:: |p{1.4cm}|p{4.3cm}|p{11.8cm}|
-
-.. flat-table:: struct v4l2_ctrl_fwht_params
-    :header-rows:  0
-    :stub-columns: 0
-    :widths:       1 1 2
-
-    * - __u64
-      - ``backward_ref_ts``
-      - Timestamp of the V4L2 capture buffer to use as backward reference, used
-        with P-coded frames. The timestamp refers to the
-	``timestamp`` field in struct :c:type:`v4l2_buffer`. Use the
-	:c:func:`v4l2_timeval_to_ns()` function to convert the struct
-	:c:type:`timeval` in struct :c:type:`v4l2_buffer` to a __u64.
-    * - __u32
-      - ``version``
-      - The version of the codec
-    * - __u32
-      - ``width``
-      - The width of the frame
-    * - __u32
-      - ``height``
-      - The height of the frame
-    * - __u32
-      - ``flags``
-      - The flags of the frame, see :ref:`fwht-flags`.
-    * - __u32
-      - ``colorspace``
-      - The colorspace of the frame, from enum :c:type:`v4l2_colorspace`.
-    * - __u32
-      - ``xfer_func``
-      - The transfer function, from enum :c:type:`v4l2_xfer_func`.
-    * - __u32
-      - ``ycbcr_enc``
-      - The Y'CbCr encoding, from enum :c:type:`v4l2_ycbcr_encoding`.
-    * - __u32
-      - ``quantization``
-      - The quantization range, from enum :c:type:`v4l2_quantization`.
-
-
-
-.. _fwht-flags:
-
-FWHT Flags
-============
-
-.. cssclass:: longtable
-
-.. tabularcolumns:: |p{6.8cm}|p{2.4cm}|p{8.3cm}|
-
-.. flat-table::
-    :header-rows:  0
-    :stub-columns: 0
-    :widths:       3 1 4
-
-    * - ``V4L2_FWHT_FL_IS_INTERLACED``
-      - 0x00000001
-      - Set if this is an interlaced format
-    * - ``V4L2_FWHT_FL_IS_BOTTOM_FIRST``
-      - 0x00000002
-      - Set if this is a bottom-first (NTSC) interlaced format
-    * - ``V4L2_FWHT_FL_IS_ALTERNATE``
-      - 0x00000004
-      - Set if each 'frame' contains just one field
-    * - ``V4L2_FWHT_FL_IS_BOTTOM_FIELD``
-      - 0x00000008
-      - If V4L2_FWHT_FL_IS_ALTERNATE was set, then this is set if this 'frame' is the
-	bottom field, else it is the top field.
-    * - ``V4L2_FWHT_FL_LUMA_IS_UNCOMPRESSED``
-      - 0x00000010
-      - Set if the luma plane is uncompressed
-    * - ``V4L2_FWHT_FL_CB_IS_UNCOMPRESSED``
-      - 0x00000020
-      - Set if the cb plane is uncompressed
-    * - ``V4L2_FWHT_FL_CR_IS_UNCOMPRESSED``
-      - 0x00000040
-      - Set if the cr plane is uncompressed
-    * - ``V4L2_FWHT_FL_CHROMA_FULL_HEIGHT``
-      - 0x00000080
-      - Set if the chroma plane has the same height as the luma plane,
-	else the chroma plane is half the height of the luma plane
-    * - ``V4L2_FWHT_FL_CHROMA_FULL_WIDTH``
-      - 0x00000100
-      - Set if the chroma plane has the same width as the luma plane,
-	else the chroma plane is half the width of the luma plane
-    * - ``V4L2_FWHT_FL_ALPHA_IS_UNCOMPRESSED``
-      - 0x00000200
-      - Set if the alpha plane is uncompressed
-    * - ``V4L2_FWHT_FL_I_FRAME``
-      - 0x00000400
-      - Set if this is an I-frame
-    * - ``V4L2_FWHT_FL_COMPONENTS_NUM_MSK``
-      - 0x00070000
-      - A 4-values flag - the number of components - 1
-    * - ``V4L2_FWHT_FL_PIXENC_YUV``
-      - 0x00080000
-      - Set if the pixel encoding is YUV
-    * - ``V4L2_FWHT_FL_PIXENC_RGB``
-      - 0x00100000
-      - Set if the pixel encoding is RGB
-    * - ``V4L2_FWHT_FL_PIXENC_HSV``
-      - 0x00180000
-      - Set if the pixel encoding is HSV
-
-
 CX2341x MPEG Controls
 =====================
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/6] pixfmt-compressed.rst: fix 'bullet' formatting
  2020-11-26 13:27 [PATCH 0/6] Stateless FWHT de-staging Hans Verkuil
                   ` (2 preceding siblings ...)
  2020-11-26 13:27 ` [PATCH 3/6] ext-ctrls-codec.rst: move FWHT docs to ext-ctrls-codec-stateless.rst Hans Verkuil
@ 2020-11-26 13:27 ` Hans Verkuil
  2020-11-26 13:27 ` [PATCH 5/6] vidioc-g-ext-ctrls.rst: add missing 'struct' before the types Hans Verkuil
  2020-11-26 13:27 ` [PATCH 6/6] userspace-api/media: finalize stateless FWHT codec docs Hans Verkuil
  5 siblings, 0 replies; 11+ messages in thread
From: Hans Verkuil @ 2020-11-26 13:27 UTC (permalink / raw)
  To: linux-media; +Cc: Ezequiel Garcia, Hans Verkuil

Drop the 'bullets' for the HEVC stateless codec documentation.
It doesn't work, and they just show up as asterisks.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
 .../userspace-api/media/v4l/pixfmt-compressed.rst         | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst b/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst
index b8899262d8de..4ae737520925 100644
--- a/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst
+++ b/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst
@@ -191,10 +191,10 @@ Compressed Formats
 	through the ``V4L2_CID_MPEG_VIDEO_HEVC_DECODE_MODE``
         and ``V4L2_CID_MPEG_VIDEO_HEVC_START_CODE`` controls.
 	Metadata associated with the frame to decode is required to be passed
-	through the following controls :
-        * ``V4L2_CID_MPEG_VIDEO_HEVC_SPS``
-        * ``V4L2_CID_MPEG_VIDEO_HEVC_PPS``
-        * ``V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS``
+	through the following controls:
+        ``V4L2_CID_MPEG_VIDEO_HEVC_SPS``,
+        ``V4L2_CID_MPEG_VIDEO_HEVC_PPS``, and
+        ``V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS``.
 	See the :ref:`associated Codec Control IDs <v4l2-mpeg-hevc>`.
 	Buffers associated with this pixel format must contain the appropriate
 	number of macroblocks to decode a full corresponding frame.
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 5/6] vidioc-g-ext-ctrls.rst: add missing 'struct' before the types
  2020-11-26 13:27 [PATCH 0/6] Stateless FWHT de-staging Hans Verkuil
                   ` (3 preceding siblings ...)
  2020-11-26 13:27 ` [PATCH 4/6] pixfmt-compressed.rst: fix 'bullet' formatting Hans Verkuil
@ 2020-11-26 13:27 ` Hans Verkuil
  2020-12-03 10:49   ` Mauro Carvalho Chehab
  2020-11-26 13:27 ` [PATCH 6/6] userspace-api/media: finalize stateless FWHT codec docs Hans Verkuil
  5 siblings, 1 reply; 11+ messages in thread
From: Hans Verkuil @ 2020-11-26 13:27 UTC (permalink / raw)
  To: linux-media; +Cc: Ezequiel Garcia, Hans Verkuil

Add 'struct' to clarify that these are pointers to structs.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
 .../userspace-api/media/v4l/vidioc-g-ext-ctrls.rst | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst b/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst
index 726d6a97325f..5b1fc62ade0d 100644
--- a/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst
+++ b/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst
@@ -180,31 +180,31 @@ still cause this situation.
       - ``p_u32``
       - A pointer to a matrix control of unsigned 32-bit values. Valid if
 	this control is of type ``V4L2_CTRL_TYPE_U32``.
-    * - :c:type:`v4l2_area` *
+    * - struct :c:type:`v4l2_area` *
       - ``p_area``
       - A pointer to a struct :c:type:`v4l2_area`. Valid if this control is
         of type ``V4L2_CTRL_TYPE_AREA``.
-    * - :c:type:`v4l2_ctrl_h264_sps` *
+    * - struct :c:type:`v4l2_ctrl_h264_sps` *
       - ``p_h264_sps``
       - A pointer to a struct :c:type:`v4l2_ctrl_h264_sps`. Valid if this control is
         of type ``V4L2_CTRL_TYPE_H264_SPS``.
-    * - :c:type:`v4l2_ctrl_h264_pps` *
+    * - struct :c:type:`v4l2_ctrl_h264_pps` *
       - ``p_h264_pps``
       - A pointer to a struct :c:type:`v4l2_ctrl_h264_pps`. Valid if this control is
         of type ``V4L2_CTRL_TYPE_H264_PPS``.
-    * - :c:type:`v4l2_ctrl_h264_scaling_matrix` *
+    * - struct :c:type:`v4l2_ctrl_h264_scaling_matrix` *
       - ``p_h264_scaling_matrix``
       - A pointer to a struct :c:type:`v4l2_ctrl_h264_scaling_matrix`. Valid if this control is
         of type ``V4L2_CTRL_TYPE_H264_SCALING_MATRIX``.
-    * - :c:type:`v4l2_ctrl_h264_pred_weights` *
+    * - struct :c:type:`v4l2_ctrl_h264_pred_weights` *
       - ``p_h264_pred_weights``
       - A pointer to a struct :c:type:`v4l2_ctrl_h264_pred_weights`. Valid if this control is
         of type ``V4L2_CTRL_TYPE_H264_PRED_WEIGHTS``.
-    * - :c:type:`v4l2_ctrl_h264_slice_params` *
+    * - struct :c:type:`v4l2_ctrl_h264_slice_params` *
       - ``p_h264_slice_params``
       - A pointer to a struct :c:type:`v4l2_ctrl_h264_slice_params`. Valid if this control is
         of type ``V4L2_CTRL_TYPE_H264_SLICE_PARAMS``.
-    * - :c:type:`v4l2_ctrl_h264_decode_params` *
+    * - struct :c:type:`v4l2_ctrl_h264_decode_params` *
       - ``p_h264_decode_params``
       - A pointer to a struct :c:type:`v4l2_ctrl_h264_decode_params`. Valid if this control is
         of type ``V4L2_CTRL_TYPE_H264_DECODE_PARAMS``.
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 6/6] userspace-api/media: finalize stateless FWHT codec docs
  2020-11-26 13:27 [PATCH 0/6] Stateless FWHT de-staging Hans Verkuil
                   ` (4 preceding siblings ...)
  2020-11-26 13:27 ` [PATCH 5/6] vidioc-g-ext-ctrls.rst: add missing 'struct' before the types Hans Verkuil
@ 2020-11-26 13:27 ` Hans Verkuil
  2020-12-03 10:50   ` Mauro Carvalho Chehab
  5 siblings, 1 reply; 11+ messages in thread
From: Hans Verkuil @ 2020-11-26 13:27 UTC (permalink / raw)
  To: linux-media; +Cc: Ezequiel Garcia, Hans Verkuil

Document V4L2_CTRL_TYPE_FWHT_PARAMS and p_fwht_params. Also
improve the V4L2_PIX_FMT_FWHT_STATELESS description.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
 Documentation/userspace-api/media/v4l/pixfmt-compressed.rst | 4 +++-
 .../userspace-api/media/v4l/vidioc-g-ext-ctrls.rst          | 4 ++++
 Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst  | 6 ++++++
 .../userspace-api/media/videodev2.h.rst.exceptions          | 1 +
 4 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst b/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst
index 4ae737520925..acad5f3ca0c1 100644
--- a/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst
+++ b/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst
@@ -217,4 +217,6 @@ Compressed Formats
       - ``V4L2_PIX_FMT_FWHT_STATELESS``
       - 'SFWH'
       - Same format as V4L2_PIX_FMT_FWHT but requires stateless codec implementation.
-	See the :ref:`associated Codec Control IDs <v4l2-mpeg-fwht>`.
+        Metadata associated with the frame to decode is required to be passed
+        through the ``V4L2_CID_STATELESS_FWHT_PARAMS`` control.
+	See the :ref:`associated Codec Control ID <codec-stateless-fwht>`.
diff --git a/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst b/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst
index 5b1fc62ade0d..116d128fa9cf 100644
--- a/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst
+++ b/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst
@@ -208,6 +208,10 @@ still cause this situation.
       - ``p_h264_decode_params``
       - A pointer to a struct :c:type:`v4l2_ctrl_h264_decode_params`. Valid if this control is
         of type ``V4L2_CTRL_TYPE_H264_DECODE_PARAMS``.
+    * - struct :c:type:`v4l2_ctrl_fwht_params` *
+      - ``p_fwht_params``
+      - A pointer to a struct :c:type:`v4l2_ctrl_fwht_params`. Valid if this control is
+        of type ``V4L2_CTRL_TYPE_FWHT_PARAMS``.
     * - void *
       - ``ptr``
       - A pointer to a compound type which can be an N-dimensional array
diff --git a/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst b/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst
index 9b8716f90f12..82f61f1e2fb8 100644
--- a/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst
+++ b/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst
@@ -462,6 +462,12 @@ See also the examples in :ref:`control`.
       - n/a
       - A struct :c:type:`v4l2_ctrl_h264_decode_params`, containing H264
 	decode parameters for stateless video decoders.
+    * - ``V4L2_CTRL_TYPE_FWHT_PARAMS``
+      - n/a
+      - n/a
+      - n/a
+      - A struct :c:type:`v4l2_ctrl_fwht_params`, containing FWHT
+	parameters for stateless video decoders.
     * - ``V4L2_CTRL_TYPE_HEVC_SPS``
       - n/a
       - n/a
diff --git a/Documentation/userspace-api/media/videodev2.h.rst.exceptions b/Documentation/userspace-api/media/videodev2.h.rst.exceptions
index 7f6a4cc2ac4e..0ed170c6e720 100644
--- a/Documentation/userspace-api/media/videodev2.h.rst.exceptions
+++ b/Documentation/userspace-api/media/videodev2.h.rst.exceptions
@@ -146,6 +146,7 @@ replace symbol V4L2_CTRL_TYPE_HEVC_SPS :c:type:`v4l2_ctrl_type`
 replace symbol V4L2_CTRL_TYPE_HEVC_PPS :c:type:`v4l2_ctrl_type`
 replace symbol V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS :c:type:`v4l2_ctrl_type`
 replace symbol V4L2_CTRL_TYPE_AREA :c:type:`v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_FWHT_PARAMS :c:type:`v4l2_ctrl_type`
 
 # V4L2 capability defines
 replace define V4L2_CAP_VIDEO_CAPTURE device-capabilities
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 5/6] vidioc-g-ext-ctrls.rst: add missing 'struct' before the types
  2020-11-26 13:27 ` [PATCH 5/6] vidioc-g-ext-ctrls.rst: add missing 'struct' before the types Hans Verkuil
@ 2020-12-03 10:49   ` Mauro Carvalho Chehab
  2020-12-03 10:52     ` Hans Verkuil
  0 siblings, 1 reply; 11+ messages in thread
From: Mauro Carvalho Chehab @ 2020-12-03 10:49 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: linux-media, Ezequiel Garcia

Em Thu, 26 Nov 2020 14:27:16 +0100
Hans Verkuil <hverkuil-cisco@xs4all.nl> escreveu:

> Add 'struct' to clarify that these are pointers to structs.

This patch is actually wrong :-)

It is incompatible with Sphinx 3.

> 
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> ---
>  .../userspace-api/media/v4l/vidioc-g-ext-ctrls.rst | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst b/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst
> index 726d6a97325f..5b1fc62ade0d 100644
> --- a/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst
> +++ b/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst
> @@ -180,31 +180,31 @@ still cause this situation.
>        - ``p_u32``
>        - A pointer to a matrix control of unsigned 32-bit values. Valid if
>  	this control is of type ``V4L2_CTRL_TYPE_U32``.
> -    * - :c:type:`v4l2_area` *
> +    * - struct :c:type:`v4l2_area` *


See, with Sphinx 3, :c:type: can only be used for typedefs and defines.

The right markup for struct is:

	:c:struct:

Actually, due to automarkup.py extension, I would just rename them to:

	struct foo

And let the automarkup code to use the right markup, as it will ensure
that the proper dialect will be used, no matter what Sphinx version 
will be used to produce the docs.

So, I'll drop this patch from the series. I'll propose a new one
instead, after testing with multiple versions of Sphinx.

Regards,
Mauro



>        - ``p_area``
>        - A pointer to a struct :c:type:`v4l2_area`. Valid if this control is
>          of type ``V4L2_CTRL_TYPE_AREA``.
> -    * - :c:type:`v4l2_ctrl_h264_sps` *
> +    * - struct :c:type:`v4l2_ctrl_h264_sps` *
>        - ``p_h264_sps``
>        - A pointer to a struct :c:type:`v4l2_ctrl_h264_sps`. Valid if this control is
>          of type ``V4L2_CTRL_TYPE_H264_SPS``.
> -    * - :c:type:`v4l2_ctrl_h264_pps` *
> +    * - struct :c:type:`v4l2_ctrl_h264_pps` *
>        - ``p_h264_pps``
>        - A pointer to a struct :c:type:`v4l2_ctrl_h264_pps`. Valid if this control is
>          of type ``V4L2_CTRL_TYPE_H264_PPS``.
> -    * - :c:type:`v4l2_ctrl_h264_scaling_matrix` *
> +    * - struct :c:type:`v4l2_ctrl_h264_scaling_matrix` *
>        - ``p_h264_scaling_matrix``
>        - A pointer to a struct :c:type:`v4l2_ctrl_h264_scaling_matrix`. Valid if this control is
>          of type ``V4L2_CTRL_TYPE_H264_SCALING_MATRIX``.
> -    * - :c:type:`v4l2_ctrl_h264_pred_weights` *
> +    * - struct :c:type:`v4l2_ctrl_h264_pred_weights` *
>        - ``p_h264_pred_weights``
>        - A pointer to a struct :c:type:`v4l2_ctrl_h264_pred_weights`. Valid if this control is
>          of type ``V4L2_CTRL_TYPE_H264_PRED_WEIGHTS``.
> -    * - :c:type:`v4l2_ctrl_h264_slice_params` *
> +    * - struct :c:type:`v4l2_ctrl_h264_slice_params` *
>        - ``p_h264_slice_params``
>        - A pointer to a struct :c:type:`v4l2_ctrl_h264_slice_params`. Valid if this control is
>          of type ``V4L2_CTRL_TYPE_H264_SLICE_PARAMS``.
> -    * - :c:type:`v4l2_ctrl_h264_decode_params` *
> +    * - struct :c:type:`v4l2_ctrl_h264_decode_params` *
>        - ``p_h264_decode_params``
>        - A pointer to a struct :c:type:`v4l2_ctrl_h264_decode_params`. Valid if this control is
>          of type ``V4L2_CTRL_TYPE_H264_DECODE_PARAMS``.



Thanks,
Mauro

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 6/6] userspace-api/media: finalize stateless FWHT codec docs
  2020-11-26 13:27 ` [PATCH 6/6] userspace-api/media: finalize stateless FWHT codec docs Hans Verkuil
@ 2020-12-03 10:50   ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 11+ messages in thread
From: Mauro Carvalho Chehab @ 2020-12-03 10:50 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: linux-media, Ezequiel Garcia

Em Thu, 26 Nov 2020 14:27:17 +0100
Hans Verkuil <hverkuil-cisco@xs4all.nl> escreveu:

> Document V4L2_CTRL_TYPE_FWHT_PARAMS and p_fwht_params. Also
> improve the V4L2_PIX_FMT_FWHT_STATELESS description.
> 
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> ---
>  Documentation/userspace-api/media/v4l/pixfmt-compressed.rst | 4 +++-
>  .../userspace-api/media/v4l/vidioc-g-ext-ctrls.rst          | 4 ++++
>  Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst  | 6 ++++++
>  .../userspace-api/media/videodev2.h.rst.exceptions          | 1 +
>  4 files changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst b/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst
> index 4ae737520925..acad5f3ca0c1 100644
> --- a/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst
> +++ b/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst
> @@ -217,4 +217,6 @@ Compressed Formats
>        - ``V4L2_PIX_FMT_FWHT_STATELESS``
>        - 'SFWH'
>        - Same format as V4L2_PIX_FMT_FWHT but requires stateless codec implementation.
> -	See the :ref:`associated Codec Control IDs <v4l2-mpeg-fwht>`.
> +        Metadata associated with the frame to decode is required to be passed
> +        through the ``V4L2_CID_STATELESS_FWHT_PARAMS`` control.
> +	See the :ref:`associated Codec Control ID <codec-stateless-fwht>`.
> diff --git a/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst b/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst
> index 5b1fc62ade0d..116d128fa9cf 100644
> --- a/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst
> +++ b/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst
> @@ -208,6 +208,10 @@ still cause this situation.
>        - ``p_h264_decode_params``
>        - A pointer to a struct :c:type:`v4l2_ctrl_h264_decode_params`. Valid if this control is
>          of type ``V4L2_CTRL_TYPE_H264_DECODE_PARAMS``.
> +    * - struct :c:type:`v4l2_ctrl_fwht_params` *
> +      - ``p_fwht_params``
> +      - A pointer to a struct :c:type:`v4l2_ctrl_fwht_params`. Valid if this control is
> +        of type ``V4L2_CTRL_TYPE_FWHT_PARAMS``.

Please see my notes for patch 5/6. The same applies here.

Regards,
Mauro

>      * - void *
>        - ``ptr``
>        - A pointer to a compound type which can be an N-dimensional array
> diff --git a/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst b/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst
> index 9b8716f90f12..82f61f1e2fb8 100644
> --- a/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst
> +++ b/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst
> @@ -462,6 +462,12 @@ See also the examples in :ref:`control`.
>        - n/a
>        - A struct :c:type:`v4l2_ctrl_h264_decode_params`, containing H264
>  	decode parameters for stateless video decoders.
> +    * - ``V4L2_CTRL_TYPE_FWHT_PARAMS``
> +      - n/a
> +      - n/a
> +      - n/a
> +      - A struct :c:type:`v4l2_ctrl_fwht_params`, containing FWHT
> +	parameters for stateless video decoders.
>      * - ``V4L2_CTRL_TYPE_HEVC_SPS``
>        - n/a
>        - n/a
> diff --git a/Documentation/userspace-api/media/videodev2.h.rst.exceptions b/Documentation/userspace-api/media/videodev2.h.rst.exceptions
> index 7f6a4cc2ac4e..0ed170c6e720 100644
> --- a/Documentation/userspace-api/media/videodev2.h.rst.exceptions
> +++ b/Documentation/userspace-api/media/videodev2.h.rst.exceptions
> @@ -146,6 +146,7 @@ replace symbol V4L2_CTRL_TYPE_HEVC_SPS :c:type:`v4l2_ctrl_type`
>  replace symbol V4L2_CTRL_TYPE_HEVC_PPS :c:type:`v4l2_ctrl_type`
>  replace symbol V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS :c:type:`v4l2_ctrl_type`
>  replace symbol V4L2_CTRL_TYPE_AREA :c:type:`v4l2_ctrl_type`
> +replace symbol V4L2_CTRL_TYPE_FWHT_PARAMS :c:type:`v4l2_ctrl_type`
>  
>  # V4L2 capability defines
>  replace define V4L2_CAP_VIDEO_CAPTURE device-capabilities



Thanks,
Mauro

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 5/6] vidioc-g-ext-ctrls.rst: add missing 'struct' before the types
  2020-12-03 10:49   ` Mauro Carvalho Chehab
@ 2020-12-03 10:52     ` Hans Verkuil
  2020-12-03 12:07       ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 11+ messages in thread
From: Hans Verkuil @ 2020-12-03 10:52 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-media, Ezequiel Garcia

On 03/12/2020 11:49, Mauro Carvalho Chehab wrote:
> Em Thu, 26 Nov 2020 14:27:16 +0100
> Hans Verkuil <hverkuil-cisco@xs4all.nl> escreveu:
> 
>> Add 'struct' to clarify that these are pointers to structs.
> 
> This patch is actually wrong :-)
> 
> It is incompatible with Sphinx 3.
> 
>>
>> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
>> ---
>>  .../userspace-api/media/v4l/vidioc-g-ext-ctrls.rst | 14 +++++++-------
>>  1 file changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst b/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst
>> index 726d6a97325f..5b1fc62ade0d 100644
>> --- a/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst
>> +++ b/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst
>> @@ -180,31 +180,31 @@ still cause this situation.
>>        - ``p_u32``
>>        - A pointer to a matrix control of unsigned 32-bit values. Valid if
>>  	this control is of type ``V4L2_CTRL_TYPE_U32``.
>> -    * - :c:type:`v4l2_area` *
>> +    * - struct :c:type:`v4l2_area` *
> 
> 
> See, with Sphinx 3, :c:type: can only be used for typedefs and defines.
> 
> The right markup for struct is:
> 
> 	:c:struct:
> 
> Actually, due to automarkup.py extension, I would just rename them to:
> 
> 	struct foo
> 
> And let the automarkup code to use the right markup, as it will ensure
> that the proper dialect will be used, no matter what Sphinx version 
> will be used to produce the docs.
> 
> So, I'll drop this patch from the series. I'll propose a new one
> instead, after testing with multiple versions of Sphinx.

'git grep struct.*:c:type Documentation' shows a lot of those incorrect
markups. Perhaps make a media-wide patch to fix this? Otherwise people
will just keep copy-and-pasting the same incorrect markup.

Regards,

	Hans

> 
> Regards,
> Mauro
> 
> 
> 
>>        - ``p_area``
>>        - A pointer to a struct :c:type:`v4l2_area`. Valid if this control is
>>          of type ``V4L2_CTRL_TYPE_AREA``.
>> -    * - :c:type:`v4l2_ctrl_h264_sps` *
>> +    * - struct :c:type:`v4l2_ctrl_h264_sps` *
>>        - ``p_h264_sps``
>>        - A pointer to a struct :c:type:`v4l2_ctrl_h264_sps`. Valid if this control is
>>          of type ``V4L2_CTRL_TYPE_H264_SPS``.
>> -    * - :c:type:`v4l2_ctrl_h264_pps` *
>> +    * - struct :c:type:`v4l2_ctrl_h264_pps` *
>>        - ``p_h264_pps``
>>        - A pointer to a struct :c:type:`v4l2_ctrl_h264_pps`. Valid if this control is
>>          of type ``V4L2_CTRL_TYPE_H264_PPS``.
>> -    * - :c:type:`v4l2_ctrl_h264_scaling_matrix` *
>> +    * - struct :c:type:`v4l2_ctrl_h264_scaling_matrix` *
>>        - ``p_h264_scaling_matrix``
>>        - A pointer to a struct :c:type:`v4l2_ctrl_h264_scaling_matrix`. Valid if this control is
>>          of type ``V4L2_CTRL_TYPE_H264_SCALING_MATRIX``.
>> -    * - :c:type:`v4l2_ctrl_h264_pred_weights` *
>> +    * - struct :c:type:`v4l2_ctrl_h264_pred_weights` *
>>        - ``p_h264_pred_weights``
>>        - A pointer to a struct :c:type:`v4l2_ctrl_h264_pred_weights`. Valid if this control is
>>          of type ``V4L2_CTRL_TYPE_H264_PRED_WEIGHTS``.
>> -    * - :c:type:`v4l2_ctrl_h264_slice_params` *
>> +    * - struct :c:type:`v4l2_ctrl_h264_slice_params` *
>>        - ``p_h264_slice_params``
>>        - A pointer to a struct :c:type:`v4l2_ctrl_h264_slice_params`. Valid if this control is
>>          of type ``V4L2_CTRL_TYPE_H264_SLICE_PARAMS``.
>> -    * - :c:type:`v4l2_ctrl_h264_decode_params` *
>> +    * - struct :c:type:`v4l2_ctrl_h264_decode_params` *
>>        - ``p_h264_decode_params``
>>        - A pointer to a struct :c:type:`v4l2_ctrl_h264_decode_params`. Valid if this control is
>>          of type ``V4L2_CTRL_TYPE_H264_DECODE_PARAMS``.
> 
> 
> 
> Thanks,
> Mauro
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 5/6] vidioc-g-ext-ctrls.rst: add missing 'struct' before the types
  2020-12-03 10:52     ` Hans Verkuil
@ 2020-12-03 12:07       ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 11+ messages in thread
From: Mauro Carvalho Chehab @ 2020-12-03 12:07 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: linux-media, Ezequiel Garcia

Em Thu, 3 Dec 2020 11:52:29 +0100
Hans Verkuil <hverkuil-cisco@xs4all.nl> escreveu:

> On 03/12/2020 11:49, Mauro Carvalho Chehab wrote:
> > Em Thu, 26 Nov 2020 14:27:16 +0100
> > Hans Verkuil <hverkuil-cisco@xs4all.nl> escreveu:
> >   
> >> Add 'struct' to clarify that these are pointers to structs.  
> > 
> > This patch is actually wrong :-)
> > 
> > It is incompatible with Sphinx 3.
> >   
> >>
> >> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> >> ---
> >>  .../userspace-api/media/v4l/vidioc-g-ext-ctrls.rst | 14 +++++++-------
> >>  1 file changed, 7 insertions(+), 7 deletions(-)
> >>
> >> diff --git a/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst b/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst
> >> index 726d6a97325f..5b1fc62ade0d 100644
> >> --- a/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst
> >> +++ b/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst
> >> @@ -180,31 +180,31 @@ still cause this situation.
> >>        - ``p_u32``
> >>        - A pointer to a matrix control of unsigned 32-bit values. Valid if
> >>  	this control is of type ``V4L2_CTRL_TYPE_U32``.
> >> -    * - :c:type:`v4l2_area` *
> >> +    * - struct :c:type:`v4l2_area` *  
> > 
> > 
> > See, with Sphinx 3, :c:type: can only be used for typedefs and defines.
> > 
> > The right markup for struct is:
> > 
> > 	:c:struct:
> > 
> > Actually, due to automarkup.py extension, I would just rename them to:
> > 
> > 	struct foo
> > 
> > And let the automarkup code to use the right markup, as it will ensure
> > that the proper dialect will be used, no matter what Sphinx version 
> > will be used to produce the docs.
> > 
> > So, I'll drop this patch from the series. I'll propose a new one
> > instead, after testing with multiple versions of Sphinx.  
> 
> 'git grep struct.*:c:type Documentation' shows a lot of those incorrect
> markups. Perhaps make a media-wide patch to fix this? Otherwise people
> will just keep copy-and-pasting the same incorrect markup.

Hmm... looking at Documentation/sphinx/parse-headers.pl, it seems
that the logic is not declaring structs using a Sphinx3 compatible
format, but, instead, using :c:type: everywhere.

So, I guess I'll just merge those two patches as-is, and then
work on a media-wide patchset.

> 
> Regards,
> 
> 	Hans
> 
> > 
> > Regards,
> > Mauro
> > 
> > 
> >   
> >>        - ``p_area``
> >>        - A pointer to a struct :c:type:`v4l2_area`. Valid if this control is
> >>          of type ``V4L2_CTRL_TYPE_AREA``.
> >> -    * - :c:type:`v4l2_ctrl_h264_sps` *
> >> +    * - struct :c:type:`v4l2_ctrl_h264_sps` *
> >>        - ``p_h264_sps``
> >>        - A pointer to a struct :c:type:`v4l2_ctrl_h264_sps`. Valid if this control is
> >>          of type ``V4L2_CTRL_TYPE_H264_SPS``.
> >> -    * - :c:type:`v4l2_ctrl_h264_pps` *
> >> +    * - struct :c:type:`v4l2_ctrl_h264_pps` *
> >>        - ``p_h264_pps``
> >>        - A pointer to a struct :c:type:`v4l2_ctrl_h264_pps`. Valid if this control is
> >>          of type ``V4L2_CTRL_TYPE_H264_PPS``.
> >> -    * - :c:type:`v4l2_ctrl_h264_scaling_matrix` *
> >> +    * - struct :c:type:`v4l2_ctrl_h264_scaling_matrix` *
> >>        - ``p_h264_scaling_matrix``
> >>        - A pointer to a struct :c:type:`v4l2_ctrl_h264_scaling_matrix`. Valid if this control is
> >>          of type ``V4L2_CTRL_TYPE_H264_SCALING_MATRIX``.
> >> -    * - :c:type:`v4l2_ctrl_h264_pred_weights` *
> >> +    * - struct :c:type:`v4l2_ctrl_h264_pred_weights` *
> >>        - ``p_h264_pred_weights``
> >>        - A pointer to a struct :c:type:`v4l2_ctrl_h264_pred_weights`. Valid if this control is
> >>          of type ``V4L2_CTRL_TYPE_H264_PRED_WEIGHTS``.
> >> -    * - :c:type:`v4l2_ctrl_h264_slice_params` *
> >> +    * - struct :c:type:`v4l2_ctrl_h264_slice_params` *
> >>        - ``p_h264_slice_params``
> >>        - A pointer to a struct :c:type:`v4l2_ctrl_h264_slice_params`. Valid if this control is
> >>          of type ``V4L2_CTRL_TYPE_H264_SLICE_PARAMS``.
> >> -    * - :c:type:`v4l2_ctrl_h264_decode_params` *
> >> +    * - struct :c:type:`v4l2_ctrl_h264_decode_params` *
> >>        - ``p_h264_decode_params``
> >>        - A pointer to a struct :c:type:`v4l2_ctrl_h264_decode_params`. Valid if this control is
> >>          of type ``V4L2_CTRL_TYPE_H264_DECODE_PARAMS``.  
> > 
> > 
> > 
> > Thanks,
> > Mauro
> >   
> 



Thanks,
Mauro

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-12-03 12:08 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-26 13:27 [PATCH 0/6] Stateless FWHT de-staging Hans Verkuil
2020-11-26 13:27 ` [PATCH 1/6] vicodec: add V4L2_ prefix before FWHT_VERSION and FWHT_FL_* Hans Verkuil
2020-11-26 13:27 ` [PATCH 2/6] vicodec: mark the stateless FWHT API as stable Hans Verkuil
2020-11-26 13:27 ` [PATCH 3/6] ext-ctrls-codec.rst: move FWHT docs to ext-ctrls-codec-stateless.rst Hans Verkuil
2020-11-26 13:27 ` [PATCH 4/6] pixfmt-compressed.rst: fix 'bullet' formatting Hans Verkuil
2020-11-26 13:27 ` [PATCH 5/6] vidioc-g-ext-ctrls.rst: add missing 'struct' before the types Hans Verkuil
2020-12-03 10:49   ` Mauro Carvalho Chehab
2020-12-03 10:52     ` Hans Verkuil
2020-12-03 12:07       ` Mauro Carvalho Chehab
2020-11-26 13:27 ` [PATCH 6/6] userspace-api/media: finalize stateless FWHT codec docs Hans Verkuil
2020-12-03 10:50   ` Mauro Carvalho Chehab

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.