lkml.org 
[lkml]   [2018]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFCv3 14/17] v4l2-ctrls: support requests in EXT_CTRLS ioctls
Date
Read and use the request_fd field of struct v4l2_ext_controls to apply
VIDIOC_G_EXT_CTRLS or VIDIOC_S_EXT_CTRLS to a request when asked by
userspace.

Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
---
drivers/media/v4l2-core/v4l2-ioctl.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index 235acdde3111..cbaefcad9694 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -30,6 +30,7 @@
#include <media/videobuf2-v4l2.h>
#include <media/v4l2-mc.h>
#include <media/media-request.h>
+#include <media/v4l2-request.h>

#include <trace/events/v4l2.h>

@@ -2158,6 +2159,24 @@ static int v4l_g_ext_ctrls(const struct v4l2_ioctl_ops *ops,
test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) ? fh : NULL;

p->error_idx = p->count;
+
+ if (p->request_fd > 0) {
+ struct media_request *req = NULL;
+ struct media_request_entity_data *_data;
+ struct media_request_v4l2_entity_data *data;
+ int ret;
+
+ req = check_request(p->request_fd, file, fh, &_data);
+ if (IS_ERR(req))
+ return PTR_ERR(req);
+ data = to_v4l2_entity_data(_data);
+
+ ret = v4l2_g_ext_ctrls(&data->ctrls, p);
+
+ media_request_put(req);
+ return ret;
+ }
+
if (vfh && vfh->ctrl_handler)
return v4l2_g_ext_ctrls(vfh->ctrl_handler, p);
if (vfd->ctrl_handler)
@@ -2177,6 +2196,23 @@ static int v4l_s_ext_ctrls(const struct v4l2_ioctl_ops *ops,
test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) ? fh : NULL;

p->error_idx = p->count;
+ if (p->request_fd > 0) {
+ struct media_request *req = NULL;
+ struct media_request_entity_data *_data;
+ struct media_request_v4l2_entity_data *data;
+ int ret;
+
+ req = check_request(p->request_fd, file, fh, &_data);
+ if (IS_ERR(req))
+ return PTR_ERR(req);
+ data = to_v4l2_entity_data(_data);
+
+ ret = v4l2_s_ext_ctrls(vfh, &data->ctrls, p);
+
+ media_request_put(req);
+ return ret;
+ }
+
if (vfh && vfh->ctrl_handler)
return v4l2_s_ext_ctrls(vfh, vfh->ctrl_handler, p);
if (vfd->ctrl_handler)
--
2.16.0.rc1.238.g530d649a79-goog
\
 
 \ /
  Last update: 2018-02-07 02:51    [W:0.114 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site