From bd05429590bddfdea0f079c2990e0df30cbc5e46 Mon Sep 17 00:00:00 2001 
 | 
From: "vicent.chi" <vicent.chi@rock-chips.com> 
 | 
Date: Sat, 28 Mar 2020 18:03:57 +0800 
 | 
Subject: [PATCH 4/6] libv4l: mplane: Support VIDIOC_EXPBUF for dmabuf 
 | 
  
 | 
Signed-off-by: vicent.chi <vicent.chi@rock-chips.com> 
 | 
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> 
 | 
--- 
 | 
 lib/libv4l-mplane/libv4l-mplane.c | 14 +++++++++++++- 
 | 
 1 file changed, 13 insertions(+), 1 deletion(-) 
 | 
  
 | 
diff --git a/lib/libv4l-mplane/libv4l-mplane.c b/lib/libv4l-mplane/libv4l-mplane.c 
 | 
index b30840a..db22b0b 100644 
 | 
--- a/lib/libv4l-mplane/libv4l-mplane.c 
 | 
+++ b/lib/libv4l-mplane/libv4l-mplane.c 
 | 
@@ -539,6 +539,17 @@ static int buf_ioctl(int fd, unsigned long int cmd, struct v4l2_buffer *arg) 
 | 
     return ret; 
 | 
 } 
 | 
  
 | 
+static int exbuf_ioctl(int fd, unsigned long int cmd, struct v4l2_exportbuffer *arg) 
 | 
+{ 
 | 
+    if (arg->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE || 
 | 
+        arg->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { 
 | 
+        errno = EINVAL; 
 | 
+        return -1; 
 | 
+    } 
 | 
+    arg->type = convert_type(arg->type); 
 | 
+    return SYS_IOCTL(fd, cmd, arg); 
 | 
+} 
 | 
+ 
 | 
 static int plugin_ioctl(void *dev_ops_priv, int fd, 
 | 
             unsigned long int cmd, void *arg) 
 | 
 { 
 | 
@@ -580,7 +591,8 @@ static int plugin_ioctl(void *dev_ops_priv, int fd, 
 | 
  
 | 
         return SYS_IOCTL(fd, cmd, &type); 
 | 
     } 
 | 
-    /* CASE VIDIOC_EXPBUF: */ 
 | 
+    case VIDIOC_EXPBUF: 
 | 
+        return exbuf_ioctl(fd, cmd, arg); 
 | 
     default: 
 | 
         return SYS_IOCTL(fd, cmd, arg); 
 | 
     } 
 | 
--  
 | 
2.20.1 
 |