1From 0612df95cea841b891420ccccbc71c7fb46a5c25 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/7] libv4l mplane plugin add exbuf_ioctl for dmabuf
5
6Signed-off-by: vicent.chi <vicent.chi@rock-chips.com>
7---
8 lib/libv4l-mplane/libv4l-mplane.c | 14 +++++++++++++-
9 1 file changed, 13 insertions(+), 1 deletion(-)
10
11diff --git a/lib/libv4l-mplane/libv4l-mplane.c b/lib/libv4l-mplane/libv4l-mplane.c
12index b30840a..db22b0b 100644
13--- a/lib/libv4l-mplane/libv4l-mplane.c
14+++ b/lib/libv4l-mplane/libv4l-mplane.c
15@@ -539,6 +539,17 @@ static int buf_ioctl(int fd, unsigned long int cmd, struct v4l2_buffer *arg)
16 	return ret;
17 }
18
19+static int exbuf_ioctl(int fd, unsigned long int cmd, struct v4l2_exportbuffer *arg)
20+{
21+	if (arg->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ||
22+		arg->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
23+		errno = EINVAL;
24+		return -1;
25+	}
26+	arg->type = convert_type(arg->type);
27+	return SYS_IOCTL(fd, cmd, arg);
28+}
29+
30 static int plugin_ioctl(void *dev_ops_priv, int fd,
31 			unsigned long int cmd, void *arg)
32 {
33@@ -580,7 +591,8 @@ static int plugin_ioctl(void *dev_ops_priv, int fd,
34
35 		return SYS_IOCTL(fd, cmd, &type);
36 	}
37-	/* CASE VIDIOC_EXPBUF: */
38+	case VIDIOC_EXPBUF:
39+		return exbuf_ioctl(fd, cmd, arg);
40 	default:
41 		return SYS_IOCTL(fd, cmd, arg);
42 	}
43--
442.20.1
45
46