v4l2-compliance: fix sequence number checks for FIELD_ALTERNATE
PATCH 1/1 v4l2-compliance: fix sequence number checks for FIELD_ALTERNATE
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 <[email protected]>
--- utils/v4l2-compliance/v4l2-test-buffers.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
utils/v4l2-compliance/v4l2-test-buffers.cpp +9 -5
@@ -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);
Signature · 1 line
2.47.3