drivers/media/pci/mgb4/mgb4_vin.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
From: Martin Tůma <martin.tuma@digiteqautomotive.com>
Compare the whole v4l2_bt_timings struct, not just the width/height when
setting new timings. Timings with the same resolution and different
pixelclock can now be properly set.
Signed-off-by: Martin Tůma <martin.tuma@digiteqautomotive.com>
---
drivers/media/pci/mgb4/mgb4_vin.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/pci/mgb4/mgb4_vin.c b/drivers/media/pci/mgb4/mgb4_vin.c
index 989e93f67f75..15182549d108 100644
--- a/drivers/media/pci/mgb4/mgb4_vin.c
+++ b/drivers/media/pci/mgb4/mgb4_vin.c
@@ -610,8 +610,8 @@ static int vidioc_s_dv_timings(struct file *file, void *fh,
timings->bt.height < video_timings_cap.bt.min_height ||
timings->bt.height > video_timings_cap.bt.max_height)
return -EINVAL;
- if (timings->bt.width == vindev->timings.bt.width &&
- timings->bt.height == vindev->timings.bt.height)
+ if (!memcmp(&timings->bt, &vindev->timings.bt,
+ sizeof(struct v4l2_bt_timings)))
return 0;
if (vb2_is_busy(&vindev->queue))
return -EBUSY;
base-commit: d968e50b5c26642754492dea23cbd3592bde62d8
--
2.50.1
On 04/08/2025 11:20, tumic@gpxsee.org wrote: > From: Martin Tůma <martin.tuma@digiteqautomotive.com> > > Compare the whole v4l2_bt_timings struct, not just the width/height when > setting new timings. Timings with the same resolution and different > pixelclock can now be properly set. > > Signed-off-by: Martin Tůma <martin.tuma@digiteqautomotive.com> > --- > drivers/media/pci/mgb4/mgb4_vin.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/pci/mgb4/mgb4_vin.c b/drivers/media/pci/mgb4/mgb4_vin.c > index 989e93f67f75..15182549d108 100644 > --- a/drivers/media/pci/mgb4/mgb4_vin.c > +++ b/drivers/media/pci/mgb4/mgb4_vin.c > @@ -610,8 +610,8 @@ static int vidioc_s_dv_timings(struct file *file, void *fh, > timings->bt.height < video_timings_cap.bt.min_height || > timings->bt.height > video_timings_cap.bt.max_height) > return -EINVAL; > - if (timings->bt.width == vindev->timings.bt.width && > - timings->bt.height == vindev->timings.bt.height) > + if (!memcmp(&timings->bt, &vindev->timings.bt, > + sizeof(struct v4l2_bt_timings))) I would recommend calling v4l2_match_dv_timings() instead. Otherwise you would also match on the reserved fields and 'standards' and 'flags' fields. Regards, Hans > return 0; > if (vb2_is_busy(&vindev->queue)) > return -EBUSY; > > base-commit: d968e50b5c26642754492dea23cbd3592bde62d8
On 8/25/25 5:03 PM, Hans Verkuil wrote: > On 04/08/2025 11:20, tumic@gpxsee.org wrote: >> From: Martin Tůma <martin.tuma@digiteqautomotive.com> >> >> Compare the whole v4l2_bt_timings struct, not just the width/height when >> setting new timings. Timings with the same resolution and different >> pixelclock can now be properly set. >> >> Signed-off-by: Martin Tůma <martin.tuma@digiteqautomotive.com> >> --- >> drivers/media/pci/mgb4/mgb4_vin.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/media/pci/mgb4/mgb4_vin.c b/drivers/media/pci/mgb4/mgb4_vin.c >> index 989e93f67f75..15182549d108 100644 >> --- a/drivers/media/pci/mgb4/mgb4_vin.c >> +++ b/drivers/media/pci/mgb4/mgb4_vin.c >> @@ -610,8 +610,8 @@ static int vidioc_s_dv_timings(struct file *file, void *fh, >> timings->bt.height < video_timings_cap.bt.min_height || >> timings->bt.height > video_timings_cap.bt.max_height) >> return -EINVAL; >> - if (timings->bt.width == vindev->timings.bt.width && >> - timings->bt.height == vindev->timings.bt.height) >> + if (!memcmp(&timings->bt, &vindev->timings.bt, >> + sizeof(struct v4l2_bt_timings))) > > I would recommend calling v4l2_match_dv_timings() instead. > Otherwise you would also match on the reserved fields and 'standards' > and 'flags' fields. > Yes, that's definitely better. I will post a v2 with this change tomorrow. Thanks for pointing this out. M. > Regards, > > Hans > >> return 0; >> if (vb2_is_busy(&vindev->queue)) >> return -EBUSY; >> >> base-commit: d968e50b5c26642754492dea23cbd3592bde62d8 >
© 2016 - 2025 Red Hat, Inc.