summaryrefslogtreecommitdiff
path: root/drivers/media/test-drivers/vivid/vivid-sdr-cap.c
diff options
context:
space:
mode:
authorDeborah Brouwer <deborahbrouwer3563@gmail.com>2021-12-08 03:40:42 +0300
committerMauro Carvalho Chehab <mchehab@kernel.org>2022-01-23 23:18:42 +0300
commit57c1d5de7d1527c04b5e58089260064b63306b35 (patch)
tree8c8fc1651f57fd6f05a689b941f71852696fe587 /drivers/media/test-drivers/vivid/vivid-sdr-cap.c
parent9a0e3cd50d3967b669f0f0ea79a7054c7877d95b (diff)
downloadlinux-57c1d5de7d1527c04b5e58089260064b63306b35.tar.xz
media: vivid: fix timestamp and sequence wrapping
The error injection controls that test wrap-around sequence and timestamp counters were partially broken. Add a menu option for 64 or 32 bit signed timestamp wrapping. Prevent the timestamp from wrapping around before the device can be tested. Remove the sequence count from the timestamp calculation so that sequence wrapping does not interfere with the timestamp. Add consistent time and sequence wrapping to sdr and touch devices. Signed-off-by: Deborah Brouwer <deborahbrouwer3563@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/media/test-drivers/vivid/vivid-sdr-cap.c')
-rw-r--r--drivers/media/test-drivers/vivid/vivid-sdr-cap.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/media/test-drivers/vivid/vivid-sdr-cap.c b/drivers/media/test-drivers/vivid/vivid-sdr-cap.c
index 265db2114671..59fd508e27c8 100644
--- a/drivers/media/test-drivers/vivid/vivid-sdr-cap.c
+++ b/drivers/media/test-drivers/vivid/vivid-sdr-cap.c
@@ -101,7 +101,7 @@ static void vivid_thread_sdr_cap_tick(struct vivid_dev *dev)
spin_unlock(&dev->slock);
if (sdr_cap_buf) {
- sdr_cap_buf->vb.sequence = dev->sdr_cap_seq_count;
+ sdr_cap_buf->vb.sequence = dev->sdr_cap_with_seq_wrap_count;
v4l2_ctrl_request_setup(sdr_cap_buf->vb.vb2_buf.req_obj.req,
&dev->ctrl_hdl_sdr_cap);
v4l2_ctrl_request_complete(sdr_cap_buf->vb.vb2_buf.req_obj.req,
@@ -131,10 +131,13 @@ static int vivid_thread_sdr_cap(void *data)
/* Resets frame counters */
dev->sdr_cap_seq_offset = 0;
- if (dev->seq_wrap)
- dev->sdr_cap_seq_offset = 0xffffff80U;
+ dev->sdr_cap_seq_count = 0;
dev->jiffies_sdr_cap = jiffies;
dev->sdr_cap_seq_resync = false;
+ if (dev->time_wrap)
+ dev->time_wrap_offset = dev->time_wrap - ktime_get_ns();
+ else
+ dev->time_wrap_offset = 0;
for (;;) {
try_to_freeze();
@@ -174,6 +177,7 @@ static int vivid_thread_sdr_cap(void *data)
}
dev->sdr_cap_seq_count =
buffers_since_start + dev->sdr_cap_seq_offset;
+ dev->sdr_cap_with_seq_wrap_count = dev->sdr_cap_seq_count - dev->sdr_cap_seq_start;
vivid_thread_sdr_cap_tick(dev);
mutex_unlock(&dev->mutex);
@@ -263,7 +267,7 @@ static int sdr_cap_start_streaming(struct vb2_queue *vq, unsigned count)
int err = 0;
dprintk(dev, 1, "%s\n", __func__);
- dev->sdr_cap_seq_count = 0;
+ dev->sdr_cap_seq_start = dev->seq_wrap * 128;
if (dev->start_streaming_error) {
dev->start_streaming_error = false;
err = -EINVAL;