Skip to contentSkip to conversation

v4l2-compliance: skip dimentions tests for media bus format MEDIA_BUS_FMT_METADATA_FIXED

PATCH In review Dafna Hirschfeld 3 participants 3 messages Sep 22, 2020 – Oct 20, 2020

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

PATCH 1/1 v4l2-compliance: skip dimentions tests for media bus format MEDIA_BUS_FMT_METADATA_FIXED

The media bus format code MEDIA_BUS_FMT_METADATA_FIXED is used for metadata formats that are not configurable from userspace and therefore may have any value for width and height. So skip width and height tests for this format.

---
note, this patch should be applied after updating the header include/linux/media-bus-format.h to include that new format.

---
 utils/v4l2-compliance/v4l2-test-subdevs.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
utils/v4l2-compliance/v4l2-test-subdevs.cpp +4 -2
index ec3ef169..f60853e3 100644
@@ -300,8 +300,10 @@ int testSubDevFrameInterval(struct node *node, unsigned pad)
 static int checkMBusFrameFmt(struct node *node, struct v4l2_mbus_framefmt &fmt)
 {
 	fail_on_test(check_0(fmt.reserved, sizeof(fmt.reserved)));
-	fail_on_test(fmt.width == 0 || fmt.width > 65536);
-	fail_on_test(fmt.height == 0 || fmt.height > 65536);
+	if (fmt.code != MEDIA_BUS_FMT_METADATA_FIXED) {
+		fail_on_test(fmt.width == 0 || fmt.width > 65536);
+		fail_on_test(fmt.height == 0 || fmt.height > 65536);
+	}
 	fail_on_test(fmt.code == 0 || fmt.code == ~0U);
 	fail_on_test(fmt.field == ~0U);
 	if (!node->is_passthrough_subdev) {
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Dafna Hirschfeld

The media bus format code MEDIA_BUS_FMT_METADATA_FIXED is used for metadata formats that are not configurable from userspace and therefore may have any value for width and height. So skip width and height tests for this format.

lgtm

Thanks
Helen

Quoted 25 lines

---
note, this patch should be applied after updating the header include/linux/media-bus-format.h to include that new format.

---
 utils/v4l2-compliance/v4l2-test-subdevs.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
utils/v4l2-compliance/v4l2-test-subdevs.cpp +4 -2
index ec3ef169..f60853e3 100644
@@ -300,8 +300,10 @@ int testSubDevFrameInterval(struct node *node, unsigned pad)
 static int checkMBusFrameFmt(struct node *node, struct v4l2_mbus_framefmt &fmt)
 {
 	fail_on_test(check_0(fmt.reserved, sizeof(fmt.reserved)));
-	fail_on_test(fmt.width == 0 || fmt.width > 65536);
-	fail_on_test(fmt.height == 0 || fmt.height > 65536);
+	if (fmt.code != MEDIA_BUS_FMT_METADATA_FIXED) {
+		fail_on_test(fmt.width == 0 || fmt.width > 65536);
+		fail_on_test(fmt.height == 0 || fmt.height > 65536);
+	}
 	fail_on_test(fmt.code == 0 || fmt.code == ~0U);
 	fail_on_test(fmt.field == ~0U);
 	if (!node->is_passthrough_subdev) {
#2 lore raw
Quoted 25 lines · Helen Koike
Quoted 7 lines · Dafna Hirschfeld

The media bus format code MEDIA_BUS_FMT_METADATA_FIXED is used for metadata formats that are not configurable from userspace and therefore may have any value for width and height. So skip width and height tests for this format.

lgtm

Thanks
Helen

Quoted 7 lines

---
note, this patch should be applied after updating the header include/linux/media-bus-format.h to include that new format.

---
 utils/v4l2-compliance/v4l2-test-subdevs.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Quoted 14 lines
Quoted 5 lines
utils/v4l2-compliance/v4l2-test-subdevs.cpp +0 -0
index ec3ef169..f60853e3 100644

utils/v4l2-compliance/v4l2-test-subdevs.cpp int testSubDevFrameInterval(struct node *node, unsigned pad) · line 306

Quoted 9 lines
utils/v4l2-compliance/v4l2-test-subdevs.cpp +4 -2
@@ -300,8 +300,10 @@ int testSubDevFrameInterval(struct node *node, unsigned pad)
 static int checkMBusFrameFmt(struct node *node, struct v4l2_mbus_framefmt &fmt)
 {
 	fail_on_test(check_0(fmt.reserved, sizeof(fmt.reserved)));
-	fail_on_test(fmt.width == 0 || fmt.width > 65536);
-	fail_on_test(fmt.height == 0 || fmt.height > 65536);
+	if (fmt.code != MEDIA_BUS_FMT_METADATA_FIXED) {
+		fail_on_test(fmt.width == 0 || fmt.width > 65536);
+		fail_on_test(fmt.height == 0 || fmt.height > 65536);
+	}

I would always fail if width or height != 0 for this format.

Regards,

Hans

Quoted 4 lines
Quoted 4 lines
utils/v4l2-compliance/v4l2-test-subdevs.cpp +0 -0
 	fail_on_test(fmt.code == 0 || fmt.code == ~0U);
 	fail_on_test(fmt.field == ~0U);
 	if (!node->is_passthrough_subdev) {