[PATCH 8/8] Fix standard video size detection

Mauro Carvalho Chehab mchehab at redhat.com
Fri Feb 11 07:54:24 PST 2011


video width/height size can vary not only as a function of the
video standard but also in function of device capabilities. Due
to that, the code were trying to get those info from the hardware.
However, due to a driver bug, the info is not properly filled when
the video standard is changed.

While I intend to fix this inside the drivers, the current logic
doesn't work with the current stable kernels. So, use an alternative
way of getting this info, just using video standards information.

Let's keep the not working code there, in order to make easy to
return, after fixing the drivers. We'll probably need to check for
driver versions after reenabling the correct (not working) code,
or to use the new VIDIOC ioctl's to enumberate the supported
formats.

Signed-off-by: Mauro Carvalho Chehab <mchehab at redhat.com>

diff --git a/src/v4l.c b/src/v4l.c
index 7b3d538..10e782b 100644
--- a/src/v4l.c
+++ b/src/v4l.c
@@ -992,7 +992,6 @@ V4LBuildEncodings(PortPrivPtr p, int fd)
      */
     for (inp = 0; inp < 256; inp++) {
         struct v4l2_input       input;
-        struct v4l2_framebuffer fbuf;
 
         memset(&input, 0, sizeof(input));
         input.index = inp;
@@ -1002,6 +1001,14 @@ V4LBuildEncodings(PortPrivPtr p, int fd)
         for (std = 0; std < num_std; std++) {
             int width, height;
 
+	    /*
+	     * Currently, this code is not reliable, due to driver
+	     * non-compliance on both saa7134 and bttv. So, instead,
+	     * just use the video standard information
+	     */
+#if 0
+	    struct v4l2_framebuffer fbuf;
+
             /* Some webcam drivers will fail here, but that's OK */
             ioctl(fd, VIDIOC_S_STD, &p->standard[std].id);
 
@@ -1035,7 +1042,16 @@ V4LBuildEncodings(PortPrivPtr p, int fd)
                     width = format.fmt.pix.width;
                 }
             }
+#else
+	    if (p->standard[std].id & V4L2_STD_525_60) {
+		height = 480;
+		width = 640;
+	    } else {
+		height = 576;
+		width = 768;
+	    }
 
+#endif
             /* Fixup for some driver bug */
             if ((p->standard[std].id & V4L2_STD_525_60) && (height == 576))
                 height = 480;
-- 
1.7.1



More information about the xorg-devel mailing list