linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexandre Courbot <acourbot@chromium.org>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Pawel Osciak <posciak@chromium.org>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Tomasz Figa <tfiga@chromium.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Gustavo Padovan <gustavo.padovan@collabora.com>,
	Linux Media Mailing List <linux-media@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Hans Verkuil <hans.verkuil@cisco.com>
Subject: Re: [RFCv4 10/21] videodev2.h: Add request_fd field to v4l2_buffer
Date: Wed, 21 Feb 2018 15:01:31 +0900	[thread overview]
Message-ID: <CAPBb6MXFTfG2zrK0eU0J6ibdmVqQJH8T6TN2uBhjTRagbzC+yA@mail.gmail.com> (raw)
In-Reply-To: <eac9e222-b605-77b6-4428-66e20f3d1269@xs4all.nl>

On Wed, Feb 21, 2018 at 12:20 AM, Hans Verkuil <hverkuil@xs4all.nl> wrote:
> On 02/20/18 05:44, Alexandre Courbot wrote:
>> From: Hans Verkuil <hans.verkuil@cisco.com>
>>
>> When queuing buffers allow for passing the request that should
>> be associated with this buffer.
>>
>> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
>> [acourbot@chromium.org: make request ID 32-bit]
>> Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
>> ---
>>  drivers/media/common/videobuf2/videobuf2-v4l2.c | 2 +-
>>  drivers/media/usb/cpia2/cpia2_v4l.c             | 2 +-
>>  drivers/media/v4l2-core/v4l2-compat-ioctl32.c   | 9 ++++++---
>>  drivers/media/v4l2-core/v4l2-ioctl.c            | 4 ++--
>>  include/uapi/linux/videodev2.h                  | 3 ++-
>>  5 files changed, 12 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/media/common/videobuf2/videobuf2-v4l2.c b/drivers/media/common/videobuf2/videobuf2-v4l2.c
>> index 886a2d8d5c6c..6d4d184aa68e 100644
>> --- a/drivers/media/common/videobuf2/videobuf2-v4l2.c
>> +++ b/drivers/media/common/videobuf2/videobuf2-v4l2.c
>> @@ -203,7 +203,7 @@ static void __fill_v4l2_buffer(struct vb2_buffer *vb, void *pb)
>>       b->timestamp = ns_to_timeval(vb->timestamp);
>>       b->timecode = vbuf->timecode;
>>       b->sequence = vbuf->sequence;
>> -     b->reserved2 = 0;
>> +     b->request_fd = 0;
>>       b->reserved = 0;
>>
>>       if (q->is_multiplanar) {
>> diff --git a/drivers/media/usb/cpia2/cpia2_v4l.c b/drivers/media/usb/cpia2/cpia2_v4l.c
>> index 99f106b13280..af42ce3ceb48 100644
>> --- a/drivers/media/usb/cpia2/cpia2_v4l.c
>> +++ b/drivers/media/usb/cpia2/cpia2_v4l.c
>> @@ -948,7 +948,7 @@ static int cpia2_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf)
>>       buf->sequence = cam->buffers[buf->index].seq;
>>       buf->m.offset = cam->buffers[buf->index].data - cam->frame_buffer;
>>       buf->length = cam->frame_size;
>> -     buf->reserved2 = 0;
>> +     buf->request_fd = 0;
>>       buf->reserved = 0;
>>       memset(&buf->timecode, 0, sizeof(buf->timecode));
>>
>> diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
>> index 5198c9eeb348..32bf47489a2e 100644
>> --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
>> +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
>> @@ -386,7 +386,7 @@ struct v4l2_buffer32 {
>>               __s32           fd;
>>       } m;
>>       __u32                   length;
>> -     __u32                   reserved2;
>> +     __s32                   request_fd;
>>       __u32                   reserved;
>>  };
>>
>> @@ -486,6 +486,7 @@ static int get_v4l2_buffer32(struct v4l2_buffer __user *kp,
>>  {
>>       u32 type;
>>       u32 length;
>> +     s32 request_fd;
>>       enum v4l2_memory memory;
>>       struct v4l2_plane32 __user *uplane32;
>>       struct v4l2_plane __user *uplane;
>> @@ -500,7 +501,9 @@ static int get_v4l2_buffer32(struct v4l2_buffer __user *kp,
>>           get_user(memory, &up->memory) ||
>>           put_user(memory, &kp->memory) ||
>>           get_user(length, &up->length) ||
>> -         put_user(length, &kp->length))
>> +         put_user(length, &kp->length) ||
>> +         get_user(request_fd, &up->request_fd) ||
>> +         put_user(request_fd, &kp->request_fd))
>>               return -EFAULT;
>>
>>       if (V4L2_TYPE_IS_OUTPUT(type))
>> @@ -604,7 +607,7 @@ static int put_v4l2_buffer32(struct v4l2_buffer __user *kp,
>>           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->request_fd, &kp->request_fd) ||
>>           assign_in_user(&up->reserved, &kp->reserved) ||
>>           get_user(length, &kp->length) ||
>>           put_user(length, &up->length))
>> diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
>> index 260288ca4f55..7bfeaf233d5a 100644
>> --- a/drivers/media/v4l2-core/v4l2-ioctl.c
>> +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
>> @@ -437,13 +437,13 @@ static void v4l_print_buffer(const void *arg, bool write_only)
>>       const struct v4l2_plane *plane;
>>       int i;
>>
>> -     pr_cont("%02ld:%02d:%02d.%08ld index=%d, type=%s, flags=0x%08x, field=%s, sequence=%d, memory=%s",
>> +     pr_cont("%02ld:%02d:%02d.%08ld index=%d, type=%s, request_fd=%u, flags=0x%08x, field=%s, sequence=%d, memory=%s",
>>                       p->timestamp.tv_sec / 3600,
>>                       (int)(p->timestamp.tv_sec / 60) % 60,
>>                       (int)(p->timestamp.tv_sec % 60),
>>                       (long)p->timestamp.tv_usec,
>>                       p->index,
>> -                     prt_names(p->type, v4l2_type_names),
>> +                     prt_names(p->type, v4l2_type_names), p->request_fd,
>>                       p->flags, prt_names(p->field, v4l2_field_names),
>>                       p->sequence, prt_names(p->memory, v4l2_memory_names));
>>
>> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
>> index 982718965180..4fd46ae8fad5 100644
>> --- a/include/uapi/linux/videodev2.h
>> +++ b/include/uapi/linux/videodev2.h
>> @@ -909,6 +909,7 @@ struct v4l2_plane {
>>   * @length:  size in bytes of the buffer (NOT its payload) for single-plane
>>   *           buffers (when type != *_MPLANE); number of elements in the
>>   *           planes array for multi-plane buffers
>> + * @request_fd: fd of the request that this buffer should use
>>   *
>>   * Contains data exchanged by application and driver using one of the Streaming
>>   * I/O methods.
>> @@ -932,7 +933,7 @@ struct v4l2_buffer {
>>               __s32           fd;
>>       } m;
>>       __u32                   length;
>> -     __u32                   reserved2;
>> +     __s32                   request_fd;
>
> This should be:
>
>         union {
>                 __s32           request_fd;
>                 __u32           reserved2;
>         };
>
> Otherwise any existing application that sets 'reserved2 = 0;' would fail.
> I encountered this issue when compiling v4l-utils.

Fixed, thanks!

  reply	other threads:[~2018-02-21  6:03 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-20  4:44 [RFCv4 00/21] Request API Alexandre Courbot
2018-02-20  4:44 ` [RFCv4 01/21] media: add request API core and UAPI Alexandre Courbot
2018-02-20 10:36   ` Hans Verkuil
2018-02-21  6:01     ` Alexandre Courbot
2018-02-21  7:29       ` Hans Verkuil
2018-02-22  9:30         ` Alexandre Courbot
2018-02-22  9:38           ` Hans Verkuil
2018-02-20  4:44 ` [RFCv4 02/21] v4l2-ctrls: v4l2_ctrl_add_handler: add from_other_dev Alexandre Courbot
2018-02-20  4:44 ` [RFCv4 03/21] v4l2-ctrls: prepare internal structs for request API Alexandre Courbot
2018-02-20  4:44 ` [RFCv4 04/21] v4l2-ctrls: add core " Alexandre Courbot
2018-02-20  4:44 ` [RFCv4 05/21] v4l2-ctrls: use ref in helper instead of ctrl Alexandre Courbot
2018-02-20  4:44 ` [RFCv4 06/21] v4l2-ctrls: support g/s_ext_ctrls for requests Alexandre Courbot
2018-02-20  4:44 ` [RFCv4 07/21] v4l2-ctrls: add v4l2_ctrl_request_setup Alexandre Courbot
2018-02-20  4:44 ` [RFCv4 08/21] [WAR] v4l2-ctrls: do not clone non-standard controls Alexandre Courbot
2018-02-20 13:05   ` Hans Verkuil
2018-02-20  4:44 ` [RFCv4 09/21] v4l2: add request API support Alexandre Courbot
2018-02-20  7:36   ` Philippe Ombredanne
2018-02-20  8:03     ` Alexandre Courbot
2018-02-20 13:25   ` Hans Verkuil
2018-02-21  6:01     ` Alexandre Courbot
2018-02-20  4:44 ` [RFCv4 10/21] videodev2.h: Add request_fd field to v4l2_buffer Alexandre Courbot
2018-02-20 15:20   ` Hans Verkuil
2018-02-21  6:01     ` Alexandre Courbot [this message]
2018-02-20  4:44 ` [RFCv4 11/21] media: v4l2_fh: add request entity field Alexandre Courbot
2018-02-20 15:24   ` Hans Verkuil
2018-02-21  6:01     ` Alexandre Courbot
2018-02-20  4:44 ` [RFCv4 12/21] media: videobuf2: add support for requests Alexandre Courbot
2018-02-20  4:44 ` [RFCv4 13/21] media: videobuf2-v4l2: " Alexandre Courbot
2018-02-20 16:18   ` Hans Verkuil
2018-02-21  6:01     ` Alexandre Courbot
2018-02-23  6:34     ` Tomasz Figa
2018-02-23  7:21       ` Hans Verkuil
2018-02-23  7:33         ` Tomasz Figa
2018-02-23  7:43           ` Hans Verkuil
2018-03-07 16:50   ` [RFCv4,13/21] " Paul Kocialkowski
2018-03-08 13:50     ` Alexandre Courbot
2018-02-20  4:44 ` [RFCv4 14/21] videodev2.h: add request_fd field to v4l2_ext_controls Alexandre Courbot
2018-02-20  4:44 ` [RFCv4 15/21] v4l2-ctrls: support requests in EXT_CTRLS ioctls Alexandre Courbot
2018-02-20  4:44 ` [RFCv4 16/21] v4l2: video_device: support for creating requests Alexandre Courbot
2018-02-20 16:35   ` Hans Verkuil
2018-02-21  6:01     ` Alexandre Courbot
2018-02-21  7:37       ` Hans Verkuil
2018-02-20  4:44 ` [RFCv4 17/21] media: mem2mem: support for requests Alexandre Courbot
2018-02-20  4:44 ` [RFCv4 18/21] Documentation: v4l: document request API Alexandre Courbot
2018-02-20  4:44 ` [RFCv4 19/21] media: vim2m: add request support Alexandre Courbot
2018-03-07 16:37   ` [RFCv4,19/21] " Paul Kocialkowski
2018-03-08 13:48     ` Alexandre Courbot
2018-03-09 14:35       ` Paul Kocialkowski
2018-03-13 10:24         ` Alexandre Courbot
2018-03-14 13:25           ` Paul Kocialkowski
2018-03-19  9:17             ` Alexandre Courbot
2018-03-11 19:40     ` Dmitry Osipenko
2018-03-11 19:42     ` Dmitry Osipenko
2018-03-12  8:10       ` Paul Kocialkowski
2018-03-12  8:15         ` Tomasz Figa
2018-03-12  8:25           ` Paul Kocialkowski
2018-03-12  8:29             ` Tomasz Figa
2018-03-12 12:21               ` Dmitry Osipenko
2018-03-12 12:32           ` Alexandre Courbot
2018-03-12 14:44             ` Dmitry Osipenko
2018-02-20  4:44 ` [RFCv4 20/21] media: vivid: add request support for the video capture device Alexandre Courbot
2018-02-20  4:44 ` [RFCv4 21/21] [WIP] media: media-device: support for creating requests Alexandre Courbot
2018-02-20  4:54 ` [RFCv4 00/21] Request API Alexandre Courbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPBb6MXFTfG2zrK0eU0J6ibdmVqQJH8T6TN2uBhjTRagbzC+yA@mail.gmail.com \
    --to=acourbot@chromium.org \
    --cc=gustavo.padovan@collabora.com \
    --cc=hans.verkuil@cisco.com \
    --cc=hverkuil@xs4all.nl \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mchehab@kernel.org \
    --cc=posciak@chromium.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tfiga@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).