Skip to contentSkip to conversation

Minor V4L2 Headers and Codec Doc Cleanups

PATCH In review Paul Kocialkowski 3 participants 12 messages Aug 24, 2025 – Aug 30, 2025 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

v2 cover Minor V4L2 Headers and Codec Doc Cleanups

Changes since v1:
- Added minor codec control cleanups;
- Added documentation about h.264 frame-wide type flags

Paul Kocialkowski (4):
media: uapi: Move colorimetry controls at the end of the file
media: uapi: Cleanup tab after define in headers
media: uapi: v4l2-controls: Cleanup codec definitions
Documentation: media: Document

    V4L2_H264_DECODE_PARAM_FLAG_PFRAME/BFRAME
 .../media/v4l/ext-ctrls-codec-stateless.rst   |   8 +-
 include/uapi/linux/v4l2-controls.h            | 121 +++++++++---------
 include/uapi/linux/videodev2.h                |  18 +--
 3 files changed, 75 insertions(+), 72 deletions(-)
Signature · 1 line
2.50.1
#1 lore raw

PATCH v2 1/4 media: uapi: Move colorimetry controls at the end of the file

The colorimetry controls class is defined after the stateless codec class at the top of the controls header. It is currently defined in the middle of stateless codec controls.

Move the colorimetry controls after the stateless codec controls, at the end of the file.

---
 include/uapi/linux/v4l2-controls.h | 68 +++++++++++++++---------------
 1 file changed, 34 insertions(+), 34 deletions(-)
include/uapi/linux/v4l2-controls.h +34 -34
index f836512e9deb..4a483ff1c418 100644
@@ -2549,40 +2549,6 @@ struct v4l2_ctrl_hevc_scaling_matrix {
 	__u8	scaling_list_dc_coef_32x32[2];
 };
 
-#define V4L2_CID_COLORIMETRY_CLASS_BASE	(V4L2_CTRL_CLASS_COLORIMETRY | 0x900)
-#define V4L2_CID_COLORIMETRY_CLASS	(V4L2_CTRL_CLASS_COLORIMETRY | 1)
-
-#define V4L2_CID_COLORIMETRY_HDR10_CLL_INFO	(V4L2_CID_COLORIMETRY_CLASS_BASE + 0)
-
-struct v4l2_ctrl_hdr10_cll_info {
-	__u16 max_content_light_level;
-	__u16 max_pic_average_light_level;
-};
-
-#define V4L2_CID_COLORIMETRY_HDR10_MASTERING_DISPLAY	(V4L2_CID_COLORIMETRY_CLASS_BASE + 1)
-
-#define V4L2_HDR10_MASTERING_PRIMARIES_X_LOW	5
-#define V4L2_HDR10_MASTERING_PRIMARIES_X_HIGH	37000
-#define V4L2_HDR10_MASTERING_PRIMARIES_Y_LOW	5
-#define V4L2_HDR10_MASTERING_PRIMARIES_Y_HIGH	42000
-#define V4L2_HDR10_MASTERING_WHITE_POINT_X_LOW	5
-#define V4L2_HDR10_MASTERING_WHITE_POINT_X_HIGH	37000
-#define V4L2_HDR10_MASTERING_WHITE_POINT_Y_LOW	5
-#define V4L2_HDR10_MASTERING_WHITE_POINT_Y_HIGH	42000
-#define V4L2_HDR10_MASTERING_MAX_LUMA_LOW	50000
-#define V4L2_HDR10_MASTERING_MAX_LUMA_HIGH	100000000
-#define V4L2_HDR10_MASTERING_MIN_LUMA_LOW	1
-#define V4L2_HDR10_MASTERING_MIN_LUMA_HIGH	50000
-
-struct v4l2_ctrl_hdr10_mastering_display {
-	__u16 display_primaries_x[3];
-	__u16 display_primaries_y[3];
-	__u16 white_point_x;
-	__u16 white_point_y;
-	__u32 max_display_mastering_luminance;
-	__u32 min_display_mastering_luminance;
-};
-
 /* Stateless VP9 controls */
 
 #define V4L2_VP9_LOOP_FILTER_FLAG_DELTA_ENABLED	0x1
@@ -3515,4 +3481,38 @@ struct v4l2_ctrl_av1_film_grain {
 #define V4L2_CID_MPEG_MFC51_BASE        V4L2_CID_CODEC_MFC51_BASE
 #endif
 
+#define V4L2_CID_COLORIMETRY_CLASS_BASE	(V4L2_CTRL_CLASS_COLORIMETRY | 0x900)
+#define V4L2_CID_COLORIMETRY_CLASS	(V4L2_CTRL_CLASS_COLORIMETRY | 1)
+
+#define V4L2_CID_COLORIMETRY_HDR10_CLL_INFO	(V4L2_CID_COLORIMETRY_CLASS_BASE + 0)
+
+struct v4l2_ctrl_hdr10_cll_info {
+	__u16 max_content_light_level;
+	__u16 max_pic_average_light_level;
+};
+
+#define V4L2_CID_COLORIMETRY_HDR10_MASTERING_DISPLAY	(V4L2_CID_COLORIMETRY_CLASS_BASE + 1)
+
+#define V4L2_HDR10_MASTERING_PRIMARIES_X_LOW	5
+#define V4L2_HDR10_MASTERING_PRIMARIES_X_HIGH	37000
+#define V4L2_HDR10_MASTERING_PRIMARIES_Y_LOW	5
+#define V4L2_HDR10_MASTERING_PRIMARIES_Y_HIGH	42000
+#define V4L2_HDR10_MASTERING_WHITE_POINT_X_LOW	5
+#define V4L2_HDR10_MASTERING_WHITE_POINT_X_HIGH	37000
+#define V4L2_HDR10_MASTERING_WHITE_POINT_Y_LOW	5
+#define V4L2_HDR10_MASTERING_WHITE_POINT_Y_HIGH	42000
+#define V4L2_HDR10_MASTERING_MAX_LUMA_LOW	50000
+#define V4L2_HDR10_MASTERING_MAX_LUMA_HIGH	100000000
+#define V4L2_HDR10_MASTERING_MIN_LUMA_LOW	1
+#define V4L2_HDR10_MASTERING_MIN_LUMA_HIGH	50000
+
+struct v4l2_ctrl_hdr10_mastering_display {
+	__u16 display_primaries_x[3];
+	__u16 display_primaries_y[3];
+	__u16 white_point_x;
+	__u16 white_point_y;
+	__u32 max_display_mastering_luminance;
+	__u32 min_display_mastering_luminance;
+};
+
 #endif
Signature · 1 line
2.50.1
Reviewed-by on v2 1/4
#2 lore raw

Re: [PATCH v2 1/4] media: uapi: Move colorimetry controls at the end of the file

Le dimanche 24 août 2025 à 20:07 +0200, Paul Kocialkowski a écrit :

Quoted 8 lines

The colorimetry controls class is defined after the stateless codec class at the top of the controls header. It is currently defined in the middle of stateless codec controls.

Move the colorimetry controls after the stateless codec controls, at the end of the file.

Quoted 95 lines

---
 include/uapi/linux/v4l2-controls.h | 68 +++++++++++++++---------------

 1 file changed, 34 insertions(+), 34 deletions(-)
include/uapi/linux/v4l2- renamed from include/uapi/linux/v4l2-controls.h +0 -0

controls.h
index f836512e9deb..4a483ff1c418 100644

include/uapi/linux/v4l2-controls.h +0 -0
@@ -2549,40 +2549,6 @@ struct v4l2_ctrl_hevc_scaling_matrix {
  	__u8	scaling_list_dc_coef_32x32[2];
  };


-#define V4L2_CID_COLORIMETRY_CLASS_BASE (V4L2_CTRL_CLASS_COLORIMETRY
| 0x900)

include/uapi/linux/v4l2-controls.h +0 -3
-#define V4L2_CID_COLORIMETRY_CLASS	(V4L2_CTRL_CLASS_COLORIMETRY | 1)
-
-#define

V4L2_CID_COLORIMETRY_HDR10_CLL_INFO (V4L2_CID_COLORIMETRY_CLASS_BASE + 0)

include/uapi/linux/v4l2-controls.h +0 -7
-
-struct v4l2_ctrl_hdr10_cll_info {
-	__u16 max_content_light_level;
-	__u16 max_pic_average_light_level;
-};
-
-#define

V4L2_CID_COLORIMETRY_HDR10_MASTERING_DISPLAY (V4L2_CID_COLORIMETRY_CLASS_BASE +1)

include/uapi/linux/v4l2-controls.h +0 -23
-
-#define V4L2_HDR10_MASTERING_PRIMARIES_X_LOW	5
-#define V4L2_HDR10_MASTERING_PRIMARIES_X_HIGH	37000
-#define V4L2_HDR10_MASTERING_PRIMARIES_Y_LOW	5
-#define V4L2_HDR10_MASTERING_PRIMARIES_Y_HIGH	42000
-#define V4L2_HDR10_MASTERING_WHITE_POINT_X_LOW	5
-#define V4L2_HDR10_MASTERING_WHITE_POINT_X_HIGH	37000
-#define V4L2_HDR10_MASTERING_WHITE_POINT_Y_LOW	5
-#define V4L2_HDR10_MASTERING_WHITE_POINT_Y_HIGH	42000
-#define V4L2_HDR10_MASTERING_MAX_LUMA_LOW	50000
-#define V4L2_HDR10_MASTERING_MAX_LUMA_HIGH	100000000
-#define V4L2_HDR10_MASTERING_MIN_LUMA_LOW	1
-#define V4L2_HDR10_MASTERING_MIN_LUMA_HIGH	50000
-
-struct v4l2_ctrl_hdr10_mastering_display {
-	__u16 display_primaries_x[3];
-	__u16 display_primaries_y[3];
-	__u16 white_point_x;
-	__u16 white_point_y;
-	__u32 max_display_mastering_luminance;
-	__u32 min_display_mastering_luminance;
-};
-

 /* Stateless VP9 controls */

 #define V4L2_VP9_LOOP_FILTER_FLAG_DELTA_ENABLED 0x1

include/uapi/linux/v4l2-controls.h +0 -0
@@ -3515,4 +3481,38 @@ struct v4l2_ctrl_av1_film_grain {
  #define V4L2_CID_MPEG_MFC51_BASE        V4L2_CID_CODEC_MFC51_BASE
  #endif


+#define V4L2_CID_COLORIMETRY_CLASS_BASE (V4L2_CTRL_CLASS_COLORIMETRY
| 0x900)

include/uapi/linux/v4l2-controls.h +3 -0
+#define V4L2_CID_COLORIMETRY_CLASS	(V4L2_CTRL_CLASS_COLORIMETRY | 1)
+
+#define

V4L2_CID_COLORIMETRY_HDR10_CLL_INFO (V4L2_CID_COLORIMETRY_CLASS_BASE + 0)

include/uapi/linux/v4l2-controls.h +7 -0
+
+struct v4l2_ctrl_hdr10_cll_info {
+	__u16 max_content_light_level;
+	__u16 max_pic_average_light_level;
+};
+
+#define

V4L2_CID_COLORIMETRY_HDR10_MASTERING_DISPLAY (V4L2_CID_COLORIMETRY_CLASS_BASE +1)

include/uapi/linux/v4l2-controls.h +23 -0
+
+#define V4L2_HDR10_MASTERING_PRIMARIES_X_LOW	5
+#define V4L2_HDR10_MASTERING_PRIMARIES_X_HIGH	37000
+#define V4L2_HDR10_MASTERING_PRIMARIES_Y_LOW	5
+#define V4L2_HDR10_MASTERING_PRIMARIES_Y_HIGH	42000
+#define V4L2_HDR10_MASTERING_WHITE_POINT_X_LOW	5
+#define V4L2_HDR10_MASTERING_WHITE_POINT_X_HIGH	37000
+#define V4L2_HDR10_MASTERING_WHITE_POINT_Y_LOW	5
+#define V4L2_HDR10_MASTERING_WHITE_POINT_Y_HIGH	42000
+#define V4L2_HDR10_MASTERING_MAX_LUMA_LOW	50000
+#define V4L2_HDR10_MASTERING_MAX_LUMA_HIGH	100000000
+#define V4L2_HDR10_MASTERING_MIN_LUMA_LOW	1
+#define V4L2_HDR10_MASTERING_MIN_LUMA_HIGH	50000
+
+struct v4l2_ctrl_hdr10_mastering_display {
+	__u16 display_primaries_x[3];
+	__u16 display_primaries_y[3];
+	__u16 white_point_x;
+	__u16 white_point_y;
+	__u32 max_display_mastering_luminance;
+	__u32 min_display_mastering_luminance;
+};
+

 #endif

#3 lore raw

PATCH v2 2/4 media: uapi: Cleanup tab after define in headers

In reply to Paul Kocialkowski

Some definitions use a tab after the define keyword instead of the usual single space. Replace it for better consistency.

---
 include/uapi/linux/v4l2-controls.h | 30 +++++++++++++++---------------
 include/uapi/linux/videodev2.h     | 18 +++++++++---------
 2 files changed, 24 insertions(+), 24 deletions(-)
include/uapi/linux/v4l2-controls.h +15 -15
index 4a483ff1c418..7aef88465d04 100644
@@ -1193,7 +1193,7 @@ enum v4l2_flash_strobe_source {
 #define V4L2_CID_JPEG_CLASS_BASE		(V4L2_CTRL_CLASS_JPEG | 0x900)
 #define V4L2_CID_JPEG_CLASS			(V4L2_CTRL_CLASS_JPEG | 1)
 
-#define	V4L2_CID_JPEG_CHROMA_SUBSAMPLING	(V4L2_CID_JPEG_CLASS_BASE + 1)
+#define V4L2_CID_JPEG_CHROMA_SUBSAMPLING	(V4L2_CID_JPEG_CLASS_BASE + 1)
 enum v4l2_jpeg_chroma_subsampling {
 	V4L2_JPEG_CHROMA_SUBSAMPLING_444	= 0,
 	V4L2_JPEG_CHROMA_SUBSAMPLING_422	= 1,
@@ -1202,15 +1202,15 @@ enum v4l2_jpeg_chroma_subsampling {
 	V4L2_JPEG_CHROMA_SUBSAMPLING_410	= 4,
 	V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY	= 5,
 };
-#define	V4L2_CID_JPEG_RESTART_INTERVAL		(V4L2_CID_JPEG_CLASS_BASE + 2)
-#define	V4L2_CID_JPEG_COMPRESSION_QUALITY	(V4L2_CID_JPEG_CLASS_BASE + 3)
+#define V4L2_CID_JPEG_RESTART_INTERVAL		(V4L2_CID_JPEG_CLASS_BASE + 2)
+#define V4L2_CID_JPEG_COMPRESSION_QUALITY	(V4L2_CID_JPEG_CLASS_BASE + 3)
 
-#define	V4L2_CID_JPEG_ACTIVE_MARKER		(V4L2_CID_JPEG_CLASS_BASE + 4)
-#define	V4L2_JPEG_ACTIVE_MARKER_APP0		(1 << 0)
-#define	V4L2_JPEG_ACTIVE_MARKER_APP1		(1 << 1)
-#define	V4L2_JPEG_ACTIVE_MARKER_COM		(1 << 16)
-#define	V4L2_JPEG_ACTIVE_MARKER_DQT		(1 << 17)
-#define	V4L2_JPEG_ACTIVE_MARKER_DHT		(1 << 18)
+#define V4L2_CID_JPEG_ACTIVE_MARKER		(V4L2_CID_JPEG_CLASS_BASE + 4)
+#define V4L2_JPEG_ACTIVE_MARKER_APP0		(1 << 0)
+#define V4L2_JPEG_ACTIVE_MARKER_APP1		(1 << 1)
+#define V4L2_JPEG_ACTIVE_MARKER_COM		(1 << 16)
+#define V4L2_JPEG_ACTIVE_MARKER_DQT		(1 << 17)
+#define V4L2_JPEG_ACTIVE_MARKER_DHT		(1 << 18)
 
 
 /* Image source controls */
@@ -1243,10 +1243,10 @@ enum v4l2_jpeg_chroma_subsampling {
 #define V4L2_CID_DV_CLASS_BASE			(V4L2_CTRL_CLASS_DV | 0x900)
 #define V4L2_CID_DV_CLASS			(V4L2_CTRL_CLASS_DV | 1)
 
-#define	V4L2_CID_DV_TX_HOTPLUG			(V4L2_CID_DV_CLASS_BASE + 1)
-#define	V4L2_CID_DV_TX_RXSENSE			(V4L2_CID_DV_CLASS_BASE + 2)
-#define	V4L2_CID_DV_TX_EDID_PRESENT		(V4L2_CID_DV_CLASS_BASE + 3)
-#define	V4L2_CID_DV_TX_MODE			(V4L2_CID_DV_CLASS_BASE + 4)
+#define V4L2_CID_DV_TX_HOTPLUG			(V4L2_CID_DV_CLASS_BASE + 1)
+#define V4L2_CID_DV_TX_RXSENSE			(V4L2_CID_DV_CLASS_BASE + 2)
+#define V4L2_CID_DV_TX_EDID_PRESENT		(V4L2_CID_DV_CLASS_BASE + 3)
+#define V4L2_CID_DV_TX_MODE			(V4L2_CID_DV_CLASS_BASE + 4)
 enum v4l2_dv_tx_mode {
 	V4L2_DV_TX_MODE_DVI_D	= 0,
 	V4L2_DV_TX_MODE_HDMI	= 1,
@@ -1267,7 +1267,7 @@ enum v4l2_dv_it_content_type {
 	V4L2_DV_IT_CONTENT_TYPE_NO_ITC	  = 4,
 };
 
-#define	V4L2_CID_DV_RX_POWER_PRESENT		(V4L2_CID_DV_CLASS_BASE + 100)
+#define V4L2_CID_DV_RX_POWER_PRESENT		(V4L2_CID_DV_CLASS_BASE + 100)
 #define V4L2_CID_DV_RX_RGB_RANGE		(V4L2_CID_DV_CLASS_BASE + 101)
 #define V4L2_CID_DV_RX_IT_CONTENT_TYPE		(V4L2_CID_DV_CLASS_BASE + 102)
 
@@ -2552,7 +2552,7 @@ struct v4l2_ctrl_hevc_scaling_matrix {
 /* Stateless VP9 controls */
 
 #define V4L2_VP9_LOOP_FILTER_FLAG_DELTA_ENABLED	0x1
-#define	V4L2_VP9_LOOP_FILTER_FLAG_DELTA_UPDATE	0x2
+#define V4L2_VP9_LOOP_FILTER_FLAG_DELTA_UPDATE	0x2
 
 /**
  * struct v4l2_vp9_loop_filter - VP9 loop filter parameters
include/uapi/linux/videodev2.h +9 -9
index 3dd9fa45dde1..64943f1a6149 100644
@@ -1607,8 +1607,8 @@ struct v4l2_bt_timings {
 } __attribute__ ((packed));
 
 /* Interlaced or progressive format */
-#define	V4L2_DV_PROGRESSIVE	0
-#define	V4L2_DV_INTERLACED	1
+#define V4L2_DV_PROGRESSIVE	0
+#define V4L2_DV_INTERLACED	1
 
 /* Polarities. If bit is not set, it is assumed to be negative polarity */
 #define V4L2_DV_VSYNC_POS_POL	0x00000001
@@ -2788,15 +2788,15 @@ struct v4l2_remove_buffers {
  * Only implemented if CONFIG_VIDEO_ADV_DEBUG is defined.
  * You must be root to use these ioctls. Never use these in applications!
  */
-#define	VIDIOC_DBG_S_REGISTER	 _IOW('V', 79, struct v4l2_dbg_register)
-#define	VIDIOC_DBG_G_REGISTER	_IOWR('V', 80, struct v4l2_dbg_register)
+#define VIDIOC_DBG_S_REGISTER	 _IOW('V', 79, struct v4l2_dbg_register)
+#define VIDIOC_DBG_G_REGISTER	_IOWR('V', 80, struct v4l2_dbg_register)
 
 #define VIDIOC_S_HW_FREQ_SEEK	 _IOW('V', 82, struct v4l2_hw_freq_seek)
-#define	VIDIOC_S_DV_TIMINGS	_IOWR('V', 87, struct v4l2_dv_timings)
-#define	VIDIOC_G_DV_TIMINGS	_IOWR('V', 88, struct v4l2_dv_timings)
-#define	VIDIOC_DQEVENT		 _IOR('V', 89, struct v4l2_event)
-#define	VIDIOC_SUBSCRIBE_EVENT	 _IOW('V', 90, struct v4l2_event_subscription)
-#define	VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription)
+#define VIDIOC_S_DV_TIMINGS	_IOWR('V', 87, struct v4l2_dv_timings)
+#define VIDIOC_G_DV_TIMINGS	_IOWR('V', 88, struct v4l2_dv_timings)
+#define VIDIOC_DQEVENT		 _IOR('V', 89, struct v4l2_event)
+#define VIDIOC_SUBSCRIBE_EVENT	 _IOW('V', 90, struct v4l2_event_subscription)
+#define VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription)
 #define VIDIOC_CREATE_BUFS	_IOWR('V', 92, struct v4l2_create_buffers)
 #define VIDIOC_PREPARE_BUF	_IOWR('V', 93, struct v4l2_buffer)
 #define VIDIOC_G_SELECTION	_IOWR('V', 94, struct v4l2_selection)
Signature · 1 line
2.50.1
Reviewed-by on v2 2/4
#4 lore raw

Re: [PATCH v2 2/4] media: uapi: Cleanup tab after define in headers

Le dimanche 24 août 2025 à 20:07 +0200, Paul Kocialkowski a écrit :

Quoted 4 lines

Some definitions use a tab after the define keyword instead of the usual single space. Replace it for better consistency.

Quoted 139 lines

---
 include/uapi/linux/v4l2-controls.h | 30 +++++++++++++++--------------- include/uapi/linux/videodev2.h     | 18 +++++++++---------

 2 files changed, 24 insertions(+), 24 deletions(-)
include/uapi/linux/v4l2- renamed from include/uapi/linux/v4l2-controls.h +0 -0

controls.h
index 4a483ff1c418..7aef88465d04 100644

include/uapi/linux/v4l2-controls.h +0 -0
@@ -1193,7 +1193,7 @@ enum v4l2_flash_strobe_source {
  #define V4L2_CID_JPEG_CLASS_BASE		(V4L2_CTRL_CLASS_JPEG |
 0x900)
  #define V4L2_CID_JPEG_CLASS			(V4L2_CTRL_CLASS_JPEG | 1)


-
#define V4L2_CID_JPEG_CHROMA_SUBSAMPLING (V4L2_CID_JPEG_CLASS_BASE + 1)
+#define V4L2_CID_JPEG_CHROMA_SUBSAMPLING (V4L2_CID_JPEG_CLASS_BASE +
1)
 enum v4l2_jpeg_chroma_subsampling {
  V4L2_JPEG_CHROMA_SUBSAMPLING_444 = 0,
  V4L2_JPEG_CHROMA_SUBSAMPLING_422 = 1,

include/uapi/linux/v4l2-controls.h +2 -2
@@ -1202,15 +1202,15 @@ enum v4l2_jpeg_chroma_subsampling {
  	V4L2_JPEG_CHROMA_SUBSAMPLING_410	= 4,
  	V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY	= 5,
  };
-
 #define	V4L2_CID_JPEG_RESTART_INTERVAL		(V4L2_CID_JPEG_CLASS_BASE + 2)
-
 #define	V4L2_CID_JPEG_COMPRESSION_QUALITY	(V4L2_CID_JPEG_CLASS_BASE + 3)
+#define V4L2_CID_JPEG_RESTART_INTERVAL		(V4L2_CID_JPEG_CLASS_BASE +
 2)
+#define V4L2_CID_JPEG_COMPRESSION_QUALITY	(V4L2_CID_JPEG_CLASS_BASE +
 3)


-
#define V4L2_CID_JPEG_ACTIVE_MARKER (V4L2_CID_JPEG_CLASS_BASE + 4)

include/uapi/linux/v4l2-controls.h +1 -5
-#define	V4L2_JPEG_ACTIVE_MARKER_APP0		(1 << 0)
-#define	V4L2_JPEG_ACTIVE_MARKER_APP1		(1 << 1)
-#define	V4L2_JPEG_ACTIVE_MARKER_COM		(1 << 16)
-#define	V4L2_JPEG_ACTIVE_MARKER_DQT		(1 << 17)
-#define	V4L2_JPEG_ACTIVE_MARKER_DHT		(1 << 18)
+#define V4L2_CID_JPEG_ACTIVE_MARKER		(V4L2_CID_JPEG_CLASS_BASE +

4)

include/uapi/linux/v4l2-controls.h +5 -0
+#define V4L2_JPEG_ACTIVE_MARKER_APP0		(1 << 0)
+#define V4L2_JPEG_ACTIVE_MARKER_APP1		(1 << 1)
+#define V4L2_JPEG_ACTIVE_MARKER_COM		(1 << 16)
+#define V4L2_JPEG_ACTIVE_MARKER_DQT		(1 << 17)
+#define V4L2_JPEG_ACTIVE_MARKER_DHT		(1 << 18)



 /* Image source controls */

include/uapi/linux/v4l2-controls.h +0 -0
@@ -1243,10 +1243,10 @@ enum v4l2_jpeg_chroma_subsampling {
  #define V4L2_CID_DV_CLASS_BASE			(V4L2_CTRL_CLASS_DV | 0x900)
  #define V4L2_CID_DV_CLASS			(V4L2_CTRL_CLASS_DV | 1)


-
#define V4L2_CID_DV_TX_HOTPLUG (V4L2_CID_DV_CLASS_BASE + 1)
-
#define V4L2_CID_DV_TX_RXSENSE (V4L2_CID_DV_CLASS_BASE + 2)
-
#define V4L2_CID_DV_TX_EDID_PRESENT (V4L2_CID_DV_CLASS_BASE + 3)
-
#define V4L2_CID_DV_TX_MODE (V4L2_CID_DV_CLASS_BASE + 4)

include/uapi/linux/v4l2-controls.h +4 -0
+#define V4L2_CID_DV_TX_HOTPLUG			(V4L2_CID_DV_CLASS_BASE + 1)
+#define V4L2_CID_DV_TX_RXSENSE			(V4L2_CID_DV_CLASS_BASE + 2)
+#define V4L2_CID_DV_TX_EDID_PRESENT		(V4L2_CID_DV_CLASS_BASE + 3)
+#define V4L2_CID_DV_TX_MODE			(V4L2_CID_DV_CLASS_BASE + 4)

 enum v4l2_dv_tx_mode {
  V4L2_DV_TX_MODE_DVI_D = 0,
  V4L2_DV_TX_MODE_HDMI = 1,

include/uapi/linux/v4l2-controls.h +0 -0
@@ -1267,7 +1267,7 @@ enum v4l2_dv_it_content_type {
  	V4L2_DV_IT_CONTENT_TYPE_NO_ITC	  = 4,
  };


-
#define V4L2_CID_DV_RX_POWER_PRESENT (V4L2_CID_DV_CLASS_BASE + 100)
+#define V4L2_CID_DV_RX_POWER_PRESENT (V4L2_CID_DV_CLASS_BASE +
100)
 #define V4L2_CID_DV_RX_RGB_RANGE (V4L2_CID_DV_CLASS_BASE +
101)
 #define V4L2_CID_DV_RX_IT_CONTENT_TYPE (V4L2_CID_DV_CLASS_BASE +
102)

include/uapi/linux/v4l2-controls.h +0 -0
@@ -2552,7 +2552,7 @@ struct v4l2_ctrl_hevc_scaling_matrix {
  /* Stateless VP9 controls */


 #define V4L2_VP9_LOOP_FILTER_FLAG_DELTA_ENABLED 0x1

include/uapi/linux/v4l2-controls.h +1 -1
-#define	V4L2_VP9_LOOP_FILTER_FLAG_DELTA_UPDATE	0x2
+#define V4L2_VP9_LOOP_FILTER_FLAG_DELTA_UPDATE	0x2


 /**
  * struct v4l2_vp9_loop_filter - VP9 loop filter parameters

include/uapi/linux/videodev2.h +0 -0
index 3dd9fa45dde1..64943f1a6149 100644
@@ -1607,8 +1607,8 @@ struct v4l2_bt_timings {
  } __attribute__ ((packed));


 /* Interlaced or progressive format */

include/uapi/linux/videodev2.h +2 -2
-#define	V4L2_DV_PROGRESSIVE	0
-#define	V4L2_DV_INTERLACED	1
+#define V4L2_DV_PROGRESSIVE	0
+#define V4L2_DV_INTERLACED	1


 /* Polarities. If bit is not set, it is assumed to be negative polarity */
 #define V4L2_DV_VSYNC_POS_POL 0x00000001

include/uapi/linux/videodev2.h +2 -2
@@ -2788,15 +2788,15 @@ struct v4l2_remove_buffers {
   * Only implemented if CONFIG_VIDEO_ADV_DEBUG is defined.
   * You must be root to use these ioctls. Never use these in applications!
   */
-#define	VIDIOC_DBG_S_REGISTER	 _IOW('V', 79, struct
 v4l2_dbg_register)
-#define	VIDIOC_DBG_G_REGISTER	_IOWR('V', 80, struct
 v4l2_dbg_register)
+#define VIDIOC_DBG_S_REGISTER	 _IOW('V', 79, struct v4l2_dbg_register)
+#define VIDIOC_DBG_G_REGISTER	_IOWR('V', 80, struct v4l2_dbg_register)


 #define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek)
-#define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct
v4l2_dv_timings)
-#define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct
v4l2_dv_timings)

include/uapi/linux/videodev2.h +0 -2
-#define	VIDIOC_DQEVENT		 _IOR('V', 89, struct v4l2_event)
-#define	VIDIOC_SUBSCRIBE_EVENT	 _IOW('V', 90, struct

v4l2_event_subscription)
-#define VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct
v4l2_event_subscription)

include/uapi/linux/videodev2.h +4 -0
+#define VIDIOC_S_DV_TIMINGS	_IOWR('V', 87, struct v4l2_dv_timings)
+#define VIDIOC_G_DV_TIMINGS	_IOWR('V', 88, struct v4l2_dv_timings)
+#define VIDIOC_DQEVENT		 _IOR('V', 89, struct v4l2_event)
+#define VIDIOC_SUBSCRIBE_EVENT	 _IOW('V', 90, struct

v4l2_event_subscription)
+#define VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription)
 #define VIDIOC_CREATE_BUFS _IOWR('V', 92, struct v4l2_create_buffers)
 #define VIDIOC_PREPARE_BUF _IOWR('V', 93, struct v4l2_buffer)
 #define VIDIOC_G_SELECTION _IOWR('V', 94, struct v4l2_selection)

#5 lore raw

PATCH v2 3/4 media: uapi: v4l2-controls: Cleanup codec definitions

In reply to Paul Kocialkowski

Move some fields closer to where they are used, add missing tabs and remove an extra newline.

---
 include/uapi/linux/v4l2-controls.h | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)
include/uapi/linux/v4l2-controls.h +11 -12
index 7aef88465d04..2d30107e047e 100644
@@ -1537,15 +1537,6 @@ struct v4l2_ctrl_h264_pred_weights {
 	struct v4l2_h264_weight_factors weight_factors[2];
 };
 
-#define V4L2_H264_SLICE_TYPE_P				0
-#define V4L2_H264_SLICE_TYPE_B				1
-#define V4L2_H264_SLICE_TYPE_I				2
-#define V4L2_H264_SLICE_TYPE_SP				3
-#define V4L2_H264_SLICE_TYPE_SI				4
-
-#define V4L2_H264_SLICE_FLAG_DIRECT_SPATIAL_MV_PRED	0x01
-#define V4L2_H264_SLICE_FLAG_SP_FOR_SWITCH		0x02
-
 #define V4L2_H264_TOP_FIELD_REF				0x1
 #define V4L2_H264_BOTTOM_FIELD_REF			0x2
 #define V4L2_H264_FRAME_REF				0x3
@@ -1566,8 +1557,17 @@ struct v4l2_h264_reference {
  * Maximum DPB size, as specified by section 'A.3.1 Level limits
  * common to the Baseline, Main, and Extended profiles'.
  */
-#define V4L2_H264_NUM_DPB_ENTRIES 16
-#define V4L2_H264_REF_LIST_LEN (2 * V4L2_H264_NUM_DPB_ENTRIES)
+#define V4L2_H264_NUM_DPB_ENTRIES		16
+#define V4L2_H264_REF_LIST_LEN			(2 * V4L2_H264_NUM_DPB_ENTRIES)
+
+#define V4L2_H264_SLICE_TYPE_P				0
+#define V4L2_H264_SLICE_TYPE_B				1
+#define V4L2_H264_SLICE_TYPE_I				2
+#define V4L2_H264_SLICE_TYPE_SP				3
+#define V4L2_H264_SLICE_TYPE_SI				4
+
+#define V4L2_H264_SLICE_FLAG_DIRECT_SPATIAL_MV_PRED		0x01
+#define V4L2_H264_SLICE_FLAG_SP_FOR_SWITCH			0x02
 
 #define V4L2_CID_STATELESS_H264_SLICE_PARAMS	(V4L2_CID_CODEC_STATELESS_BASE + 6)
 /**
@@ -1707,7 +1707,6 @@ struct v4l2_ctrl_h264_decode_params {
 	__u32 flags;
 };
 
-
 /* Stateless FWHT control, used by the vicodec driver */
 
 /* Current FWHT version */
Signature · 1 line
2.50.1
Reviewed-by on v2 3/4
#6 lore raw

Re: [PATCH v2 3/4] media: uapi: v4l2-controls: Cleanup codec definitions

Le dimanche 24 août 2025 à 20:07 +0200, Paul Kocialkowski a écrit :

Quoted 4 lines

Move some fields closer to where they are used, add missing tabs and remove an extra newline.

Quoted 55 lines

---
 include/uapi/linux/v4l2-controls.h | 23 +++++++++++------------

 1 file changed, 11 insertions(+), 12 deletions(-)
include/uapi/linux/v4l2- renamed from include/uapi/linux/v4l2-controls.h +0 -0

controls.h
index 7aef88465d04..2d30107e047e 100644

include/uapi/linux/v4l2-controls.h +0 -0
@@ -1537,15 +1537,6 @@ struct v4l2_ctrl_h264_pred_weights {
  	struct v4l2_h264_weight_factors weight_factors[2];
  };

include/uapi/linux/v4l2-controls.h +0 -9
-#define V4L2_H264_SLICE_TYPE_P				0
-#define V4L2_H264_SLICE_TYPE_B				1
-#define V4L2_H264_SLICE_TYPE_I				2
-#define V4L2_H264_SLICE_TYPE_SP				3
-#define V4L2_H264_SLICE_TYPE_SI				4
-
-#define V4L2_H264_SLICE_FLAG_DIRECT_SPATIAL_MV_PRED	0x01
-#define V4L2_H264_SLICE_FLAG_SP_FOR_SWITCH		0x02
-

 #define V4L2_H264_TOP_FIELD_REF 0x1
 #define V4L2_H264_BOTTOM_FIELD_REF 0x2
 #define V4L2_H264_FRAME_REF 0x3

include/uapi/linux/v4l2-controls.h +11 -2
@@ -1566,8 +1557,17 @@ struct v4l2_h264_reference {
   * Maximum DPB size, as specified by section 'A.3.1 Level limits
   * common to the Baseline, Main, and Extended profiles'.
   */
-#define V4L2_H264_NUM_DPB_ENTRIES 16
-#define V4L2_H264_REF_LIST_LEN (2 * V4L2_H264_NUM_DPB_ENTRIES)
+#define V4L2_H264_NUM_DPB_ENTRIES		16
+#define V4L2_H264_REF_LIST_LEN			(2 *
 V4L2_H264_NUM_DPB_ENTRIES)
+
+#define V4L2_H264_SLICE_TYPE_P				0
+#define V4L2_H264_SLICE_TYPE_B				1
+#define V4L2_H264_SLICE_TYPE_I				2
+#define V4L2_H264_SLICE_TYPE_SP				3
+#define V4L2_H264_SLICE_TYPE_SI				4
+
+#define V4L2_H264_SLICE_FLAG_DIRECT_SPATIAL_MV_PRED		0x01
+#define V4L2_H264_SLICE_FLAG_SP_FOR_SWITCH			0x02


 #define
V4L2_CID_STATELESS_H264_SLICE_PARAMS (V4L2_CID_CODEC_STATELESS_BASE + 6)
 /**

include/uapi/linux/v4l2-controls.h +0 -0
@@ -1707,7 +1707,6 @@ struct v4l2_ctrl_h264_decode_params {
  	__u32 flags;
  };


-
 /* Stateless FWHT control, used by the vicodec driver */
 /* Current FWHT version */

#7 lore raw

PATCH v2 4/4 Documentation: media: Document V4L2_H264_DECODE_PARAM_FLAG_PFRAME/BFRAME

In reply to Paul Kocialkowski

These flags are meant for a very specific use-case, add a mention of it.

---
 .../userspace-api/media/v4l/ext-ctrls-codec-stateless.rst | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst +6 -2
index 0da635691fdc..de1e3873385c 100644
@@ -618,10 +618,14 @@ Stateless Codec Control ID
       -
     * - ``V4L2_H264_DECODE_PARAM_FLAG_PFRAME``
       - 0x00000008
-      -
+      - All submitted slices for the frame are P slices. This is a compability
+        flag required for decoders that only support decoding such frames, but
+        should not be required for slice-based decoders.
     * - ``V4L2_H264_DECODE_PARAM_FLAG_BFRAME``
       - 0x00000010
-      -
+      - All submitted slices for the frame are B slices. This is a compability
+        flag required for decoders that only support decoding such frames, but
+        should not be required for slice-based decoders.
 
 .. raw:: latex
 
Signature · 1 line
2.50.1
#8 lore raw

Re: [PATCH v2 4/4] Documentation: media: Document V4L2_H264_DECODE_PARAM_FLAG_PFRAME/BFRAME

Le dimanche 24 août 2025 à 20:07 +0200, Paul Kocialkowski a écrit :

Quoted 12 lines

These flags are meant for a very specific use-case, add a mention of it.

---
 .../userspace-api/media/v4l/ext-ctrls-codec-stateless.rst | 8 ++++++--

 1 file changed, 6 insertions(+), 2 deletions(-)
Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst +0 -0
index 0da635691fdc..de1e3873385c 100644
@@ -618,10 +618,14 @@ Stateless Codec Control ID
Quoted 7 lines

       -
     * - ``V4L2_H264_DECODE_PARAM_FLAG_PFRAME``
       - 0x00000008
-      -
+      - All submitted slices for the frame are P slices. This is a compability +        flag required for decoders that only support decoding such frames, but +        should not be required for slice-based decoders.

Seems to match the comment in Tegra driver, and related to a hardware limitation. Shall we also recommend not to use this unless similar limitation exists ?

Note that mix of P and I, or, B and I, should still work on Tegra, its mixing P and B that will fail since one of the reference list will be missing. At least, this is my understanding.

Nicolas

Quoted 9 lines

     * - ``V4L2_H264_DECODE_PARAM_FLAG_BFRAME``
       - 0x00000010
-      -
+      - All submitted slices for the frame are B slices. This is a compability +        flag required for decoders that only support decoding such frames, but +        should not be required for slice-based decoders.

 .. raw:: latex

#9 lore raw

Re: [PATCH v2 4/4] Documentation: media: Document V4L2_H264_DECODE_PARAM_FLAG_PFRAME/BFRAME

Hi,

+ Adding Dmitry in the loop (whom I forgot, sorry).

Dmitry, we're discussing the precise meaning of the Tegra VDE H.264 decode flags that indicate PFRAME/BFRAME.

Quoted 8 lines · Nicolas Dufresne

Le dimanche 24 août 2025 à 20:07 +0200, Paul Kocialkowski a écrit :

Quoted 7 lines

These flags are meant for a very specific use-case, add a mention of it.

---
 .../userspace-api/media/v4l/ext-ctrls-codec-stateless.rst | 8 ++++++--

 1 file changed, 6 insertions(+), 2 deletions(-)
Quoted 16 lines
Quoted 5 lines
Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst +0 -0
index 0da635691fdc..de1e3873385c 100644
@@ -618,10 +618,14 @@ Stateless Codec Control ID
Quoted 7 lines

       -
     * - ``V4L2_H264_DECODE_PARAM_FLAG_PFRAME``
       - 0x00000008
-      -
+      - All submitted slices for the frame are P slices. This is a compability +        flag required for decoders that only support decoding such frames, but +        should not be required for slice-based decoders.

Seems to match the comment in Tegra driver, and related to a hardware limitation. Shall we also recommend not to use this unless similar limitation exists ?

I think the flag should only be allowed for frame-based decode mode and indeed it would be good to say that drivers should only check this flag if they have such limitations.

Userspace on the other hand cannot really know if it will be used or not so it should set the flags when applicable.

Quoted 3 lines

Note that mix of P and I, or, B and I, should still work on Tegra, its mixing P and B that will fail since one of the reference list will be missing. At least, this is my understanding.

Well the comment in the driver mandates that "frame consists of the same type slices" and "decoding of a non-uniform frames isn't supported by hardware".

But looking at the code these statements seem exaggerated and I concur to your understanding that at least mixing I and P should work, since it only sets up the L0 reference list. There's an explicit hardware flag for "B frames" that could have a more restrictive meaning. Maybe it also allows I frames and/or P frames, maybe not.

So perhaps we could relax the definitions to an indication that the L0/L1 reference lists will be used by the frame slices, which implicitly allows mixing different types of slices.

After all it is likely that decoders in that situation just really care about having the required ref lists prepared and don't particularly need each slice_type to be the same. After all they're still parsing the slice headers so they do have all the slice-specific info.

Paul

Quoted 11 lines

Nicolas

Quoted 9 lines

     * - ``V4L2_H264_DECODE_PARAM_FLAG_BFRAME``
       - 0x00000010
-      -
+      - All submitted slices for the frame are B slices. This is a compability +        flag required for decoders that only support decoding such frames, but +        should not be required for slice-based decoders.

 .. raw:: latex

Signature · 6 lines
Paul Kocialkowski,

Independent contractor - sys-base - https://www.sys-base.io/
Free software developer - https://www.paulk.fr/

Expert in multimedia, graphics and embedded hardware support with Linux.
#10 lore raw

Re: [PATCH v2 4/4] Documentation: media: Document V4L2_H264_DECODE_PARAM_FLAG_PFRAME/BFRAME

29.08.2025 17:15, Paul Kocialkowski пишет:

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

+      - All submitted slices for the frame are P slices. This is a compability +        flag required for decoders that only support decoding such frames, but +        should not be required for slice-based decoders.

Seems to match the comment in Tegra driver, and related to a hardware limitation. Shall we also recommend not to use this unless similar limitation exists ?

Quoted 6 lines

I think the flag should only be allowed for frame-based decode mode and indeed it would be good to say that drivers should only check this flag if they have such limitations.

Userspace on the other hand cannot really know if it will be used or not so it should set the flags when applicable.

IIRC, Tegra dec driver doesn't support decoding frames consisting of multiple slices, it can only decode frames consisting of a single slice. Tegra dec can handle multi-slice frames using a "macroblock by macroblock" decoding mode with a lot of CPU processing, like classic old hw decoders did it, this is not supported by upstream driver.

#11 lore raw
In reply to Paul Kocialkowski

Le dimanche 24 août 2025 à 20:07 +0200, Paul Kocialkowski a écrit :

Quoted 8 lines

Changes since v1:
- Added minor codec control cleanups;
- Added documentation about h.264 frame-wide type flags

Paul Kocialkowski (4):
  media: uapi: Move colorimetry controls at the end of the file
  media: uapi: Cleanup tab after define in headers
  media: uapi: v4l2-controls: Cleanup codec definitions

I've picked the 3 above.

Quoted 2 lines

  Documentation: media: Document
    V4L2_H264_DECODE_PARAM_FLAG_PFRAME/BFRAME

So you will only have to update this one.

cheers,
Nicolas

Quoted 5 lines

 .../media/v4l/ext-ctrls-codec-stateless.rst   |   8 +- include/uapi/linux/v4l2-controls.h            | 121 +++++++++--------- include/uapi/linux/videodev2.h                |  18 +--

 3 files changed, 75 insertions(+), 72 deletions(-)