* [PATCH xawtv3] v4l2: Add a workaround for bttv kernel driver planar fmt width bug
@ 2016-02-07 16:22 Hans de Goede
0 siblings, 0 replies; only message in thread
From: Hans de Goede @ 2016-02-07 16:22 UTC (permalink / raw)
To: Linux Media Mailing List; +Cc: Hans de Goede
The bttv driver has a bug where it will return a width which is not
a multiple of 16 for planar formats, while it cannot handle this,
this commit adds a workaround for this.
A kernel fix has been send upstream for this for 4.5 / 4.6, so
eventually this workaround should be removed again.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
libng/plugins/drv0-v4l2.tmpl.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/libng/plugins/drv0-v4l2.tmpl.c b/libng/plugins/drv0-v4l2.tmpl.c
index 2cbd34b..56fff9a 100644
--- a/libng/plugins/drv0-v4l2.tmpl.c
+++ b/libng/plugins/drv0-v4l2.tmpl.c
@@ -1122,6 +1122,22 @@ retry:
}
if (h->fmt_v4l2.fmt.pix.pixelformat != xawtv_pixelformat[fmt->fmtid])
return -1;
+
+ /*
+ * The bttv driver has a bug where it will return a width which is not
+ * a multiple of 16 for planar formats, while it cannot handle this,
+ * fix this up.
+ *
+ * A kernel fix has been send upstream for this for 4.5 / 4.6, so
+ * eventually this workaround should be removed.
+ */
+ if (0 && !strcmp(h->cap.driver, "bttv") &&
+ (fmt->fmtid == VIDEO_YUV422P || fmt->fmtid == VIDEO_YUV420P) &&
+ h->fmt_v4l2.fmt.pix.width % 16) {
+ fmt->width = h->fmt_v4l2.fmt.pix.width & ~15;
+ goto retry;
+ }
+
fmt->width = h->fmt_v4l2.fmt.pix.width;
fmt->height = h->fmt_v4l2.fmt.pix.height;
fmt->bytesperline = h->fmt_v4l2.fmt.pix.bytesperline;
--
2.5.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-02-07 16:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-07 16:22 [PATCH xawtv3] v4l2: Add a workaround for bttv kernel driver planar fmt width bug Hans de Goede
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).