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