When queuing buffers allow for passing the request that should be associated with this buffer. If V4L2_BUF_FLAG_REQUEST_FD is set, then request_fd is used as the file descriptor. If a buffer is stored in a request, but not yet queued to the driver, then V4L2_BUF_FLAG_IN_REQUEST is set.
Unified · Split
| @@ -384,7 +384,7 @@ static void __fill_v4l2_buffer(struct vb2_buffer *vb, void *pb) · 383 unmodified lines | |||
| 384 | b->timecode = vbuf->timecode; | 384 | b->timecode = vbuf->timecode; |
| 385 | b->sequence = vbuf->sequence; | 385 | b->sequence = vbuf->sequence; |
| 386 | b->reserved2 = 0; | 386 | b->reserved2 = 0; |
| 387 | b->reserved = 0; | 387 | b->request_fd = 0; |
| 388 | 388 | ||
| 389 | if (q->is_multiplanar) { | 389 | if (q->is_multiplanar) { |
| 390 | /* | 390 | /* |
| @@ -949,7 +949,7 @@ static int cpia2_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf) · 948 unmodified lines | |||
| 949 | buf->m.offset = cam->buffers[buf->index].data - cam->frame_buffer; | 949 | buf->m.offset = cam->buffers[buf->index].data - cam->frame_buffer; |
| 950 | buf->length = cam->frame_size; | 950 | buf->length = cam->frame_size; |
| 951 | buf->reserved2 = 0; | 951 | buf->reserved2 = 0; |
| 952 | buf->reserved = 0; | 952 | buf->request_fd = 0; |
| 953 | memset(&buf->timecode, 0, sizeof(buf->timecode)); | 953 | memset(&buf->timecode, 0, sizeof(buf->timecode)); |
| 954 | 954 | ||
| 955 | DBG("DQBUF #%d status:%d seq:%d length:%d\n", buf->index, | 955 | DBG("DQBUF #%d status:%d seq:%d length:%d\n", buf->index, |
| @@ -482,7 +482,7 @@ struct v4l2_buffer32 { · 481 unmodified lines | |||
| 482 | } m; | 482 | } m; |
| 483 | __u32 length; | 483 | __u32 length; |
| 484 | __u32 reserved2; | 484 | __u32 reserved2; |
| 485 | __u32 reserved; | 485 | __s32 request_fd; |
| 486 | }; | 486 | }; |
| 487 | 487 | ||
| 488 | static int get_v4l2_plane32(struct v4l2_plane __user *p64, | 488 | static int get_v4l2_plane32(struct v4l2_plane __user *p64, |
| @@ -581,6 +581,7 @@ static int get_v4l2_buffer32(struct v4l2_buffer __user *p64, · 92 unmodified lines | |||
| 581 | { | 581 | { |
| 582 | u32 type; | 582 | u32 type; |
| 583 | u32 length; | 583 | u32 length; |
| 584 | s32 request_fd; | ||
| 584 | enum v4l2_memory memory; | 585 | enum v4l2_memory memory; |
| 585 | struct v4l2_plane32 __user *uplane32; | 586 | struct v4l2_plane32 __user *uplane32; |
| 586 | struct v4l2_plane __user *uplane; | 587 | struct v4l2_plane __user *uplane; |
| @@ -595,7 +596,9 @@ static int get_v4l2_buffer32(struct v4l2_buffer __user *p64, · 8 unmodified lines | |||
| 595 | get_user(memory, &p32->memory) || | 596 | get_user(memory, &p32->memory) || |
| 596 | put_user(memory, &p64->memory) || | 597 | put_user(memory, &p64->memory) || |
| 597 | get_user(length, &p32->length) || | 598 | get_user(length, &p32->length) || |
| 598 | put_user(length, &p64->length)) | 599 | put_user(length, &p64->length) || |
| 600 | get_user(request_fd, &p32->request_fd) || | ||
| 601 | put_user(request_fd, &p64->request_fd)) | ||
| 599 | return -EFAULT; | 602 | return -EFAULT; |
| 600 | 603 | ||
| 601 | if (V4L2_TYPE_IS_OUTPUT(type)) | 604 | if (V4L2_TYPE_IS_OUTPUT(type)) |
| @@ -699,7 +702,7 @@ static int put_v4l2_buffer32(struct v4l2_buffer __user *p64, · 97 unmodified lines | |||
| 699 | copy_in_user(&p32->timecode, &p64->timecode, sizeof(p64->timecode)) || | 702 | copy_in_user(&p32->timecode, &p64->timecode, sizeof(p64->timecode)) || |
| 700 | assign_in_user(&p32->sequence, &p64->sequence) || | 703 | assign_in_user(&p32->sequence, &p64->sequence) || |
| 701 | assign_in_user(&p32->reserved2, &p64->reserved2) || | 704 | assign_in_user(&p32->reserved2, &p64->reserved2) || |
| 702 | assign_in_user(&p32->reserved, &p64->reserved) || | 705 | assign_in_user(&p32->request_fd, &p64->request_fd) || |
| 703 | get_user(length, &p64->length) || | 706 | get_user(length, &p64->length) || |
| 704 | put_user(length, &p32->length)) | 707 | put_user(length, &p32->length)) |
| 705 | return -EFAULT; | 708 | return -EFAULT; |
| @@ -474,13 +474,13 @@ static void v4l_print_buffer(const void *arg, bool write_only) · 473 unmodified lines | |||
| 474 | const struct v4l2_plane *plane; | 474 | const struct v4l2_plane *plane; |
| 475 | int i; | 475 | int i; |
| 476 | 476 | ||
| 477 | pr_cont("%02ld:%02d:%02d.%08ld index=%d, type=%s, flags=0x%08x, field=%s, sequence=%d, memory=%s", | 477 | pr_cont("%02ld:%02d:%02d.%08ld index=%d, type=%s, request_fd=%d, flags=0x%08x, field=%s, sequence=%d, memory=%s", |
| 478 | p->timestamp.tv_sec / 3600, | 478 | p->timestamp.tv_sec / 3600, |
| 479 | (int)(p->timestamp.tv_sec / 60) % 60, | 479 | (int)(p->timestamp.tv_sec / 60) % 60, |
| 480 | (int)(p->timestamp.tv_sec % 60), | 480 | (int)(p->timestamp.tv_sec % 60), |
| 481 | (long)p->timestamp.tv_usec, | 481 | (long)p->timestamp.tv_usec, |
| 482 | p->index, | 482 | p->index, |
| 483 | prt_names(p->type, v4l2_type_names), | 483 | prt_names(p->type, v4l2_type_names), p->request_fd, |
| 484 | p->flags, prt_names(p->field, v4l2_field_names), | 484 | p->flags, prt_names(p->field, v4l2_field_names), |
| 485 | p->sequence, prt_names(p->memory, v4l2_memory_names)); | 485 | p->sequence, prt_names(p->memory, v4l2_memory_names)); |
| 486 | 486 | ||
| @@ -917,6 +917,7 @@ struct v4l2_plane { · 916 unmodified lines | |||
| 917 | * @length: size in bytes of the buffer (NOT its payload) for single-plane | 917 | * @length: size in bytes of the buffer (NOT its payload) for single-plane |
| 918 | * buffers (when type != *_MPLANE); number of elements in the | 918 | * buffers (when type != *_MPLANE); number of elements in the |
| 919 | * planes array for multi-plane buffers | 919 | * planes array for multi-plane buffers |
| 920 | * @request_fd: fd of the request that this buffer should use | ||
| 920 | * | 921 | * |
| 921 | * Contains data exchanged by application and driver using one of the Streaming | 922 | * Contains data exchanged by application and driver using one of the Streaming |
| 922 | * I/O methods. | 923 | * I/O methods. |
| @@ -941,7 +942,10 @@ struct v4l2_buffer { · 18 unmodified lines | |||
| 941 | } m; | 942 | } m; |
| 942 | __u32 length; | 943 | __u32 length; |
| 943 | __u32 reserved2; | 944 | __u32 reserved2; |
| 944 | __u32 reserved; | 945 | union { |
| 946 | __s32 request_fd; | ||
| 947 | __u32 reserved; | ||
| 948 | }; | ||
| 945 | }; | 949 | }; |
| 946 | 950 | ||
| 947 | /* Flags for 'flags' field */ | 951 | /* Flags for 'flags' field */ |
| @@ -959,6 +963,8 @@ struct v4l2_buffer { · 11 unmodified lines | |||
| 959 | #define V4L2_BUF_FLAG_BFRAME 0x00000020 | 963 | #define V4L2_BUF_FLAG_BFRAME 0x00000020 |
| 960 | /* Buffer is ready, but the data contained within is corrupted. */ | 964 | /* Buffer is ready, but the data contained within is corrupted. */ |
| 961 | #define V4L2_BUF_FLAG_ERROR 0x00000040 | 965 | #define V4L2_BUF_FLAG_ERROR 0x00000040 |
| 966 | /* Buffer is added to an unqueued request */ | ||
| 967 | #define V4L2_BUF_FLAG_IN_REQUEST 0x00000080 | ||
| 962 | /* timecode field is valid */ | 968 | /* timecode field is valid */ |
| 963 | #define V4L2_BUF_FLAG_TIMECODE 0x00000100 | 969 | #define V4L2_BUF_FLAG_TIMECODE 0x00000100 |
| 964 | /* Buffer is prepared for queuing */ | 970 | /* Buffer is prepared for queuing */ |
| @@ -977,6 +983,8 @@ struct v4l2_buffer { · 12 unmodified lines | |||
| 977 | #define V4L2_BUF_FLAG_TSTAMP_SRC_SOE 0x00010000 | 983 | #define V4L2_BUF_FLAG_TSTAMP_SRC_SOE 0x00010000 |
| 978 | /* mem2mem encoder/decoder */ | 984 | /* mem2mem encoder/decoder */ |
| 979 | #define V4L2_BUF_FLAG_LAST 0x00100000 | 985 | #define V4L2_BUF_FLAG_LAST 0x00100000 |
| 986 | /* request_fd is valid */ | ||
| 987 | #define V4L2_BUF_FLAG_REQUEST_FD 0x00800000 | ||
| 980 | 988 | ||
| 981 | /** | 989 | /** |
| 982 | * struct v4l2_exportbuffer - export of video buffer as DMABUF file descriptor | 990 | * struct v4l2_exportbuffer - export of video buffer as DMABUF file descriptor |