[PATCH xawtv3] v4l2: Add a workaround for bttv kernel driver planar fmt width bug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux