Message ID | 20211204061351.53611-1-deborahbrouwer3563@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2] media: vivid: fix timestamp and sequence wrapping | expand |
Hi Deborah, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on media-tree/master] [also build test WARNING on v5.16-rc3 next-20211203] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Deborah-Brouwer/media-vivid-fix-timestamp-and-sequence-wrapping/20211204-141534 base: git://linuxtv.org/media_tree.git master config: mips-allyesconfig (https://download.01.org/0day-ci/archive/20211204/202112041916.6eQfvskR-lkp@intel.com/config) compiler: mips-linux-gcc (GCC) 11.2.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/e6e5201f7b5b9718f318a5c3034b71fcc79aa47f git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Deborah-Brouwer/media-vivid-fix-timestamp-and-sequence-wrapping/20211204-141534 git checkout e6e5201f7b5b9718f318a5c3034b71fcc79aa47f # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=mips SHELL=/bin/bash drivers/media/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): drivers/media/test-drivers/vivid/vivid-ctrls.c: In function 'vivid_streaming_s_ctrl': >> drivers/media/test-drivers/vivid/vivid-ctrls.c:1125:70: warning: integer overflow in expression of type 'long int' results in '-1179869184' [-Woverflow] 1125 | dev->time_wrap = (1ULL << 63) - NSEC_PER_SEC * 16; | ^ vim +1125 drivers/media/test-drivers/vivid/vivid-ctrls.c 1083 1084 static int vivid_streaming_s_ctrl(struct v4l2_ctrl *ctrl) 1085 { 1086 struct vivid_dev *dev = container_of(ctrl->handler, struct vivid_dev, ctrl_hdl_streaming); 1087 1088 switch (ctrl->id) { 1089 case VIVID_CID_DQBUF_ERROR: 1090 dev->dqbuf_error = true; 1091 break; 1092 case VIVID_CID_PERC_DROPPED: 1093 dev->perc_dropped_buffers = ctrl->val; 1094 break; 1095 case VIVID_CID_QUEUE_SETUP_ERROR: 1096 dev->queue_setup_error = true; 1097 break; 1098 case VIVID_CID_BUF_PREPARE_ERROR: 1099 dev->buf_prepare_error = true; 1100 break; 1101 case VIVID_CID_START_STR_ERROR: 1102 dev->start_streaming_error = true; 1103 break; 1104 case VIVID_CID_REQ_VALIDATE_ERROR: 1105 dev->req_validate_error = true; 1106 break; 1107 case VIVID_CID_QUEUE_ERROR: 1108 if (vb2_start_streaming_called(&dev->vb_vid_cap_q)) 1109 vb2_queue_error(&dev->vb_vid_cap_q); 1110 if (vb2_start_streaming_called(&dev->vb_vbi_cap_q)) 1111 vb2_queue_error(&dev->vb_vbi_cap_q); 1112 if (vb2_start_streaming_called(&dev->vb_vid_out_q)) 1113 vb2_queue_error(&dev->vb_vid_out_q); 1114 if (vb2_start_streaming_called(&dev->vb_vbi_out_q)) 1115 vb2_queue_error(&dev->vb_vbi_out_q); 1116 if (vb2_start_streaming_called(&dev->vb_sdr_cap_q)) 1117 vb2_queue_error(&dev->vb_sdr_cap_q); 1118 break; 1119 case VIVID_CID_SEQ_WRAP: 1120 dev->seq_wrap = ctrl->val; 1121 break; 1122 case VIVID_CID_TIME_WRAP: 1123 dev->time_wrap = ctrl->val; 1124 if (dev->time_wrap == 1) > 1125 dev->time_wrap = (1ULL << 63) - NSEC_PER_SEC * 16; 1126 else if (dev->time_wrap == 2) 1127 dev->time_wrap = ((1ULL << 31) - 16) * NSEC_PER_SEC; 1128 break; 1129 } 1130 return 0; 1131 } 1132 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi Deborah, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on media-tree/master] [also build test WARNING on v5.16-rc3 next-20211203] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Deborah-Brouwer/media-vivid-fix-timestamp-and-sequence-wrapping/20211204-141534 base: git://linuxtv.org/media_tree.git master config: i386-randconfig-a013-20211203 (https://download.01.org/0day-ci/archive/20211204/202112042134.zRpYtrRg-lkp@intel.com/config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5f1d1854eb1450d352663ee732235893c5782237) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/e6e5201f7b5b9718f318a5c3034b71fcc79aa47f git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Deborah-Brouwer/media-vivid-fix-timestamp-and-sequence-wrapping/20211204-141534 git checkout e6e5201f7b5b9718f318a5c3034b71fcc79aa47f # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/media/test-drivers/vivid/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): >> drivers/media/test-drivers/vivid/vivid-ctrls.c:1125:49: warning: overflow in expression; result is -1179869184 with type 'long' [-Winteger-overflow] dev->time_wrap = (1ULL << 63) - NSEC_PER_SEC * 16; ^ 1 warning generated. vim +/long +1125 drivers/media/test-drivers/vivid/vivid-ctrls.c 1083 1084 static int vivid_streaming_s_ctrl(struct v4l2_ctrl *ctrl) 1085 { 1086 struct vivid_dev *dev = container_of(ctrl->handler, struct vivid_dev, ctrl_hdl_streaming); 1087 1088 switch (ctrl->id) { 1089 case VIVID_CID_DQBUF_ERROR: 1090 dev->dqbuf_error = true; 1091 break; 1092 case VIVID_CID_PERC_DROPPED: 1093 dev->perc_dropped_buffers = ctrl->val; 1094 break; 1095 case VIVID_CID_QUEUE_SETUP_ERROR: 1096 dev->queue_setup_error = true; 1097 break; 1098 case VIVID_CID_BUF_PREPARE_ERROR: 1099 dev->buf_prepare_error = true; 1100 break; 1101 case VIVID_CID_START_STR_ERROR: 1102 dev->start_streaming_error = true; 1103 break; 1104 case VIVID_CID_REQ_VALIDATE_ERROR: 1105 dev->req_validate_error = true; 1106 break; 1107 case VIVID_CID_QUEUE_ERROR: 1108 if (vb2_start_streaming_called(&dev->vb_vid_cap_q)) 1109 vb2_queue_error(&dev->vb_vid_cap_q); 1110 if (vb2_start_streaming_called(&dev->vb_vbi_cap_q)) 1111 vb2_queue_error(&dev->vb_vbi_cap_q); 1112 if (vb2_start_streaming_called(&dev->vb_vid_out_q)) 1113 vb2_queue_error(&dev->vb_vid_out_q); 1114 if (vb2_start_streaming_called(&dev->vb_vbi_out_q)) 1115 vb2_queue_error(&dev->vb_vbi_out_q); 1116 if (vb2_start_streaming_called(&dev->vb_sdr_cap_q)) 1117 vb2_queue_error(&dev->vb_sdr_cap_q); 1118 break; 1119 case VIVID_CID_SEQ_WRAP: 1120 dev->seq_wrap = ctrl->val; 1121 break; 1122 case VIVID_CID_TIME_WRAP: 1123 dev->time_wrap = ctrl->val; 1124 if (dev->time_wrap == 1) > 1125 dev->time_wrap = (1ULL << 63) - NSEC_PER_SEC * 16; 1126 else if (dev->time_wrap == 2) 1127 dev->time_wrap = ((1ULL << 31) - 16) * NSEC_PER_SEC; 1128 break; 1129 } 1130 return 0; 1131 } 1132 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Ok, ignore this v2, I am sending a v3 with this issue fixed I hope. On Sat, Dec 4, 2021 at 5:56 AM kernel test robot <lkp@intel.com> wrote: > > Hi Deborah, > > Thank you for the patch! Perhaps something to improve: > > [auto build test WARNING on media-tree/master] > [also build test WARNING on v5.16-rc3 next-20211203] > [If your patch is applied to the wrong git tree, kindly drop us a note. > And when submitting patch, we suggest to use '--base' as documented in > https://git-scm.com/docs/git-format-patch] > > url: https://github.com/0day-ci/linux/commits/Deborah-Brouwer/media-vivid-fix-timestamp-and-sequence-wrapping/20211204-141534 > base: git://linuxtv.org/media_tree.git master > config: i386-randconfig-a013-20211203 (https://download.01.org/0day-ci/archive/20211204/202112042134.zRpYtrRg-lkp@intel.com/config) > compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5f1d1854eb1450d352663ee732235893c5782237) > reproduce (this is a W=1 build): > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > chmod +x ~/bin/make.cross > # https://github.com/0day-ci/linux/commit/e6e5201f7b5b9718f318a5c3034b71fcc79aa47f > git remote add linux-review https://github.com/0day-ci/linux > git fetch --no-tags linux-review Deborah-Brouwer/media-vivid-fix-timestamp-and-sequence-wrapping/20211204-141534 > git checkout e6e5201f7b5b9718f318a5c3034b71fcc79aa47f > # save the config file to linux build tree > mkdir build_dir > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/media/test-drivers/vivid/ > > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot <lkp@intel.com> > > All warnings (new ones prefixed by >>): > > >> drivers/media/test-drivers/vivid/vivid-ctrls.c:1125:49: warning: overflow in expression; result is -1179869184 with type 'long' [-Winteger-overflow] > dev->time_wrap = (1ULL << 63) - NSEC_PER_SEC * 16; > ^ > 1 warning generated. > > > vim +/long +1125 drivers/media/test-drivers/vivid/vivid-ctrls.c > > 1083 > 1084 static int vivid_streaming_s_ctrl(struct v4l2_ctrl *ctrl) > 1085 { > 1086 struct vivid_dev *dev = container_of(ctrl->handler, struct vivid_dev, ctrl_hdl_streaming); > 1087 > 1088 switch (ctrl->id) { > 1089 case VIVID_CID_DQBUF_ERROR: > 1090 dev->dqbuf_error = true; > 1091 break; > 1092 case VIVID_CID_PERC_DROPPED: > 1093 dev->perc_dropped_buffers = ctrl->val; > 1094 break; > 1095 case VIVID_CID_QUEUE_SETUP_ERROR: > 1096 dev->queue_setup_error = true; > 1097 break; > 1098 case VIVID_CID_BUF_PREPARE_ERROR: > 1099 dev->buf_prepare_error = true; > 1100 break; > 1101 case VIVID_CID_START_STR_ERROR: > 1102 dev->start_streaming_error = true; > 1103 break; > 1104 case VIVID_CID_REQ_VALIDATE_ERROR: > 1105 dev->req_validate_error = true; > 1106 break; > 1107 case VIVID_CID_QUEUE_ERROR: > 1108 if (vb2_start_streaming_called(&dev->vb_vid_cap_q)) > 1109 vb2_queue_error(&dev->vb_vid_cap_q); > 1110 if (vb2_start_streaming_called(&dev->vb_vbi_cap_q)) > 1111 vb2_queue_error(&dev->vb_vbi_cap_q); > 1112 if (vb2_start_streaming_called(&dev->vb_vid_out_q)) > 1113 vb2_queue_error(&dev->vb_vid_out_q); > 1114 if (vb2_start_streaming_called(&dev->vb_vbi_out_q)) > 1115 vb2_queue_error(&dev->vb_vbi_out_q); > 1116 if (vb2_start_streaming_called(&dev->vb_sdr_cap_q)) > 1117 vb2_queue_error(&dev->vb_sdr_cap_q); > 1118 break; > 1119 case VIVID_CID_SEQ_WRAP: > 1120 dev->seq_wrap = ctrl->val; > 1121 break; > 1122 case VIVID_CID_TIME_WRAP: > 1123 dev->time_wrap = ctrl->val; > 1124 if (dev->time_wrap == 1) > > 1125 dev->time_wrap = (1ULL << 63) - NSEC_PER_SEC * 16; > 1126 else if (dev->time_wrap == 2) > 1127 dev->time_wrap = ((1ULL << 31) - 16) * NSEC_PER_SEC; > 1128 break; > 1129 } > 1130 return 0; > 1131 } > 1132 > > --- > 0-DAY CI Kernel Test Service, Intel Corporation > https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/drivers/media/test-drivers/vivid/vivid-core.h b/drivers/media/test-drivers/vivid/vivid-core.h index 45f96706edde..176b72cb143b 100644 --- a/drivers/media/test-drivers/vivid/vivid-core.h +++ b/drivers/media/test-drivers/vivid/vivid-core.h @@ -307,7 +307,7 @@ struct vivid_dev { bool dqbuf_error; bool req_validate_error; bool seq_wrap; - bool time_wrap; + u64 time_wrap; u64 time_wrap_offset; unsigned perc_dropped_buffers; enum vivid_signal_mode std_signal_mode[MAX_INPUTS]; @@ -437,6 +437,7 @@ struct vivid_dev { bool touch_cap_seq_resync; u32 touch_cap_seq_start; u32 touch_cap_seq_count; + u32 touch_cap_with_seq_wrap_count; bool touch_cap_streaming; struct v4l2_fract timeperframe_tch_cap; struct v4l2_pix_format tch_format; @@ -524,7 +525,9 @@ struct vivid_dev { struct task_struct *kthread_sdr_cap; unsigned long jiffies_sdr_cap; u32 sdr_cap_seq_offset; + u32 sdr_cap_seq_start; u32 sdr_cap_seq_count; + u32 sdr_cap_with_seq_wrap_count; bool sdr_cap_seq_resync; /* RDS generator */ diff --git a/drivers/media/test-drivers/vivid/vivid-ctrls.c b/drivers/media/test-drivers/vivid/vivid-ctrls.c index 8dc50fe22972..466f9e22083d 100644 --- a/drivers/media/test-drivers/vivid/vivid-ctrls.c +++ b/drivers/media/test-drivers/vivid/vivid-ctrls.c @@ -1084,7 +1084,6 @@ static const struct v4l2_ctrl_config vivid_ctrl_display_present = { static int vivid_streaming_s_ctrl(struct v4l2_ctrl *ctrl) { struct vivid_dev *dev = container_of(ctrl->handler, struct vivid_dev, ctrl_hdl_streaming); - u64 rem; switch (ctrl->id) { case VIVID_CID_DQBUF_ERROR: @@ -1122,20 +1121,10 @@ static int vivid_streaming_s_ctrl(struct v4l2_ctrl *ctrl) break; case VIVID_CID_TIME_WRAP: dev->time_wrap = ctrl->val; - if (ctrl->val == 0) { - dev->time_wrap_offset = 0; - break; - } - /* - * We want to set the time 16 seconds before the 32 bit tv_sec - * value of struct timeval would wrap around. So first we - * calculate ktime_get_ns() % ((1 << 32) * NSEC_PER_SEC), and - * then we set the offset to ((1 << 32) - 16) * NSEC_PER_SEC). - */ - div64_u64_rem(ktime_get_ns(), - 0x100000000ULL * NSEC_PER_SEC, &rem); - dev->time_wrap_offset = - (0x100000000ULL - 16) * NSEC_PER_SEC - rem; + if (dev->time_wrap == 1) + dev->time_wrap = (1ULL << 63) - NSEC_PER_SEC * 16; + else if (dev->time_wrap == 2) + dev->time_wrap = ((1ULL << 31) - 16) * NSEC_PER_SEC; break; } return 0; @@ -1208,13 +1197,20 @@ static const struct v4l2_ctrl_config vivid_ctrl_seq_wrap = { .step = 1, }; +static const char * const vivid_ctrl_time_wrap_strings[] = { + "None", + "64 Bit", + "32 Bit", + NULL, +}; + static const struct v4l2_ctrl_config vivid_ctrl_time_wrap = { .ops = &vivid_streaming_ctrl_ops, .id = VIVID_CID_TIME_WRAP, .name = "Wrap Timestamp", - .type = V4L2_CTRL_TYPE_BOOLEAN, - .max = 1, - .step = 1, + .type = V4L2_CTRL_TYPE_MENU, + .max = ARRAY_SIZE(vivid_ctrl_time_wrap_strings) - 2, + .qmenu = vivid_ctrl_time_wrap_strings, }; diff --git a/drivers/media/test-drivers/vivid/vivid-kthread-cap.c b/drivers/media/test-drivers/vivid/vivid-kthread-cap.c index 9da730ccfa94..6baa046c1ae3 100644 --- a/drivers/media/test-drivers/vivid/vivid-kthread-cap.c +++ b/drivers/media/test-drivers/vivid/vivid-kthread-cap.c @@ -719,8 +719,7 @@ static noinline_for_stack void vivid_thread_vid_cap_tick(struct vivid_dev *dev, if (!vid_cap_buf && !vbi_cap_buf && !meta_cap_buf) goto update_mv; - f_time = dev->cap_frame_period * dev->vid_cap_seq_count + - dev->cap_stream_start + dev->time_wrap_offset; + f_time = ktime_get_ns() + dev->time_wrap_offset; if (vid_cap_buf) { v4l2_ctrl_request_setup(vid_cap_buf->vb.vb2_buf.req_obj.req, @@ -813,6 +812,10 @@ static int vivid_thread_vid_cap(void *data) dev->cap_seq_resync = false; dev->jiffies_vid_cap = jiffies; dev->cap_stream_start = ktime_get_ns(); + if (dev->time_wrap) + dev->time_wrap_offset = dev->time_wrap - dev->cap_stream_start; + else + dev->time_wrap_offset = 0; vivid_cap_update_frame_period(dev); for (;;) { diff --git a/drivers/media/test-drivers/vivid/vivid-kthread-out.c b/drivers/media/test-drivers/vivid/vivid-kthread-out.c index 79c57d14ac4e..b6d43169e970 100644 --- a/drivers/media/test-drivers/vivid/vivid-kthread-out.c +++ b/drivers/media/test-drivers/vivid/vivid-kthread-out.c @@ -154,12 +154,13 @@ static int vivid_thread_vid_out(void *data) /* Resets frame counters */ dev->out_seq_offset = 0; - if (dev->seq_wrap) - dev->out_seq_count = 0xffffff80U; + dev->out_seq_count = 0; dev->jiffies_vid_out = jiffies; - dev->vid_out_seq_start = dev->vbi_out_seq_start = 0; - dev->meta_out_seq_start = 0; dev->out_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(); diff --git a/drivers/media/test-drivers/vivid/vivid-kthread-touch.c b/drivers/media/test-drivers/vivid/vivid-kthread-touch.c index 38fdfee79498..f065faae4988 100644 --- a/drivers/media/test-drivers/vivid/vivid-kthread-touch.c +++ b/drivers/media/test-drivers/vivid/vivid-kthread-touch.c @@ -62,6 +62,10 @@ static int vivid_thread_touch_cap(void *data) dev->touch_cap_seq_count = 0; dev->touch_cap_seq_resync = false; dev->jiffies_touch_cap = jiffies; + if (dev->time_wrap) + dev->time_wrap_offset = dev->time_wrap - ktime_get_ns(); + else + dev->time_wrap_offset = 0; for (;;) { try_to_freeze(); @@ -102,6 +106,8 @@ static int vivid_thread_touch_cap(void *data) } dropped_bufs = buffers_since_start + dev->touch_cap_seq_offset - dev->touch_cap_seq_count; dev->touch_cap_seq_count = buffers_since_start + dev->touch_cap_seq_offset; + dev->touch_cap_with_seq_wrap_count = + dev->touch_cap_seq_count - dev->touch_cap_seq_start; vivid_thread_tch_cap_tick(dev, dropped_bufs); @@ -143,6 +149,7 @@ int vivid_start_generating_touch_cap(struct vivid_dev *dev) return 0; } + dev->touch_cap_seq_start = dev->seq_wrap * 128; dev->kthread_touch_cap = kthread_run(vivid_thread_touch_cap, dev, "%s-tch-cap", dev->v4l2_dev.name); 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; diff --git a/drivers/media/test-drivers/vivid/vivid-touch-cap.c b/drivers/media/test-drivers/vivid/vivid-touch-cap.c index ebb00b128030..64e3e4cb30c2 100644 --- a/drivers/media/test-drivers/vivid/vivid-touch-cap.c +++ b/drivers/media/test-drivers/vivid/vivid-touch-cap.c @@ -262,7 +262,7 @@ void vivid_fillbuff_tch(struct vivid_dev *dev, struct vivid_buffer *buf) __s16 *tch_buf = vb2_plane_vaddr(&buf->vb.vb2_buf, 0); - buf->vb.sequence = dev->touch_cap_seq_count; + buf->vb.sequence = dev->touch_cap_with_seq_wrap_count; test_pattern = (buf->vb.sequence / TCH_SEQ_COUNT) % TEST_CASE_MAX; test_pat_idx = buf->vb.sequence % TCH_SEQ_COUNT;
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> --- Changes since v1: - wrap timestamp at signed rather than unsigned values - simplify time_wrap_offset calculation How I set the controls: v4l2-ctl -d <dev> -c wrap_sequence_number=1 v4l2-ctl -d <dev> -c wrap_timestamp=1 v4l2-ctl -d <dev> -c wrap_timestamp=2 How I tested: v4l2-ctl -d <dev> --stream-mmap --verbose v4l2-ctl -d <dev> --stream-out-mmap --verbose v4l2-ctl-32 -d <dev> --stream-mmap --verbose v4l2-ctl-32 -d <dev> --stream-out-mmap --verbose Devices I tested: vivid-000-vid-cap, inputs: webcam, TV, S-Video, HDMI vivid-000-vid-out, outputs: S-Video, HDMI vivid-000-touch-cap vivid-000-sdr-cap vivid-000-vbi-out vivid-000-meta-cap vivid-000-meta-out drivers/media/test-drivers/vivid/vivid-core.h | 5 ++- .../media/test-drivers/vivid/vivid-ctrls.c | 32 ++++++++----------- .../test-drivers/vivid/vivid-kthread-cap.c | 7 ++-- .../test-drivers/vivid/vivid-kthread-out.c | 9 +++--- .../test-drivers/vivid/vivid-kthread-touch.c | 7 ++++ .../media/test-drivers/vivid/vivid-sdr-cap.c | 12 ++++--- .../test-drivers/vivid/vivid-touch-cap.c | 2 +- 7 files changed, 44 insertions(+), 30 deletions(-)