Linux Media Controller development
 help / color / mirror / Atom feed
From: Matthew Laux <matthew.laux@gmail.com>
To: linux-media@vger.kernel.org
Cc: Matthew Laux <matthew.laux@gmail.com>
Subject: [PATCH v4l-utils v2] v4l2-compliance: fix sequence number checks for FIELD_ALTERNATE
Date: Wed, 25 Nov 2026 16:07:22 -0600	[thread overview]
Message-ID: <20261125220722.26361-1-matthew.laux@gmail.com> (raw)

The sequence number check was impossible to satisfy for devices using
V4L2_FIELD_ALTERNATE. Allow the same sequence number twice in a row for these
devices by making the minimum the same as the current value on every other
field.

Fixes: 11adf49a3b56 ("v4l2-compliance: warn for non-consecutive sequence numbers")
Signed-off-by: Matthew Laux <matthew.laux@gmail.com>
---
v2: corrected subject-prefix to "PATCH v4l-utils"

 utils/v4l2-compliance/v4l2-test-buffers.cpp | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/utils/v4l2-compliance/v4l2-test-buffers.cpp b/utils/v4l2-compliance/v4l2-test-buffers.cpp
index 7d0fb9e5..7a621f6c 100644
--- a/utils/v4l2-compliance/v4l2-test-buffers.cpp
+++ b/utils/v4l2-compliance/v4l2-test-buffers.cpp
@@ -408,14 +408,19 @@ int buffer::check(unsigned type, unsigned memory, unsigned index,
 
 		fail_on_test(g_flags() & V4L2_BUF_FLAG_DONE);
 
+		int min_seq = seq.last_seq + 1;
+		if (v4l_type_is_video(g_type()) &&
+		    fmt.g_field() == V4L2_FIELD_ALTERNATE && !seq.field_nr)
+			min_seq = seq.last_seq;
+
 		// The vivid driver has unreliable timings causing wrong
 		// sequence numbers on occasion. Skip this test until this
 		// bug is solved.
 		if (!is_vivid)
-			fail_on_test((int)g_sequence() < seq.last_seq + 1);
-		else if ((int)g_sequence() < seq.last_seq + 1)
-			info("(int)g_sequence() < seq.last_seq + 1): %d < %d\n",
-			     (int)g_sequence(), seq.last_seq + 1);
+			fail_on_test((int)g_sequence() < min_seq);
+		else if ((int)g_sequence() < min_seq)
+			info("(int)g_sequence() < min_seq): %d < %d\n",
+			     (int)g_sequence(), min_seq);
 
 		if (v4l_type_is_video(g_type())) {
 			fail_on_test(g_field() == V4L2_FIELD_ALTERNATE);
@@ -430,7 +435,6 @@ int buffer::check(unsigned type, unsigned memory, unsigned index,
 						warn("got sequence number %u, expected %u\n",
 							g_sequence(), seq.last_seq);
 				} else {
-					fail_on_test((int)g_sequence() == seq.last_seq + 1);
 					if (static_cast<int>(g_sequence()) != seq.last_seq + 1)
 						warn("got sequence number %u, expected %u\n",
 							g_sequence(), seq.last_seq + 1);
-- 
2.47.3


                 reply	other threads:[~2026-11-25 22:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261125220722.26361-1-matthew.laux@gmail.com \
    --to=matthew.laux@gmail.com \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox