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