Skip to contentSkip to conversation

Drop stream support for the subdev crop API

PATCH In review Laurent Pinchart 2 participants 4 messages Apr 3, 2024 – Apr 4, 2024 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

cover Drop stream support for the subdev crop API

Hello,

This small patch series is the v4l-utils side of the corresponding kernel change, posted in [1].

There's not much else to be said in this cover letter, please see individual patches for details.

[1] https://lore.kernel.org/linux-media/[email protected]/

Laurent Pinchart (2):
utils: libv4l2subdev: Drop stream support for the crop API
v4l2-compliance: Drop stream support for the subdev crop API

 utils/media-ctl/libv4l2subdev.c             |  1 -
 utils/v4l2-compliance/v4l2-test-subdevs.cpp | 21 +++++++++++----------
 2 files changed, 11 insertions(+), 11 deletions(-)

base-commit: 62f1c6833e12f22c81750529761410621aa54830

Signature · 3 lines
Regards,

Laurent Pinchart
#1 lore raw

PATCH 1/2 utils: libv4l2subdev: Drop stream support for the crop API

The subdev crop API has never had working streams support in the kernel. The stream field of the v4l2_subdev_crop structure will be removed, prepare for that by not setting it.

---
 utils/media-ctl/libv4l2subdev.c | 1 -
 1 file changed, 1 deletion(-)
utils/media-ctl/libv4l2subdev.c +0 -1
index c614f4a2e0fd..b9d33fb301f0 100644
@@ -226,7 +226,6 @@ int v4l2_subdev_set_selection(struct media_entity *entity,
 
 	memset(&u.crop, 0, sizeof(u.crop));
 	u.crop.pad = pad;
-	u.crop.stream = stream;
 	u.crop.which = which;
 	u.crop.rect = *rect;
 
Signature · 3 lines
Regards,

Laurent Pinchart
Reviewed-by on v1 1/2
#2 lore raw

Re: [v4l-utils] [PATCH 1/2] utils: libv4l2subdev: Drop stream support for the crop API

Quoted 5 lines · Laurent Pinchart

The subdev crop API has never had working streams support in the kernel. The stream field of the v4l2_subdev_crop structure will be removed, prepare for that by not setting it.

Signature · 1 line
Sakari Ailus
#3 lore raw

PATCH 2/2 v4l2-compliance: Drop stream support for the subdev crop API

In reply to Laurent Pinchart

The subdev crop API has never had working streams support in the kernel. The stream field of the v4l2_subdev_crop structure will be removed, prepare for that by not setting it.

As the selection API tests checks that the crop and selection APIs return the same results, we also need to skip all those checks when testing selection support on streams.

---
 utils/v4l2-compliance/v4l2-test-subdevs.cpp | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
utils/v4l2-compliance/v4l2-test-subdevs.cpp +11 -10
index da304a8caa8a..2e4d20f657f8 100644
@@ -484,7 +484,6 @@ int testSubDevSelection(struct node *node, unsigned which, unsigned pad, unsigne
 	targets[V4L2_SEL_TGT_NATIVE_SIZE].readonly = is_sink;
 	memset(&crop, 0, sizeof(crop));
 	crop.pad = pad;
-	crop.stream = stream;
 	crop.which = which;
 	memset(&sel, 0, sizeof(sel));
 	sel.which = which;
@@ -493,17 +492,20 @@ int testSubDevSelection(struct node *node, unsigned which, unsigned pad, unsigne
 	sel.target = V4L2_SEL_TGT_CROP;
 	ret = doioctl(node, VIDIOC_SUBDEV_G_SELECTION, &sel);
 	node->has_subdev_selection |= (ret != ENOTTY) << which;
-	fail_on_test(doioctl(node, VIDIOC_SUBDEV_G_CROP, &crop) != ret);
+	if (!stream)
+		fail_on_test(doioctl(node, VIDIOC_SUBDEV_G_CROP, &crop) != ret);
 	if (ret == ENOTTY) {
 		fail_on_test(doioctl(node, VIDIOC_SUBDEV_S_SELECTION, &sel) != ENOTTY);
-		fail_on_test(doioctl(node, VIDIOC_SUBDEV_S_CROP, &crop) != ENOTTY);
+		if (!stream)
+			fail_on_test(doioctl(node, VIDIOC_SUBDEV_S_CROP, &crop) != ENOTTY);
 		return ret;
 	}
-	fail_on_test(check_0(crop.reserved, sizeof(crop.reserved)));
-	fail_on_test(crop.which != which);
-	fail_on_test(crop.pad != pad);
-	fail_on_test(crop.stream != stream);
-	fail_on_test(memcmp(&crop.rect, &sel.r, sizeof(sel.r)));
+	if (!stream) {
+		fail_on_test(check_0(crop.reserved, sizeof(crop.reserved)));
+		fail_on_test(crop.which != which);
+		fail_on_test(crop.pad != pad);
+		fail_on_test(memcmp(&crop.rect, &sel.r, sizeof(sel.r)));
+	}
 
 	for (unsigned tgt = 0; targets[tgt].target != ~0U; tgt++) {
 		targets[tgt].found = false;
@@ -544,7 +546,7 @@ int testSubDevSelection(struct node *node, unsigned which, unsigned pad, unsigne
 		ret = doioctl(node, VIDIOC_SUBDEV_S_SELECTION, &s_sel);
 		if (node->is_ro_subdev && which == V4L2_SUBDEV_FORMAT_ACTIVE)
 			fail_on_test(ret != EPERM);
-		if (tgt == V4L2_SEL_TGT_CROP) {
+		if (tgt == V4L2_SEL_TGT_CROP && !stream) {
 			crop.rect = sel.r;
 			memset(crop.reserved, 0xff, sizeof(crop.reserved));
 			fail_on_test(doioctl(node, VIDIOC_SUBDEV_S_CROP, &crop) != ret);
@@ -552,7 +554,6 @@ int testSubDevSelection(struct node *node, unsigned which, unsigned pad, unsigne
 				fail_on_test(check_0(crop.reserved, sizeof(crop.reserved)));
 				fail_on_test(crop.which != which);
 				fail_on_test(crop.pad != pad);
-				fail_on_test(crop.stream != stream);
 				fail_on_test(memcmp(&crop.rect, &sel.r, sizeof(sel.r)));
 			}
 		}
Signature · 3 lines
Regards,

Laurent Pinchart