[PATCHv10 17/26] Documentation: media: description of DMABUF exporting in V4L2

2012-10-15 Thread Hans Verkuil
On Wed October 10 2012 16:46:36 Tomasz Stanislawski wrote:
> This patch adds description and usage examples for exporting
> DMABUF file descriptor in V4L2.
> 
> Signed-off-by: Tomasz Stanislawski 
> Signed-off-by: Kyungmin Park 
> CC: linux-doc at vger.kernel.org
> ---
>  Documentation/DocBook/media/v4l/compat.xml|3 +
>  Documentation/DocBook/media/v4l/io.xml|3 +
>  Documentation/DocBook/media/v4l/v4l2.xml  |1 +
>  Documentation/DocBook/media/v4l/vidioc-expbuf.xml |  212 
> +
>  4 files changed, 219 insertions(+)
>  create mode 100644 Documentation/DocBook/media/v4l/vidioc-expbuf.xml
> 

Acked-by: Hans Verkuil 


Re: [PATCHv10 17/26] Documentation: media: description of DMABUF exporting in V4L2

2012-10-15 Thread Hans Verkuil
On Wed October 10 2012 16:46:36 Tomasz Stanislawski wrote:
> This patch adds description and usage examples for exporting
> DMABUF file descriptor in V4L2.
> 
> Signed-off-by: Tomasz Stanislawski 
> Signed-off-by: Kyungmin Park 
> CC: linux-...@vger.kernel.org
> ---
>  Documentation/DocBook/media/v4l/compat.xml|3 +
>  Documentation/DocBook/media/v4l/io.xml|3 +
>  Documentation/DocBook/media/v4l/v4l2.xml  |1 +
>  Documentation/DocBook/media/v4l/vidioc-expbuf.xml |  212 
> +
>  4 files changed, 219 insertions(+)
>  create mode 100644 Documentation/DocBook/media/v4l/vidioc-expbuf.xml
> 

Acked-by: Hans Verkuil 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv10 17/26] Documentation: media: description of DMABUF exporting in V4L2

2012-10-10 Thread Tomasz Stanislawski
This patch adds description and usage examples for exporting
DMABUF file descriptor in V4L2.

Signed-off-by: Tomasz Stanislawski 
Signed-off-by: Kyungmin Park 
CC: linux-doc at vger.kernel.org
---
 Documentation/DocBook/media/v4l/compat.xml|3 +
 Documentation/DocBook/media/v4l/io.xml|3 +
 Documentation/DocBook/media/v4l/v4l2.xml  |1 +
 Documentation/DocBook/media/v4l/vidioc-expbuf.xml |  212 +
 4 files changed, 219 insertions(+)
 create mode 100644 Documentation/DocBook/media/v4l/vidioc-expbuf.xml

diff --git a/Documentation/DocBook/media/v4l/compat.xml 
b/Documentation/DocBook/media/v4l/compat.xml
index 50eb630..3dd9e78 100644
--- a/Documentation/DocBook/media/v4l/compat.xml
+++ b/Documentation/DocBook/media/v4l/compat.xml
@@ -2590,6 +2590,9 @@ ioctls.
  Importing DMABUF file descriptors as a new IO method described
  in .
 
+
+ Exporting DMABUF files using &VIDIOC-EXPBUF; ioctl.
+
   
 

diff --git a/Documentation/DocBook/media/v4l/io.xml 
b/Documentation/DocBook/media/v4l/io.xml
index 0abb5cb..81d0ed4 100644
--- a/Documentation/DocBook/media/v4l/io.xml
+++ b/Documentation/DocBook/media/v4l/io.xml
@@ -488,6 +488,9 @@ DMA buffer from userspace using a file descriptor 
previously exported for a
 different or the same device (known as the importer role), or both. This
 section describes the DMABUF importer role API in V4L2.

+Refer to  DMABUF exporting  for
+details about exporting V4L2 buffers as DMABUF file descriptors.
+
 Input and output devices support the streaming I/O method when the
 V4L2_CAP_STREAMING flag in the
 capabilities field of &v4l2-capability; returned by
diff --git a/Documentation/DocBook/media/v4l/v4l2.xml 
b/Documentation/DocBook/media/v4l/v4l2.xml
index 10ccde9..4d110b1 100644
--- a/Documentation/DocBook/media/v4l/v4l2.xml
+++ b/Documentation/DocBook/media/v4l/v4l2.xml
@@ -543,6 +543,7 @@ and discussions on the V4L mailing list.
 &sub-enuminput;
 &sub-enumoutput;
 &sub-enumstd;
+&sub-expbuf;
 &sub-g-audio;
 &sub-g-audioout;
 &sub-g-crop;
diff --git a/Documentation/DocBook/media/v4l/vidioc-expbuf.xml 
b/Documentation/DocBook/media/v4l/vidioc-expbuf.xml
new file mode 100644
index 000..72dfbd2
--- /dev/null
+++ b/Documentation/DocBook/media/v4l/vidioc-expbuf.xml
@@ -0,0 +1,212 @@
+
+
+  
+ioctl VIDIOC_EXPBUF
+&manvol;
+  
+
+  
+VIDIOC_EXPBUF
+Export a buffer as a DMABUF file descriptor.
+  
+
+  
+
+  
+   int ioctl
+   int fd
+   int request
+   struct v4l2_exportbuffer 
*argp
+  
+
+  
+
+  
+Arguments
+
+
+  
+   fd
+   
+ &fd;
+   
+  
+  
+   request
+   
+ VIDIOC_EXPBUF
+   
+  
+  
+   argp
+   
+ 
+   
+  
+
+  
+
+  
+Description
+
+
+  Experimental
+  This is an  experimental 
+  interface and may change in the future.
+
+
+This ioctl is an extension to the memory
+mapping I/O method, therefore it is available only for
+V4L2_MEMORY_MMAP buffers.  It can be used to export a
+buffer as a DMABUF file at any time after buffers have been allocated with the
+&VIDIOC-REQBUFS; ioctl.
+
+ To export a buffer, applications fill &v4l2-exportbuffer;.  The
+ type  field is set to the same buffer type as was
+previously used with  &v4l2-requestbuffers; type .
+Applications must also set the  index  field. Valid
+index numbers range from zero to the number of buffers allocated with
+&VIDIOC-REQBUFS; (&v4l2-requestbuffers; count )
+minus one.  For the multi-planar API, applications set the  plane
+ field to the index of the plane to be exported. Valid planes
+range from zero to the maximal number of valid planes for the currently active
+format. For the single-planar API, applications must set  plane
+ to zero.  Additional flags may be posted in the 
+flags  field.  Refer to a manual for open() for details.
+Currently only O_CLOEXEC is supported.  All other fields must be set to zero.
+In the case of multi-planar API, every plane is exported separately using
+multiple  VIDIOC_EXPBUF  calls. 
+
+ After calling VIDIOC_EXPBUF the  fd
+ field will be set by a driver.  This is a DMABUF file
+descriptor. The application may pass it to other DMABUF-aware devices. Refer to
+DMABUF importing for details about importing
+DMABUF files into V4L2 nodes. It is recommended to close a DMABUF file when it
+is no longer used to allow the associated memory to be reclaimed. 
+
+  
+  
+   
+  Examples
+
+  
+   Exporting a buffer.
+   
+int buffer_export(int v4lfd, &v4l2-buf-type; bt, int index, int *dmafd)
+{
+   &v4l2-exportbuffer; expbuf;
+
+   memset(&expbuf, 0, sizeof(expbuf));
+   expbuf.type = bt;
+   expbuf.index = index;
+   if (ioctl(v4lfd, &VIDIOC-EXPBUF;, &expbuf) == -1) {
+   perror("VIDIOC_EXPBUF");
+   return -1;
+   }
+

[PATCHv10 17/26] Documentation: media: description of DMABUF exporting in V4L2

2012-10-10 Thread Tomasz Stanislawski
This patch adds description and usage examples for exporting
DMABUF file descriptor in V4L2.

Signed-off-by: Tomasz Stanislawski 
Signed-off-by: Kyungmin Park 
CC: linux-...@vger.kernel.org
---
 Documentation/DocBook/media/v4l/compat.xml|3 +
 Documentation/DocBook/media/v4l/io.xml|3 +
 Documentation/DocBook/media/v4l/v4l2.xml  |1 +
 Documentation/DocBook/media/v4l/vidioc-expbuf.xml |  212 +
 4 files changed, 219 insertions(+)
 create mode 100644 Documentation/DocBook/media/v4l/vidioc-expbuf.xml

diff --git a/Documentation/DocBook/media/v4l/compat.xml 
b/Documentation/DocBook/media/v4l/compat.xml
index 50eb630..3dd9e78 100644
--- a/Documentation/DocBook/media/v4l/compat.xml
+++ b/Documentation/DocBook/media/v4l/compat.xml
@@ -2590,6 +2590,9 @@ ioctls.
  Importing DMABUF file descriptors as a new IO method described
  in .
 
+
+ Exporting DMABUF files using &VIDIOC-EXPBUF; ioctl.
+
   
 
 
diff --git a/Documentation/DocBook/media/v4l/io.xml 
b/Documentation/DocBook/media/v4l/io.xml
index 0abb5cb..81d0ed4 100644
--- a/Documentation/DocBook/media/v4l/io.xml
+++ b/Documentation/DocBook/media/v4l/io.xml
@@ -488,6 +488,9 @@ DMA buffer from userspace using a file descriptor 
previously exported for a
 different or the same device (known as the importer role), or both. This
 section describes the DMABUF importer role API in V4L2.
 
+Refer to  DMABUF exporting  for
+details about exporting V4L2 buffers as DMABUF file descriptors.
+
 Input and output devices support the streaming I/O method when the
 V4L2_CAP_STREAMING flag in the
 capabilities field of &v4l2-capability; returned by
diff --git a/Documentation/DocBook/media/v4l/v4l2.xml 
b/Documentation/DocBook/media/v4l/v4l2.xml
index 10ccde9..4d110b1 100644
--- a/Documentation/DocBook/media/v4l/v4l2.xml
+++ b/Documentation/DocBook/media/v4l/v4l2.xml
@@ -543,6 +543,7 @@ and discussions on the V4L mailing list.
 &sub-enuminput;
 &sub-enumoutput;
 &sub-enumstd;
+&sub-expbuf;
 &sub-g-audio;
 &sub-g-audioout;
 &sub-g-crop;
diff --git a/Documentation/DocBook/media/v4l/vidioc-expbuf.xml 
b/Documentation/DocBook/media/v4l/vidioc-expbuf.xml
new file mode 100644
index 000..72dfbd2
--- /dev/null
+++ b/Documentation/DocBook/media/v4l/vidioc-expbuf.xml
@@ -0,0 +1,212 @@
+
+
+  
+ioctl VIDIOC_EXPBUF
+&manvol;
+  
+
+  
+VIDIOC_EXPBUF
+Export a buffer as a DMABUF file descriptor.
+  
+
+  
+
+  
+   int ioctl
+   int fd
+   int request
+   struct v4l2_exportbuffer 
*argp
+  
+
+  
+
+  
+Arguments
+
+
+  
+   fd
+   
+ &fd;
+   
+  
+  
+   request
+   
+ VIDIOC_EXPBUF
+   
+  
+  
+   argp
+   
+ 
+   
+  
+
+  
+
+  
+Description
+
+
+  Experimental
+  This is an  experimental 
+  interface and may change in the future.
+
+
+This ioctl is an extension to the memory
+mapping I/O method, therefore it is available only for
+V4L2_MEMORY_MMAP buffers.  It can be used to export a
+buffer as a DMABUF file at any time after buffers have been allocated with the
+&VIDIOC-REQBUFS; ioctl.
+
+ To export a buffer, applications fill &v4l2-exportbuffer;.  The
+ type  field is set to the same buffer type as was
+previously used with  &v4l2-requestbuffers; type .
+Applications must also set the  index  field. Valid
+index numbers range from zero to the number of buffers allocated with
+&VIDIOC-REQBUFS; (&v4l2-requestbuffers; count )
+minus one.  For the multi-planar API, applications set the  plane
+ field to the index of the plane to be exported. Valid planes
+range from zero to the maximal number of valid planes for the currently active
+format. For the single-planar API, applications must set  plane
+ to zero.  Additional flags may be posted in the 
+flags  field.  Refer to a manual for open() for details.
+Currently only O_CLOEXEC is supported.  All other fields must be set to zero.
+In the case of multi-planar API, every plane is exported separately using
+multiple  VIDIOC_EXPBUF  calls. 
+
+ After calling VIDIOC_EXPBUF the  fd
+ field will be set by a driver.  This is a DMABUF file
+descriptor. The application may pass it to other DMABUF-aware devices. Refer to
+DMABUF importing for details about importing
+DMABUF files into V4L2 nodes. It is recommended to close a DMABUF file when it
+is no longer used to allow the associated memory to be reclaimed. 
+
+  
+  
+   
+  Examples
+
+  
+   Exporting a buffer.
+   
+int buffer_export(int v4lfd, &v4l2-buf-type; bt, int index, int *dmafd)
+{
+   &v4l2-exportbuffer; expbuf;
+
+   memset(&expbuf, 0, sizeof(expbuf));
+   expbuf.type = bt;
+   expbuf.index = index;
+   if (ioctl(v4lfd, &VIDIOC-EXPBUF;, &expbuf) == -1) {
+   perror("VIDIOC_EXPBUF");
+   return -1;
+   }
+
+