aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/v4l2-core/v4l2-ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/v4l2-core/v4l2-ioctl.c')
-rw-r--r--drivers/media/v4l2-core/v4l2-ioctl.c146
1 files changed, 142 insertions, 4 deletions
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index 7961499..b014904 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -466,6 +466,28 @@ static void v4l_print_buffer(const void *arg, bool write_only)
tc->type, tc->flags, tc->frames, *(__u32 *)tc->userbits);
}
+static void v4l_print_ext_buffer(const void *arg, bool write_only)
+{
+ const struct v4l2_ext_buffer *p = arg;
+ const struct v4l2_ext_plane *plane;
+ int i;
+
+ pr_cont("%lld index=%d, type=%s, flags=0x%08x, field=%s, sequence=%d, memory=%s\n",
+ p->timestamp,
+ p->index,
+ prt_names(p->type, v4l2_type_names),
+ p->flags, prt_names(p->field, v4l2_field_names),
+ p->sequence, prt_names(p->memory, v4l2_memory_names));
+
+ for (i = 0; i < p->num_planes; ++i) {
+ plane = &p->planes[i];
+ printk(KERN_DEBUG
+ "plane %d: bytesused=%d, data_offset=0x%08x, offset/userptr=0x%llx, length=%d\n",
+ i, plane->bytesused, plane->data_offset,
+ plane->m.userptr, plane->length);
+ }
+}
+
static void v4l_print_exportbuffer(const void *arg, bool write_only)
{
const struct v4l2_exportbuffer *p = arg;
@@ -1897,27 +1919,51 @@ static int v4l_querybuf(const struct v4l2_ioctl_ops *ops,
struct file *file, void *fh, void *arg)
{
struct v4l2_buffer *p = arg;
+ struct v4l2_ext_buffer e;
int ret = check_fmt(file, p->type);
- return ret ? ret : ops->vidioc_querybuf(file, fh, p);
+ if (ret || ops->vidioc_querybuf)
+ return ret ? ret : ops->vidioc_querybuf(file, fh, p);
+
+ v4l2_buffer_to_ext_buffer(p, &e);
+ ret = ops->vidioc_ext_querybuf(file, fh, &e);
+ if (!ret)
+ v4l2_ext_buffer_to_buffer(&e, p);
+ return ret;
}
static int v4l_qbuf(const struct v4l2_ioctl_ops *ops,
struct file *file, void *fh, void *arg)
{
struct v4l2_buffer *p = arg;
+ struct v4l2_ext_buffer e;
int ret = check_fmt(file, p->type);
- return ret ? ret : ops->vidioc_qbuf(file, fh, p);
+ if (ret || ops->vidioc_qbuf)
+ return ret ? ret : ops->vidioc_qbuf(file, fh, p);
+
+ v4l2_buffer_to_ext_buffer(p, &e);
+ ret = ops->vidioc_ext_qbuf(file, fh, &e);
+ if (!ret)
+ v4l2_ext_buffer_to_buffer(&e, p);
+ return ret;
}
static int v4l_dqbuf(const struct v4l2_ioctl_ops *ops,
struct file *file, void *fh, void *arg)
{
struct v4l2_buffer *p = arg;
+ struct v4l2_ext_buffer e;
int ret = check_fmt(file, p->type);
- return ret ? ret : ops->vidioc_dqbuf(file, fh, p);
+ if (ret || ops->vidioc_dqbuf)
+ return ret ? ret : ops->vidioc_dqbuf(file, fh, p);
+
+ v4l2_buffer_to_ext_buffer(p, &e);
+ ret = ops->vidioc_ext_dqbuf(file, fh, &e);
+ if (!ret)
+ v4l2_ext_buffer_to_buffer(&e, p);
+ return ret;
}
static int v4l_create_bufs(const struct v4l2_ioctl_ops *ops,
@@ -1946,9 +1992,17 @@ static int v4l_prepare_buf(const struct v4l2_ioctl_ops *ops,
struct file *file, void *fh, void *arg)
{
struct v4l2_buffer *b = arg;
+ struct v4l2_ext_buffer e;
int ret = check_fmt(file, b->type);
- return ret ? ret : ops->vidioc_prepare_buf(file, fh, b);
+ if (ret || ops->vidioc_prepare_buf)
+ return ret ? ret : ops->vidioc_prepare_buf(file, fh, b);
+
+ v4l2_buffer_to_ext_buffer(b, &e);
+ ret = ops->vidioc_ext_prepare_buf(file, fh, &e);
+ if (!ret)
+ v4l2_ext_buffer_to_buffer(&e, b);
+ return ret;
}
static int v4l_g_parm(const struct v4l2_ioctl_ops *ops,
@@ -2511,6 +2565,86 @@ static int v4l_enum_freq_bands(const struct v4l2_ioctl_ops *ops,
return -ENOTTY;
}
+static int v4l_ext_prepare_buf(const struct v4l2_ioctl_ops *ops,
+ struct file *file, void *fh, void *arg)
+{
+ struct v4l2_ext_buffer *e = arg;
+ struct v4l2_plane planes[VIDEO_MAX_PLANES];
+ struct v4l2_buffer b = {
+ .m.planes = planes,
+ };
+ int ret = check_fmt(file, e->type);
+
+ if (ret || ops->vidioc_ext_prepare_buf)
+ return ret ? ret : ops->vidioc_ext_prepare_buf(file, fh, e);
+
+ v4l2_ext_buffer_to_buffer(e, &b);
+ ret = ops->vidioc_prepare_buf(file, fh, &b);
+ if (!ret)
+ v4l2_buffer_to_ext_buffer(&b, e);
+ return ret;
+}
+
+static int v4l_ext_querybuf(const struct v4l2_ioctl_ops *ops,
+ struct file *file, void *fh, void *arg)
+{
+ struct v4l2_ext_buffer *e = arg;
+ struct v4l2_plane planes[VIDEO_MAX_PLANES];
+ struct v4l2_buffer b = {
+ .m.planes = planes,
+ };
+ int ret = check_fmt(file, e->type);
+
+ if (ret || ops->vidioc_ext_querybuf)
+ return ret ? ret : ops->vidioc_ext_querybuf(file, fh, e);
+
+ v4l2_ext_buffer_to_buffer(e, &b);
+ ret = ops->vidioc_querybuf(file, fh, &b);
+ if (!ret)
+ v4l2_buffer_to_ext_buffer(&b, e);
+ return ret;
+}
+
+static int v4l_ext_qbuf(const struct v4l2_ioctl_ops *ops,
+ struct file *file, void *fh, void *arg)
+{
+ struct v4l2_ext_buffer *e = arg;
+ struct v4l2_plane planes[VIDEO_MAX_PLANES];
+ struct v4l2_buffer b = {
+ .m.planes = planes,
+ };
+ int ret = check_fmt(file, e->type);
+
+ if (ret || ops->vidioc_ext_qbuf)
+ return ret ? ret : ops->vidioc_ext_qbuf(file, fh, e);
+
+ v4l2_ext_buffer_to_buffer(e, &b);
+ ret = ops->vidioc_qbuf(file, fh, &b);
+ if (!ret)
+ v4l2_buffer_to_ext_buffer(&b, e);
+ return ret;
+}
+
+static int v4l_ext_dqbuf(const struct v4l2_ioctl_ops *ops,
+ struct file *file, void *fh, void *arg)
+{
+ struct v4l2_ext_buffer *e = arg;
+ struct v4l2_plane planes[VIDEO_MAX_PLANES];
+ struct v4l2_buffer b = {
+ .m.planes = planes,
+ };
+ int ret = check_fmt(file, e->type);
+
+ if (ret || ops->vidioc_ext_dqbuf)
+ return ret ? ret : ops->vidioc_ext_dqbuf(file, fh, e);
+
+ v4l2_ext_buffer_to_buffer(e, &b);
+ ret = ops->vidioc_dqbuf(file, fh, &b);
+ if (!ret)
+ v4l2_buffer_to_ext_buffer(&b, e);
+ return ret;
+}
+
struct v4l2_ioctl_info {
unsigned int ioctl;
u32 flags;
@@ -2642,6 +2776,10 @@ static struct v4l2_ioctl_info v4l2_ioctls[] = {
IOCTL_INFO_FNC(VIDIOC_ENUM_FREQ_BANDS, v4l_enum_freq_bands, v4l_print_freq_band, 0),
IOCTL_INFO_FNC(VIDIOC_DBG_G_CHIP_INFO, v4l_dbg_g_chip_info, v4l_print_dbg_chip_info, INFO_FL_CLEAR(v4l2_dbg_chip_info, match)),
IOCTL_INFO_FNC(VIDIOC_QUERY_EXT_CTRL, v4l_query_ext_ctrl, v4l_print_query_ext_ctrl, INFO_FL_CTRL | INFO_FL_CLEAR(v4l2_query_ext_ctrl, id)),
+ IOCTL_INFO_FNC(VIDIOC_EXT_QUERYBUF, v4l_ext_querybuf, v4l_print_ext_buffer, INFO_FL_QUEUE | INFO_FL_CLEAR(v4l2_ext_buffer, num_planes)),
+ IOCTL_INFO_FNC(VIDIOC_EXT_QBUF, v4l_ext_qbuf, v4l_print_ext_buffer, INFO_FL_QUEUE),
+ IOCTL_INFO_FNC(VIDIOC_EXT_DQBUF, v4l_ext_dqbuf, v4l_print_ext_buffer, INFO_FL_QUEUE),
+ IOCTL_INFO_FNC(VIDIOC_EXT_PREPARE_BUF, v4l_ext_prepare_buf, v4l_print_ext_buffer, INFO_FL_QUEUE),
};
#define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls)

Privacy Policy