Skip to contentSkip to conversation

Add format MEDIA_BUS_FMT_METADATA_FIXED and use it in rkisp1

PATCH Superseded Dafna Hirschfeld 3 participants 6 messages Sep 22, 2020 – Oct 20, 2020

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Add format MEDIA_BUS_FMT_METADATA_FIXED and use it in rkisp1

There are 2 pads between the entities
rkisp1_isp to rkisp1_params and rkisp1_stats that transmit metadata. This metadata is fixed and not configurable from userspace. Since the metadata has no dimensions, it makes sense to set the width and height of these pads to 0. The problem is that it makes the v4l-compliance tests fail. Currently, in order to silent the tests, the width and height are set to RKISP1_DEFAULT_*

This patchset sets the dimensions to 0 and solves the compliance error by introducing a new media bus code MEDIA_BUS_FMT_METADATA_FIXED

The new code should be used when
the same driver handles both sides of the link and the bus format is a fixed metadata format that is not configurable from userspace.

Then the v4l2-compliance tests can skip the
dimensions test for this media bus code.

See irc discussion for that issue:
https://linuxtv.org/irc/irclogger_log/v4l?date=2020-05-13,Wed
https://linuxtv.org/irc/irclogger_log/v4l?date=2020-05-14,Thu

Dafna Hirschfeld (2):
meida: uapi: add MEDIA_BUS_FMT_METADATA_FIXED media bus format.
media: staging: rkisp1: isp: set metadata pads to
MEDIA_BUS_FMT_METADATA_FIXED

 drivers/staging/media/rkisp1/TODO         | 1 -
 drivers/staging/media/rkisp1/rkisp1-isp.c | 8 ++++----
 include/uapi/linux/media-bus-format.h     | 8 ++++++++
 3 files changed, 12 insertions(+), 5 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/2 meida: uapi: add MEDIA_BUS_FMT_METADATA_FIXED media bus format.

MEDIA_BUS_FMT_METADATA_FIXED should be used when the same driver handles both sides of the link and the bus format is a fixed metadata format that is not configurable from userspace.

---
 include/uapi/linux/media-bus-format.h | 8 ++++++++
 1 file changed, 8 insertions(+)
include/uapi/linux/media-bus-format.h +8 -0
index 84fa53ffb13f..847b45fb546b 100644
@@ -156,4 +156,12 @@
 /* HSV - next is	0x6002 */
 #define MEDIA_BUS_FMT_AHSV8888_1X32		0x6001
 
+/*
+ * This format should be used when the same driver handles
+ * both sides of the link and the bus format is a fixed
+ * metadata format that is not configurable from userspace.
+ * This format may have 0 height and width.
+ */
+#define MEDIA_BUS_FMT_METADATA_FIXED		0x7001
+
 #endif /* __LINUX_MEDIA_BUS_FORMAT_H */
Signature · 1 line
2.17.1
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] meida: uapi: add MEDIA_BUS_FMT_METADATA_FIXED media bus format.

Quoted 6 lines · Dafna Hirschfeld

MEDIA_BUS_FMT_METADATA_FIXED should be used when the same driver handles both sides of the link and the bus format is a fixed metadata format that is not configurable from userspace.

Thanks
Helen

Quoted 22 lines
---
 include/uapi/linux/media-bus-format.h | 8 ++++++++
 1 file changed, 8 insertions(+)
include/uapi/linux/media-bus-format.h +8 -0
index 84fa53ffb13f..847b45fb546b 100644
@@ -156,4 +156,12 @@
 /* HSV - next is	0x6002 */
 #define MEDIA_BUS_FMT_AHSV8888_1X32		0x6001
 
+/*
+ * This format should be used when the same driver handles
+ * both sides of the link and the bus format is a fixed
+ * metadata format that is not configurable from userspace.
+ * This format may have 0 height and width.
+ */
+#define MEDIA_BUS_FMT_METADATA_FIXED		0x7001
+
 #endif /* __LINUX_MEDIA_BUS_FORMAT_H */
#3 lore raw

Re: [PATCH 1/2] meida: uapi: add MEDIA_BUS_FMT_METADATA_FIXED media bus format.

Quoted 27 lines · Helen Koike
Quoted 6 lines · Dafna Hirschfeld

MEDIA_BUS_FMT_METADATA_FIXED should be used when the same driver handles both sides of the link and the bus format is a fixed metadata format that is not configurable from userspace.

Thanks
Helen

Quoted 12 lines
---
 include/uapi/linux/media-bus-format.h | 8 ++++++++
 1 file changed, 8 insertions(+)
include/uapi/linux/media-bus-format.h +0 -0
index 84fa53ffb13f..847b45fb546b 100644
@@ -156,4 +156,12 @@
 /* HSV - next is	0x6002 */
 #define MEDIA_BUS_FMT_AHSV8888_1X32		0x6001
 
Quoted 5 lines

include/uapi/linux/media-bus-format.h line 163

Quoted 5 lines
include/uapi/linux/media-bus-format.h +5 -0
+/*
+ * This format should be used when the same driver handles
+ * both sides of the link and the bus format is a fixed
+ * metadata format that is not configurable from userspace.
+ * This format may have 0 height and width.

I would make this stronger:

"Width and height will be set to 0 for this format."

Regards,

Hans

Quoted 5 lines
Quoted 5 lines
include/uapi/linux/media-bus-format.h +3 -0
+ */
+#define MEDIA_BUS_FMT_METADATA_FIXED		0x7001
+
 #endif /* __LINUX_MEDIA_BUS_FORMAT_H */
#4 lore raw

PATCH 2/2 media: staging: rkisp1: isp: set metadata pads to MEDIA_BUS_FMT_METADATA_FIXED

In reply to Dafna Hirschfeld

Set the code of the metadata pads of the isp entity to MEDIA_BUS_FMT_METADATA_FIXED and set the width and height of their formats to 0. This solves the TODO item:
"Fix pad format size for statistics and parameters entities."

---
 drivers/staging/media/rkisp1/TODO         | 1 -
 drivers/staging/media/rkisp1/rkisp1-isp.c | 8 ++++----
 2 files changed, 4 insertions(+), 5 deletions(-)
drivers/staging/media/rkisp1/TODO +0 -1
index f0c90d1c86a8..f4a94eca6d31 100644
@@ -1,4 +1,3 @@
-* Fix pad format size for statistics and parameters entities.
 * Fix checkpatch errors.
 * Review and comment every lock
 * Handle quantization
drivers/staging/media/rkisp1/rkisp1-isp.c +4 -4
index 02eafea92863..a6c0f1eb0c5a 100644
@@ -574,7 +574,7 @@ static int rkisp1_isp_enum_mbus_code(struct v4l2_subdev *sd,
 	} else {
 		if (code->index > 0)
 			return -EINVAL;
-		code->code = MEDIA_BUS_FMT_FIXED;
+		code->code = MEDIA_BUS_FMT_METADATA_FIXED;
 		return 0;
 	}
 
@@ -630,10 +630,10 @@ static int rkisp1_isp_init_config(struct v4l2_subdev *sd,
 					      RKISP1_ISP_PAD_SINK_PARAMS);
 	src_fmt = v4l2_subdev_get_try_format(sd, cfg,
 					     RKISP1_ISP_PAD_SOURCE_STATS);
-	sink_fmt->width = RKISP1_DEFAULT_WIDTH;
-	sink_fmt->height = RKISP1_DEFAULT_HEIGHT;
+	sink_fmt->width = 0;
+	sink_fmt->height = 0;
 	sink_fmt->field = V4L2_FIELD_NONE;
-	sink_fmt->code = MEDIA_BUS_FMT_FIXED;
+	sink_fmt->code = MEDIA_BUS_FMT_METADATA_FIXED;
 	*src_fmt = *sink_fmt;
 
 	return 0;
Signature · 1 line
2.17.1
Acked-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] media: staging: rkisp1: isp: set metadata pads to MEDIA_BUS_FMT_METADATA_FIXED

Quoted 7 lines · Dafna Hirschfeld

Set the code of the metadata pads of the isp entity to MEDIA_BUS_FMT_METADATA_FIXED and set the width and height of their formats to 0. This solves the TODO item:
"Fix pad format size for statistics and parameters entities."

Thanks
Helen

Quoted 42 lines
---
 drivers/staging/media/rkisp1/TODO         | 1 -
 drivers/staging/media/rkisp1/rkisp1-isp.c | 8 ++++----
 2 files changed, 4 insertions(+), 5 deletions(-)
drivers/staging/media/rkisp1/TODO +0 -1
index f0c90d1c86a8..f4a94eca6d31 100644
@@ -1,4 +1,3 @@
-* Fix pad format size for statistics and parameters entities.
 * Fix checkpatch errors.
 * Review and comment every lock
 * Handle quantization
drivers/staging/media/rkisp1/rkisp1-isp.c +4 -4
index 02eafea92863..a6c0f1eb0c5a 100644
@@ -574,7 +574,7 @@ static int rkisp1_isp_enum_mbus_code(struct v4l2_subdev *sd,
 	} else {
 		if (code->index > 0)
 			return -EINVAL;
-		code->code = MEDIA_BUS_FMT_FIXED;
+		code->code = MEDIA_BUS_FMT_METADATA_FIXED;
 		return 0;
 	}
 
@@ -630,10 +630,10 @@ static int rkisp1_isp_init_config(struct v4l2_subdev *sd,
 					      RKISP1_ISP_PAD_SINK_PARAMS);
 	src_fmt = v4l2_subdev_get_try_format(sd, cfg,
 					     RKISP1_ISP_PAD_SOURCE_STATS);
-	sink_fmt->width = RKISP1_DEFAULT_WIDTH;
-	sink_fmt->height = RKISP1_DEFAULT_HEIGHT;
+	sink_fmt->width = 0;
+	sink_fmt->height = 0;
 	sink_fmt->field = V4L2_FIELD_NONE;
-	sink_fmt->code = MEDIA_BUS_FMT_FIXED;
+	sink_fmt->code = MEDIA_BUS_FMT_METADATA_FIXED;
 	*src_fmt = *sink_fmt;
 
 	return 0;