elements in the ``planes`` array. The driver will fill in the
actual number of valid elements in that array.
* - __u32
- - ``reserved2``
+ - ``fence_fd``
-
- - A place holder for future extensions. Drivers and applications
- must set this to 0.
+ - Used to communicate fences file descriptors from userspace to kernel
+ and vice-versa. On :ref:`VIDIOC_QBUF <VIDIOC_QBUF>` when sending
+ an in-fence for V4L2 to wait on, the ``V4L2_BUF_FLAG_IN_FENCE`` flag must
+ be used and this field set to the fence file descriptor of the in-fence
+ If the in-fence is not valid ` VIDIOC_QBUF`` returns an error.
+
+ To get an out-fence back from V4L2 the ``V4L2_BUF_FLAG_OUT_FENCE``
+ must be set, the kernel will return the out-fence file descriptor on
+ this field. If it fails to create the out-fence ``VIDIOC_QBUF` returns
+ an error.
+
+ In all other ioctls V4L2 sets this field to -1 if
+ ``V4L2_BUF_FLAG_IN_FENCE`` and/or ``V4L2_BUF_FLAG_OUT_FENCE`` are set,
+ otherwise this field is set to 0 for backward compatibility.
* - __u32
- ``reserved``
-
- Start Of Exposure. The buffer timestamp has been taken when the
exposure of the frame has begun. This is only valid for the
``V4L2_BUF_TYPE_VIDEO_CAPTURE`` buffer type.
+ * .. _`V4L2-BUF-FLAG-IN-FENCE`:
+
+ - ``V4L2_BUF_FLAG_IN_FENCE``
+ - 0x00200000
+ - Ask V4L2 to wait on the fence passed in the ``fence_fd`` field. The
+ buffer won't be queued to the driver until the fence signals. The order
+ in which buffers are queued is guaranteed to be preserved, so any
+ buffers queued after this buffer will also be blocked until this fence
+ signals. This flag must be set before calling ``VIDIOC_QBUF``. For
+ other ioctls the driver just report the value of the flag.
+
+ If the fence signals the flag is cleared and not reported anymore.
+ If the fence is not valid ``VIDIOC_QBUF`` returns an error.
+
+
+ * .. _`V4L2-BUF-FLAG-OUT-FENCE`:
+
+ - ``V4L2_BUF_FLAG_OUT_FENCE``
+ - 0x00400000
+ - Request for a fence to be attached to the buffer. The driver will fill
+ in the out-fence fd in the ``fence_fd`` field when :ref:`VIDIOC_QBUF
+ <VIDIOC_QBUF>` returns. This flag must be set before calling
+ ``VIDIOC_QBUF``. For other ioctls the driver just report the value of
+ the flag.
+
+ If the creation of the out-fence fails ``VIDIOC_QBUF`` returns an
+ error.
__s32 fd;
} m;
__u32 length;
- __u32 reserved2;
+ __s32 fence_fd;
__u32 reserved;
};
assign_in_user(&up->timestamp.tv_usec, &kp->timestamp.tv_usec) ||
copy_in_user(&up->timecode, &kp->timecode, sizeof(kp->timecode)) ||
assign_in_user(&up->sequence, &kp->sequence) ||
- assign_in_user(&up->reserved2, &kp->reserved2) ||
+ assign_in_user(&up->fence_fd, &kp->fence_fd) ||
assign_in_user(&up->reserved, &kp->reserved) ||
get_user(length, &kp->length) ||
put_user(length, &up->length))