* [RFCv1 PATCH 0/6] Improved/New timings API
@ 2012-02-03 10:06 Hans Verkuil
2012-02-03 10:06 ` [RFCv1 PATCH 1/6] videodev2.h: add enum/query/cap dv_timings ioctls Hans Verkuil
2012-02-24 9:54 ` [RFCv1 PATCH 0/6] Improved/New timings API Hans Verkuil
0 siblings, 2 replies; 18+ messages in thread
From: Hans Verkuil @ 2012-02-03 10:06 UTC (permalink / raw)
To: linux-media; +Cc: Mauro Carvalho Chehab
Hi all,
This is an implementation of this RFC:
http://www.mail-archive.com/linux-media@vger.kernel.org/msg38168.html
The goal is that with these additions the existing DV_PRESET API can be
removed eventually. It's always painful to admit, but that wasn't the best
API ever :-)
To my dismay I discovered that some of the preset defines were even impossible:
there are no interlaced 1920x1080i25/29.97/30 formats.
I have been testing this new code with the adv7604 HDMI receiver as used here:
http://git.linuxtv.org/hverkuil/cisco.git/shortlog/refs/heads/test-timings
This is my development/test branch, so the code is a bit messy.
One problem that I always had with the older proposals is that there was no
easy way to just select a specific standard (e.g. 720p60). By creating the
linux/v4l2-dv-timings.h header this is now very easy to do, both for drivers
and applications.
I also took special care on how to distinguish between e.g. 720p60 and 720p59.94.
See the documentation for more information.
Note that the QUERY_DV_TIMINGS and DV_TIMINGS_CAP ioctls will be marked
experimental. Particularly the latter ioctl might well change in the future as
I do not have enough experience to tell whether DV_TIMINGS_CAP is sufficiently
detailed.
I would like to get some feedback on this approach, just to make sure I don't
need to start over.
In the meantime I will be working on code to detect CVT and GTF video timings
since that is needed to verify that that part works correctly as well.
And once everyone agrees to the API, then I will try and add this API to all
drivers that currently use the preset API. That way there will be a decent
path forward to eventually remove the preset API (sooner rather than later
IMHO).
Regards,
Hans
^ permalink raw reply [flat|nested] 18+ messages in thread
* [RFCv1 PATCH 1/6] videodev2.h: add enum/query/cap dv_timings ioctls.
2012-02-03 10:06 [RFCv1 PATCH 0/6] Improved/New timings API Hans Verkuil
@ 2012-02-03 10:06 ` Hans Verkuil
2012-02-03 10:06 ` [RFCv1 PATCH 2/6] v4l2 framework: add support for the new " Hans Verkuil
` (5 more replies)
2012-02-24 9:54 ` [RFCv1 PATCH 0/6] Improved/New timings API Hans Verkuil
1 sibling, 6 replies; 18+ messages in thread
From: Hans Verkuil @ 2012-02-03 10:06 UTC (permalink / raw)
To: linux-media; +Cc: Mauro Carvalho Chehab, Hans Verkuil
From: Hans Verkuil <hans.verkuil@cisco.com>
These new ioctls make it possible for the dv_timings API to replace
the dv_preset API eventually.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
include/linux/videodev2.h | 110 ++++++++++++++++++++++++++++++++++++++++----
1 files changed, 100 insertions(+), 10 deletions(-)
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 0db0503..e59cd02 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -987,28 +987,42 @@ struct v4l2_dv_enum_preset {
*/
/* BT.656/BT.1120 timing data */
+
+/*
+ * A note regarding vertical interlaced timings: height refers to the total
+ * height of the frame (= two fields). The blanking timings refer
+ * to the blanking of each field. So the height of the active frame is
+ * calculated as follows:
+ *
+ * act_height = height - vfrontporch - vsync - vbackporch -
+ * il_vfrontporch - il_vsync - il_vbackporch
+ *
+ * The active height of each field is act_height / 2.
+ */
struct v4l2_bt_timings {
- __u32 width; /* width in pixels */
- __u32 height; /* height in lines */
+ __u32 width; /* total frame width in pixels */
+ __u32 height; /* total frame height in lines */
__u32 interlaced; /* Interlaced or progressive */
__u32 polarities; /* Positive or negative polarity */
__u64 pixelclock; /* Pixel clock in HZ. Ex. 74.25MHz->74250000 */
- __u32 hfrontporch; /* Horizpontal front porch in pixels */
+ __u32 hfrontporch; /* Horizontal front porch in pixels */
__u32 hsync; /* Horizontal Sync length in pixels */
__u32 hbackporch; /* Horizontal back porch in pixels */
__u32 vfrontporch; /* Vertical front porch in pixels */
__u32 vsync; /* Vertical Sync length in lines */
__u32 vbackporch; /* Vertical back porch in lines */
- __u32 il_vfrontporch; /* Vertical front porch for bottom field of
- * interlaced field formats
+ __u32 il_vfrontporch; /* Vertical front porch for the even field
+ * (aka field 2) of interlaced field formats
*/
- __u32 il_vsync; /* Vertical sync length for bottom field of
- * interlaced field formats
+ __u32 il_vsync; /* Vertical sync length for the even field
+ * (aka field 2) of interlaced field formats
*/
- __u32 il_vbackporch; /* Vertical back porch for bottom field of
- * interlaced field formats
+ __u32 il_vbackporch; /* Vertical back porch for the even field
+ * (aka field 2) of interlaced field formats
*/
- __u32 reserved[16];
+ __u32 standards; /* Standards the timing belongs to */
+ __u32 flags; /* Flags */
+ __u32 reserved[14];
} __attribute__ ((packed));
/* Interlaced or progressive format */
@@ -1019,6 +1033,37 @@ struct v4l2_bt_timings {
#define V4L2_DV_VSYNC_POS_POL 0x00000001
#define V4L2_DV_HSYNC_POS_POL 0x00000002
+/* Timings standards */
+#define V4L2_DV_BT_STD_CEA861 (1 << 0) /* CEA-861 Digital TV Profile */
+#define V4L2_DV_BT_STD_DMT (1 << 1) /* VESA Discrete Monitor Timings */
+#define V4L2_DV_BT_STD_CVT (1 << 2) /* VESA Coordinated Video Timings */
+#define V4L2_DV_BT_STD_GTF (1 << 3) /* VESA Generalized Timings Formula */
+
+/* Flags */
+
+/* CVT/GTF specific: timing uses reduced blanking (CVT) or the 'Secondary
+ GTF' curve (GTF). In both cases the horizontal and/or vertical blanking
+ intervals are reduced, allowing a higher resolution over the same
+ bandwidth. This is a read-only flag. */
+#define V4L2_DV_FL_REDUCED_BLANKING (1 << 0)
+/* CEA-861 specific: set for CEA-861 formats with a framerate of a multiple
+ of six. These formats can be optionally played at 1 / 1.001 speed to
+ be compatible with the normal NTSC framerate of 29.97 frames per second.
+ This is a read-only flag. */
+#define V4L2_DV_FL_NTSC_COMPATIBLE (1 << 1)
+/* CEA-861 specific: only valid for video transmitters, the flag is cleared
+ by receivers.
+ If the framerate of the format is a multiple of six, then the pixelclock
+ used to set up the transmitter is divided by 1.001 to make it compatible
+ with NTSC framerates. Otherwise this flag is cleared. If the transmitter
+ can't generate such frequencies, then the flag will also be cleared. */
+#define V4L2_DV_FL_DIVIDE_CLOCK_BY_1_001 (1 << 2)
+/* Specific to interlaced formats: if set, then field 1 is really one half-line
+ longer and field 2 is really one half-line shorter, so each field has
+ exactly the same number of half-lines. Whether half-lines can be detected
+ or used depends on the hardware. */
+#define V4L2_DV_FL_HALF_LINE (1 << 0)
+
/* DV timings */
struct v4l2_dv_timings {
@@ -1032,6 +1077,47 @@ struct v4l2_dv_timings {
/* Values for the type field */
#define V4L2_DV_BT_656_1120 0 /* BT.656/1120 timing type */
+
+/* DV timings enumeration */
+struct v4l2_enum_dv_timings {
+ __u32 index;
+ __u32 reserved[3];
+ struct v4l2_dv_timings timings;
+};
+
+/* BT.656/BT.1120 timing capabilities */
+struct v4l2_bt_timings_cap {
+ __u32 min_width; /* width in pixels */
+ __u32 max_width; /* width in pixels */
+ __u32 min_height; /* height in lines */
+ __u32 max_height; /* height in lines */
+ __u64 min_pixelclock; /* Pixel clock in HZ. Ex. 74.25MHz->74250000 */
+ __u64 max_pixelclock; /* Pixel clock in HZ. Ex. 74.25MHz->74250000 */
+ __u32 standards; /* Supported standards */
+ __u32 capabilities; /* See below */
+ __u32 reserved[16];
+} __attribute__ ((packed));
+
+/* Supports interlaced formats */
+#define V4L2_DV_BT_CAP_INTERLACED (1 << 0)
+/* Supports progressive formats */
+#define V4L2_DV_BT_CAP_PROGRESSIVE (1 << 1)
+/* Supports CVT/GTF reduced blanking */
+#define V4L2_DV_BT_CAP_REDUCED_BLANKING (1 << 2)
+/* Supports custom formats */
+#define V4L2_DV_BT_CAP_CUSTOM (1 << 3)
+
+/* DV timings capabilities */
+struct v4l2_dv_timings_cap {
+ __u32 type;
+ __u32 reserved[3];
+ union {
+ struct v4l2_bt_timings_cap bt;
+ __u32 raw_data[32];
+ };
+};
+
+
/*
* V I D E O I N P U T S
*/
@@ -2318,6 +2404,10 @@ struct v4l2_create_buffers {
#define VIDIOC_G_SELECTION _IOWR('V', 94, struct v4l2_selection)
#define VIDIOC_S_SELECTION _IOWR('V', 95, struct v4l2_selection)
+#define VIDIOC_ENUM_DV_TIMINGS _IOWR('V', 96, struct v4l2_enum_dv_timings)
+#define VIDIOC_QUERY_DV_TIMINGS _IOR('V', 97, struct v4l2_dv_timings)
+#define VIDIOC_DV_TIMINGS_CAP _IOWR('V', 98, struct v4l2_dv_timings_cap)
+
/* Reminder: when adding new ioctls please add support for them to
drivers/media/video/v4l2-compat-ioctl32.c as well! */
--
1.7.8.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [RFCv1 PATCH 2/6] v4l2 framework: add support for the new dv_timings ioctls.
2012-02-03 10:06 ` [RFCv1 PATCH 1/6] videodev2.h: add enum/query/cap dv_timings ioctls Hans Verkuil
@ 2012-02-03 10:06 ` Hans Verkuil
2012-02-03 10:06 ` [RFCv1 PATCH 3/6] v4l2-dv-timings.h: definitions for CEA-861 and VESA DMT timings Hans Verkuil
` (4 subsequent siblings)
5 siblings, 0 replies; 18+ messages in thread
From: Hans Verkuil @ 2012-02-03 10:06 UTC (permalink / raw)
To: linux-media; +Cc: Mauro Carvalho Chehab, Hans Verkuil
From: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
drivers/media/video/v4l2-compat-ioctl32.c | 3 +
drivers/media/video/v4l2-ioctl.c | 122 ++++++++++++++++++++---------
include/media/v4l2-ioctl.h | 6 ++
include/media/v4l2-subdev.h | 6 ++
4 files changed, 101 insertions(+), 36 deletions(-)
diff --git a/drivers/media/video/v4l2-compat-ioctl32.c b/drivers/media/video/v4l2-compat-ioctl32.c
index af4419e..87ac6c8 100644
--- a/drivers/media/video/v4l2-compat-ioctl32.c
+++ b/drivers/media/video/v4l2-compat-ioctl32.c
@@ -1021,6 +1021,9 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
case VIDIOC_UNSUBSCRIBE_EVENT:
case VIDIOC_CREATE_BUFS32:
case VIDIOC_PREPARE_BUF32:
+ case VIDIOC_ENUM_DV_TIMINGS:
+ case VIDIOC_QUERY_DV_TIMINGS:
+ case VIDIOC_DV_TIMINGS_CAP:
ret = do_video_ioctl(file, cmd, arg);
break;
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c
index d0d7281..c8d2452 100644
--- a/drivers/media/video/v4l2-ioctl.c
+++ b/drivers/media/video/v4l2-ioctl.c
@@ -277,6 +277,9 @@ static const char *v4l2_ioctls[] = {
[_IOC_NR(VIDIOC_UNSUBSCRIBE_EVENT)] = "VIDIOC_UNSUBSCRIBE_EVENT",
[_IOC_NR(VIDIOC_CREATE_BUFS)] = "VIDIOC_CREATE_BUFS",
[_IOC_NR(VIDIOC_PREPARE_BUF)] = "VIDIOC_PREPARE_BUF",
+ [_IOC_NR(VIDIOC_ENUM_DV_TIMINGS)] = "VIDIOC_ENUM_DV_TIMINGS",
+ [_IOC_NR(VIDIOC_QUERY_DV_TIMINGS)] = "VIDIOC_QUERY_DV_TIMINGS",
+ [_IOC_NR(VIDIOC_DV_TIMINGS_CAP)] = "VIDIOC_DV_TIMINGS_CAP",
};
#define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls)
@@ -357,6 +360,34 @@ static inline void dbgrect(struct video_device *vfd, char *s,
r->width, r->height);
};
+static void dbgtimings(struct video_device *vfd,
+ const struct v4l2_dv_timings *p)
+{
+ switch (p->type) {
+ case V4L2_DV_BT_656_1120:
+ dbgarg2("bt-656/1120:interlaced=%d,"
+ " pixelclock=%lld,"
+ " width=%d, height=%d, polarities=%x,"
+ " hfrontporch=%d, hsync=%d,"
+ " hbackporch=%d, vfrontporch=%d,"
+ " vsync=%d, vbackporch=%d,"
+ " il_vfrontporch=%d, il_vsync=%d,"
+ " il_vbackporch=%d, standards=%x, flags=%x\n",
+ p->bt.interlaced, p->bt.pixelclock,
+ p->bt.width, p->bt.height,
+ p->bt.polarities, p->bt.hfrontporch,
+ p->bt.hsync, p->bt.hbackporch,
+ p->bt.vfrontporch, p->bt.vsync,
+ p->bt.vbackporch, p->bt.il_vfrontporch,
+ p->bt.il_vsync, p->bt.il_vbackporch,
+ p->bt.standards, p->bt.flags);
+ break;
+ default:
+ dbgarg2("Unknown type %d!\n", p->type);
+ break;
+ }
+}
+
static inline void v4l_print_pix_fmt(struct video_device *vfd,
struct v4l2_pix_format *fmt)
{
@@ -2112,25 +2143,13 @@ static long __video_do_ioctl(struct file *file,
break;
}
+ dbgtimings(vfd, p);
switch (p->type) {
case V4L2_DV_BT_656_1120:
- dbgarg2("bt-656/1120:interlaced=%d, pixelclock=%lld,"
- " width=%d, height=%d, polarities=%x,"
- " hfrontporch=%d, hsync=%d, hbackporch=%d,"
- " vfrontporch=%d, vsync=%d, vbackporch=%d,"
- " il_vfrontporch=%d, il_vsync=%d,"
- " il_vbackporch=%d\n",
- p->bt.interlaced, p->bt.pixelclock,
- p->bt.width, p->bt.height, p->bt.polarities,
- p->bt.hfrontporch, p->bt.hsync,
- p->bt.hbackporch, p->bt.vfrontporch,
- p->bt.vsync, p->bt.vbackporch,
- p->bt.il_vfrontporch, p->bt.il_vsync,
- p->bt.il_vbackporch);
ret = ops->vidioc_s_dv_timings(file, fh, p);
break;
default:
- dbgarg2("Unknown type %d!\n", p->type);
+ ret = -EINVAL;
break;
}
break;
@@ -2143,29 +2162,60 @@ static long __video_do_ioctl(struct file *file,
break;
ret = ops->vidioc_g_dv_timings(file, fh, p);
+ if (!ret)
+ dbgtimings(vfd, p);
+ break;
+ }
+ case VIDIOC_ENUM_DV_TIMINGS:
+ {
+ struct v4l2_enum_dv_timings *p = arg;
+
+ if (!ops->vidioc_enum_dv_timings)
+ break;
+
+ ret = ops->vidioc_enum_dv_timings(file, fh, p);
if (!ret) {
- switch (p->type) {
- case V4L2_DV_BT_656_1120:
- dbgarg2("bt-656/1120:interlaced=%d,"
- " pixelclock=%lld,"
- " width=%d, height=%d, polarities=%x,"
- " hfrontporch=%d, hsync=%d,"
- " hbackporch=%d, vfrontporch=%d,"
- " vsync=%d, vbackporch=%d,"
- " il_vfrontporch=%d, il_vsync=%d,"
- " il_vbackporch=%d\n",
- p->bt.interlaced, p->bt.pixelclock,
- p->bt.width, p->bt.height,
- p->bt.polarities, p->bt.hfrontporch,
- p->bt.hsync, p->bt.hbackporch,
- p->bt.vfrontporch, p->bt.vsync,
- p->bt.vbackporch, p->bt.il_vfrontporch,
- p->bt.il_vsync, p->bt.il_vbackporch);
- break;
- default:
- dbgarg2("Unknown type %d!\n", p->type);
- break;
- }
+ dbgarg(cmd, "index=%d: ", p->index);
+ dbgtimings(vfd, &p->timings);
+ }
+ break;
+ }
+ case VIDIOC_QUERY_DV_TIMINGS:
+ {
+ struct v4l2_dv_timings *p = arg;
+
+ if (!ops->vidioc_query_dv_timings)
+ break;
+
+ ret = ops->vidioc_query_dv_timings(file, fh, p);
+ if (!ret)
+ dbgtimings(vfd, p);
+ break;
+ }
+ case VIDIOC_DV_TIMINGS_CAP:
+ {
+ struct v4l2_dv_timings_cap *p = arg;
+
+ if (!ops->vidioc_dv_timings_cap)
+ break;
+
+ ret = ops->vidioc_dv_timings_cap(file, fh, p);
+ if (ret)
+ break;
+ switch (p->type) {
+ case V4L2_DV_BT_656_1120:
+ dbgarg(cmd,
+ "type=%d, width=%u-%u, height=%u-%u, "
+ "pixelclock=%llu-%llu, standards=%x, capabilities=%x ",
+ p->type,
+ p->bt.min_width, p->bt.max_width,
+ p->bt.min_height, p->bt.max_height,
+ p->bt.min_pixelclock, p->bt.max_pixelclock,
+ p->bt.standards, p->bt.capabilities);
+ break;
+ default:
+ dbgarg(cmd, "unknown type ");
+ break;
}
break;
}
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index 3f5d60f..e53b896 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -268,6 +268,12 @@ struct v4l2_ioctl_ops {
struct v4l2_dv_timings *timings);
int (*vidioc_g_dv_timings) (struct file *file, void *fh,
struct v4l2_dv_timings *timings);
+ int (*vidioc_query_dv_timings) (struct file *file, void *fh,
+ struct v4l2_dv_timings *timings);
+ int (*vidioc_enum_dv_timings) (struct file *file, void *fh,
+ struct v4l2_enum_dv_timings *timings);
+ int (*vidioc_dv_timings_cap) (struct file *file, void *fh,
+ struct v4l2_dv_timings_cap *cap);
int (*vidioc_subscribe_event) (struct v4l2_fh *fh,
struct v4l2_event_subscription *sub);
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index f0f3358..9f82c0b 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -307,6 +307,12 @@ struct v4l2_subdev_video_ops {
struct v4l2_dv_timings *timings);
int (*g_dv_timings)(struct v4l2_subdev *sd,
struct v4l2_dv_timings *timings);
+ int (*enum_dv_timings)(struct v4l2_subdev *sd,
+ struct v4l2_enum_dv_timings *timings);
+ int (*query_dv_timings)(struct v4l2_subdev *sd,
+ struct v4l2_dv_timings *timings);
+ int (*dv_timings_cap)(struct v4l2_subdev *sd,
+ struct v4l2_dv_timings_cap *cap);
int (*enum_mbus_fmt)(struct v4l2_subdev *sd, unsigned int index,
enum v4l2_mbus_pixelcode *code);
int (*enum_mbus_fsizes)(struct v4l2_subdev *sd,
--
1.7.8.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [RFCv1 PATCH 3/6] v4l2-dv-timings.h: definitions for CEA-861 and VESA DMT timings.
2012-02-03 10:06 ` [RFCv1 PATCH 1/6] videodev2.h: add enum/query/cap dv_timings ioctls Hans Verkuil
2012-02-03 10:06 ` [RFCv1 PATCH 2/6] v4l2 framework: add support for the new " Hans Verkuil
@ 2012-02-03 10:06 ` Hans Verkuil
2012-02-03 10:06 ` [RFCv1 PATCH 4/6] V4L2 spec: document the new V4L2 DV timings ioctls Hans Verkuil
` (3 subsequent siblings)
5 siblings, 0 replies; 18+ messages in thread
From: Hans Verkuil @ 2012-02-03 10:06 UTC (permalink / raw)
To: linux-media; +Cc: Mauro Carvalho Chehab, Hans Verkuil
From: Hans Verkuil <hans.verkuil@cisco.com>
This header contains the timings for the common CEA-861 and all VESA
DMT formats for use with the V4L2 dv_timings API.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
include/linux/Kbuild | 1 +
include/linux/v4l2-dv-timings.h | 734 +++++++++++++++++++++++++++++++++++++++
2 files changed, 735 insertions(+), 0 deletions(-)
create mode 100644 include/linux/v4l2-dv-timings.h
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index c94e717..1c17ced 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -379,6 +379,7 @@ header-y += usbdevice_fs.h
header-y += utime.h
header-y += utsname.h
header-y += uvcvideo.h
+header-y += v4l2-dv-timings.h
header-y += v4l2-mediabus.h
header-y += v4l2-subdev.h
header-y += veth.h
diff --git a/include/linux/v4l2-dv-timings.h b/include/linux/v4l2-dv-timings.h
new file mode 100644
index 0000000..ae6b495
--- /dev/null
+++ b/include/linux/v4l2-dv-timings.h
@@ -0,0 +1,734 @@
+/*
+ * V4L2 DV timings header.
+ *
+ * Copyright (C) 2012 Hans Verkuil <hans.verkuil@cisco.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#ifndef _V4L2_DV_TIMINGS_H
+#define _V4L2_DV_TIMINGS_H
+
+/* CEA-861 timings (i.e. standard HDTV timings) */
+
+#define V4L2_DV_BT_CEA_640X480P59_94 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 640, 480, 0, 0, \
+ 25175000, 16, 96, 48, 10, 2, 33, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CEA861, 0 } \
+}
+
+#define V4L2_DV_BT_CEA_720X480P59_94 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 720, 480, 0, 0, \
+ 27000000, 16, 62, 60, 9, 6, 30, 0, 0, 0, \
+ V4L2_DV_BT_STD_CEA861, 0 } \
+}
+
+#define V4L2_DV_BT_CEA_720X576P50 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 720, 576, 0, 0, \
+ 27000000, 12, 64, 68, 5, 5, 39, 0, 0, 0, \
+ V4L2_DV_BT_STD_CEA861, 0 } \
+}
+
+#define V4L2_DV_BT_CEA_1280X720P24 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1280, 720, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 59400000, 1760, 40, 220, 5, 5, 20, 0, 0, 0, \
+ V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_NTSC_COMPATIBLE } \
+}
+
+#define V4L2_DV_BT_CEA_1280X720P25 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1280, 720, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 74250000, 2420, 40, 220, 5, 5, 20, 0, 0, 0, \
+ V4L2_DV_BT_STD_CEA861, 0 } \
+}
+
+#define V4L2_DV_BT_CEA_1280X720P30 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1280, 720, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 74250000, 1760, 40, 220, 5, 5, 20, 0, 0, 0, \
+ V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_NTSC_COMPATIBLE } \
+}
+
+#define V4L2_DV_BT_CEA_1280X720P50 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1280, 720, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 74250000, 440, 40, 220, 5, 5, 20, 0, 0, 0, \
+ V4L2_DV_BT_STD_CEA861, 0 } \
+}
+
+#define V4L2_DV_BT_CEA_1280X720P60 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1280, 720, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 74250000, 110, 40, 220, 5, 5, 20, 0, 0, 0, \
+ V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_NTSC_COMPATIBLE } \
+}
+
+#define V4L2_DV_BT_CEA_1920X1080P24 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1920, 1080, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 74250000, 638, 44, 148, 4, 5, 36, 0, 0, 0, \
+ V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_NTSC_COMPATIBLE } \
+}
+
+#define V4L2_DV_BT_CEA_1920X1080P25 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1920, 1080, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 74250000, 528, 44, 148, 4, 5, 36, 0, 0, 0, \
+ V4L2_DV_BT_STD_CEA861, 0 } \
+}
+
+#define V4L2_DV_BT_CEA_1920X1080P30 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1920, 1080, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 74250000, 88, 44, 148, 4, 5, 36, 0, 0, 0, \
+ V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_NTSC_COMPATIBLE } \
+}
+
+#define V4L2_DV_BT_CEA_1920X1080I50 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1920, 1080, 1, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 74250000, 528, 44, 148, 2, 5, 15, 2, 5, 16, \
+ V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_HALF_LINE } \
+}
+
+#define V4L2_DV_BT_CEA_1920X1080P50 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1920, 1080, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 148500000, 528, 44, 148, 4, 5, 36, 0, 0, 0, \
+ V4L2_DV_BT_STD_CEA861, 0 } \
+}
+
+#define V4L2_DV_BT_CEA_1920X1080I60 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1920, 1080, 1, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 74250000, 88, 44, 148, 2, 5, 15, 2, 5, 16, \
+ V4L2_DV_BT_STD_CEA861, \
+ V4L2_DV_FL_NTSC_COMPATIBLE | V4L2_DV_FL_HALF_LINE } \
+}
+
+#define V4L2_DV_BT_CEA_1920X1080P60 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1920, 1080, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 148500000, 88, 44, 148, 4, 5, 36, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_NTSC_COMPATIBLE } \
+}
+
+
+/* VESA Discrete Monitor Timings */
+
+#define V4L2_DV_BT_DMT_640X350P85 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 640, 350, 0, V4L2_DV_HSYNC_POS_POL, \
+ 31500000, 32, 64, 96, 32, 3, 60, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_640X400P85 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 640, 400, 0, V4L2_DV_VSYNC_POS_POL, \
+ 31500000, 32, 64, 96, 1, 3, 41, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_720X400P85 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 720, 400, 0, V4L2_DV_VSYNC_POS_POL, \
+ 35500000, 36, 72, 108, 1, 3, 42, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+/* VGA resolutions */
+#define V4L2_DV_BT_DMT_640X480P60 V4L2_DV_BT_CEA_640X480P59_94
+
+#define V4L2_DV_BT_DMT_640X480P72 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 640, 480, 0, 0, \
+ 31500000, 24, 40, 128, 9, 3, 28, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_640X480P75 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 640, 480, 0, 0, \
+ 31500000, 16, 64, 120, 1, 3, 16, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_640X480P85 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 640, 480, 0, 0, \
+ 36000000, 56, 56, 80, 1, 3, 25, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+/* SVGA resolutions */
+#define V4L2_DV_BT_DMT_800X600P56 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 800, 600, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 36000000, 24, 72, 128, 1, 2, 22, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_800X600P60 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 800, 600, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 40000000, 40, 128, 88, 1, 4, 23, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_800X600P72 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 800, 600, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 50000000, 56, 120, 64, 37, 6, 23, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_800X600P75 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 800, 600, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 49500000, 16, 80, 160, 1, 3, 21, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_800X600P85 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 800, 600, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 56250000, 32, 64, 152, 1, 3, 27, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_800X600P120_RB { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 800, 600, 0, V4L2_DV_HSYNC_POS_POL, \
+ 73250000, 48, 32, 80, 3, 4, 29, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
+ V4L2_DV_FL_REDUCED_BLANKING } \
+}
+
+#define V4L2_DV_BT_DMT_848X480P60 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 848, 480, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 33750000, 16, 112, 112, 6, 8, 23, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1024X768I43 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1024, 768, 1, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 44900000, 8, 176, 56, 0, 4, 20, 0, 4, 21, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+/* XGA resolutions */
+#define V4L2_DV_BT_DMT_1024X768P60 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1024, 768, 0, 0, \
+ 65000000, 24, 136, 160, 3, 6, 29, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1024X768P70 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1024, 768, 0, 0, \
+ 75000000, 24, 136, 144, 3, 6, 29, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1024X768P75 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1024, 768, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 78750000, 16, 96, 176, 1, 3, 28, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1024X768P85 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1024, 768, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 94500000, 48, 96, 208, 1, 3, 36, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1024X768P120_RB { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1024, 768, 0, V4L2_DV_HSYNC_POS_POL, \
+ 115500000, 48, 32, 80, 3, 4, 38, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
+ V4L2_DV_FL_REDUCED_BLANKING } \
+}
+
+/* XGA+ resolution */
+#define V4L2_DV_BT_DMT_1152X864P75 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1152, 864, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 108000000, 64, 128, 256, 1, 3, 32, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+/* WXGA resolutions */
+#define V4L2_DV_BT_DMT_1280X768P60_RB { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1280, 768, 0, V4L2_DV_HSYNC_POS_POL, \
+ 68250000, 48, 32, 80, 3, 7, 12, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
+ V4L2_DV_FL_REDUCED_BLANKING } \
+}
+
+#define V4L2_DV_BT_DMT_1280X768P60 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1280, 768, 0, V4L2_DV_VSYNC_POS_POL, \
+ 79500000, 64, 128, 192, 3, 7, 20, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1280X768P75 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1280, 768, 0, V4L2_DV_VSYNC_POS_POL, \
+ 102250000, 80, 128, 208, 3, 7, 27, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1280X768P85 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1280, 768, 0, V4L2_DV_VSYNC_POS_POL, \
+ 117500000, 80, 136, 216, 3, 7, 31, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1280X768P120_RB { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1280, 768, 0, V4L2_DV_HSYNC_POS_POL, \
+ 140250000, 48, 32, 80, 3, 7, 35, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
+ V4L2_DV_FL_REDUCED_BLANKING } \
+}
+
+#define V4L2_DV_BT_DMT_1280X800P60_RB { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1280, 800, 0, V4L2_DV_HSYNC_POS_POL, \
+ 71000000, 48, 32, 80, 3, 6, 14, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
+ V4L2_DV_FL_REDUCED_BLANKING } \
+}
+
+#define V4L2_DV_BT_DMT_1280X800P60 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1280, 800, 0, V4L2_DV_VSYNC_POS_POL, \
+ 83500000, 72, 128, 200, 3, 6, 22, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1280X800P75 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1280, 800, 0, V4L2_DV_VSYNC_POS_POL, \
+ 106500000, 80, 128, 208, 3, 6, 29, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1280X800P85 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1280, 800, 0, V4L2_DV_VSYNC_POS_POL, \
+ 122500000, 80, 136, 216, 3, 6, 34, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1280X800P120_RB { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1280, 800, 0, V4L2_DV_HSYNC_POS_POL, \
+ 146250000, 48, 32, 80, 3, 6, 38, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
+ V4L2_DV_FL_REDUCED_BLANKING } \
+}
+
+#define V4L2_DV_BT_DMT_1280X960P60 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1280, 960, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 108000000, 96, 112, 312, 1, 3, 36, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1280X960P85 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1280, 960, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 148500000, 64, 160, 224, 1, 3, 47, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1280X960P120_RB { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1280, 960, 0, V4L2_DV_HSYNC_POS_POL, \
+ 175500000, 48, 32, 80, 3, 4, 50, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
+ V4L2_DV_FL_REDUCED_BLANKING } \
+}
+
+/* SXGA resolutions */
+#define V4L2_DV_BT_DMT_1280X1024P60 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1280, 1024, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 108000000, 48, 112, 248, 1, 3, 38, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1280X1024P75 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1280, 1024, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 135000000, 16, 144, 248, 1, 3, 38, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1280X1024P85 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1280, 1024, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 157500000, 64, 160, 224, 1, 3, 44, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1280X1024P120_RB { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1280, 1024, 0, V4L2_DV_HSYNC_POS_POL, \
+ 187250000, 48, 32, 80, 3, 7, 50, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
+ V4L2_DV_FL_REDUCED_BLANKING } \
+}
+
+#define V4L2_DV_BT_DMT_1360X768P60 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1360, 768, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 85500000, 64, 112, 256, 3, 6, 18, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1360X768P120_RB { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1360, 768, 0, V4L2_DV_HSYNC_POS_POL, \
+ 148250000, 48, 32, 80, 3, 5, 37, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
+ V4L2_DV_FL_REDUCED_BLANKING } \
+}
+
+/* SXGA+ resolutions */
+#define V4L2_DV_BT_DMT_1400X1050P60_RB { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1400, 1050, 0, V4L2_DV_HSYNC_POS_POL, \
+ 101000000, 48, 32, 80, 3, 4, 23, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
+ V4L2_DV_FL_REDUCED_BLANKING } \
+}
+
+#define V4L2_DV_BT_DMT_1400X1050P60 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1400, 1050, 0, V4L2_DV_VSYNC_POS_POL, \
+ 121750000, 88, 144, 232, 3, 4, 32, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1400X1050P75 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1400, 1050, 0, V4L2_DV_VSYNC_POS_POL, \
+ 156000000, 104, 144, 248, 3, 4, 42, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1400X1050P85 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1400, 1050, 0, V4L2_DV_VSYNC_POS_POL, \
+ 179500000, 104, 152, 256, 3, 4, 48, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1400X1050P120_RB { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1400, 1050, 0, V4L2_DV_HSYNC_POS_POL, \
+ 208000000, 48, 32, 80, 3, 4, 55, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
+ V4L2_DV_FL_REDUCED_BLANKING } \
+}
+
+/* WXGA+ resolutions */
+#define V4L2_DV_BT_DMT_1440X900P60_RB { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1440, 900, 0, V4L2_DV_HSYNC_POS_POL, \
+ 88750000, 48, 32, 80, 3, 6, 17, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
+ V4L2_DV_FL_REDUCED_BLANKING } \
+}
+
+#define V4L2_DV_BT_DMT_1440X900P60 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1440, 900, 0, V4L2_DV_VSYNC_POS_POL, \
+ 106500000, 80, 152, 232, 3, 6, 25, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1440X900P75 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1440, 900, 0, V4L2_DV_VSYNC_POS_POL, \
+ 136750000, 96, 152, 248, 3, 6, 33, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1440X900P85 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1440, 900, 0, V4L2_DV_VSYNC_POS_POL, \
+ 157000000, 104, 152, 256, 3, 6, 39, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1440X900P120_RB { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1440, 900, 0, V4L2_DV_HSYNC_POS_POL, \
+ 182750000, 48, 32, 80, 3, 6, 44, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
+ V4L2_DV_FL_REDUCED_BLANKING } \
+}
+
+/* UXGA resolutions */
+#define V4L2_DV_BT_DMT_1600X1200P60 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1600, 1200, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 162000000, 64, 192, 304, 1, 3, 46, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1600X1200P65 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1600, 1200, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 175500000, 64, 192, 304, 1, 3, 46, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1600X1200P70 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1600, 1200, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 189000000, 64, 192, 304, 1, 3, 46, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1600X1200P75 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1600, 1200, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 202500000, 64, 192, 304, 1, 3, 46, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1600X1200P85 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1600, 1200, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 229500000, 64, 192, 304, 1, 3, 46, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1600X1200P120_RB { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1600, 1200, 0, V4L2_DV_HSYNC_POS_POL, \
+ 268250000, 48, 32, 80, 3, 4, 64, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
+ V4L2_DV_FL_REDUCED_BLANKING } \
+}
+
+/* WSXGA+ resolutions */
+#define V4L2_DV_BT_DMT_1680X1050P60_RB { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1680, 1050, 0, V4L2_DV_HSYNC_POS_POL, \
+ 119000000, 48, 32, 80, 3, 6, 21, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
+ V4L2_DV_FL_REDUCED_BLANKING } \
+}
+
+#define V4L2_DV_BT_DMT_1680X1050P60 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1680, 1050, 0, V4L2_DV_VSYNC_POS_POL, \
+ 146250000, 104, 176, 280, 3, 6, 30, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1680X1050P75 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1680, 1050, 0, V4L2_DV_VSYNC_POS_POL, \
+ 187000000, 120, 176, 296, 3, 6, 40, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1680X1050P85 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1680, 1050, 0, V4L2_DV_VSYNC_POS_POL, \
+ 214750000, 128, 176, 304, 3, 6, 46, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1680X1050P120_RB { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1680, 1050, 0, V4L2_DV_HSYNC_POS_POL, \
+ 245500000, 48, 32, 80, 3, 6, 53, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
+ V4L2_DV_FL_REDUCED_BLANKING } \
+}
+
+#define V4L2_DV_BT_DMT_1792X1344P60 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1792, 1344, 0, V4L2_DV_VSYNC_POS_POL, \
+ 204750000, 128, 200, 328, 1, 3, 46, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1792X1344P75 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1792, 1344, 0, V4L2_DV_VSYNC_POS_POL, \
+ 261000000, 96, 216, 352, 1, 3, 69, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1792X1344P120_RB { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1792, 1344, 0, V4L2_DV_HSYNC_POS_POL, \
+ 333250000, 48, 32, 80, 3, 4, 72, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
+ V4L2_DV_FL_REDUCED_BLANKING } \
+}
+
+#define V4L2_DV_BT_DMT_1856X1392P60 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1856, 1392, 0, V4L2_DV_VSYNC_POS_POL, \
+ 218250000, 96, 224, 352, 1, 3, 43, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1856X1392P75 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1856, 1392, 0, V4L2_DV_VSYNC_POS_POL, \
+ 288000000, 128, 224, 352, 1, 3, 104, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1856X1392P120_RB { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1856, 1392, 0, V4L2_DV_HSYNC_POS_POL, \
+ 356500000, 48, 32, 80, 3, 4, 75, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
+ V4L2_DV_FL_REDUCED_BLANKING } \
+}
+
+/* WUXGA resolutions */
+#define V4L2_DV_BT_DMT_1920X1200P60_RB { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1920, 1200, 0, V4L2_DV_HSYNC_POS_POL, \
+ 154000000, 48, 32, 80, 3, 6, 26, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
+ V4L2_DV_FL_REDUCED_BLANKING } \
+}
+
+#define V4L2_DV_BT_DMT_1920X1200P60 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1920, 1200, 0, V4L2_DV_VSYNC_POS_POL, \
+ 193250000, 136, 200, 336, 3, 6, 36, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1920X1200P75 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1920, 1200, 0, V4L2_DV_VSYNC_POS_POL, \
+ 245250000, 136, 208, 344, 3, 6, 46, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1920X1200P85 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1920, 1200, 0, V4L2_DV_VSYNC_POS_POL, \
+ 281250000, 144, 208, 352, 3, 6, 53, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1920X1200P120_RB { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1920, 1200, 0, V4L2_DV_HSYNC_POS_POL, \
+ 317000000, 48, 32, 80, 3, 6, 62, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
+ V4L2_DV_FL_REDUCED_BLANKING } \
+}
+
+#define V4L2_DV_BT_DMT_1920X1440P60 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1920, 1440, 0, V4L2_DV_VSYNC_POS_POL, \
+ 234000000, 128, 208, 344, 1, 3, 56, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1920X1440P75 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1920, 1440, 0, V4L2_DV_VSYNC_POS_POL, \
+ 297000000, 144, 224, 352, 1, 3, 56, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1920X1440P120_RB { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1920, 1440, 0, V4L2_DV_HSYNC_POS_POL, \
+ 380500000, 48, 32, 80, 3, 4, 78, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
+ V4L2_DV_FL_REDUCED_BLANKING } \
+}
+
+/* WQXGA resolutions */
+#define V4L2_DV_BT_DMT_2560X1600P60_RB { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 2560, 1600, 0, V4L2_DV_HSYNC_POS_POL, \
+ 268500000, 48, 32, 80, 3, 6, 37, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
+ V4L2_DV_FL_REDUCED_BLANKING } \
+}
+
+#define V4L2_DV_BT_DMT_2560X1600P60 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 2560, 1600, 0, V4L2_DV_VSYNC_POS_POL, \
+ 348500000, 192, 280, 472, 3, 6, 49, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_2560X1600P75 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 2560, 1600, 0, V4L2_DV_VSYNC_POS_POL, \
+ 443250000, 208, 280, 488, 3, 6, 63, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_2560X1600P85 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 2560, 1600, 0, V4L2_DV_VSYNC_POS_POL, \
+ 505250000, 208, 280, 488, 3, 6, 73, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_2560X1600P120_RB { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 2560, 1600, 0, V4L2_DV_HSYNC_POS_POL, \
+ 552750000, 48, 32, 80, 3, 6, 85, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
+ V4L2_DV_FL_REDUCED_BLANKING } \
+}
+
+#define V4L2_DV_BT_DMT_1366X768P60 { \
+ .type = V4L2_DV_BT_656_1120, \
+ .bt = { 1366, 768, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
+ 85500000, 70, 143, 213, 3, 3, 24, 0, 0, 0, \
+ V4L2_DV_BT_STD_DMT, 0 } \
+}
+
+#define V4L2_DV_BT_DMT_1920X1080P60 V4L2_DV_BT_CEA_1920X1080P60
+
+#endif
--
1.7.8.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [RFCv1 PATCH 4/6] V4L2 spec: document the new V4L2 DV timings ioctls.
2012-02-03 10:06 ` [RFCv1 PATCH 1/6] videodev2.h: add enum/query/cap dv_timings ioctls Hans Verkuil
2012-02-03 10:06 ` [RFCv1 PATCH 2/6] v4l2 framework: add support for the new " Hans Verkuil
2012-02-03 10:06 ` [RFCv1 PATCH 3/6] v4l2-dv-timings.h: definitions for CEA-861 and VESA DMT timings Hans Verkuil
@ 2012-02-03 10:06 ` Hans Verkuil
2012-02-28 11:01 ` Mauro Carvalho Chehab
2012-02-03 10:06 ` [RFCv1 PATCH 5/6] v4l2-common: add new support functions to match DV timings Hans Verkuil
` (2 subsequent siblings)
5 siblings, 1 reply; 18+ messages in thread
From: Hans Verkuil @ 2012-02-03 10:06 UTC (permalink / raw)
To: linux-media; +Cc: Mauro Carvalho Chehab, Hans Verkuil
From: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
Documentation/DocBook/media/v4l/v4l2.xml | 3 +
.../DocBook/media/v4l/vidioc-dv-timings-cap.xml | 205 ++++++++++++++++++++
.../DocBook/media/v4l/vidioc-enum-dv-timings.xml | 113 +++++++++++
.../DocBook/media/v4l/vidioc-g-dv-timings.xml | 120 +++++++++++-
.../DocBook/media/v4l/vidioc-query-dv-timings.xml | 98 ++++++++++
5 files changed, 531 insertions(+), 8 deletions(-)
create mode 100644 Documentation/DocBook/media/v4l/vidioc-dv-timings-cap.xml
create mode 100644 Documentation/DocBook/media/v4l/vidioc-enum-dv-timings.xml
create mode 100644 Documentation/DocBook/media/v4l/vidioc-query-dv-timings.xml
diff --git a/Documentation/DocBook/media/v4l/v4l2.xml b/Documentation/DocBook/media/v4l/v4l2.xml
index dce3fef..8bc2ccd 100644
--- a/Documentation/DocBook/media/v4l/v4l2.xml
+++ b/Documentation/DocBook/media/v4l/v4l2.xml
@@ -481,10 +481,12 @@ and discussions on the V4L mailing list.</revremark>
&sub-dbg-g-chip-ident;
&sub-dbg-g-register;
&sub-dqevent;
+ &sub-dv-timings-cap;
&sub-encoder-cmd;
&sub-enumaudio;
&sub-enumaudioout;
&sub-enum-dv-presets;
+ &sub-enum-dv-timings;
&sub-enum-fmt;
&sub-enum-framesizes;
&sub-enum-frameintervals;
@@ -519,6 +521,7 @@ and discussions on the V4L mailing list.</revremark>
&sub-querycap;
&sub-queryctrl;
&sub-query-dv-preset;
+ &sub-query-dv-timings;
&sub-querystd;
&sub-prepare-buf;
&sub-reqbufs;
diff --git a/Documentation/DocBook/media/v4l/vidioc-dv-timings-cap.xml b/Documentation/DocBook/media/v4l/vidioc-dv-timings-cap.xml
new file mode 100644
index 0000000..0477de1
--- /dev/null
+++ b/Documentation/DocBook/media/v4l/vidioc-dv-timings-cap.xml
@@ -0,0 +1,205 @@
+<refentry id="vidioc-dv-timings-cap">
+ <refmeta>
+ <refentrytitle>ioctl VIDIOC_DV_TIMINGS_CAP</refentrytitle>
+ &manvol;
+ </refmeta>
+
+ <refnamediv>
+ <refname>VIDIOC_DV_TIMINGS_CAP</refname>
+ <refpurpose>The capabilities of the Digital Video receiver/transmitter</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>int <function>ioctl</function></funcdef>
+ <paramdef>int <parameter>fd</parameter></paramdef>
+ <paramdef>int <parameter>request</parameter></paramdef>
+ <paramdef>struct v4l2_dv_timings_cap *<parameter>argp</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>Arguments</title>
+
+ <variablelist>
+ <varlistentry>
+ <term><parameter>fd</parameter></term>
+ <listitem>
+ <para>&fd;</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><parameter>request</parameter></term>
+ <listitem>
+ <para>VIDIOC_DV_TIMINGS_CAP</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><parameter>argp</parameter></term>
+ <listitem>
+ <para></para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect1>
+
+ <refsect1>
+ <title>Description</title>
+
+ <para>To query the available timings, applications initialize the
+<structfield>index</structfield> field and zero the reserved array of &v4l2-dv-timings-cap;
+and call the <constant>VIDIOC_DV_TIMINGS_CAP</constant> ioctl with a pointer to this
+structure. Drivers fill the rest of the structure or return an
+&EINVAL; when the index is out of bounds. To enumerate all supported DV timings,
+applications shall begin at index zero, incrementing by one until the
+driver returns <errorcode>EINVAL</errorcode>. Note that drivers may enumerate a
+different set of DV timings after switching the video input or
+output.</para>
+
+ <table pgwide="1" frame="none" id="v4l2-bt-timings-cap">
+ <title>struct <structname>v4l2_bt_timings_cap</structname></title>
+ <tgroup cols="3">
+ &cs-str;
+ <tbody valign="top">
+ <row>
+ <entry>__u32</entry>
+ <entry><structfield>min_width</structfield></entry>
+ <entry>Minimum width of the active video in pixels.</entry>
+ </row>
+ <row>
+ <entry>__u32</entry>
+ <entry><structfield>max_width</structfield></entry>
+ <entry>Maximum width of the active video in pixels.</entry>
+ </row>
+ <row>
+ <entry>__u32</entry>
+ <entry><structfield>min_height</structfield></entry>
+ <entry>Minimum height of the active video in lines.</entry>
+ </row>
+ <row>
+ <entry>__u32</entry>
+ <entry><structfield>max_height</structfield></entry>
+ <entry>Maximum height of the active video in lines.</entry>
+ </row>
+ <row>
+ <entry>__u64</entry>
+ <entry><structfield>min_pixelclock</structfield></entry>
+ <entry>Minimum pixelclock frequency in Hz.</entry>
+ </row>
+ <row>
+ <entry>__u64</entry>
+ <entry><structfield>max_pixelclock</structfield></entry>
+ <entry>Maximum pixelclock frequency in Hz.</entry>
+ </row>
+ <row>
+ <entry>__u32</entry>
+ <entry><structfield>standards</structfield></entry>
+ <entry>The video standard(s) supported by the hardware.
+ See <xref linkend="dv-bt-standards"/> for a list of standards.</entry>
+ </row>
+ <row>
+ <entry>__u32</entry>
+ <entry><structfield>capabilities</structfield></entry>
+ <entry>Several flags giving more information about the capabilities.
+ See <xref linkend="dv-bt-cap-capabilities"/> for a description of the flags.
+ </entry>
+ </row>
+ <row>
+ <entry>__u32</entry>
+ <entry><structfield>reserved</structfield>[16]</entry>
+ <entry></entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <table pgwide="1" frame="none" id="v4l2-dv-timings-cap">
+ <title>struct <structname>v4l2_dv_timings_cap</structname></title>
+ <tgroup cols="4">
+ &cs-str;
+ <tbody valign="top">
+ <row>
+ <entry>__u32</entry>
+ <entry><structfield>type</structfield></entry>
+ <entry>Type of DV timings as listed in <xref linkend="dv-timing-types"/>.</entry>
+ </row>
+ <row>
+ <entry>__u32</entry>
+ <entry><structfield>reserved</structfield>[3]</entry>
+ <entry>Reserved for future extensions. Drivers must set the array to zero.</entry>
+ </row>
+ <row>
+ <entry>union</entry>
+ <entry><structfield></structfield></entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry></entry>
+ <entry>&v4l2-bt-timings-cap;</entry>
+ <entry><structfield>bt</structfield></entry>
+ <entry>BT.656/1120 timings capabilities of the hardware.</entry>
+ </row>
+ <row>
+ <entry></entry>
+ <entry>__u32</entry>
+ <entry><structfield>raw_data</structfield>[32]</entry>
+ <entry></entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <table pgwide="1" frame="none" id="dv-bt-cap-capabilities">
+ <title>DV BT Timing capabilities</title>
+ <tgroup cols="2">
+ &cs-str;
+ <tbody valign="top">
+ <row>
+ <entry>Flag</entry>
+ <entry>Description</entry>
+ </row>
+ <row>
+ <entry></entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry>V4L2_DV_BT_CAP_INTERLACED</entry>
+ <entry>Interlaced formats are supported.
+ </entry>
+ </row>
+ <row>
+ <entry>V4L2_DV_BT_CAP_PROGRESSIVE</entry>
+ <entry>Progressive formats are supported.
+ </entry>
+ </row>
+ <row>
+ <entry>V4L2_DV_BT_CAP_REDUCED_BLANKING</entry>
+ <entry>CVT/GTF specific: the timings can make use of reduced blanking (CVT)
+or the 'Secondary GTF' curve (GTF).
+ </entry>
+ </row>
+ <row>
+ <entry>V4L2_DV_BT_CAP_CUSTOM</entry>
+ <entry>Can support non-standard timings, i.e. timings not belonging to the
+standards set in the <structfield>standards</structfield> field.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </refsect1>
+
+ <refsect1>
+ &return-value;
+ </refsect1>
+</refentry>
+
+<!--
+Local Variables:
+mode: sgml
+sgml-parent-document: "v4l2.sgml"
+indent-tabs-mode: nil
+End:
+-->
diff --git a/Documentation/DocBook/media/v4l/vidioc-enum-dv-timings.xml b/Documentation/DocBook/media/v4l/vidioc-enum-dv-timings.xml
new file mode 100644
index 0000000..edd6964
--- /dev/null
+++ b/Documentation/DocBook/media/v4l/vidioc-enum-dv-timings.xml
@@ -0,0 +1,113 @@
+<refentry id="vidioc-enum-dv-timings">
+ <refmeta>
+ <refentrytitle>ioctl VIDIOC_ENUM_DV_TIMINGS</refentrytitle>
+ &manvol;
+ </refmeta>
+
+ <refnamediv>
+ <refname>VIDIOC_ENUM_DV_TIMINGS</refname>
+ <refpurpose>Enumerate supported Digital Video timings</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>int <function>ioctl</function></funcdef>
+ <paramdef>int <parameter>fd</parameter></paramdef>
+ <paramdef>int <parameter>request</parameter></paramdef>
+ <paramdef>struct v4l2_enum_dv_timings *<parameter>argp</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>Arguments</title>
+
+ <variablelist>
+ <varlistentry>
+ <term><parameter>fd</parameter></term>
+ <listitem>
+ <para>&fd;</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><parameter>request</parameter></term>
+ <listitem>
+ <para>VIDIOC_ENUM_DV_TIMINGS</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><parameter>argp</parameter></term>
+ <listitem>
+ <para></para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect1>
+
+ <refsect1>
+ <title>Description</title>
+
+ <para>While some DV receivers or transmitters support a wide range of timings, others
+support only a limited number of timings. With this ioctl applications can enumerate a list
+of known supported timings. Call &VIDIOC-DV-TIMINGS-CAP; to check if it also supports other
+standards or even custom timings that are not in this list.</para>
+
+ <para>To query the available timings, applications initialize the
+<structfield>index</structfield> field and zero the reserved array of &v4l2-enum-dv-timings;
+and call the <constant>VIDIOC_ENUM_DV_TIMINGS</constant> ioctl with a pointer to this
+structure. Drivers fill the rest of the structure or return an
+&EINVAL; when the index is out of bounds. To enumerate all supported DV timings,
+applications shall begin at index zero, incrementing by one until the
+driver returns <errorcode>EINVAL</errorcode>. Note that drivers may enumerate a
+different set of DV timings after switching the video input or
+output.</para>
+
+ <table pgwide="1" frame="none" id="v4l2-enum-dv-timings">
+ <title>struct <structname>v4l2_enum_dv_timings</structname></title>
+ <tgroup cols="3">
+ &cs-str;
+ <tbody valign="top">
+ <row>
+ <entry>__u32</entry>
+ <entry><structfield>index</structfield></entry>
+ <entry>Number of the DV timings, set by the
+application.</entry>
+ </row>
+ <row>
+ <entry>__u32</entry>
+ <entry><structfield>reserved</structfield>[3]</entry>
+ <entry>Reserved for future extensions. Drivers must set the array to zero.</entry>
+ </row>
+ <row>
+ <entry>&v4l2-dv-timings;</entry>
+ <entry><structfield>timings</structfield></entry>
+ <entry>The timings.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </refsect1>
+
+ <refsect1>
+ &return-value;
+
+ <variablelist>
+ <varlistentry>
+ <term><errorcode>EINVAL</errorcode></term>
+ <listitem>
+ <para>The &v4l2-enum-dv-timings; <structfield>index</structfield>
+is out of bounds.</para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect1>
+</refentry>
+
+<!--
+Local Variables:
+mode: sgml
+sgml-parent-document: "v4l2.sgml"
+indent-tabs-mode: nil
+End:
+-->
diff --git a/Documentation/DocBook/media/v4l/vidioc-g-dv-timings.xml b/Documentation/DocBook/media/v4l/vidioc-g-dv-timings.xml
index 4a8648a..bffd26c 100644
--- a/Documentation/DocBook/media/v4l/vidioc-g-dv-timings.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-g-dv-timings.xml
@@ -83,12 +83,13 @@ or the timing values are not correct, the driver returns &EINVAL;.</para>
<row>
<entry>__u32</entry>
<entry><structfield>width</structfield></entry>
- <entry>Width of the active video in pixels</entry>
+ <entry>Width of the active video in pixels.</entry>
</row>
<row>
<entry>__u32</entry>
<entry><structfield>height</structfield></entry>
- <entry>Height of the active video in lines</entry>
+ <entry>Height of the active video frame in lines. So for interlaced formats the
+ height of the active video in each field is <structfield>height</structfield>/2.</entry>
</row>
<row>
<entry>__u32</entry>
@@ -125,32 +126,52 @@ bit 0 (V4L2_DV_VSYNC_POS_POL) is for vertical sync polarity and bit 1 (V4L2_DV_H
<row>
<entry>__u32</entry>
<entry><structfield>vfrontporch</structfield></entry>
- <entry>Vertical front porch in lines</entry>
+ <entry>Vertical front porch in lines. For interlaced formats this refers to the
+ odd field (aka field 1).</entry>
</row>
<row>
<entry>__u32</entry>
<entry><structfield>vsync</structfield></entry>
- <entry>Vertical sync length in lines</entry>
+ <entry>Vertical sync length in lines. For interlaced formats this refers to the
+ odd field (aka field 1).</entry>
</row>
<row>
<entry>__u32</entry>
<entry><structfield>vbackporch</structfield></entry>
- <entry>Vertical back porch in lines</entry>
+ <entry>Vertical back porch in lines. For interlaced formats this refers to the
+ odd field (aka field 1).</entry>
</row>
<row>
<entry>__u32</entry>
<entry><structfield>il_vfrontporch</structfield></entry>
- <entry>Vertical front porch in lines for bottom field of interlaced field formats</entry>
+ <entry>Vertical front porch in lines for the even field (aka field 2) of
+ interlaced field formats.</entry>
</row>
<row>
<entry>__u32</entry>
<entry><structfield>il_vsync</structfield></entry>
- <entry>Vertical sync length in lines for bottom field of interlaced field formats</entry>
+ <entry>Vertical sync length in lines for the even field (aka field 2) of
+ interlaced field formats.</entry>
</row>
<row>
<entry>__u32</entry>
<entry><structfield>il_vbackporch</structfield></entry>
- <entry>Vertical back porch in lines for bottom field of interlaced field formats</entry>
+ <entry>Vertical back porch in lines for the even field (aka field 2) of
+ interlaced field formats.</entry>
+ </row>
+ <row>
+ <entry>__u32</entry>
+ <entry><structfield>standards</structfield></entry>
+ <entry>The video standard(s) this format belongs to. This will be filled in by
+ the driver. Applications must set this to 0. See <xref linkend="dv-bt-standards"/>
+ for a list of standards.</entry>
+ </row>
+ <row>
+ <entry>__u32</entry>
+ <entry><structfield>flags</structfield></entry>
+ <entry>Several flags giving more information about the format.
+ See <xref linkend="dv-bt-flags"/> for a description of the flags.
+ </entry>
</row>
</tbody>
</tgroup>
@@ -211,6 +232,89 @@ bit 0 (V4L2_DV_VSYNC_POS_POL) is for vertical sync polarity and bit 1 (V4L2_DV_H
</tbody>
</tgroup>
</table>
+ <table pgwide="1" frame="none" id="dv-bt-standards">
+ <title>DV BT Timing standards</title>
+ <tgroup cols="2">
+ &cs-str;
+ <tbody valign="top">
+ <row>
+ <entry>Timing standard</entry>
+ <entry>Description</entry>
+ </row>
+ <row>
+ <entry></entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry>V4L2_DV_BT_STD_CEA861</entry>
+ <entry>The timings follow the CEA-861 Digital TV Profile standard</entry>
+ </row>
+ <row>
+ <entry>V4L2_DV_BT_STD_DMT</entry>
+ <entry>The timings follow the VESA Discrete Monitor Timings standard</entry>
+ </row>
+ <row>
+ <entry>V4L2_DV_BT_STD_CVT</entry>
+ <entry>The timings follow the VESA Coordinated Video Timings standard</entry>
+ </row>
+ <row>
+ <entry>V4L2_DV_BT_STD_GTF</entry>
+ <entry>The timings follow the VESA Generalized Timings Formula standard</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <table pgwide="1" frame="none" id="dv-bt-flags">
+ <title>DV BT Timing flags</title>
+ <tgroup cols="2">
+ &cs-str;
+ <tbody valign="top">
+ <row>
+ <entry>Flag</entry>
+ <entry>Description</entry>
+ </row>
+ <row>
+ <entry></entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry>V4L2_DV_FL_REDUCED_BLANKING</entry>
+ <entry>CVT/GTF specific: the timings use reduced blanking (CVT) or the 'Secondary
+GTF' curve (GTF). In both cases the horizontal and/or vertical blanking
+intervals are reduced, allowing a higher resolution over the same
+bandwidth. This is a read-only flag, applications must not set this.
+ </entry>
+ </row>
+ <row>
+ <entry>V4L2_DV_FL_NTSC_COMPATIBLE</entry>
+ <entry>CEA-861 specific: set for CEA-861 formats with a framerate of a multiple
+of six. These formats can be optionally played at 1 / 1.001 speed to
+be compatible with the normal NTSC framerate of 29.97 frames per second.
+This is a read-only flag, applications must not set this.
+ </entry>
+ </row>
+ <row>
+ <entry>V4L2_DV_FL_DIVIDE_CLOCK_BY_1_001</entry>
+ <entry>CEA-861 specific: only valid for video transmitters, the flag is cleared
+by receivers. It is also only valid for formats with the V4L2_DV_FL_NTSC_COMPATIBLE flag
+set, for other formats the flag will be cleared by the driver.
+
+If the application sets this flag, then the pixelclock used to set up the transmitter is
+divided by 1.001 to make it compatible with NTSC framerates. If the transmitter
+can't generate such frequencies, then the flag will also be cleared.
+ </entry>
+ </row>
+ <row>
+ <entry>V4L2_DV_FL_HALF_LINE</entry>
+ <entry>Specific to interlaced formats: if set, then field 1 (aka the odd field)
+is really one half-line longer and field 2 (aka the even field) is really one half-line
+shorter, so each field has exactly the same number of half-lines. Whether half-lines can be
+detected or used depends on the hardware.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
</refsect1>
<refsect1>
&return-value;
diff --git a/Documentation/DocBook/media/v4l/vidioc-query-dv-timings.xml b/Documentation/DocBook/media/v4l/vidioc-query-dv-timings.xml
new file mode 100644
index 0000000..9d7ac43
--- /dev/null
+++ b/Documentation/DocBook/media/v4l/vidioc-query-dv-timings.xml
@@ -0,0 +1,98 @@
+<refentry id="vidioc-query-dv-timings">
+ <refmeta>
+ <refentrytitle>ioctl VIDIOC_QUERY_DV_TIMINGS</refentrytitle>
+ &manvol;
+ </refmeta>
+
+ <refnamediv>
+ <refname>VIDIOC_QUERY_DV_TIMINGS</refname>
+ <refpurpose>Sense the DV preset received by the current
+input</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>int <function>ioctl</function></funcdef>
+ <paramdef>int <parameter>fd</parameter></paramdef>
+ <paramdef>int <parameter>request</parameter></paramdef>
+ <paramdef>struct v4l2_dv_timings *<parameter>argp</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>Arguments</title>
+
+ <variablelist>
+ <varlistentry>
+ <term><parameter>fd</parameter></term>
+ <listitem>
+ <para>&fd;</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><parameter>request</parameter></term>
+ <listitem>
+ <para>VIDIOC_QUERY_DV_TIMINGS</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><parameter>argp</parameter></term>
+ <listitem>
+ <para></para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect1>
+
+ <refsect1>
+ <title>Description</title>
+
+ <para>The hardware may be able to detect the current DV timings
+automatically, similar to sensing the video standard. To do so, applications
+call <constant>VIDIOC_QUERY_DV_TIMINGS</constant> with a pointer to a
+&v4l2-dv-timings;. Once the hardware detects the timings, it will fill in the
+timings structure.
+
+If the timings could not be detected because there was no signal, then
+<errorcode>ENOLINK</errorcode> is returned. If a signal was detected, but
+it was unstable and the receiver could not lock to the signal, then
+<errorcode>ENOLCK</errorcode> is returned. If the receiver could lock to the signal,
+but the format is unsupported (e.g. because the pixelclock is out of range
+of the hardware capabilities), then the driver fills in whatever timings it
+could find and returns <errorcode>ERANGE</errorcode>. In that case the application
+can call &VIDIOC-DV-TIMINGS-CAP; to compare the found timings with the hardware's
+capabilities in order to give more precise feedback to the user.
+</para>
+ </refsect1>
+
+ <refsect1>
+ &return-value;
+
+ <variablelist>
+ <varlistentry>
+ <term><errorcode>ENOLINK</errorcode></term>
+ <listitem>
+ <para>No timings could be detected because no signal was found.
+</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><errorcode>ENOLCK</errorcode></term>
+ <listitem>
+ <para>The signal was unstable and the hardware could not lock on to it.
+</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><errorcode>ERANGE</errorcode></term>
+ <listitem>
+ <para>Timings were found, but they are out of range of the hardware
+capabilities.
+</para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect1>
+</refentry>
--
1.7.8.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [RFCv1 PATCH 5/6] v4l2-common: add new support functions to match DV timings.
2012-02-03 10:06 ` [RFCv1 PATCH 1/6] videodev2.h: add enum/query/cap dv_timings ioctls Hans Verkuil
` (2 preceding siblings ...)
2012-02-03 10:06 ` [RFCv1 PATCH 4/6] V4L2 spec: document the new V4L2 DV timings ioctls Hans Verkuil
@ 2012-02-03 10:06 ` Hans Verkuil
2012-02-28 11:03 ` Mauro Carvalho Chehab
2012-02-03 10:06 ` [RFCv1 PATCH 6/6] tvp7002: add support for the new dv timings API Hans Verkuil
2012-02-28 10:54 ` [RFCv1 PATCH 1/6] videodev2.h: add enum/query/cap dv_timings ioctls Mauro Carvalho Chehab
5 siblings, 1 reply; 18+ messages in thread
From: Hans Verkuil @ 2012-02-03 10:06 UTC (permalink / raw)
To: linux-media; +Cc: Mauro Carvalho Chehab, Hans Verkuil
From: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
drivers/media/video/v4l2-common.c | 102 ++++++++++++++++++++++++++++++-------
include/media/v4l2-common.h | 15 +++++
2 files changed, 99 insertions(+), 18 deletions(-)
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index 5c6100f..f133961 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -567,24 +567,24 @@ int v4l_fill_dv_preset_info(u32 preset, struct v4l2_dv_enum_preset *info)
const char *name;
} dv_presets[] = {
{ 0, 0, "Invalid" }, /* V4L2_DV_INVALID */
- { 720, 480, "480p@59.94" }, /* V4L2_DV_480P59_94 */
- { 720, 576, "576p@50" }, /* V4L2_DV_576P50 */
- { 1280, 720, "720p@24" }, /* V4L2_DV_720P24 */
- { 1280, 720, "720p@25" }, /* V4L2_DV_720P25 */
- { 1280, 720, "720p@30" }, /* V4L2_DV_720P30 */
- { 1280, 720, "720p@50" }, /* V4L2_DV_720P50 */
- { 1280, 720, "720p@59.94" }, /* V4L2_DV_720P59_94 */
- { 1280, 720, "720p@60" }, /* V4L2_DV_720P60 */
- { 1920, 1080, "1080i@29.97" }, /* V4L2_DV_1080I29_97 */
- { 1920, 1080, "1080i@30" }, /* V4L2_DV_1080I30 */
- { 1920, 1080, "1080i@25" }, /* V4L2_DV_1080I25 */
- { 1920, 1080, "1080i@50" }, /* V4L2_DV_1080I50 */
- { 1920, 1080, "1080i@60" }, /* V4L2_DV_1080I60 */
- { 1920, 1080, "1080p@24" }, /* V4L2_DV_1080P24 */
- { 1920, 1080, "1080p@25" }, /* V4L2_DV_1080P25 */
- { 1920, 1080, "1080p@30" }, /* V4L2_DV_1080P30 */
- { 1920, 1080, "1080p@50" }, /* V4L2_DV_1080P50 */
- { 1920, 1080, "1080p@60" }, /* V4L2_DV_1080P60 */
+ { 720, 480, "720x480p59.94" }, /* V4L2_DV_480P59_94 */
+ { 720, 576, "720x576p50" }, /* V4L2_DV_576P50 */
+ { 1280, 720, "1280x720p24" }, /* V4L2_DV_720P24 */
+ { 1280, 720, "1280x720p25" }, /* V4L2_DV_720P25 */
+ { 1280, 720, "1280x720p30" }, /* V4L2_DV_720P30 */
+ { 1280, 720, "1280x720p50" }, /* V4L2_DV_720P50 */
+ { 1280, 720, "1280x720p59.94" },/* V4L2_DV_720P59_94 */
+ { 1280, 720, "1280x720p60" }, /* V4L2_DV_720P60 */
+ { 0, 0, "Invalid" }, /* V4L2_DV_1080I29_97 */
+ { 0, 0, "Invalid" }, /* V4L2_DV_1080I30 */
+ { 0, 0, "Invalid" }, /* V4L2_DV_1080I25 */
+ { 1920, 1080, "1920x1080i50" }, /* V4L2_DV_1080I50 */
+ { 1920, 1080, "1920x1080i60" }, /* V4L2_DV_1080I60 */
+ { 1920, 1080, "1920x1080p24" }, /* V4L2_DV_1080P24 */
+ { 1920, 1080, "1920x1080p25" }, /* V4L2_DV_1080P25 */
+ { 1920, 1080, "1920x1080p30" }, /* V4L2_DV_1080P30 */
+ { 1920, 1080, "1920x1080p50" }, /* V4L2_DV_1080P50 */
+ { 1920, 1080, "1920x1080p60" }, /* V4L2_DV_1080P60 */
};
if (info == NULL || preset >= ARRAY_SIZE(dv_presets))
@@ -598,6 +598,72 @@ int v4l_fill_dv_preset_info(u32 preset, struct v4l2_dv_enum_preset *info)
}
EXPORT_SYMBOL_GPL(v4l_fill_dv_preset_info);
+bool v4l_match_dv_timings(const struct v4l2_dv_timings *t1,
+ const struct v4l2_dv_timings *t2)
+{
+ if (t1->type != t2->type || t1->type != V4L2_DV_BT_656_1120)
+ return false;
+ return !memcmp(&t1->bt, &t2->bt, &t1->bt.standards - &t1->bt.width);
+}
+EXPORT_SYMBOL_GPL(v4l_match_dv_timings);
+
+bool v4l_match_dv_timings_fuzzy(const struct v4l2_dv_timings *t1,
+ const struct v4l2_dv_timings *t2,
+ u32 clock_resolution, u32 flags)
+{
+ const struct v4l2_bt_timings *bt1, *bt2;
+ unsigned v_blank1, v_blank2;
+ u32 clock_diff;
+
+ if (t1->type != t2->type || t1->type != V4L2_DV_BT_656_1120)
+ return false;
+ bt1 = &t1->bt;
+ bt2 = &t2->bt;
+ if (bt1->interlaced != bt2->interlaced)
+ return false;
+ v_blank1 = bt1->vfrontporch + bt1->vsync + bt1->vbackporch +
+ bt1->il_vfrontporch + bt1->il_vsync + bt1->il_vbackporch;
+ v_blank2 = bt2->vfrontporch + bt2->vsync + bt2->vbackporch +
+ bt2->il_vfrontporch + bt2->il_vsync + bt2->il_vbackporch;
+ if (bt1->height != bt2->height)
+ return false;
+ if ((flags & V4L_MATCH_BT_HAVE_ACTIVE_HEIGHT) &&
+ v_blank1 != v_blank2)
+ return false;
+ if ((flags & V4L_MATCH_BT_HAVE_V_POL) &&
+ (bt1->polarities & V4L2_DV_VSYNC_POS_POL) !=
+ (bt2->polarities & V4L2_DV_VSYNC_POS_POL))
+ return false;
+ if ((flags & V4L_MATCH_BT_HAVE_H_POL) &&
+ (bt1->polarities & V4L2_DV_HSYNC_POS_POL) !=
+ (bt2->polarities & V4L2_DV_HSYNC_POS_POL))
+ return false;
+ if ((flags & V4L_MATCH_BT_HAVE_VSYNC) &&
+ bt1->vsync != bt2->vsync)
+ return false;
+ if ((flags & V4L_MATCH_BT_HAVE_HSYNC) &&
+ bt1->hsync != bt2->hsync)
+ return false;
+ if (flags & V4L_MATCH_BT_HAVE_WIDTH) {
+ unsigned h_blank1 = bt1->hfrontporch + bt1->hsync +
+ bt1->hbackporch;
+ unsigned h_blank2 = bt2->hfrontporch + bt2->hsync +
+ bt2->hbackporch;
+
+ if (bt1->width != bt2->width)
+ return false;
+ if ((flags & V4L_MATCH_BT_HAVE_ACTIVE_WIDTH) &&
+ h_blank1 != h_blank2)
+ return false;
+ }
+ if (bt1->pixelclock > bt2->pixelclock)
+ clock_diff = bt1->pixelclock - bt2->pixelclock;
+ else
+ clock_diff = bt2->pixelclock - bt1->pixelclock;
+ return clock_diff < clock_resolution;
+}
+EXPORT_SYMBOL_GPL(v4l_match_dv_timings_fuzzy);
+
const struct v4l2_frmsize_discrete *v4l2_find_nearest_format(
const struct v4l2_discrete_probe *probe,
s32 width, s32 height)
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index a298ec4..4469696 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -202,6 +202,21 @@ void v4l_bound_align_image(unsigned int *w, unsigned int wmin,
unsigned int hmax, unsigned int halign,
unsigned int salign);
int v4l_fill_dv_preset_info(u32 preset, struct v4l2_dv_enum_preset *info);
+bool v4l_match_dv_timings(const struct v4l2_dv_timings *t1,
+ const struct v4l2_dv_timings *t2);
+
+#define V4L_MATCH_BT_HAVE_WIDTH (1 << 0)
+#define V4L_MATCH_BT_HAVE_ACTIVE_HEIGHT (1 << 1)
+#define V4L_MATCH_BT_HAVE_ACTIVE_WIDTH (1 << 2)
+#define V4L_MATCH_BT_HAVE_V_POL (1 << 3)
+#define V4L_MATCH_BT_HAVE_H_POL (1 << 4)
+#define V4L_MATCH_BT_HAVE_VSYNC (1 << 5)
+#define V4L_MATCH_BT_HAVE_HSYNC (1 << 6)
+
+bool v4l_match_dv_timings_fuzzy(const struct v4l2_dv_timings *t1,
+ const struct v4l2_dv_timings *t2,
+ u32 clock_resolution,
+ u32 flags);
struct v4l2_discrete_probe {
const struct v4l2_frmsize_discrete *sizes;
--
1.7.8.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [RFCv1 PATCH 6/6] tvp7002: add support for the new dv timings API.
2012-02-03 10:06 ` [RFCv1 PATCH 1/6] videodev2.h: add enum/query/cap dv_timings ioctls Hans Verkuil
` (3 preceding siblings ...)
2012-02-03 10:06 ` [RFCv1 PATCH 5/6] v4l2-common: add new support functions to match DV timings Hans Verkuil
@ 2012-02-03 10:06 ` Hans Verkuil
2012-02-28 10:54 ` [RFCv1 PATCH 1/6] videodev2.h: add enum/query/cap dv_timings ioctls Mauro Carvalho Chehab
5 siblings, 0 replies; 18+ messages in thread
From: Hans Verkuil @ 2012-02-03 10:06 UTC (permalink / raw)
To: linux-media; +Cc: Mauro Carvalho Chehab, Hans Verkuil
From: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
drivers/media/video/tvp7002.c | 102 +++++++++++++++++++++++++++++++++++-----
1 files changed, 89 insertions(+), 13 deletions(-)
diff --git a/drivers/media/video/tvp7002.c b/drivers/media/video/tvp7002.c
index 236c559..f658ef3 100644
--- a/drivers/media/video/tvp7002.c
+++ b/drivers/media/video/tvp7002.c
@@ -29,6 +29,7 @@
#include <linux/slab.h>
#include <linux/videodev2.h>
#include <linux/module.h>
+#include <linux/v4l2-dv-timings.h>
#include <media/tvp7002.h>
#include <media/v4l2-device.h>
#include <media/v4l2-chip-ident.h>
@@ -328,6 +329,7 @@ static const struct i2c_reg_value tvp7002_parms_720P50[] = {
/* Preset definition for handling device operation */
struct tvp7002_preset_definition {
u32 preset;
+ struct v4l2_dv_timings timings;
const struct i2c_reg_value *p_settings;
enum v4l2_colorspace color_space;
enum v4l2_field scanmode;
@@ -341,6 +343,7 @@ struct tvp7002_preset_definition {
static const struct tvp7002_preset_definition tvp7002_presets[] = {
{
V4L2_DV_720P60,
+ V4L2_DV_BT_CEA_1280X720P60,
tvp7002_parms_720P60,
V4L2_COLORSPACE_REC709,
V4L2_FIELD_NONE,
@@ -351,6 +354,7 @@ static const struct tvp7002_preset_definition tvp7002_presets[] = {
},
{
V4L2_DV_1080I60,
+ V4L2_DV_BT_CEA_1920X1080I60,
tvp7002_parms_1080I60,
V4L2_COLORSPACE_REC709,
V4L2_FIELD_INTERLACED,
@@ -361,6 +365,7 @@ static const struct tvp7002_preset_definition tvp7002_presets[] = {
},
{
V4L2_DV_1080I50,
+ V4L2_DV_BT_CEA_1920X1080I50,
tvp7002_parms_1080I50,
V4L2_COLORSPACE_REC709,
V4L2_FIELD_INTERLACED,
@@ -371,6 +376,7 @@ static const struct tvp7002_preset_definition tvp7002_presets[] = {
},
{
V4L2_DV_720P50,
+ V4L2_DV_BT_CEA_1280X720P50,
tvp7002_parms_720P50,
V4L2_COLORSPACE_REC709,
V4L2_FIELD_NONE,
@@ -381,6 +387,7 @@ static const struct tvp7002_preset_definition tvp7002_presets[] = {
},
{
V4L2_DV_1080P60,
+ V4L2_DV_BT_CEA_1920X1080P60,
tvp7002_parms_1080P60,
V4L2_COLORSPACE_REC709,
V4L2_FIELD_NONE,
@@ -391,6 +398,7 @@ static const struct tvp7002_preset_definition tvp7002_presets[] = {
},
{
V4L2_DV_480P59_94,
+ V4L2_DV_BT_CEA_720X480P59_94,
tvp7002_parms_480P,
V4L2_COLORSPACE_SMPTE170M,
V4L2_FIELD_NONE,
@@ -401,6 +409,7 @@ static const struct tvp7002_preset_definition tvp7002_presets[] = {
},
{
V4L2_DV_576P50,
+ V4L2_DV_BT_CEA_720X576P50,
tvp7002_parms_576P,
V4L2_COLORSPACE_SMPTE170M,
V4L2_FIELD_NONE,
@@ -605,6 +614,35 @@ static int tvp7002_s_dv_preset(struct v4l2_subdev *sd,
return -EINVAL;
}
+static int tvp7002_s_dv_timings(struct v4l2_subdev *sd,
+ struct v4l2_dv_timings *dv_timings)
+{
+ struct tvp7002 *device = to_tvp7002(sd);
+ const struct v4l2_bt_timings *bt = &dv_timings->bt;
+ int i;
+
+ if (dv_timings->type != V4L2_DV_BT_656_1120)
+ return -EINVAL;
+ for (i = 0; i < NUM_PRESETS; i++) {
+ const struct v4l2_bt_timings *t = &tvp7002_presets[i].timings.bt;
+
+ if (!memcmp(bt, t, &bt->standards - &bt->width)) {
+ device->current_preset = &tvp7002_presets[i];
+ return tvp7002_write_inittab(sd, tvp7002_presets[i].p_settings);
+ }
+ }
+ return -EINVAL;
+}
+
+static int tvp7002_g_dv_timings(struct v4l2_subdev *sd,
+ struct v4l2_dv_timings *dv_timings)
+{
+ struct tvp7002 *device = to_tvp7002(sd);
+
+ *dv_timings = device->current_preset->timings;
+ return 0;
+}
+
/*
* tvp7002_s_ctrl() - Set a control
* @ctrl: ptr to v4l2_ctrl struct
@@ -666,8 +704,7 @@ static int tvp7002_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *f
* Returns the current DV preset by TVP7002. If no active input is
* detected, returns -EINVAL
*/
-static int tvp7002_query_dv_preset(struct v4l2_subdev *sd,
- struct v4l2_dv_preset *qpreset)
+static int tvp7002_query_dv(struct v4l2_subdev *sd, int *index)
{
const struct tvp7002_preset_definition *presets = tvp7002_presets;
struct tvp7002 *device;
@@ -679,10 +716,9 @@ static int tvp7002_query_dv_preset(struct v4l2_subdev *sd,
u8 lpf_msb;
u8 cpl_lsb;
u8 cpl_msb;
- int index;
- /* Return invalid preset if no active input is detected */
- qpreset->preset = V4L2_DV_INVALID;
+ /* Return invalid index if no active input is detected */
+ *index = NUM_PRESETS;
device = to_tvp7002(sd);
@@ -705,8 +741,8 @@ static int tvp7002_query_dv_preset(struct v4l2_subdev *sd,
progressive = (lpf_msb & TVP7002_INPR_MASK) >> TVP7002_IP_SHIFT;
/* Do checking of video modes */
- for (index = 0; index < NUM_PRESETS; index++, presets++)
- if (lpfr == presets->lines_per_frame &&
+ for (*index = 0; *index < NUM_PRESETS; (*index)++, presets++)
+ if (lpfr == presets->lines_per_frame &&
progressive == presets->progressive) {
if (presets->cpl_min == 0xffff)
break;
@@ -714,17 +750,42 @@ static int tvp7002_query_dv_preset(struct v4l2_subdev *sd,
break;
}
- if (index == NUM_PRESETS) {
+ if (*index == NUM_PRESETS) {
v4l2_dbg(1, debug, sd, "detection failed: lpf = %x, cpl = %x\n",
lpfr, cpln);
- return 0;
+ return -ENOLINK;
}
- /* Set values in found preset */
- qpreset->preset = presets->preset;
-
/* Update lines per frame and clocks per line info */
- v4l2_dbg(1, debug, sd, "detected preset: %d\n", presets->preset);
+ v4l2_dbg(1, debug, sd, "detected preset: %d\n", *index);
+ return 0;
+}
+
+static int tvp7002_query_dv_preset(struct v4l2_subdev *sd,
+ struct v4l2_dv_preset *qpreset)
+{
+ int index;
+ int err = tvp7002_query_dv(sd, &index);
+
+ if (err || index == NUM_PRESETS) {
+ qpreset->preset = V4L2_DV_INVALID;
+ if (err == -ENOLINK)
+ err = 0;
+ return err;
+ }
+ qpreset->preset = tvp7002_presets[index].preset;
+ return 0;
+}
+
+static int tvp7002_query_dv_timings(struct v4l2_subdev *sd,
+ struct v4l2_dv_timings *timings)
+{
+ int index;
+ int err = tvp7002_query_dv(sd, &index);
+
+ if (err)
+ return err;
+ *timings = tvp7002_presets[index].timings;
return 0;
}
@@ -894,6 +955,17 @@ static int tvp7002_enum_dv_presets(struct v4l2_subdev *sd,
return v4l_fill_dv_preset_info(tvp7002_presets[preset->index].preset, preset);
}
+static int tvp7002_enum_dv_timings(struct v4l2_subdev *sd,
+ struct v4l2_enum_dv_timings *timings)
+{
+ /* Check requested format index is within range */
+ if (timings->index >= NUM_PRESETS)
+ return -EINVAL;
+
+ timings->timings = tvp7002_presets[timings->index].timings;
+ return 0;
+}
+
static const struct v4l2_ctrl_ops tvp7002_ctrl_ops = {
.s_ctrl = tvp7002_s_ctrl,
};
@@ -920,6 +992,10 @@ static const struct v4l2_subdev_video_ops tvp7002_video_ops = {
.enum_dv_presets = tvp7002_enum_dv_presets,
.s_dv_preset = tvp7002_s_dv_preset,
.query_dv_preset = tvp7002_query_dv_preset,
+ .g_dv_timings = tvp7002_g_dv_timings,
+ .s_dv_timings = tvp7002_s_dv_timings,
+ .enum_dv_timings = tvp7002_enum_dv_timings,
+ .query_dv_timings = tvp7002_query_dv_timings,
.s_stream = tvp7002_s_stream,
.g_mbus_fmt = tvp7002_mbus_fmt,
.try_mbus_fmt = tvp7002_mbus_fmt,
--
1.7.8.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [RFCv1 PATCH 0/6] Improved/New timings API
2012-02-03 10:06 [RFCv1 PATCH 0/6] Improved/New timings API Hans Verkuil
2012-02-03 10:06 ` [RFCv1 PATCH 1/6] videodev2.h: add enum/query/cap dv_timings ioctls Hans Verkuil
@ 2012-02-24 9:54 ` Hans Verkuil
2012-02-28 11:13 ` Mauro Carvalho Chehab
1 sibling, 1 reply; 18+ messages in thread
From: Hans Verkuil @ 2012-02-24 9:54 UTC (permalink / raw)
To: linux-media; +Cc: Mauro Carvalho Chehab
On Friday, February 03, 2012 11:06:00 Hans Verkuil wrote:
> Hi all,
>
> This is an implementation of this RFC:
>
> http://www.mail-archive.com/linux-media@vger.kernel.org/msg38168.html
Mauro,
I'd greatly appreciate it if you can review this API.
I've verified that it works well with CVT and GTF timings (the code for that
is in the test-timings branch in the git repo below).
One thing that might change slightly is the description of this flag:
<entry>V4L2_DV_FL_DIVIDE_CLOCK_BY_1_001</entry>
<entry>CEA-861 specific: only valid for video transmitters, the flag is cleared
by receivers. It is also only valid for formats with the V4L2_DV_FL_NTSC_COMPATIBLE flag
set, for other formats the flag will be cleared by the driver.
If the application sets this flag, then the pixelclock used to set up the transmitter is
divided by 1.001 to make it compatible with NTSC framerates. If the transmitter
can't generate such frequencies, then the flag will also be cleared.
</entry>
Currently it is only valid for transmitters, but I've seen newer receivers
that should be able to detect this small difference in pixelclock frequency.
I haven't tested (yet) whether they can actually do this, and it would have
to be considered a hint only since this minute pixelclock difference falls
within the CEA861-defined pixelclock variation. But if they can do this, then
that would be a really nice feature.
Basically I'm looking for a stamp of approval before I continue with this.
If you are OK with it, then I'll make a final version of this patch series,
and start adding this API to all drivers that currently use the preset API.
Once that's done we can deprecate and eventually remove the preset API.
But that's a fair amount of work and I don't want to start on that unless I
know you agree with this API.
Regards,
Hans
>
> The goal is that with these additions the existing DV_PRESET API can be
> removed eventually. It's always painful to admit, but that wasn't the best
> API ever :-)
>
> To my dismay I discovered that some of the preset defines were even impossible:
> there are no interlaced 1920x1080i25/29.97/30 formats.
>
> I have been testing this new code with the adv7604 HDMI receiver as used here:
>
> http://git.linuxtv.org/hverkuil/cisco.git/shortlog/refs/heads/test-timings
>
> This is my development/test branch, so the code is a bit messy.
>
> One problem that I always had with the older proposals is that there was no
> easy way to just select a specific standard (e.g. 720p60). By creating the
> linux/v4l2-dv-timings.h header this is now very easy to do, both for drivers
> and applications.
>
> I also took special care on how to distinguish between e.g. 720p60 and 720p59.94.
> See the documentation for more information.
>
> Note that the QUERY_DV_TIMINGS and DV_TIMINGS_CAP ioctls will be marked
> experimental. Particularly the latter ioctl might well change in the future as
> I do not have enough experience to tell whether DV_TIMINGS_CAP is sufficiently
> detailed.
>
> I would like to get some feedback on this approach, just to make sure I don't
> need to start over.
>
> In the meantime I will be working on code to detect CVT and GTF video timings
> since that is needed to verify that that part works correctly as well.
>
> And once everyone agrees to the API, then I will try and add this API to all
> drivers that currently use the preset API. That way there will be a decent
> path forward to eventually remove the preset API (sooner rather than later
> IMHO).
>
> Regards,
>
> Hans
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFCv1 PATCH 1/6] videodev2.h: add enum/query/cap dv_timings ioctls.
2012-02-03 10:06 ` [RFCv1 PATCH 1/6] videodev2.h: add enum/query/cap dv_timings ioctls Hans Verkuil
` (4 preceding siblings ...)
2012-02-03 10:06 ` [RFCv1 PATCH 6/6] tvp7002: add support for the new dv timings API Hans Verkuil
@ 2012-02-28 10:54 ` Mauro Carvalho Chehab
2012-02-28 11:06 ` Hans Verkuil
5 siblings, 1 reply; 18+ messages in thread
From: Mauro Carvalho Chehab @ 2012-02-28 10:54 UTC (permalink / raw)
To: Hans Verkuil; +Cc: linux-media, Hans Verkuil
Em 03-02-2012 08:06, Hans Verkuil escreveu:
> From: Hans Verkuil <hans.verkuil@cisco.com>
>
> These new ioctls make it possible for the dv_timings API to replace
> the dv_preset API eventually.
>
> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
> ---
> include/linux/videodev2.h | 110 ++++++++++++++++++++++++++++++++++++++++----
> 1 files changed, 100 insertions(+), 10 deletions(-)
>
> diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
> index 0db0503..e59cd02 100644
> --- a/include/linux/videodev2.h
> +++ b/include/linux/videodev2.h
> @@ -987,28 +987,42 @@ struct v4l2_dv_enum_preset {
> */
>
> /* BT.656/BT.1120 timing data */
> +
> +/*
> + * A note regarding vertical interlaced timings: height refers to the total
> + * height of the frame (= two fields). The blanking timings refer
> + * to the blanking of each field. So the height of the active frame is
> + * calculated as follows:
> + *
> + * act_height = height - vfrontporch - vsync - vbackporch -
> + * il_vfrontporch - il_vsync - il_vbackporch
> + *
> + * The active height of each field is act_height / 2.
> + */
> struct v4l2_bt_timings {
> - __u32 width; /* width in pixels */
> - __u32 height; /* height in lines */
> + __u32 width; /* total frame width in pixels */
> + __u32 height; /* total frame height in lines */
> __u32 interlaced; /* Interlaced or progressive */
> __u32 polarities; /* Positive or negative polarity */
> __u64 pixelclock; /* Pixel clock in HZ. Ex. 74.25MHz->74250000 */
> - __u32 hfrontporch; /* Horizpontal front porch in pixels */
> + __u32 hfrontporch; /* Horizontal front porch in pixels */
> __u32 hsync; /* Horizontal Sync length in pixels */
> __u32 hbackporch; /* Horizontal back porch in pixels */
> __u32 vfrontporch; /* Vertical front porch in pixels */
> __u32 vsync; /* Vertical Sync length in lines */
> __u32 vbackporch; /* Vertical back porch in lines */
> - __u32 il_vfrontporch; /* Vertical front porch for bottom field of
> - * interlaced field formats
> + __u32 il_vfrontporch; /* Vertical front porch for the even field
> + * (aka field 2) of interlaced field formats
> */
> - __u32 il_vsync; /* Vertical sync length for bottom field of
> - * interlaced field formats
> + __u32 il_vsync; /* Vertical sync length for the even field
> + * (aka field 2) of interlaced field formats
> */
> - __u32 il_vbackporch; /* Vertical back porch for bottom field of
> - * interlaced field formats
> + __u32 il_vbackporch; /* Vertical back porch for the even field
> + * (aka field 2) of interlaced field formats
> */
> - __u32 reserved[16];
> + __u32 standards; /* Standards the timing belongs to */
> + __u32 flags; /* Flags */
> + __u32 reserved[14];
> } __attribute__ ((packed));
>
> /* Interlaced or progressive format */
> @@ -1019,6 +1033,37 @@ struct v4l2_bt_timings {
> #define V4L2_DV_VSYNC_POS_POL 0x00000001
> #define V4L2_DV_HSYNC_POS_POL 0x00000002
>
> +/* Timings standards */
> +#define V4L2_DV_BT_STD_CEA861 (1 << 0) /* CEA-861 Digital TV Profile */
> +#define V4L2_DV_BT_STD_DMT (1 << 1) /* VESA Discrete Monitor Timings */
> +#define V4L2_DV_BT_STD_CVT (1 << 2) /* VESA Coordinated Video Timings */
> +#define V4L2_DV_BT_STD_GTF (1 << 3) /* VESA Generalized Timings Formula */
> +
> +/* Flags */
> +
> +/* CVT/GTF specific: timing uses reduced blanking (CVT) or the 'Secondary
> + GTF' curve (GTF). In both cases the horizontal and/or vertical blanking
> + intervals are reduced, allowing a higher resolution over the same
> + bandwidth. This is a read-only flag. */
> +#define V4L2_DV_FL_REDUCED_BLANKING (1 << 0)
> +/* CEA-861 specific: set for CEA-861 formats with a framerate of a multiple
> + of six. These formats can be optionally played at 1 / 1.001 speed to
> + be compatible with the normal NTSC framerate of 29.97 frames per second.
> + This is a read-only flag. */
> +#define V4L2_DV_FL_NTSC_COMPATIBLE (1 << 1)
> +/* CEA-861 specific: only valid for video transmitters, the flag is cleared
> + by receivers.
> + If the framerate of the format is a multiple of six, then the pixelclock
> + used to set up the transmitter is divided by 1.001 to make it compatible
> + with NTSC framerates. Otherwise this flag is cleared. If the transmitter
> + can't generate such frequencies, then the flag will also be cleared. */
> +#define V4L2_DV_FL_DIVIDE_CLOCK_BY_1_001 (1 << 2)
The two above have a conceptual problem: NTSC has nothing to do with the frequency.
While, in practice, NTSC is only used on Countries with 60Hz power supply, and a
1000/1001 shift is used there, to avoid flicker with the light bulbs, the
standard doesn't mean a 29.97 Hz frame rate.
If you take a look at CEA-861, it doesn't mention there NTSC (well, except for a
reference for the existing standards), to avoid such conceptual issue.
Besides that, PAL/M (and PAL/60) also uses a 29.97 Hz frame rate, in order to avoid
flicker.
So, please don't call the flag as "NTSC_COMPATIBLE", and please fix the comments
to either not mention NTSC, or to use something more generic, like replacing:
"...be compatible with the normal NTSC framerateof 29.97 frames per second."
with
"...be compatible with 60Hz based standards that use a framerate of 29.97
frames per second, like NTSC and PAL/M."
> +/* Specific to interlaced formats: if set, then field 1 is really one half-line
> + longer and field 2 is really one half-line shorter, so each field has
> + exactly the same number of half-lines. Whether half-lines can be detected
> + or used depends on the hardware. */
> +#define V4L2_DV_FL_HALF_LINE (1 << 0)
> +
>
> /* DV timings */
> struct v4l2_dv_timings {
> @@ -1032,6 +1077,47 @@ struct v4l2_dv_timings {
> /* Values for the type field */
> #define V4L2_DV_BT_656_1120 0 /* BT.656/1120 timing type */
>
> +
> +/* DV timings enumeration */
> +struct v4l2_enum_dv_timings {
> + __u32 index;
> + __u32 reserved[3];
> + struct v4l2_dv_timings timings;
> +};
> +
> +/* BT.656/BT.1120 timing capabilities */
> +struct v4l2_bt_timings_cap {
> + __u32 min_width; /* width in pixels */
> + __u32 max_width; /* width in pixels */
> + __u32 min_height; /* height in lines */
> + __u32 max_height; /* height in lines */
> + __u64 min_pixelclock; /* Pixel clock in HZ. Ex. 74.25MHz->74250000 */
> + __u64 max_pixelclock; /* Pixel clock in HZ. Ex. 74.25MHz->74250000 */
> + __u32 standards; /* Supported standards */
> + __u32 capabilities; /* See below */
> + __u32 reserved[16];
> +} __attribute__ ((packed));
Hmm... why to define a new struct here, instead of just use struct v4l2_bt_timings ?
> +
> +/* Supports interlaced formats */
> +#define V4L2_DV_BT_CAP_INTERLACED (1 << 0)
> +/* Supports progressive formats */
> +#define V4L2_DV_BT_CAP_PROGRESSIVE (1 << 1)
> +/* Supports CVT/GTF reduced blanking */
> +#define V4L2_DV_BT_CAP_REDUCED_BLANKING (1 << 2)
> +/* Supports custom formats */
> +#define V4L2_DV_BT_CAP_CUSTOM (1 << 3)
> +
> +/* DV timings capabilities */
> +struct v4l2_dv_timings_cap {
> + __u32 type;
What are the posible values for type?
Btw, it is a good idea to use kernel-doc-nano to describe the structures:
/**
* struct v4l2_dv_timings_cap - DV timings capabilities
* @type: some description
...
*/
As it documents better what is defined there.
> + __u32 reserved[3];
> + union {
> + struct v4l2_bt_timings_cap bt;
> + __u32 raw_data[32];
> + };
> +};
> +
> +
> /*
> * V I D E O I N P U T S
> */
> @@ -2318,6 +2404,10 @@ struct v4l2_create_buffers {
> #define VIDIOC_G_SELECTION _IOWR('V', 94, struct v4l2_selection)
> #define VIDIOC_S_SELECTION _IOWR('V', 95, struct v4l2_selection)
>
> +#define VIDIOC_ENUM_DV_TIMINGS _IOWR('V', 96, struct v4l2_enum_dv_timings)
> +#define VIDIOC_QUERY_DV_TIMINGS _IOR('V', 97, struct v4l2_dv_timings)
> +#define VIDIOC_DV_TIMINGS_CAP _IOWR('V', 98, struct v4l2_dv_timings_cap)
> +
> /* Reminder: when adding new ioctls please add support for them to
> drivers/media/video/v4l2-compat-ioctl32.c as well! */
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFCv1 PATCH 4/6] V4L2 spec: document the new V4L2 DV timings ioctls.
2012-02-03 10:06 ` [RFCv1 PATCH 4/6] V4L2 spec: document the new V4L2 DV timings ioctls Hans Verkuil
@ 2012-02-28 11:01 ` Mauro Carvalho Chehab
2012-02-28 11:09 ` Hans Verkuil
0 siblings, 1 reply; 18+ messages in thread
From: Mauro Carvalho Chehab @ 2012-02-28 11:01 UTC (permalink / raw)
To: Hans Verkuil; +Cc: linux-media, Hans Verkuil
Em 03-02-2012 08:06, Hans Verkuil escreveu:
> From: Hans Verkuil <hans.verkuil@cisco.com>
The comments for patch 1 apply here. So, I won't repeat myself ;) There's just one
minor comment below.
>
> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
> ---
> Documentation/DocBook/media/v4l/v4l2.xml | 3 +
> .../DocBook/media/v4l/vidioc-dv-timings-cap.xml | 205 ++++++++++++++++++++
> .../DocBook/media/v4l/vidioc-enum-dv-timings.xml | 113 +++++++++++
> .../DocBook/media/v4l/vidioc-g-dv-timings.xml | 120 +++++++++++-
> .../DocBook/media/v4l/vidioc-query-dv-timings.xml | 98 ++++++++++
> 5 files changed, 531 insertions(+), 8 deletions(-)
> create mode 100644 Documentation/DocBook/media/v4l/vidioc-dv-timings-cap.xml
> create mode 100644 Documentation/DocBook/media/v4l/vidioc-enum-dv-timings.xml
> create mode 100644 Documentation/DocBook/media/v4l/vidioc-query-dv-timings.xml
>
> diff --git a/Documentation/DocBook/media/v4l/v4l2.xml b/Documentation/DocBook/media/v4l/v4l2.xml
> index dce3fef..8bc2ccd 100644
> --- a/Documentation/DocBook/media/v4l/v4l2.xml
> +++ b/Documentation/DocBook/media/v4l/v4l2.xml
> @@ -481,10 +481,12 @@ and discussions on the V4L mailing list.</revremark>
> &sub-dbg-g-chip-ident;
> &sub-dbg-g-register;
> &sub-dqevent;
> + &sub-dv-timings-cap;
> &sub-encoder-cmd;
> &sub-enumaudio;
> &sub-enumaudioout;
> &sub-enum-dv-presets;
> + &sub-enum-dv-timings;
> &sub-enum-fmt;
> &sub-enum-framesizes;
> &sub-enum-frameintervals;
> @@ -519,6 +521,7 @@ and discussions on the V4L mailing list.</revremark>
> &sub-querycap;
> &sub-queryctrl;
> &sub-query-dv-preset;
> + &sub-query-dv-timings;
> &sub-querystd;
> &sub-prepare-buf;
> &sub-reqbufs;
> diff --git a/Documentation/DocBook/media/v4l/vidioc-dv-timings-cap.xml b/Documentation/DocBook/media/v4l/vidioc-dv-timings-cap.xml
> new file mode 100644
> index 0000000..0477de1
> --- /dev/null
> +++ b/Documentation/DocBook/media/v4l/vidioc-dv-timings-cap.xml
> @@ -0,0 +1,205 @@
> +<refentry id="vidioc-dv-timings-cap">
> + <refmeta>
> + <refentrytitle>ioctl VIDIOC_DV_TIMINGS_CAP</refentrytitle>
> + &manvol;
> + </refmeta>
> +
> + <refnamediv>
> + <refname>VIDIOC_DV_TIMINGS_CAP</refname>
> + <refpurpose>The capabilities of the Digital Video receiver/transmitter</refpurpose>
> + </refnamediv>
> +
> + <refsynopsisdiv>
> + <funcsynopsis>
> + <funcprototype>
> + <funcdef>int <function>ioctl</function></funcdef>
> + <paramdef>int <parameter>fd</parameter></paramdef>
> + <paramdef>int <parameter>request</parameter></paramdef>
> + <paramdef>struct v4l2_dv_timings_cap *<parameter>argp</parameter></paramdef>
> + </funcprototype>
> + </funcsynopsis>
> + </refsynopsisdiv>
> +
> + <refsect1>
> + <title>Arguments</title>
> +
> + <variablelist>
> + <varlistentry>
> + <term><parameter>fd</parameter></term>
> + <listitem>
> + <para>&fd;</para>
> + </listitem>
> + </varlistentry>
> + <varlistentry>
> + <term><parameter>request</parameter></term>
> + <listitem>
> + <para>VIDIOC_DV_TIMINGS_CAP</para>
> + </listitem>
> + </varlistentry>
> + <varlistentry>
> + <term><parameter>argp</parameter></term>
> + <listitem>
> + <para></para>
> + </listitem>
> + </varlistentry>
> + </variablelist>
> + </refsect1>
> +
> + <refsect1>
> + <title>Description</title>
> +
> + <para>To query the available timings, applications initialize the
> +<structfield>index</structfield> field and zero the reserved array of &v4l2-dv-timings-cap;
> +and call the <constant>VIDIOC_DV_TIMINGS_CAP</constant> ioctl with a pointer to this
> +structure. Drivers fill the rest of the structure or return an
> +&EINVAL; when the index is out of bounds. To enumerate all supported DV timings,
> +applications shall begin at index zero, incrementing by one until the
> +driver returns <errorcode>EINVAL</errorcode>. Note that drivers may enumerate a
> +different set of DV timings after switching the video input or
> +output.</para>
> +
> + <table pgwide="1" frame="none" id="v4l2-bt-timings-cap">
> + <title>struct <structname>v4l2_bt_timings_cap</structname></title>
> + <tgroup cols="3">
> + &cs-str;
> + <tbody valign="top">
> + <row>
> + <entry>__u32</entry>
> + <entry><structfield>min_width</structfield></entry>
> + <entry>Minimum width of the active video in pixels.</entry>
> + </row>
> + <row>
> + <entry>__u32</entry>
> + <entry><structfield>max_width</structfield></entry>
> + <entry>Maximum width of the active video in pixels.</entry>
> + </row>
> + <row>
> + <entry>__u32</entry>
> + <entry><structfield>min_height</structfield></entry>
> + <entry>Minimum height of the active video in lines.</entry>
> + </row>
> + <row>
> + <entry>__u32</entry>
> + <entry><structfield>max_height</structfield></entry>
> + <entry>Maximum height of the active video in lines.</entry>
> + </row>
> + <row>
> + <entry>__u64</entry>
> + <entry><structfield>min_pixelclock</structfield></entry>
> + <entry>Minimum pixelclock frequency in Hz.</entry>
> + </row>
> + <row>
> + <entry>__u64</entry>
> + <entry><structfield>max_pixelclock</structfield></entry>
> + <entry>Maximum pixelclock frequency in Hz.</entry>
> + </row>
> + <row>
> + <entry>__u32</entry>
> + <entry><structfield>standards</structfield></entry>
> + <entry>The video standard(s) supported by the hardware.
> + See <xref linkend="dv-bt-standards"/> for a list of standards.</entry>
> + </row>
> + <row>
> + <entry>__u32</entry>
> + <entry><structfield>capabilities</structfield></entry>
> + <entry>Several flags giving more information about the capabilities.
> + See <xref linkend="dv-bt-cap-capabilities"/> for a description of the flags.
> + </entry>
> + </row>
> + <row>
> + <entry>__u32</entry>
> + <entry><structfield>reserved</structfield>[16]</entry>
> + <entry></entry>
> + </row>
> + </tbody>
> + </tgroup>
> + </table>
> +
> + <table pgwide="1" frame="none" id="v4l2-dv-timings-cap">
> + <title>struct <structname>v4l2_dv_timings_cap</structname></title>
> + <tgroup cols="4">
> + &cs-str;
> + <tbody valign="top">
> + <row>
> + <entry>__u32</entry>
> + <entry><structfield>type</structfield></entry>
> + <entry>Type of DV timings as listed in <xref linkend="dv-timing-types"/>.</entry>
> + </row>
> + <row>
> + <entry>__u32</entry>
> + <entry><structfield>reserved</structfield>[3]</entry>
> + <entry>Reserved for future extensions. Drivers must set the array to zero.</entry>
> + </row>
> + <row>
> + <entry>union</entry>
> + <entry><structfield></structfield></entry>
> + <entry></entry>
> + </row>
> + <row>
> + <entry></entry>
> + <entry>&v4l2-bt-timings-cap;</entry>
> + <entry><structfield>bt</structfield></entry>
> + <entry>BT.656/1120 timings capabilities of the hardware.</entry>
> + </row>
> + <row>
> + <entry></entry>
> + <entry>__u32</entry>
> + <entry><structfield>raw_data</structfield>[32]</entry>
> + <entry></entry>
> + </row>
> + </tbody>
> + </tgroup>
> + </table>
> +
> + <table pgwide="1" frame="none" id="dv-bt-cap-capabilities">
> + <title>DV BT Timing capabilities</title>
> + <tgroup cols="2">
> + &cs-str;
> + <tbody valign="top">
> + <row>
> + <entry>Flag</entry>
> + <entry>Description</entry>
> + </row>
> + <row>
> + <entry></entry>
> + <entry></entry>
> + </row>
> + <row>
> + <entry>V4L2_DV_BT_CAP_INTERLACED</entry>
> + <entry>Interlaced formats are supported.
> + </entry>
> + </row>
> + <row>
> + <entry>V4L2_DV_BT_CAP_PROGRESSIVE</entry>
> + <entry>Progressive formats are supported.
> + </entry>
> + </row>
> + <row>
> + <entry>V4L2_DV_BT_CAP_REDUCED_BLANKING</entry>
> + <entry>CVT/GTF specific: the timings can make use of reduced blanking (CVT)
> +or the 'Secondary GTF' curve (GTF).
> + </entry>
> + </row>
> + <row>
> + <entry>V4L2_DV_BT_CAP_CUSTOM</entry>
> + <entry>Can support non-standard timings, i.e. timings not belonging to the
> +standards set in the <structfield>standards</structfield> field.
> + </entry>
> + </row>
> + </tbody>
> + </tgroup>
> + </table>
> + </refsect1>
> +
> + <refsect1>
> + &return-value;
> + </refsect1>
> +</refentry>
> +
> +<!--
> +Local Variables:
> +mode: sgml
> +sgml-parent-document: "v4l2.sgml"
> +indent-tabs-mode: nil
> +End:
> +-->
> diff --git a/Documentation/DocBook/media/v4l/vidioc-enum-dv-timings.xml b/Documentation/DocBook/media/v4l/vidioc-enum-dv-timings.xml
> new file mode 100644
> index 0000000..edd6964
> --- /dev/null
> +++ b/Documentation/DocBook/media/v4l/vidioc-enum-dv-timings.xml
> @@ -0,0 +1,113 @@
> +<refentry id="vidioc-enum-dv-timings">
> + <refmeta>
> + <refentrytitle>ioctl VIDIOC_ENUM_DV_TIMINGS</refentrytitle>
> + &manvol;
> + </refmeta>
> +
> + <refnamediv>
> + <refname>VIDIOC_ENUM_DV_TIMINGS</refname>
> + <refpurpose>Enumerate supported Digital Video timings</refpurpose>
> + </refnamediv>
> +
> + <refsynopsisdiv>
> + <funcsynopsis>
> + <funcprototype>
> + <funcdef>int <function>ioctl</function></funcdef>
> + <paramdef>int <parameter>fd</parameter></paramdef>
> + <paramdef>int <parameter>request</parameter></paramdef>
> + <paramdef>struct v4l2_enum_dv_timings *<parameter>argp</parameter></paramdef>
> + </funcprototype>
> + </funcsynopsis>
> + </refsynopsisdiv>
> +
> + <refsect1>
> + <title>Arguments</title>
> +
> + <variablelist>
> + <varlistentry>
> + <term><parameter>fd</parameter></term>
> + <listitem>
> + <para>&fd;</para>
> + </listitem>
> + </varlistentry>
> + <varlistentry>
> + <term><parameter>request</parameter></term>
> + <listitem>
> + <para>VIDIOC_ENUM_DV_TIMINGS</para>
> + </listitem>
> + </varlistentry>
> + <varlistentry>
> + <term><parameter>argp</parameter></term>
> + <listitem>
> + <para></para>
> + </listitem>
> + </varlistentry>
> + </variablelist>
> + </refsect1>
> +
> + <refsect1>
> + <title>Description</title>
> +
> + <para>While some DV receivers or transmitters support a wide range of timings, others
> +support only a limited number of timings. With this ioctl applications can enumerate a list
> +of known supported timings. Call &VIDIOC-DV-TIMINGS-CAP; to check if it also supports other
> +standards or even custom timings that are not in this list.</para>
> +
> + <para>To query the available timings, applications initialize the
> +<structfield>index</structfield> field and zero the reserved array of &v4l2-enum-dv-timings;
> +and call the <constant>VIDIOC_ENUM_DV_TIMINGS</constant> ioctl with a pointer to this
> +structure. Drivers fill the rest of the structure or return an
> +&EINVAL; when the index is out of bounds. To enumerate all supported DV timings,
> +applications shall begin at index zero, incrementing by one until the
> +driver returns <errorcode>EINVAL</errorcode>. Note that drivers may enumerate a
> +different set of DV timings after switching the video input or
> +output.</para>
> +
> + <table pgwide="1" frame="none" id="v4l2-enum-dv-timings">
> + <title>struct <structname>v4l2_enum_dv_timings</structname></title>
> + <tgroup cols="3">
> + &cs-str;
> + <tbody valign="top">
> + <row>
> + <entry>__u32</entry>
> + <entry><structfield>index</structfield></entry>
> + <entry>Number of the DV timings, set by the
> +application.</entry>
> + </row>
> + <row>
> + <entry>__u32</entry>
> + <entry><structfield>reserved</structfield>[3]</entry>
> + <entry>Reserved for future extensions. Drivers must set the array to zero.</entry>
> + </row>
> + <row>
> + <entry>&v4l2-dv-timings;</entry>
> + <entry><structfield>timings</structfield></entry>
> + <entry>The timings.</entry>
> + </row>
> + </tbody>
> + </tgroup>
> + </table>
> + </refsect1>
> +
> + <refsect1>
> + &return-value;
> +
> + <variablelist>
> + <varlistentry>
> + <term><errorcode>EINVAL</errorcode></term>
> + <listitem>
> + <para>The &v4l2-enum-dv-timings; <structfield>index</structfield>
> +is out of bounds.</para>
> + </listitem>
> + </varlistentry>
> + </variablelist>
> + </refsect1>
> +</refentry>
> +
> +<!--
> +Local Variables:
> +mode: sgml
> +sgml-parent-document: "v4l2.sgml"
> +indent-tabs-mode: nil
> +End:
> +-->
Don't insert editor-specific parameters at the file! That violates CodingStyle.
> diff --git a/Documentation/DocBook/media/v4l/vidioc-g-dv-timings.xml b/Documentation/DocBook/media/v4l/vidioc-g-dv-timings.xml
> index 4a8648a..bffd26c 100644
> --- a/Documentation/DocBook/media/v4l/vidioc-g-dv-timings.xml
> +++ b/Documentation/DocBook/media/v4l/vidioc-g-dv-timings.xml
> @@ -83,12 +83,13 @@ or the timing values are not correct, the driver returns &EINVAL;.</para>
> <row>
> <entry>__u32</entry>
> <entry><structfield>width</structfield></entry>
> - <entry>Width of the active video in pixels</entry>
> + <entry>Width of the active video in pixels.</entry>
> </row>
> <row>
> <entry>__u32</entry>
> <entry><structfield>height</structfield></entry>
> - <entry>Height of the active video in lines</entry>
> + <entry>Height of the active video frame in lines. So for interlaced formats the
> + height of the active video in each field is <structfield>height</structfield>/2.</entry>
> </row>
> <row>
> <entry>__u32</entry>
> @@ -125,32 +126,52 @@ bit 0 (V4L2_DV_VSYNC_POS_POL) is for vertical sync polarity and bit 1 (V4L2_DV_H
> <row>
> <entry>__u32</entry>
> <entry><structfield>vfrontporch</structfield></entry>
> - <entry>Vertical front porch in lines</entry>
> + <entry>Vertical front porch in lines. For interlaced formats this refers to the
> + odd field (aka field 1).</entry>
> </row>
> <row>
> <entry>__u32</entry>
> <entry><structfield>vsync</structfield></entry>
> - <entry>Vertical sync length in lines</entry>
> + <entry>Vertical sync length in lines. For interlaced formats this refers to the
> + odd field (aka field 1).</entry>
> </row>
> <row>
> <entry>__u32</entry>
> <entry><structfield>vbackporch</structfield></entry>
> - <entry>Vertical back porch in lines</entry>
> + <entry>Vertical back porch in lines. For interlaced formats this refers to the
> + odd field (aka field 1).</entry>
> </row>
> <row>
> <entry>__u32</entry>
> <entry><structfield>il_vfrontporch</structfield></entry>
> - <entry>Vertical front porch in lines for bottom field of interlaced field formats</entry>
> + <entry>Vertical front porch in lines for the even field (aka field 2) of
> + interlaced field formats.</entry>
> </row>
> <row>
> <entry>__u32</entry>
> <entry><structfield>il_vsync</structfield></entry>
> - <entry>Vertical sync length in lines for bottom field of interlaced field formats</entry>
> + <entry>Vertical sync length in lines for the even field (aka field 2) of
> + interlaced field formats.</entry>
> </row>
> <row>
> <entry>__u32</entry>
> <entry><structfield>il_vbackporch</structfield></entry>
> - <entry>Vertical back porch in lines for bottom field of interlaced field formats</entry>
> + <entry>Vertical back porch in lines for the even field (aka field 2) of
> + interlaced field formats.</entry>
> + </row>
> + <row>
> + <entry>__u32</entry>
> + <entry><structfield>standards</structfield></entry>
> + <entry>The video standard(s) this format belongs to. This will be filled in by
> + the driver. Applications must set this to 0. See <xref linkend="dv-bt-standards"/>
> + for a list of standards.</entry>
> + </row>
> + <row>
> + <entry>__u32</entry>
> + <entry><structfield>flags</structfield></entry>
> + <entry>Several flags giving more information about the format.
> + See <xref linkend="dv-bt-flags"/> for a description of the flags.
> + </entry>
> </row>
> </tbody>
> </tgroup>
> @@ -211,6 +232,89 @@ bit 0 (V4L2_DV_VSYNC_POS_POL) is for vertical sync polarity and bit 1 (V4L2_DV_H
> </tbody>
> </tgroup>
> </table>
> + <table pgwide="1" frame="none" id="dv-bt-standards">
> + <title>DV BT Timing standards</title>
> + <tgroup cols="2">
> + &cs-str;
> + <tbody valign="top">
> + <row>
> + <entry>Timing standard</entry>
> + <entry>Description</entry>
> + </row>
> + <row>
> + <entry></entry>
> + <entry></entry>
> + </row>
> + <row>
> + <entry>V4L2_DV_BT_STD_CEA861</entry>
> + <entry>The timings follow the CEA-861 Digital TV Profile standard</entry>
> + </row>
> + <row>
> + <entry>V4L2_DV_BT_STD_DMT</entry>
> + <entry>The timings follow the VESA Discrete Monitor Timings standard</entry>
> + </row>
> + <row>
> + <entry>V4L2_DV_BT_STD_CVT</entry>
> + <entry>The timings follow the VESA Coordinated Video Timings standard</entry>
> + </row>
> + <row>
> + <entry>V4L2_DV_BT_STD_GTF</entry>
> + <entry>The timings follow the VESA Generalized Timings Formula standard</entry>
> + </row>
> + </tbody>
> + </tgroup>
> + </table>
> + <table pgwide="1" frame="none" id="dv-bt-flags">
> + <title>DV BT Timing flags</title>
> + <tgroup cols="2">
> + &cs-str;
> + <tbody valign="top">
> + <row>
> + <entry>Flag</entry>
> + <entry>Description</entry>
> + </row>
> + <row>
> + <entry></entry>
> + <entry></entry>
> + </row>
> + <row>
> + <entry>V4L2_DV_FL_REDUCED_BLANKING</entry>
> + <entry>CVT/GTF specific: the timings use reduced blanking (CVT) or the 'Secondary
> +GTF' curve (GTF). In both cases the horizontal and/or vertical blanking
> +intervals are reduced, allowing a higher resolution over the same
> +bandwidth. This is a read-only flag, applications must not set this.
> + </entry>
> + </row>
> + <row>
> + <entry>V4L2_DV_FL_NTSC_COMPATIBLE</entry>
> + <entry>CEA-861 specific: set for CEA-861 formats with a framerate of a multiple
> +of six. These formats can be optionally played at 1 / 1.001 speed to
> +be compatible with the normal NTSC framerate of 29.97 frames per second.
> +This is a read-only flag, applications must not set this.
> + </entry>
> + </row>
> + <row>
> + <entry>V4L2_DV_FL_DIVIDE_CLOCK_BY_1_001</entry>
> + <entry>CEA-861 specific: only valid for video transmitters, the flag is cleared
> +by receivers. It is also only valid for formats with the V4L2_DV_FL_NTSC_COMPATIBLE flag
> +set, for other formats the flag will be cleared by the driver.
> +
> +If the application sets this flag, then the pixelclock used to set up the transmitter is
> +divided by 1.001 to make it compatible with NTSC framerates. If the transmitter
> +can't generate such frequencies, then the flag will also be cleared.
> + </entry>
> + </row>
> + <row>
> + <entry>V4L2_DV_FL_HALF_LINE</entry>
> + <entry>Specific to interlaced formats: if set, then field 1 (aka the odd field)
> +is really one half-line longer and field 2 (aka the even field) is really one half-line
> +shorter, so each field has exactly the same number of half-lines. Whether half-lines can be
> +detected or used depends on the hardware.
> + </entry>
> + </row>
> + </tbody>
> + </tgroup>
> + </table>
> </refsect1>
> <refsect1>
> &return-value;
> diff --git a/Documentation/DocBook/media/v4l/vidioc-query-dv-timings.xml b/Documentation/DocBook/media/v4l/vidioc-query-dv-timings.xml
> new file mode 100644
> index 0000000..9d7ac43
> --- /dev/null
> +++ b/Documentation/DocBook/media/v4l/vidioc-query-dv-timings.xml
> @@ -0,0 +1,98 @@
> +<refentry id="vidioc-query-dv-timings">
> + <refmeta>
> + <refentrytitle>ioctl VIDIOC_QUERY_DV_TIMINGS</refentrytitle>
> + &manvol;
> + </refmeta>
> +
> + <refnamediv>
> + <refname>VIDIOC_QUERY_DV_TIMINGS</refname>
> + <refpurpose>Sense the DV preset received by the current
> +input</refpurpose>
> + </refnamediv>
> +
> + <refsynopsisdiv>
> + <funcsynopsis>
> + <funcprototype>
> + <funcdef>int <function>ioctl</function></funcdef>
> + <paramdef>int <parameter>fd</parameter></paramdef>
> + <paramdef>int <parameter>request</parameter></paramdef>
> + <paramdef>struct v4l2_dv_timings *<parameter>argp</parameter></paramdef>
> + </funcprototype>
> + </funcsynopsis>
> + </refsynopsisdiv>
> +
> + <refsect1>
> + <title>Arguments</title>
> +
> + <variablelist>
> + <varlistentry>
> + <term><parameter>fd</parameter></term>
> + <listitem>
> + <para>&fd;</para>
> + </listitem>
> + </varlistentry>
> + <varlistentry>
> + <term><parameter>request</parameter></term>
> + <listitem>
> + <para>VIDIOC_QUERY_DV_TIMINGS</para>
> + </listitem>
> + </varlistentry>
> + <varlistentry>
> + <term><parameter>argp</parameter></term>
> + <listitem>
> + <para></para>
> + </listitem>
> + </varlistentry>
> + </variablelist>
> + </refsect1>
> +
> + <refsect1>
> + <title>Description</title>
> +
> + <para>The hardware may be able to detect the current DV timings
> +automatically, similar to sensing the video standard. To do so, applications
> +call <constant>VIDIOC_QUERY_DV_TIMINGS</constant> with a pointer to a
> +&v4l2-dv-timings;. Once the hardware detects the timings, it will fill in the
> +timings structure.
> +
> +If the timings could not be detected because there was no signal, then
> +<errorcode>ENOLINK</errorcode> is returned. If a signal was detected, but
> +it was unstable and the receiver could not lock to the signal, then
> +<errorcode>ENOLCK</errorcode> is returned. If the receiver could lock to the signal,
> +but the format is unsupported (e.g. because the pixelclock is out of range
> +of the hardware capabilities), then the driver fills in whatever timings it
> +could find and returns <errorcode>ERANGE</errorcode>. In that case the application
> +can call &VIDIOC-DV-TIMINGS-CAP; to compare the found timings with the hardware's
> +capabilities in order to give more precise feedback to the user.
> +</para>
> + </refsect1>
> +
> + <refsect1>
> + &return-value;
> +
> + <variablelist>
> + <varlistentry>
> + <term><errorcode>ENOLINK</errorcode></term>
> + <listitem>
> + <para>No timings could be detected because no signal was found.
> +</para>
> + </listitem>
> + </varlistentry>
> + <varlistentry>
> + <term><errorcode>ENOLCK</errorcode></term>
> + <listitem>
> + <para>The signal was unstable and the hardware could not lock on to it.
> +</para>
> + </listitem>
> + </varlistentry>
> + <varlistentry>
> + <term><errorcode>ERANGE</errorcode></term>
> + <listitem>
> + <para>Timings were found, but they are out of range of the hardware
> +capabilities.
> +</para>
> + </listitem>
> + </varlistentry>
> + </variablelist>
> + </refsect1>
> +</refentry>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFCv1 PATCH 5/6] v4l2-common: add new support functions to match DV timings.
2012-02-03 10:06 ` [RFCv1 PATCH 5/6] v4l2-common: add new support functions to match DV timings Hans Verkuil
@ 2012-02-28 11:03 ` Mauro Carvalho Chehab
2012-02-28 11:18 ` Hans Verkuil
0 siblings, 1 reply; 18+ messages in thread
From: Mauro Carvalho Chehab @ 2012-02-28 11:03 UTC (permalink / raw)
To: Hans Verkuil; +Cc: linux-media, Hans Verkuil
Em 03-02-2012 08:06, Hans Verkuil escreveu:
> From: Hans Verkuil <hans.verkuil@cisco.com>
>
> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
> ---
> drivers/media/video/v4l2-common.c | 102 ++++++++++++++++++++++++++++++-------
> include/media/v4l2-common.h | 15 +++++
> 2 files changed, 99 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
> index 5c6100f..f133961 100644
> --- a/drivers/media/video/v4l2-common.c
> +++ b/drivers/media/video/v4l2-common.c
> @@ -567,24 +567,24 @@ int v4l_fill_dv_preset_info(u32 preset, struct v4l2_dv_enum_preset *info)
> const char *name;
> } dv_presets[] = {
> { 0, 0, "Invalid" }, /* V4L2_DV_INVALID */
> - { 720, 480, "480p@59.94" }, /* V4L2_DV_480P59_94 */
> - { 720, 576, "576p@50" }, /* V4L2_DV_576P50 */
> - { 1280, 720, "720p@24" }, /* V4L2_DV_720P24 */
> - { 1280, 720, "720p@25" }, /* V4L2_DV_720P25 */
> - { 1280, 720, "720p@30" }, /* V4L2_DV_720P30 */
> - { 1280, 720, "720p@50" }, /* V4L2_DV_720P50 */
> - { 1280, 720, "720p@59.94" }, /* V4L2_DV_720P59_94 */
> - { 1280, 720, "720p@60" }, /* V4L2_DV_720P60 */
> - { 1920, 1080, "1080i@29.97" }, /* V4L2_DV_1080I29_97 */
> - { 1920, 1080, "1080i@30" }, /* V4L2_DV_1080I30 */
> - { 1920, 1080, "1080i@25" }, /* V4L2_DV_1080I25 */
> - { 1920, 1080, "1080i@50" }, /* V4L2_DV_1080I50 */
> - { 1920, 1080, "1080i@60" }, /* V4L2_DV_1080I60 */
> - { 1920, 1080, "1080p@24" }, /* V4L2_DV_1080P24 */
> - { 1920, 1080, "1080p@25" }, /* V4L2_DV_1080P25 */
> - { 1920, 1080, "1080p@30" }, /* V4L2_DV_1080P30 */
> - { 1920, 1080, "1080p@50" }, /* V4L2_DV_1080P50 */
> - { 1920, 1080, "1080p@60" }, /* V4L2_DV_1080P60 */
> + { 720, 480, "720x480p59.94" }, /* V4L2_DV_480P59_94 */
> + { 720, 576, "720x576p50" }, /* V4L2_DV_576P50 */
> + { 1280, 720, "1280x720p24" }, /* V4L2_DV_720P24 */
> + { 1280, 720, "1280x720p25" }, /* V4L2_DV_720P25 */
> + { 1280, 720, "1280x720p30" }, /* V4L2_DV_720P30 */
> + { 1280, 720, "1280x720p50" }, /* V4L2_DV_720P50 */
> + { 1280, 720, "1280x720p59.94" },/* V4L2_DV_720P59_94 */
> + { 1280, 720, "1280x720p60" }, /* V4L2_DV_720P60 */
> + { 0, 0, "Invalid" }, /* V4L2_DV_1080I29_97 */
> + { 0, 0, "Invalid" }, /* V4L2_DV_1080I30 */
> + { 0, 0, "Invalid" }, /* V4L2_DV_1080I25 */
Huh? That seems to be causing a regression.
> + { 1920, 1080, "1920x1080i50" }, /* V4L2_DV_1080I50 */
> + { 1920, 1080, "1920x1080i60" }, /* V4L2_DV_1080I60 */
> + { 1920, 1080, "1920x1080p24" }, /* V4L2_DV_1080P24 */
> + { 1920, 1080, "1920x1080p25" }, /* V4L2_DV_1080P25 */
> + { 1920, 1080, "1920x1080p30" }, /* V4L2_DV_1080P30 */
> + { 1920, 1080, "1920x1080p50" }, /* V4L2_DV_1080P50 */
> + { 1920, 1080, "1920x1080p60" }, /* V4L2_DV_1080P60 */
> };
>
> if (info == NULL || preset >= ARRAY_SIZE(dv_presets))
> @@ -598,6 +598,72 @@ int v4l_fill_dv_preset_info(u32 preset, struct v4l2_dv_enum_preset *info)
> }
> EXPORT_SYMBOL_GPL(v4l_fill_dv_preset_info);
>
> +bool v4l_match_dv_timings(const struct v4l2_dv_timings *t1,
> + const struct v4l2_dv_timings *t2)
> +{
> + if (t1->type != t2->type || t1->type != V4L2_DV_BT_656_1120)
> + return false;
> + return !memcmp(&t1->bt, &t2->bt, &t1->bt.standards - &t1->bt.width);
> +}
> +EXPORT_SYMBOL_GPL(v4l_match_dv_timings);
> +
> +bool v4l_match_dv_timings_fuzzy(const struct v4l2_dv_timings *t1,
> + const struct v4l2_dv_timings *t2,
> + u32 clock_resolution, u32 flags)
> +{
> + const struct v4l2_bt_timings *bt1, *bt2;
> + unsigned v_blank1, v_blank2;
> + u32 clock_diff;
> +
> + if (t1->type != t2->type || t1->type != V4L2_DV_BT_656_1120)
> + return false;
> + bt1 = &t1->bt;
> + bt2 = &t2->bt;
> + if (bt1->interlaced != bt2->interlaced)
> + return false;
> + v_blank1 = bt1->vfrontporch + bt1->vsync + bt1->vbackporch +
> + bt1->il_vfrontporch + bt1->il_vsync + bt1->il_vbackporch;
> + v_blank2 = bt2->vfrontporch + bt2->vsync + bt2->vbackporch +
> + bt2->il_vfrontporch + bt2->il_vsync + bt2->il_vbackporch;
> + if (bt1->height != bt2->height)
> + return false;
> + if ((flags & V4L_MATCH_BT_HAVE_ACTIVE_HEIGHT) &&
> + v_blank1 != v_blank2)
> + return false;
> + if ((flags & V4L_MATCH_BT_HAVE_V_POL) &&
> + (bt1->polarities & V4L2_DV_VSYNC_POS_POL) !=
> + (bt2->polarities & V4L2_DV_VSYNC_POS_POL))
> + return false;
> + if ((flags & V4L_MATCH_BT_HAVE_H_POL) &&
> + (bt1->polarities & V4L2_DV_HSYNC_POS_POL) !=
> + (bt2->polarities & V4L2_DV_HSYNC_POS_POL))
> + return false;
> + if ((flags & V4L_MATCH_BT_HAVE_VSYNC) &&
> + bt1->vsync != bt2->vsync)
> + return false;
> + if ((flags & V4L_MATCH_BT_HAVE_HSYNC) &&
> + bt1->hsync != bt2->hsync)
> + return false;
> + if (flags & V4L_MATCH_BT_HAVE_WIDTH) {
> + unsigned h_blank1 = bt1->hfrontporch + bt1->hsync +
> + bt1->hbackporch;
> + unsigned h_blank2 = bt2->hfrontporch + bt2->hsync +
> + bt2->hbackporch;
> +
> + if (bt1->width != bt2->width)
> + return false;
> + if ((flags & V4L_MATCH_BT_HAVE_ACTIVE_WIDTH) &&
> + h_blank1 != h_blank2)
> + return false;
> + }
> + if (bt1->pixelclock > bt2->pixelclock)
> + clock_diff = bt1->pixelclock - bt2->pixelclock;
> + else
> + clock_diff = bt2->pixelclock - bt1->pixelclock;
> + return clock_diff < clock_resolution;
> +}
> +EXPORT_SYMBOL_GPL(v4l_match_dv_timings_fuzzy);
> +
> const struct v4l2_frmsize_discrete *v4l2_find_nearest_format(
> const struct v4l2_discrete_probe *probe,
> s32 width, s32 height)
> diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
> index a298ec4..4469696 100644
> --- a/include/media/v4l2-common.h
> +++ b/include/media/v4l2-common.h
> @@ -202,6 +202,21 @@ void v4l_bound_align_image(unsigned int *w, unsigned int wmin,
> unsigned int hmax, unsigned int halign,
> unsigned int salign);
> int v4l_fill_dv_preset_info(u32 preset, struct v4l2_dv_enum_preset *info);
> +bool v4l_match_dv_timings(const struct v4l2_dv_timings *t1,
> + const struct v4l2_dv_timings *t2);
> +
> +#define V4L_MATCH_BT_HAVE_WIDTH (1 << 0)
> +#define V4L_MATCH_BT_HAVE_ACTIVE_HEIGHT (1 << 1)
> +#define V4L_MATCH_BT_HAVE_ACTIVE_WIDTH (1 << 2)
> +#define V4L_MATCH_BT_HAVE_V_POL (1 << 3)
> +#define V4L_MATCH_BT_HAVE_H_POL (1 << 4)
> +#define V4L_MATCH_BT_HAVE_VSYNC (1 << 5)
> +#define V4L_MATCH_BT_HAVE_HSYNC (1 << 6)
> +
> +bool v4l_match_dv_timings_fuzzy(const struct v4l2_dv_timings *t1,
> + const struct v4l2_dv_timings *t2,
> + u32 clock_resolution,
> + u32 flags);
>
> struct v4l2_discrete_probe {
> const struct v4l2_frmsize_discrete *sizes;
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFCv1 PATCH 1/6] videodev2.h: add enum/query/cap dv_timings ioctls.
2012-02-28 10:54 ` [RFCv1 PATCH 1/6] videodev2.h: add enum/query/cap dv_timings ioctls Mauro Carvalho Chehab
@ 2012-02-28 11:06 ` Hans Verkuil
2012-02-28 11:14 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 18+ messages in thread
From: Hans Verkuil @ 2012-02-28 11:06 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: linux-media, Hans Verkuil
On Tuesday, February 28, 2012 11:54:54 Mauro Carvalho Chehab wrote:
> Em 03-02-2012 08:06, Hans Verkuil escreveu:
> > From: Hans Verkuil <hans.verkuil@cisco.com>
> >
> > These new ioctls make it possible for the dv_timings API to replace
> > the dv_preset API eventually.
> >
> > Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
> > ---
> > include/linux/videodev2.h | 110 ++++++++++++++++++++++++++++++++++++++++----
> > 1 files changed, 100 insertions(+), 10 deletions(-)
> >
> > diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
> > index 0db0503..e59cd02 100644
> > --- a/include/linux/videodev2.h
> > +++ b/include/linux/videodev2.h
> > @@ -987,28 +987,42 @@ struct v4l2_dv_enum_preset {
> > */
> >
> > /* BT.656/BT.1120 timing data */
> > +
> > +/*
> > + * A note regarding vertical interlaced timings: height refers to the total
> > + * height of the frame (= two fields). The blanking timings refer
> > + * to the blanking of each field. So the height of the active frame is
> > + * calculated as follows:
> > + *
> > + * act_height = height - vfrontporch - vsync - vbackporch -
> > + * il_vfrontporch - il_vsync - il_vbackporch
> > + *
> > + * The active height of each field is act_height / 2.
> > + */
> > struct v4l2_bt_timings {
> > - __u32 width; /* width in pixels */
> > - __u32 height; /* height in lines */
> > + __u32 width; /* total frame width in pixels */
> > + __u32 height; /* total frame height in lines */
> > __u32 interlaced; /* Interlaced or progressive */
> > __u32 polarities; /* Positive or negative polarity */
> > __u64 pixelclock; /* Pixel clock in HZ. Ex. 74.25MHz->74250000 */
> > - __u32 hfrontporch; /* Horizpontal front porch in pixels */
> > + __u32 hfrontporch; /* Horizontal front porch in pixels */
> > __u32 hsync; /* Horizontal Sync length in pixels */
> > __u32 hbackporch; /* Horizontal back porch in pixels */
> > __u32 vfrontporch; /* Vertical front porch in pixels */
> > __u32 vsync; /* Vertical Sync length in lines */
> > __u32 vbackporch; /* Vertical back porch in lines */
> > - __u32 il_vfrontporch; /* Vertical front porch for bottom field of
> > - * interlaced field formats
> > + __u32 il_vfrontporch; /* Vertical front porch for the even field
> > + * (aka field 2) of interlaced field formats
> > */
> > - __u32 il_vsync; /* Vertical sync length for bottom field of
> > - * interlaced field formats
> > + __u32 il_vsync; /* Vertical sync length for the even field
> > + * (aka field 2) of interlaced field formats
> > */
> > - __u32 il_vbackporch; /* Vertical back porch for bottom field of
> > - * interlaced field formats
> > + __u32 il_vbackporch; /* Vertical back porch for the even field
> > + * (aka field 2) of interlaced field formats
> > */
> > - __u32 reserved[16];
> > + __u32 standards; /* Standards the timing belongs to */
> > + __u32 flags; /* Flags */
> > + __u32 reserved[14];
> > } __attribute__ ((packed));
> >
> > /* Interlaced or progressive format */
> > @@ -1019,6 +1033,37 @@ struct v4l2_bt_timings {
> > #define V4L2_DV_VSYNC_POS_POL 0x00000001
> > #define V4L2_DV_HSYNC_POS_POL 0x00000002
> >
> > +/* Timings standards */
> > +#define V4L2_DV_BT_STD_CEA861 (1 << 0) /* CEA-861 Digital TV Profile */
> > +#define V4L2_DV_BT_STD_DMT (1 << 1) /* VESA Discrete Monitor Timings */
> > +#define V4L2_DV_BT_STD_CVT (1 << 2) /* VESA Coordinated Video Timings */
> > +#define V4L2_DV_BT_STD_GTF (1 << 3) /* VESA Generalized Timings Formula */
> > +
> > +/* Flags */
> > +
> > +/* CVT/GTF specific: timing uses reduced blanking (CVT) or the 'Secondary
> > + GTF' curve (GTF). In both cases the horizontal and/or vertical blanking
> > + intervals are reduced, allowing a higher resolution over the same
> > + bandwidth. This is a read-only flag. */
> > +#define V4L2_DV_FL_REDUCED_BLANKING (1 << 0)
>
> > +/* CEA-861 specific: set for CEA-861 formats with a framerate of a multiple
> > + of six. These formats can be optionally played at 1 / 1.001 speed to
> > + be compatible with the normal NTSC framerate of 29.97 frames per second.
> > + This is a read-only flag. */
> > +#define V4L2_DV_FL_NTSC_COMPATIBLE (1 << 1)
> > +/* CEA-861 specific: only valid for video transmitters, the flag is cleared
> > + by receivers.
> > + If the framerate of the format is a multiple of six, then the pixelclock
> > + used to set up the transmitter is divided by 1.001 to make it compatible
> > + with NTSC framerates. Otherwise this flag is cleared. If the transmitter
> > + can't generate such frequencies, then the flag will also be cleared. */
> > +#define V4L2_DV_FL_DIVIDE_CLOCK_BY_1_001 (1 << 2)
>
> The two above have a conceptual problem: NTSC has nothing to do with the frequency.
>
> While, in practice, NTSC is only used on Countries with 60Hz power supply, and a
> 1000/1001 shift is used there, to avoid flicker with the light bulbs, the
> standard doesn't mean a 29.97 Hz frame rate.
>
> If you take a look at CEA-861, it doesn't mention there NTSC (well, except for a
> reference for the existing standards), to avoid such conceptual issue.
>
> Besides that, PAL/M (and PAL/60) also uses a 29.97 Hz frame rate, in order to avoid
> flicker.
>
> So, please don't call the flag as "NTSC_COMPATIBLE", and please fix the comments
> to either not mention NTSC, or to use something more generic, like replacing:
>
> "...be compatible with the normal NTSC framerateof 29.97 frames per second."
> with
> "...be compatible with 60Hz based standards that use a framerate of 29.97
> frames per second, like NTSC and PAL/M."
I'll try and find a more neutral term. I'm not satisfied with the name either.
>
> > +/* Specific to interlaced formats: if set, then field 1 is really one half-line
> > + longer and field 2 is really one half-line shorter, so each field has
> > + exactly the same number of half-lines. Whether half-lines can be detected
> > + or used depends on the hardware. */
> > +#define V4L2_DV_FL_HALF_LINE (1 << 0)
> > +
> >
> > /* DV timings */
> > struct v4l2_dv_timings {
> > @@ -1032,6 +1077,47 @@ struct v4l2_dv_timings {
> > /* Values for the type field */
> > #define V4L2_DV_BT_656_1120 0 /* BT.656/1120 timing type */
> >
> > +
> > +/* DV timings enumeration */
> > +struct v4l2_enum_dv_timings {
> > + __u32 index;
> > + __u32 reserved[3];
> > + struct v4l2_dv_timings timings;
> > +};
> > +
> > +/* BT.656/BT.1120 timing capabilities */
> > +struct v4l2_bt_timings_cap {
> > + __u32 min_width; /* width in pixels */
> > + __u32 max_width; /* width in pixels */
> > + __u32 min_height; /* height in lines */
> > + __u32 max_height; /* height in lines */
> > + __u64 min_pixelclock; /* Pixel clock in HZ. Ex. 74.25MHz->74250000 */
> > + __u64 max_pixelclock; /* Pixel clock in HZ. Ex. 74.25MHz->74250000 */
> > + __u32 standards; /* Supported standards */
> > + __u32 capabilities; /* See below */
> > + __u32 reserved[16];
> > +} __attribute__ ((packed));
>
> Hmm... why to define a new struct here, instead of just use struct v4l2_bt_timings ?
Perhaps there is some misunderstanding here? Struct v4l2_bt_timings defines the
timings of a particular format. Struct v4l2_bt_timings_cap defines the range of
timings that the hardware is capable of. The fields are quite different between
the two.
>
> > +
> > +/* Supports interlaced formats */
> > +#define V4L2_DV_BT_CAP_INTERLACED (1 << 0)
> > +/* Supports progressive formats */
> > +#define V4L2_DV_BT_CAP_PROGRESSIVE (1 << 1)
> > +/* Supports CVT/GTF reduced blanking */
> > +#define V4L2_DV_BT_CAP_REDUCED_BLANKING (1 << 2)
> > +/* Supports custom formats */
> > +#define V4L2_DV_BT_CAP_CUSTOM (1 << 3)
> > +
> > +/* DV timings capabilities */
> > +struct v4l2_dv_timings_cap {
> > + __u32 type;
>
> What are the posible values for type?
Same as the type of v4l2_dv_timings. I'll clarify this.
> Btw, it is a good idea to use kernel-doc-nano to describe the structures:
>
> /**
> * struct v4l2_dv_timings_cap - DV timings capabilities
> * @type: some description
> ...
> */
>
> As it documents better what is defined there.
Certainly.
> > + __u32 reserved[3];
> > + union {
> > + struct v4l2_bt_timings_cap bt;
> > + __u32 raw_data[32];
> > + };
> > +};
> > +
> > +
> > /*
> > * V I D E O I N P U T S
> > */
> > @@ -2318,6 +2404,10 @@ struct v4l2_create_buffers {
> > #define VIDIOC_G_SELECTION _IOWR('V', 94, struct v4l2_selection)
> > #define VIDIOC_S_SELECTION _IOWR('V', 95, struct v4l2_selection)
> >
> > +#define VIDIOC_ENUM_DV_TIMINGS _IOWR('V', 96, struct v4l2_enum_dv_timings)
> > +#define VIDIOC_QUERY_DV_TIMINGS _IOR('V', 97, struct v4l2_dv_timings)
> > +#define VIDIOC_DV_TIMINGS_CAP _IOWR('V', 98, struct v4l2_dv_timings_cap)
> > +
> > /* Reminder: when adding new ioctls please add support for them to
> > drivers/media/video/v4l2-compat-ioctl32.c as well! */
> >
>
Thanks for reviewing this!
Regards,
Hans
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFCv1 PATCH 4/6] V4L2 spec: document the new V4L2 DV timings ioctls.
2012-02-28 11:01 ` Mauro Carvalho Chehab
@ 2012-02-28 11:09 ` Hans Verkuil
0 siblings, 0 replies; 18+ messages in thread
From: Hans Verkuil @ 2012-02-28 11:09 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: linux-media, Hans Verkuil
On Tuesday, February 28, 2012 12:01:01 Mauro Carvalho Chehab wrote:
> Em 03-02-2012 08:06, Hans Verkuil escreveu:
> > From: Hans Verkuil <hans.verkuil@cisco.com>
>
> The comments for patch 1 apply here. So, I won't repeat myself ;) There's just one
> minor comment below.
>
> > +<!--
> > +Local Variables:
> > +mode: sgml
> > +sgml-parent-document: "v4l2.sgml"
> > +indent-tabs-mode: nil
> > +End:
> > +-->
>
> Don't insert editor-specific parameters at the file! That violates CodingStyle.
This must be a copy-and-paste thing, I hate this as much as you do.
I definitely didn't add it knowingly :-)
Regards,
Hans
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFCv1 PATCH 0/6] Improved/New timings API
2012-02-24 9:54 ` [RFCv1 PATCH 0/6] Improved/New timings API Hans Verkuil
@ 2012-02-28 11:13 ` Mauro Carvalho Chehab
2012-02-28 12:42 ` Hans Verkuil
0 siblings, 1 reply; 18+ messages in thread
From: Mauro Carvalho Chehab @ 2012-02-28 11:13 UTC (permalink / raw)
To: Hans Verkuil; +Cc: linux-media
Em 24-02-2012 07:54, Hans Verkuil escreveu:
> On Friday, February 03, 2012 11:06:00 Hans Verkuil wrote:
>> Hi all,
>>
>> This is an implementation of this RFC:
>>
>> http://www.mail-archive.com/linux-media@vger.kernel.org/msg38168.html
>
> Mauro,
>
> I'd greatly appreciate it if you can review this API.
API Reviewed.
> I've verified that it works well with CVT and GTF timings (the code for that
> is in the test-timings branch in the git repo below).
>
> One thing that might change slightly is the description of this flag:
>
> <entry>V4L2_DV_FL_DIVIDE_CLOCK_BY_1_001</entry>
> <entry>CEA-861 specific: only valid for video transmitters, the flag is cleared
> by receivers. It is also only valid for formats with the V4L2_DV_FL_NTSC_COMPATIBLE flag
> set, for other formats the flag will be cleared by the driver.
>
> If the application sets this flag, then the pixelclock used to set up the transmitter is
> divided by 1.001 to make it compatible with NTSC framerates. If the transmitter
> can't generate such frequencies, then the flag will also be cleared.
> </entry>
>
> Currently it is only valid for transmitters, but I've seen newer receivers
> that should be able to detect this small difference in pixelclock frequency.
A 1000/1001 time shift is generally detected well by the receiver, as the PLL's
are generally able to lock. However, depending on how this frequency is used
internally at the receiver, it can cause a miss-sample at chroma, causing a
weird effect: the vertical borders have the color shifting between to values.
This is noticed mostly on high-contrast borders.
> I haven't tested (yet) whether they can actually do this, and it would have
> to be considered a hint only since this minute pixelclock difference falls
> within the CEA861-defined pixelclock variation. But if they can do this, then
> that would be a really nice feature.
You'll likely be able to notice if they're actually detecting, if you display a
standard color bar and look at the borders, and see if the colors are steady
at the borders.
> Basically I'm looking for a stamp of approval before I continue with this.
>
> If you are OK with it, then I'll make a final version of this patch series,
> and start adding this API to all drivers that currently use the preset API.
> Once that's done we can deprecate and eventually remove the preset API.
>
> But that's a fair amount of work and I don't want to start on that unless I
> know you agree with this API.
>
> Regards,
>
> Hans
>
>>
>> The goal is that with these additions the existing DV_PRESET API can be
>> removed eventually. It's always painful to admit, but that wasn't the best
>> API ever :-)
>>
>> To my dismay I discovered that some of the preset defines were even impossible:
>> there are no interlaced 1920x1080i25/29.97/30 formats.
>>
>> I have been testing this new code with the adv7604 HDMI receiver as used here:
>>
>> http://git.linuxtv.org/hverkuil/cisco.git/shortlog/refs/heads/test-timings
>>
>> This is my development/test branch, so the code is a bit messy.
>>
>> One problem that I always had with the older proposals is that there was no
>> easy way to just select a specific standard (e.g. 720p60). By creating the
>> linux/v4l2-dv-timings.h header this is now very easy to do, both for drivers
>> and applications.
>>
>> I also took special care on how to distinguish between e.g. 720p60 and 720p59.94.
>> See the documentation for more information.
>>
>> Note that the QUERY_DV_TIMINGS and DV_TIMINGS_CAP ioctls will be marked
>> experimental. Particularly the latter ioctl might well change in the future as
>> I do not have enough experience to tell whether DV_TIMINGS_CAP is sufficiently
>> detailed.
>>
>> I would like to get some feedback on this approach, just to make sure I don't
>> need to start over.
>>
>> In the meantime I will be working on code to detect CVT and GTF video timings
>> since that is needed to verify that that part works correctly as well.
>>
>> And once everyone agrees to the API, then I will try and add this API to all
>> drivers that currently use the preset API. That way there will be a decent
>> path forward to eventually remove the preset API (sooner rather than later
>> IMHO).
>>
>> Regards,
>>
>> Hans
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-media" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFCv1 PATCH 1/6] videodev2.h: add enum/query/cap dv_timings ioctls.
2012-02-28 11:06 ` Hans Verkuil
@ 2012-02-28 11:14 ` Mauro Carvalho Chehab
0 siblings, 0 replies; 18+ messages in thread
From: Mauro Carvalho Chehab @ 2012-02-28 11:14 UTC (permalink / raw)
To: Hans Verkuil; +Cc: linux-media, Hans Verkuil
Em 28-02-2012 08:06, Hans Verkuil escreveu:
> On Tuesday, February 28, 2012 11:54:54 Mauro Carvalho Chehab wrote:
>> Em 03-02-2012 08:06, Hans Verkuil escreveu:
>>> From: Hans Verkuil <hans.verkuil@cisco.com>
>>>
>>> These new ioctls make it possible for the dv_timings API to replace
>>> the dv_preset API eventually.
>>>
>>> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
>>> ---
>>> include/linux/videodev2.h | 110 ++++++++++++++++++++++++++++++++++++++++----
>>> 1 files changed, 100 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
>>> index 0db0503..e59cd02 100644
>>> --- a/include/linux/videodev2.h
>>> +++ b/include/linux/videodev2.h
>>> @@ -987,28 +987,42 @@ struct v4l2_dv_enum_preset {
>>> */
>>>
>>> /* BT.656/BT.1120 timing data */
>>> +
>>> +/*
>>> + * A note regarding vertical interlaced timings: height refers to the total
>>> + * height of the frame (= two fields). The blanking timings refer
>>> + * to the blanking of each field. So the height of the active frame is
>>> + * calculated as follows:
>>> + *
>>> + * act_height = height - vfrontporch - vsync - vbackporch -
>>> + * il_vfrontporch - il_vsync - il_vbackporch
>>> + *
>>> + * The active height of each field is act_height / 2.
>>> + */
>>> struct v4l2_bt_timings {
>>> - __u32 width; /* width in pixels */
>>> - __u32 height; /* height in lines */
>>> + __u32 width; /* total frame width in pixels */
>>> + __u32 height; /* total frame height in lines */
>>> __u32 interlaced; /* Interlaced or progressive */
>>> __u32 polarities; /* Positive or negative polarity */
>>> __u64 pixelclock; /* Pixel clock in HZ. Ex. 74.25MHz->74250000 */
>>> - __u32 hfrontporch; /* Horizpontal front porch in pixels */
>>> + __u32 hfrontporch; /* Horizontal front porch in pixels */
>>> __u32 hsync; /* Horizontal Sync length in pixels */
>>> __u32 hbackporch; /* Horizontal back porch in pixels */
>>> __u32 vfrontporch; /* Vertical front porch in pixels */
>>> __u32 vsync; /* Vertical Sync length in lines */
>>> __u32 vbackporch; /* Vertical back porch in lines */
>>> - __u32 il_vfrontporch; /* Vertical front porch for bottom field of
>>> - * interlaced field formats
>>> + __u32 il_vfrontporch; /* Vertical front porch for the even field
>>> + * (aka field 2) of interlaced field formats
>>> */
>>> - __u32 il_vsync; /* Vertical sync length for bottom field of
>>> - * interlaced field formats
>>> + __u32 il_vsync; /* Vertical sync length for the even field
>>> + * (aka field 2) of interlaced field formats
>>> */
>>> - __u32 il_vbackporch; /* Vertical back porch for bottom field of
>>> - * interlaced field formats
>>> + __u32 il_vbackporch; /* Vertical back porch for the even field
>>> + * (aka field 2) of interlaced field formats
>>> */
>>> - __u32 reserved[16];
>>> + __u32 standards; /* Standards the timing belongs to */
>>> + __u32 flags; /* Flags */
>>> + __u32 reserved[14];
>>> } __attribute__ ((packed));
>>>
>>> /* Interlaced or progressive format */
>>> @@ -1019,6 +1033,37 @@ struct v4l2_bt_timings {
>>> #define V4L2_DV_VSYNC_POS_POL 0x00000001
>>> #define V4L2_DV_HSYNC_POS_POL 0x00000002
>>>
>>> +/* Timings standards */
>>> +#define V4L2_DV_BT_STD_CEA861 (1 << 0) /* CEA-861 Digital TV Profile */
>>> +#define V4L2_DV_BT_STD_DMT (1 << 1) /* VESA Discrete Monitor Timings */
>>> +#define V4L2_DV_BT_STD_CVT (1 << 2) /* VESA Coordinated Video Timings */
>>> +#define V4L2_DV_BT_STD_GTF (1 << 3) /* VESA Generalized Timings Formula */
>>> +
>>> +/* Flags */
>>> +
>>> +/* CVT/GTF specific: timing uses reduced blanking (CVT) or the 'Secondary
>>> + GTF' curve (GTF). In both cases the horizontal and/or vertical blanking
>>> + intervals are reduced, allowing a higher resolution over the same
>>> + bandwidth. This is a read-only flag. */
>>> +#define V4L2_DV_FL_REDUCED_BLANKING (1 << 0)
>>
>>> +/* CEA-861 specific: set for CEA-861 formats with a framerate of a multiple
>>> + of six. These formats can be optionally played at 1 / 1.001 speed to
>>> + be compatible with the normal NTSC framerate of 29.97 frames per second.
>>> + This is a read-only flag. */
>>> +#define V4L2_DV_FL_NTSC_COMPATIBLE (1 << 1)
>>> +/* CEA-861 specific: only valid for video transmitters, the flag is cleared
>>> + by receivers.
>>> + If the framerate of the format is a multiple of six, then the pixelclock
>>> + used to set up the transmitter is divided by 1.001 to make it compatible
>>> + with NTSC framerates. Otherwise this flag is cleared. If the transmitter
>>> + can't generate such frequencies, then the flag will also be cleared. */
>>> +#define V4L2_DV_FL_DIVIDE_CLOCK_BY_1_001 (1 << 2)
>>
>> The two above have a conceptual problem: NTSC has nothing to do with the frequency.
>>
>> While, in practice, NTSC is only used on Countries with 60Hz power supply, and a
>> 1000/1001 shift is used there, to avoid flicker with the light bulbs, the
>> standard doesn't mean a 29.97 Hz frame rate.
>>
>> If you take a look at CEA-861, it doesn't mention there NTSC (well, except for a
>> reference for the existing standards), to avoid such conceptual issue.
>>
>> Besides that, PAL/M (and PAL/60) also uses a 29.97 Hz frame rate, in order to avoid
>> flicker.
>>
>> So, please don't call the flag as "NTSC_COMPATIBLE", and please fix the comments
>> to either not mention NTSC, or to use something more generic, like replacing:
>>
>> "...be compatible with the normal NTSC framerateof 29.97 frames per second."
>> with
>> "...be compatible with 60Hz based standards that use a framerate of 29.97
>> frames per second, like NTSC and PAL/M."
>
> I'll try and find a more neutral term. I'm not satisfied with the name either.
Ok, thanks!
>
>>
>>> +/* Specific to interlaced formats: if set, then field 1 is really one half-line
>>> + longer and field 2 is really one half-line shorter, so each field has
>>> + exactly the same number of half-lines. Whether half-lines can be detected
>>> + or used depends on the hardware. */
>>> +#define V4L2_DV_FL_HALF_LINE (1 << 0)
>>> +
>>>
>>> /* DV timings */
>>> struct v4l2_dv_timings {
>>> @@ -1032,6 +1077,47 @@ struct v4l2_dv_timings {
>>> /* Values for the type field */
>>> #define V4L2_DV_BT_656_1120 0 /* BT.656/1120 timing type */
>>>
>>> +
>>> +/* DV timings enumeration */
>>> +struct v4l2_enum_dv_timings {
>>> + __u32 index;
>>> + __u32 reserved[3];
>>> + struct v4l2_dv_timings timings;
>>> +};
>>> +
>>> +/* BT.656/BT.1120 timing capabilities */
>>> +struct v4l2_bt_timings_cap {
>>> + __u32 min_width; /* width in pixels */
>>> + __u32 max_width; /* width in pixels */
>>> + __u32 min_height; /* height in lines */
>>> + __u32 max_height; /* height in lines */
>>> + __u64 min_pixelclock; /* Pixel clock in HZ. Ex. 74.25MHz->74250000 */
>>> + __u64 max_pixelclock; /* Pixel clock in HZ. Ex. 74.25MHz->74250000 */
>>> + __u32 standards; /* Supported standards */
>>> + __u32 capabilities; /* See below */
>>> + __u32 reserved[16];
>>> +} __attribute__ ((packed));
>>
>> Hmm... why to define a new struct here, instead of just use struct v4l2_bt_timings ?
>
> Perhaps there is some misunderstanding here? Struct v4l2_bt_timings defines the
> timings of a particular format. Struct v4l2_bt_timings_cap defines the range of
> timings that the hardware is capable of. The fields are quite different between
> the two.
Ah, OK.
>
>>
>>> +
>>> +/* Supports interlaced formats */
>>> +#define V4L2_DV_BT_CAP_INTERLACED (1 << 0)
>>> +/* Supports progressive formats */
>>> +#define V4L2_DV_BT_CAP_PROGRESSIVE (1 << 1)
>>> +/* Supports CVT/GTF reduced blanking */
>>> +#define V4L2_DV_BT_CAP_REDUCED_BLANKING (1 << 2)
>>> +/* Supports custom formats */
>>> +#define V4L2_DV_BT_CAP_CUSTOM (1 << 3)
>>> +
>>> +/* DV timings capabilities */
>>> +struct v4l2_dv_timings_cap {
>>> + __u32 type;
>>
>> What are the posible values for type?
>
> Same as the type of v4l2_dv_timings. I'll clarify this.
>
>> Btw, it is a good idea to use kernel-doc-nano to describe the structures:
>>
>> /**
>> * struct v4l2_dv_timings_cap - DV timings capabilities
>> * @type: some description
>> ...
>> */
>>
>> As it documents better what is defined there.
>
> Certainly.
>
>>> + __u32 reserved[3];
>>> + union {
>>> + struct v4l2_bt_timings_cap bt;
>>> + __u32 raw_data[32];
>>> + };
>>> +};
>>> +
>>> +
>>> /*
>>> * V I D E O I N P U T S
>>> */
>>> @@ -2318,6 +2404,10 @@ struct v4l2_create_buffers {
>>> #define VIDIOC_G_SELECTION _IOWR('V', 94, struct v4l2_selection)
>>> #define VIDIOC_S_SELECTION _IOWR('V', 95, struct v4l2_selection)
>>>
>>> +#define VIDIOC_ENUM_DV_TIMINGS _IOWR('V', 96, struct v4l2_enum_dv_timings)
>>> +#define VIDIOC_QUERY_DV_TIMINGS _IOR('V', 97, struct v4l2_dv_timings)
>>> +#define VIDIOC_DV_TIMINGS_CAP _IOWR('V', 98, struct v4l2_dv_timings_cap)
>>> +
>>> /* Reminder: when adding new ioctls please add support for them to
>>> drivers/media/video/v4l2-compat-ioctl32.c as well! */
>>>
>>
>
> Thanks for reviewing this!
>
> Regards,
>
> Hans
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFCv1 PATCH 5/6] v4l2-common: add new support functions to match DV timings.
2012-02-28 11:03 ` Mauro Carvalho Chehab
@ 2012-02-28 11:18 ` Hans Verkuil
2012-02-28 11:26 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 18+ messages in thread
From: Hans Verkuil @ 2012-02-28 11:18 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: linux-media, Hans Verkuil
On Tuesday, February 28, 2012 12:03:23 Mauro Carvalho Chehab wrote:
> Em 03-02-2012 08:06, Hans Verkuil escreveu:
> > From: Hans Verkuil <hans.verkuil@cisco.com>
> >
> > Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
> > ---
> > drivers/media/video/v4l2-common.c | 102 ++++++++++++++++++++++++++++++-------
> > include/media/v4l2-common.h | 15 +++++
> > 2 files changed, 99 insertions(+), 18 deletions(-)
> >
> > diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
> > index 5c6100f..f133961 100644
> > --- a/drivers/media/video/v4l2-common.c
> > +++ b/drivers/media/video/v4l2-common.c
> > @@ -567,24 +567,24 @@ int v4l_fill_dv_preset_info(u32 preset, struct v4l2_dv_enum_preset *info)
> > const char *name;
> > } dv_presets[] = {
> > { 0, 0, "Invalid" }, /* V4L2_DV_INVALID */
> > - { 720, 480, "480p@59.94" }, /* V4L2_DV_480P59_94 */
> > - { 720, 576, "576p@50" }, /* V4L2_DV_576P50 */
> > - { 1280, 720, "720p@24" }, /* V4L2_DV_720P24 */
> > - { 1280, 720, "720p@25" }, /* V4L2_DV_720P25 */
> > - { 1280, 720, "720p@30" }, /* V4L2_DV_720P30 */
> > - { 1280, 720, "720p@50" }, /* V4L2_DV_720P50 */
> > - { 1280, 720, "720p@59.94" }, /* V4L2_DV_720P59_94 */
> > - { 1280, 720, "720p@60" }, /* V4L2_DV_720P60 */
> > - { 1920, 1080, "1080i@29.97" }, /* V4L2_DV_1080I29_97 */
> > - { 1920, 1080, "1080i@30" }, /* V4L2_DV_1080I30 */
> > - { 1920, 1080, "1080i@25" }, /* V4L2_DV_1080I25 */
> > - { 1920, 1080, "1080i@50" }, /* V4L2_DV_1080I50 */
> > - { 1920, 1080, "1080i@60" }, /* V4L2_DV_1080I60 */
> > - { 1920, 1080, "1080p@24" }, /* V4L2_DV_1080P24 */
> > - { 1920, 1080, "1080p@25" }, /* V4L2_DV_1080P25 */
> > - { 1920, 1080, "1080p@30" }, /* V4L2_DV_1080P30 */
> > - { 1920, 1080, "1080p@50" }, /* V4L2_DV_1080P50 */
> > - { 1920, 1080, "1080p@60" }, /* V4L2_DV_1080P60 */
> > + { 720, 480, "720x480p59.94" }, /* V4L2_DV_480P59_94 */
> > + { 720, 576, "720x576p50" }, /* V4L2_DV_576P50 */
> > + { 1280, 720, "1280x720p24" }, /* V4L2_DV_720P24 */
> > + { 1280, 720, "1280x720p25" }, /* V4L2_DV_720P25 */
> > + { 1280, 720, "1280x720p30" }, /* V4L2_DV_720P30 */
> > + { 1280, 720, "1280x720p50" }, /* V4L2_DV_720P50 */
> > + { 1280, 720, "1280x720p59.94" },/* V4L2_DV_720P59_94 */
> > + { 1280, 720, "1280x720p60" }, /* V4L2_DV_720P60 */
>
> > + { 0, 0, "Invalid" }, /* V4L2_DV_1080I29_97 */
> > + { 0, 0, "Invalid" }, /* V4L2_DV_1080I30 */
> > + { 0, 0, "Invalid" }, /* V4L2_DV_1080I25 */
>
> Huh? That seems to be causing a regression.
I'm not quite certain how to handle this. The problem is that these three
formats literally do not exist. I'm entirely to blame for this and I've no
idea how I ended up adding these formats.
Changing this table was my, possibly misguided, attempt to at least let
the application know that these formats are bogus.
No drivers currently support these formats (for obvious reasons).
An alternative is to make a feature-removal entry, saying that these three
formats are removed in 3.5, and until then leave this table as is.
What do you think?
Regards,
Hans
>
> > + { 1920, 1080, "1920x1080i50" }, /* V4L2_DV_1080I50 */
> > + { 1920, 1080, "1920x1080i60" }, /* V4L2_DV_1080I60 */
> > + { 1920, 1080, "1920x1080p24" }, /* V4L2_DV_1080P24 */
> > + { 1920, 1080, "1920x1080p25" }, /* V4L2_DV_1080P25 */
> > + { 1920, 1080, "1920x1080p30" }, /* V4L2_DV_1080P30 */
> > + { 1920, 1080, "1920x1080p50" }, /* V4L2_DV_1080P50 */
> > + { 1920, 1080, "1920x1080p60" }, /* V4L2_DV_1080P60 */
> > };
> >
> > if (info == NULL || preset >= ARRAY_SIZE(dv_presets))
> > @@ -598,6 +598,72 @@ int v4l_fill_dv_preset_info(u32 preset, struct v4l2_dv_enum_preset *info)
> > }
> > EXPORT_SYMBOL_GPL(v4l_fill_dv_preset_info);
> >
> > +bool v4l_match_dv_timings(const struct v4l2_dv_timings *t1,
> > + const struct v4l2_dv_timings *t2)
> > +{
> > + if (t1->type != t2->type || t1->type != V4L2_DV_BT_656_1120)
> > + return false;
> > + return !memcmp(&t1->bt, &t2->bt, &t1->bt.standards - &t1->bt.width);
> > +}
> > +EXPORT_SYMBOL_GPL(v4l_match_dv_timings);
> > +
> > +bool v4l_match_dv_timings_fuzzy(const struct v4l2_dv_timings *t1,
> > + const struct v4l2_dv_timings *t2,
> > + u32 clock_resolution, u32 flags)
> > +{
> > + const struct v4l2_bt_timings *bt1, *bt2;
> > + unsigned v_blank1, v_blank2;
> > + u32 clock_diff;
> > +
> > + if (t1->type != t2->type || t1->type != V4L2_DV_BT_656_1120)
> > + return false;
> > + bt1 = &t1->bt;
> > + bt2 = &t2->bt;
> > + if (bt1->interlaced != bt2->interlaced)
> > + return false;
> > + v_blank1 = bt1->vfrontporch + bt1->vsync + bt1->vbackporch +
> > + bt1->il_vfrontporch + bt1->il_vsync + bt1->il_vbackporch;
> > + v_blank2 = bt2->vfrontporch + bt2->vsync + bt2->vbackporch +
> > + bt2->il_vfrontporch + bt2->il_vsync + bt2->il_vbackporch;
> > + if (bt1->height != bt2->height)
> > + return false;
> > + if ((flags & V4L_MATCH_BT_HAVE_ACTIVE_HEIGHT) &&
> > + v_blank1 != v_blank2)
> > + return false;
> > + if ((flags & V4L_MATCH_BT_HAVE_V_POL) &&
> > + (bt1->polarities & V4L2_DV_VSYNC_POS_POL) !=
> > + (bt2->polarities & V4L2_DV_VSYNC_POS_POL))
> > + return false;
> > + if ((flags & V4L_MATCH_BT_HAVE_H_POL) &&
> > + (bt1->polarities & V4L2_DV_HSYNC_POS_POL) !=
> > + (bt2->polarities & V4L2_DV_HSYNC_POS_POL))
> > + return false;
> > + if ((flags & V4L_MATCH_BT_HAVE_VSYNC) &&
> > + bt1->vsync != bt2->vsync)
> > + return false;
> > + if ((flags & V4L_MATCH_BT_HAVE_HSYNC) &&
> > + bt1->hsync != bt2->hsync)
> > + return false;
> > + if (flags & V4L_MATCH_BT_HAVE_WIDTH) {
> > + unsigned h_blank1 = bt1->hfrontporch + bt1->hsync +
> > + bt1->hbackporch;
> > + unsigned h_blank2 = bt2->hfrontporch + bt2->hsync +
> > + bt2->hbackporch;
> > +
> > + if (bt1->width != bt2->width)
> > + return false;
> > + if ((flags & V4L_MATCH_BT_HAVE_ACTIVE_WIDTH) &&
> > + h_blank1 != h_blank2)
> > + return false;
> > + }
> > + if (bt1->pixelclock > bt2->pixelclock)
> > + clock_diff = bt1->pixelclock - bt2->pixelclock;
> > + else
> > + clock_diff = bt2->pixelclock - bt1->pixelclock;
> > + return clock_diff < clock_resolution;
> > +}
> > +EXPORT_SYMBOL_GPL(v4l_match_dv_timings_fuzzy);
> > +
> > const struct v4l2_frmsize_discrete *v4l2_find_nearest_format(
> > const struct v4l2_discrete_probe *probe,
> > s32 width, s32 height)
> > diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
> > index a298ec4..4469696 100644
> > --- a/include/media/v4l2-common.h
> > +++ b/include/media/v4l2-common.h
> > @@ -202,6 +202,21 @@ void v4l_bound_align_image(unsigned int *w, unsigned int wmin,
> > unsigned int hmax, unsigned int halign,
> > unsigned int salign);
> > int v4l_fill_dv_preset_info(u32 preset, struct v4l2_dv_enum_preset *info);
> > +bool v4l_match_dv_timings(const struct v4l2_dv_timings *t1,
> > + const struct v4l2_dv_timings *t2);
> > +
> > +#define V4L_MATCH_BT_HAVE_WIDTH (1 << 0)
> > +#define V4L_MATCH_BT_HAVE_ACTIVE_HEIGHT (1 << 1)
> > +#define V4L_MATCH_BT_HAVE_ACTIVE_WIDTH (1 << 2)
> > +#define V4L_MATCH_BT_HAVE_V_POL (1 << 3)
> > +#define V4L_MATCH_BT_HAVE_H_POL (1 << 4)
> > +#define V4L_MATCH_BT_HAVE_VSYNC (1 << 5)
> > +#define V4L_MATCH_BT_HAVE_HSYNC (1 << 6)
> > +
> > +bool v4l_match_dv_timings_fuzzy(const struct v4l2_dv_timings *t1,
> > + const struct v4l2_dv_timings *t2,
> > + u32 clock_resolution,
> > + u32 flags);
> >
> > struct v4l2_discrete_probe {
> > const struct v4l2_frmsize_discrete *sizes;
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFCv1 PATCH 5/6] v4l2-common: add new support functions to match DV timings.
2012-02-28 11:18 ` Hans Verkuil
@ 2012-02-28 11:26 ` Mauro Carvalho Chehab
0 siblings, 0 replies; 18+ messages in thread
From: Mauro Carvalho Chehab @ 2012-02-28 11:26 UTC (permalink / raw)
To: Hans Verkuil; +Cc: linux-media, Hans Verkuil
Em 28-02-2012 08:18, Hans Verkuil escreveu:
> On Tuesday, February 28, 2012 12:03:23 Mauro Carvalho Chehab wrote:
>> Em 03-02-2012 08:06, Hans Verkuil escreveu:
>>> From: Hans Verkuil <hans.verkuil@cisco.com>
>>>
>>> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
>>> ---
>>> drivers/media/video/v4l2-common.c | 102 ++++++++++++++++++++++++++++++-------
>>> include/media/v4l2-common.h | 15 +++++
>>> 2 files changed, 99 insertions(+), 18 deletions(-)
>>>
>>> diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
>>> index 5c6100f..f133961 100644
>>> --- a/drivers/media/video/v4l2-common.c
>>> +++ b/drivers/media/video/v4l2-common.c
>>> @@ -567,24 +567,24 @@ int v4l_fill_dv_preset_info(u32 preset, struct v4l2_dv_enum_preset *info)
>>> const char *name;
>>> } dv_presets[] = {
>>> { 0, 0, "Invalid" }, /* V4L2_DV_INVALID */
>>> - { 720, 480, "480p@59.94" }, /* V4L2_DV_480P59_94 */
>>> - { 720, 576, "576p@50" }, /* V4L2_DV_576P50 */
>>> - { 1280, 720, "720p@24" }, /* V4L2_DV_720P24 */
>>> - { 1280, 720, "720p@25" }, /* V4L2_DV_720P25 */
>>> - { 1280, 720, "720p@30" }, /* V4L2_DV_720P30 */
>>> - { 1280, 720, "720p@50" }, /* V4L2_DV_720P50 */
>>> - { 1280, 720, "720p@59.94" }, /* V4L2_DV_720P59_94 */
>>> - { 1280, 720, "720p@60" }, /* V4L2_DV_720P60 */
>>> - { 1920, 1080, "1080i@29.97" }, /* V4L2_DV_1080I29_97 */
>>> - { 1920, 1080, "1080i@30" }, /* V4L2_DV_1080I30 */
>>> - { 1920, 1080, "1080i@25" }, /* V4L2_DV_1080I25 */
>>> - { 1920, 1080, "1080i@50" }, /* V4L2_DV_1080I50 */
>>> - { 1920, 1080, "1080i@60" }, /* V4L2_DV_1080I60 */
>>> - { 1920, 1080, "1080p@24" }, /* V4L2_DV_1080P24 */
>>> - { 1920, 1080, "1080p@25" }, /* V4L2_DV_1080P25 */
>>> - { 1920, 1080, "1080p@30" }, /* V4L2_DV_1080P30 */
>>> - { 1920, 1080, "1080p@50" }, /* V4L2_DV_1080P50 */
>>> - { 1920, 1080, "1080p@60" }, /* V4L2_DV_1080P60 */
>>> + { 720, 480, "720x480p59.94" }, /* V4L2_DV_480P59_94 */
>>> + { 720, 576, "720x576p50" }, /* V4L2_DV_576P50 */
>>> + { 1280, 720, "1280x720p24" }, /* V4L2_DV_720P24 */
>>> + { 1280, 720, "1280x720p25" }, /* V4L2_DV_720P25 */
>>> + { 1280, 720, "1280x720p30" }, /* V4L2_DV_720P30 */
>>> + { 1280, 720, "1280x720p50" }, /* V4L2_DV_720P50 */
>>> + { 1280, 720, "1280x720p59.94" },/* V4L2_DV_720P59_94 */
>>> + { 1280, 720, "1280x720p60" }, /* V4L2_DV_720P60 */
>>
>>> + { 0, 0, "Invalid" }, /* V4L2_DV_1080I29_97 */
>>> + { 0, 0, "Invalid" }, /* V4L2_DV_1080I30 */
>>> + { 0, 0, "Invalid" }, /* V4L2_DV_1080I25 */
>>
>> Huh? That seems to be causing a regression.
>
> I'm not quite certain how to handle this. The problem is that these three
> formats literally do not exist. I'm entirely to blame for this and I've no
> idea how I ended up adding these formats.
>
> Changing this table was my, possibly misguided, attempt to at least let
> the application know that these formats are bogus.
>
> No drivers currently support these formats (for obvious reasons).
>
> An alternative is to make a feature-removal entry, saying that these three
> formats are removed in 3.5, and until then leave this table as is.
>
> What do you think?
Better to add it at features to be removed. After cleaning them, we might
re-use those "enum" values with non-bogus values on some future.
>
> Regards,
>
> Hans
>
>>
>>> + { 1920, 1080, "1920x1080i50" }, /* V4L2_DV_1080I50 */
>>> + { 1920, 1080, "1920x1080i60" }, /* V4L2_DV_1080I60 */
>>> + { 1920, 1080, "1920x1080p24" }, /* V4L2_DV_1080P24 */
>>> + { 1920, 1080, "1920x1080p25" }, /* V4L2_DV_1080P25 */
>>> + { 1920, 1080, "1920x1080p30" }, /* V4L2_DV_1080P30 */
>>> + { 1920, 1080, "1920x1080p50" }, /* V4L2_DV_1080P50 */
>>> + { 1920, 1080, "1920x1080p60" }, /* V4L2_DV_1080P60 */
>>> };
>>>
>>> if (info == NULL || preset >= ARRAY_SIZE(dv_presets))
>>> @@ -598,6 +598,72 @@ int v4l_fill_dv_preset_info(u32 preset, struct v4l2_dv_enum_preset *info)
>>> }
>>> EXPORT_SYMBOL_GPL(v4l_fill_dv_preset_info);
>>>
>>> +bool v4l_match_dv_timings(const struct v4l2_dv_timings *t1,
>>> + const struct v4l2_dv_timings *t2)
>>> +{
>>> + if (t1->type != t2->type || t1->type != V4L2_DV_BT_656_1120)
>>> + return false;
>>> + return !memcmp(&t1->bt, &t2->bt, &t1->bt.standards - &t1->bt.width);
>>> +}
>>> +EXPORT_SYMBOL_GPL(v4l_match_dv_timings);
>>> +
>>> +bool v4l_match_dv_timings_fuzzy(const struct v4l2_dv_timings *t1,
>>> + const struct v4l2_dv_timings *t2,
>>> + u32 clock_resolution, u32 flags)
>>> +{
>>> + const struct v4l2_bt_timings *bt1, *bt2;
>>> + unsigned v_blank1, v_blank2;
>>> + u32 clock_diff;
>>> +
>>> + if (t1->type != t2->type || t1->type != V4L2_DV_BT_656_1120)
>>> + return false;
>>> + bt1 = &t1->bt;
>>> + bt2 = &t2->bt;
>>> + if (bt1->interlaced != bt2->interlaced)
>>> + return false;
>>> + v_blank1 = bt1->vfrontporch + bt1->vsync + bt1->vbackporch +
>>> + bt1->il_vfrontporch + bt1->il_vsync + bt1->il_vbackporch;
>>> + v_blank2 = bt2->vfrontporch + bt2->vsync + bt2->vbackporch +
>>> + bt2->il_vfrontporch + bt2->il_vsync + bt2->il_vbackporch;
>>> + if (bt1->height != bt2->height)
>>> + return false;
>>> + if ((flags & V4L_MATCH_BT_HAVE_ACTIVE_HEIGHT) &&
>>> + v_blank1 != v_blank2)
>>> + return false;
>>> + if ((flags & V4L_MATCH_BT_HAVE_V_POL) &&
>>> + (bt1->polarities & V4L2_DV_VSYNC_POS_POL) !=
>>> + (bt2->polarities & V4L2_DV_VSYNC_POS_POL))
>>> + return false;
>>> + if ((flags & V4L_MATCH_BT_HAVE_H_POL) &&
>>> + (bt1->polarities & V4L2_DV_HSYNC_POS_POL) !=
>>> + (bt2->polarities & V4L2_DV_HSYNC_POS_POL))
>>> + return false;
>>> + if ((flags & V4L_MATCH_BT_HAVE_VSYNC) &&
>>> + bt1->vsync != bt2->vsync)
>>> + return false;
>>> + if ((flags & V4L_MATCH_BT_HAVE_HSYNC) &&
>>> + bt1->hsync != bt2->hsync)
>>> + return false;
>>> + if (flags & V4L_MATCH_BT_HAVE_WIDTH) {
>>> + unsigned h_blank1 = bt1->hfrontporch + bt1->hsync +
>>> + bt1->hbackporch;
>>> + unsigned h_blank2 = bt2->hfrontporch + bt2->hsync +
>>> + bt2->hbackporch;
>>> +
>>> + if (bt1->width != bt2->width)
>>> + return false;
>>> + if ((flags & V4L_MATCH_BT_HAVE_ACTIVE_WIDTH) &&
>>> + h_blank1 != h_blank2)
>>> + return false;
>>> + }
>>> + if (bt1->pixelclock > bt2->pixelclock)
>>> + clock_diff = bt1->pixelclock - bt2->pixelclock;
>>> + else
>>> + clock_diff = bt2->pixelclock - bt1->pixelclock;
>>> + return clock_diff < clock_resolution;
>>> +}
>>> +EXPORT_SYMBOL_GPL(v4l_match_dv_timings_fuzzy);
>>> +
>>> const struct v4l2_frmsize_discrete *v4l2_find_nearest_format(
>>> const struct v4l2_discrete_probe *probe,
>>> s32 width, s32 height)
>>> diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
>>> index a298ec4..4469696 100644
>>> --- a/include/media/v4l2-common.h
>>> +++ b/include/media/v4l2-common.h
>>> @@ -202,6 +202,21 @@ void v4l_bound_align_image(unsigned int *w, unsigned int wmin,
>>> unsigned int hmax, unsigned int halign,
>>> unsigned int salign);
>>> int v4l_fill_dv_preset_info(u32 preset, struct v4l2_dv_enum_preset *info);
>>> +bool v4l_match_dv_timings(const struct v4l2_dv_timings *t1,
>>> + const struct v4l2_dv_timings *t2);
>>> +
>>> +#define V4L_MATCH_BT_HAVE_WIDTH (1 << 0)
>>> +#define V4L_MATCH_BT_HAVE_ACTIVE_HEIGHT (1 << 1)
>>> +#define V4L_MATCH_BT_HAVE_ACTIVE_WIDTH (1 << 2)
>>> +#define V4L_MATCH_BT_HAVE_V_POL (1 << 3)
>>> +#define V4L_MATCH_BT_HAVE_H_POL (1 << 4)
>>> +#define V4L_MATCH_BT_HAVE_VSYNC (1 << 5)
>>> +#define V4L_MATCH_BT_HAVE_HSYNC (1 << 6)
>>> +
>>> +bool v4l_match_dv_timings_fuzzy(const struct v4l2_dv_timings *t1,
>>> + const struct v4l2_dv_timings *t2,
>>> + u32 clock_resolution,
>>> + u32 flags);
>>>
>>> struct v4l2_discrete_probe {
>>> const struct v4l2_frmsize_discrete *sizes;
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-media" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFCv1 PATCH 0/6] Improved/New timings API
2012-02-28 11:13 ` Mauro Carvalho Chehab
@ 2012-02-28 12:42 ` Hans Verkuil
0 siblings, 0 replies; 18+ messages in thread
From: Hans Verkuil @ 2012-02-28 12:42 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: linux-media
On Tuesday, February 28, 2012 12:13:08 Mauro Carvalho Chehab wrote:
> Em 24-02-2012 07:54, Hans Verkuil escreveu:
> > On Friday, February 03, 2012 11:06:00 Hans Verkuil wrote:
> >> Hi all,
> >>
> >> This is an implementation of this RFC:
> >>
> >> http://www.mail-archive.com/linux-media@vger.kernel.org/msg38168.html
> >
> > Mauro,
> >
> > I'd greatly appreciate it if you can review this API.
>
> API Reviewed.
>
> > I've verified that it works well with CVT and GTF timings (the code for that
> > is in the test-timings branch in the git repo below).
> >
> > One thing that might change slightly is the description of this flag:
> >
> > <entry>V4L2_DV_FL_DIVIDE_CLOCK_BY_1_001</entry>
> > <entry>CEA-861 specific: only valid for video transmitters, the flag is cleared
> > by receivers. It is also only valid for formats with the V4L2_DV_FL_NTSC_COMPATIBLE flag
> > set, for other formats the flag will be cleared by the driver.
> >
> > If the application sets this flag, then the pixelclock used to set up the transmitter is
> > divided by 1.001 to make it compatible with NTSC framerates. If the transmitter
> > can't generate such frequencies, then the flag will also be cleared.
> > </entry>
> >
> > Currently it is only valid for transmitters, but I've seen newer receivers
> > that should be able to detect this small difference in pixelclock frequency.
>
> A 1000/1001 time shift is generally detected well by the receiver, as the PLL's
> are generally able to lock. However, depending on how this frequency is used
> internally at the receiver, it can cause a miss-sample at chroma, causing a
> weird effect: the vertical borders have the color shifting between to values.
> This is noticed mostly on high-contrast borders.
I think you are talking about SDTV receivers (i.e. saa7115-type receivers).
It's a different story for HDMI/DisplayPort/DVI-D/etc. type receivers. There
the pixelclock is coming from the transmitter, so it is all digital.
In those cases the determination of whether the framerate is 60 Hz or 59.94 Hz
has to be based on the detected pixelclock frequency. At least for the several
receivers I have experience with the frequency precision is quite coarse
(around .25 MHz), which is insufficient to see the difference between 148.5 MHz
for 60 Hz full HD and 148.35 MHz for 59.94 full HD.
Newer receivers have better precision, but it is still a hint at best.
> > I haven't tested (yet) whether they can actually do this, and it would have
> > to be considered a hint only since this minute pixelclock difference falls
> > within the CEA861-defined pixelclock variation. But if they can do this, then
> > that would be a really nice feature.
>
> You'll likely be able to notice if they're actually detecting, if you display a
> standard color bar and look at the borders, and see if the colors are steady
> at the borders.
True for analog inputs, but not for digital inputs like HDMI etc.
It's actually an interesting experiment to see what happens when I try to
feed 59.94 Hz 1080p video over an analog component input. Something to try
next week. I don't think this changes anything regarding this API, but it is
useful to know how this is handled.
Thanks for your review, I'll take care of your comments and start working on
a final version.
Regards,
Hans
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2012-02-28 12:42 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-03 10:06 [RFCv1 PATCH 0/6] Improved/New timings API Hans Verkuil
2012-02-03 10:06 ` [RFCv1 PATCH 1/6] videodev2.h: add enum/query/cap dv_timings ioctls Hans Verkuil
2012-02-03 10:06 ` [RFCv1 PATCH 2/6] v4l2 framework: add support for the new " Hans Verkuil
2012-02-03 10:06 ` [RFCv1 PATCH 3/6] v4l2-dv-timings.h: definitions for CEA-861 and VESA DMT timings Hans Verkuil
2012-02-03 10:06 ` [RFCv1 PATCH 4/6] V4L2 spec: document the new V4L2 DV timings ioctls Hans Verkuil
2012-02-28 11:01 ` Mauro Carvalho Chehab
2012-02-28 11:09 ` Hans Verkuil
2012-02-03 10:06 ` [RFCv1 PATCH 5/6] v4l2-common: add new support functions to match DV timings Hans Verkuil
2012-02-28 11:03 ` Mauro Carvalho Chehab
2012-02-28 11:18 ` Hans Verkuil
2012-02-28 11:26 ` Mauro Carvalho Chehab
2012-02-03 10:06 ` [RFCv1 PATCH 6/6] tvp7002: add support for the new dv timings API Hans Verkuil
2012-02-28 10:54 ` [RFCv1 PATCH 1/6] videodev2.h: add enum/query/cap dv_timings ioctls Mauro Carvalho Chehab
2012-02-28 11:06 ` Hans Verkuil
2012-02-28 11:14 ` Mauro Carvalho Chehab
2012-02-24 9:54 ` [RFCv1 PATCH 0/6] Improved/New timings API Hans Verkuil
2012-02-28 11:13 ` Mauro Carvalho Chehab
2012-02-28 12:42 ` Hans Verkuil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox