1From bd05429590bddfdea0f079c2990e0df30cbc5e46 Mon Sep 17 00:00:00 2001 2From: "vicent.chi" <vicent.chi@rock-chips.com> 3Date: Sat, 28 Mar 2020 18:03:57 +0800 4Subject: [PATCH 4/6] libv4l: mplane: Support VIDIOC_EXPBUF for dmabuf 5 6Signed-off-by: vicent.chi <vicent.chi@rock-chips.com> 7Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> 8--- 9 lib/libv4l-mplane/libv4l-mplane.c | 14 +++++++++++++- 10 1 file changed, 13 insertions(+), 1 deletion(-) 11 12diff --git a/lib/libv4l-mplane/libv4l-mplane.c b/lib/libv4l-mplane/libv4l-mplane.c 13index b30840a..db22b0b 100644 14--- a/lib/libv4l-mplane/libv4l-mplane.c 15+++ b/lib/libv4l-mplane/libv4l-mplane.c 16@@ -539,6 +539,17 @@ static int buf_ioctl(int fd, unsigned long int cmd, struct v4l2_buffer *arg) 17 return ret; 18 } 19 20+static int exbuf_ioctl(int fd, unsigned long int cmd, struct v4l2_exportbuffer *arg) 21+{ 22+ if (arg->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE || 23+ arg->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { 24+ errno = EINVAL; 25+ return -1; 26+ } 27+ arg->type = convert_type(arg->type); 28+ return SYS_IOCTL(fd, cmd, arg); 29+} 30+ 31 static int plugin_ioctl(void *dev_ops_priv, int fd, 32 unsigned long int cmd, void *arg) 33 { 34@@ -580,7 +591,8 @@ static int plugin_ioctl(void *dev_ops_priv, int fd, 35 36 return SYS_IOCTL(fd, cmd, &type); 37 } 38- /* CASE VIDIOC_EXPBUF: */ 39+ case VIDIOC_EXPBUF: 40+ return exbuf_ioctl(fd, cmd, arg); 41 default: 42 return SYS_IOCTL(fd, cmd, arg); 43 } 44-- 452.20.1 46 47