aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2011-09-28 10:34:06 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-11-03 16:28:24 -0400
commit2150158b31a3290cc883cf6dea4f5d6803b6b811 (patch)
tree1c06a0fa4688a14df0ed9a630656d7188fb4420a /include
parentebc087d0905c41d7fe450866eb1afd1f661cba76 (diff)
[media] V4L: add two new ioctl()s for multi-size videobuffer management
A possibility to preallocate and initialise buffers of different sizes in V4L2 is required for an efficient implementation of a snapshot mode. This patch adds two new ioctl()s: VIDIOC_CREATE_BUFS and VIDIOC_PREPARE_BUF and defines respective data structures. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/videodev2.h18
-rw-r--r--include/media/v4l2-ioctl.h2
2 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 225560c1a10f..cd512f07beed 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -653,6 +653,10 @@ struct v4l2_buffer {
653#define V4L2_BUF_FLAG_ERROR 0x0040 653#define V4L2_BUF_FLAG_ERROR 0x0040
654#define V4L2_BUF_FLAG_TIMECODE 0x0100 /* timecode field is valid */ 654#define V4L2_BUF_FLAG_TIMECODE 0x0100 /* timecode field is valid */
655#define V4L2_BUF_FLAG_INPUT 0x0200 /* input field is valid */ 655#define V4L2_BUF_FLAG_INPUT 0x0200 /* input field is valid */
656#define V4L2_BUF_FLAG_PREPARED 0x0400 /* Buffer is prepared for queuing */
657/* Cache handling flags */
658#define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE 0x0800
659#define V4L2_BUF_FLAG_NO_CACHE_CLEAN 0x1000
656 660
657/* 661/*
658 * O V E R L A Y P R E V I E W 662 * O V E R L A Y P R E V I E W
@@ -2138,6 +2142,15 @@ struct v4l2_dbg_chip_ident {
2138 __u32 revision; /* chip revision, chip specific */ 2142 __u32 revision; /* chip revision, chip specific */
2139} __attribute__ ((packed)); 2143} __attribute__ ((packed));
2140 2144
2145/* VIDIOC_CREATE_BUFS */
2146struct v4l2_create_buffers {
2147 __u32 index; /* output: buffers index...index + count - 1 have been created */
2148 __u32 count;
2149 enum v4l2_memory memory;
2150 struct v4l2_format format; /* "type" is used always, the rest if sizeimage == 0 */
2151 __u32 reserved[8];
2152};
2153
2141/* 2154/*
2142 * I O C T L C O D E S F O R V I D E O D E V I C E S 2155 * I O C T L C O D E S F O R V I D E O D E V I C E S
2143 * 2156 *
@@ -2228,6 +2241,11 @@ struct v4l2_dbg_chip_ident {
2228#define VIDIOC_SUBSCRIBE_EVENT _IOW('V', 90, struct v4l2_event_subscription) 2241#define VIDIOC_SUBSCRIBE_EVENT _IOW('V', 90, struct v4l2_event_subscription)
2229#define VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription) 2242#define VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription)
2230 2243
2244/* Experimental, the below two ioctls may change over the next couple of kernel
2245 versions */
2246#define VIDIOC_CREATE_BUFS _IOWR('V', 92, struct v4l2_create_buffers)
2247#define VIDIOC_PREPARE_BUF _IOWR('V', 93, struct v4l2_buffer)
2248
2231/* Reminder: when adding new ioctls please add support for them to 2249/* Reminder: when adding new ioctls please add support for them to
2232 drivers/media/video/v4l2-compat-ioctl32.c as well! */ 2250 drivers/media/video/v4l2-compat-ioctl32.c as well! */
2233 2251
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index dd9f1e7b8ff7..4d1c74ad4c84 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -122,6 +122,8 @@ struct v4l2_ioctl_ops {
122 int (*vidioc_qbuf) (struct file *file, void *fh, struct v4l2_buffer *b); 122 int (*vidioc_qbuf) (struct file *file, void *fh, struct v4l2_buffer *b);
123 int (*vidioc_dqbuf) (struct file *file, void *fh, struct v4l2_buffer *b); 123 int (*vidioc_dqbuf) (struct file *file, void *fh, struct v4l2_buffer *b);
124 124
125 int (*vidioc_create_bufs)(struct file *file, void *fh, struct v4l2_create_buffers *b);
126 int (*vidioc_prepare_buf)(struct file *file, void *fh, struct v4l2_buffer *b);
125 127
126 int (*vidioc_overlay) (struct file *file, void *fh, unsigned int i); 128 int (*vidioc_overlay) (struct file *file, void *fh, unsigned int i);
127 int (*vidioc_g_fbuf) (struct file *file, void *fh, 129 int (*vidioc_g_fbuf) (struct file *file, void *fh,