Received: by 10.223.176.46 with SMTP id f43csp285636wra; Thu, 25 Jan 2018 22:06:17 -0800 (PST) X-Google-Smtp-Source: AH8x226/Mv8A9nbMlERe/WLqFebdUOC7ERRBjeaM7LwbfRDKDLxBBbYmlG3PQ3SGDITP2bLVO4WU X-Received: by 2002:a17:902:a03:: with SMTP id 3-v6mr11788404plo.282.1516946777784; Thu, 25 Jan 2018 22:06:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516946777; cv=none; d=google.com; s=arc-20160816; b=bnMnd4Kade3gxagKDoMxLiYILtY3h5ID2cF/cCbNPTFHk4u2wwVb7zwXxUhRcT67NW 7ptOuh7JSMmvQyZGUKMFzx2TPHxidrtyHvqNpJBG1RCsop8kZop/HY9FE9SClK5OKKL7 JkNwHZjU+nxyo31JLrl3KsL6CwZSXb8OapzmMz1UWqu8l9QtjX0ITsqNwLbLmfvfhLX2 c7tJZpwDmzW1Qbs/BXaJs1EvlKazNT21MHrQrEppjkKawoDi+/lE/FeHvJX4klG9NmAf Arooc2tWUA/2opc2PE9P6sPWan4ygHYK1SCGIY20DEg/b6+hYlAdCcEG4L/2rKHszud7 c5Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=RrX2NtRFh291NNLRs6fC8esRrRWh1ExOJby7/0mec/Q=; b=gzlOA82RhZsaoTzCVJxtyU2cahONeSelQFkADeOOkXVOWnj609BIzusSilxhgnGnhY 1qES0ERmy5e1q8B6nD29AwRufUGqFzpycBNbX+Zw2Qrw8Es8P/IuBC8WyseA5WhMdgM7 k4s4YBaZorgBbcpgZ4u1WOeymh136XtJ+wCssV4yf8ZS2NJxYZx6eLhXrVKFcjkYTAw6 BksTCfNQqohX+MHSRN5KnCUZTjvGp+s1dhfsdM+UlnGEA+ZWye5fHc4OybiWKuKMmspG LkLgwXnYSRa5ixaWZPdQaAPGwr68TAu4lanxstT1clQHUz+iy6q6jvZyHJkPxkvAJsrF CxDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=gAqwjQfp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d2si2573460pgn.504.2018.01.25.22.06.03; Thu, 25 Jan 2018 22:06:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=gAqwjQfp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752001AbeAZGEj (ORCPT + 99 others); Fri, 26 Jan 2018 01:04:39 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:33330 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751813AbeAZGCr (ORCPT ); Fri, 26 Jan 2018 01:02:47 -0500 Received: by mail-pf0-f195.google.com with SMTP id t5so7598001pfi.0 for ; Thu, 25 Jan 2018 22:02:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=RrX2NtRFh291NNLRs6fC8esRrRWh1ExOJby7/0mec/Q=; b=gAqwjQfp2dbQshMQbiPHzIdhNJ1lgK+wozfHqYBspwt6WzeAL/JmCepGsMp5a0VXek DVEKx4qGfS7ODnKH1e98j21INwgWLYn6dcI57u1BQOwnDLHs7v9LTPx/D7ZH1ct03QEe vCYo8kMh8gqkrMfvbug9I5O1vc+CUOsscevSk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=RrX2NtRFh291NNLRs6fC8esRrRWh1ExOJby7/0mec/Q=; b=I8AXiWWE9Hllh5AA4sSNKXyIfHWaoVS6IEt7Vx1Z22i5FH60UdInGZ0wxpOHCgylu6 O5owfdi5NBkhPt7XOwxFbu4C+zeVWhfKlSlbLpoVVsviA24ikpbbZc5W9q3//o65bAp/ oDjG26mHEa05hdlpgH2XIKCoTOLF/q17ftOQhLRspiqhfTGxLxFpt+29B4X3qY98UJ/l J6JIFTjX8pN0CYmmM6V7bvrn5QKA5zie/FOpTe5SDbhBiZ3zFVd0j0vb/6O1HG/i4rEl Tuqz6VjLAUYYyhL8bKF1HXAlnTwEa4Pi3pGIbXBUo5/RN7W42jnfJ+dn5Ee3O/22C5/y UG1Q== X-Gm-Message-State: AKwxytei/LLVxYskl/5tHpy3V3vk9sNnG265qKhJFvRvriY7ENjkK89X vf0mfHTnodIuWuUZY/1tXut2lw== X-Received: by 10.98.144.79 with SMTP id a76mr18085508pfe.15.1516946567117; Thu, 25 Jan 2018 22:02:47 -0800 (PST) Received: from acourbot.tok.corp.google.com ([2401:fa00:4:1002:a6cd:a898:e07b:a331]) by smtp.gmail.com with ESMTPSA id j3sm14543201pfh.39.2018.01.25.22.02.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jan 2018 22:02:46 -0800 (PST) From: Alexandre Courbot To: Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Pawel Osciak , Marek Szyprowski , Tomasz Figa , Sakari Ailus , Gustavo Padovan Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Verkuil , Alexandre Courbot Subject: [RFC PATCH 2/8] videodev2.h: Add request field to v4l2_buffer Date: Fri, 26 Jan 2018 15:02:10 +0900 Message-Id: <20180126060216.147918-3-acourbot@chromium.org> X-Mailer: git-send-email 2.16.0.rc1.238.g530d649a79-goog In-Reply-To: <20180126060216.147918-1-acourbot@chromium.org> References: <20180126060216.147918-1-acourbot@chromium.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans Verkuil When queuing buffers allow for passing the request ID that should be associated with this buffer. Signed-off-by: Hans Verkuil [acourbot@chromium.org: make request ID 32-bit] Signed-off-by: Alexandre Courbot --- drivers/media/usb/cpia2/cpia2_v4l.c | 2 +- drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 7 ++++--- drivers/media/v4l2-core/v4l2-ioctl.c | 4 ++-- drivers/media/v4l2-core/videobuf2-v4l2.c | 3 ++- include/media/videobuf2-v4l2.h | 2 ++ include/uapi/linux/videodev2.h | 3 ++- 6 files changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/media/usb/cpia2/cpia2_v4l.c b/drivers/media/usb/cpia2/cpia2_v4l.c index 3dedd83f0b19..7acb6807b306 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 821f2aa299ae..7e4440950c76 100644 --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c @@ -370,7 +370,7 @@ struct v4l2_buffer32 { __s32 fd; } m; __u32 length; - __u32 reserved2; + __u32 request_fd; __u32 reserved; }; @@ -438,7 +438,8 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user get_user(kp->type, &up->type) || get_user(kp->flags, &up->flags) || get_user(kp->memory, &up->memory) || - get_user(kp->length, &up->length)) + get_user(kp->length, &up->length) || + get_user(kp->request_fd, &up->request_fd)) return -EFAULT; if (V4L2_TYPE_IS_OUTPUT(kp->type)) @@ -533,7 +534,7 @@ static int put_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user put_user(kp->timestamp.tv_usec, &up->timestamp.tv_usec) || copy_to_user(&up->timecode, &kp->timecode, sizeof(struct v4l2_timecode)) || put_user(kp->sequence, &up->sequence) || - put_user(kp->reserved2, &up->reserved2) || + put_user(kp->request_fd, &up->request_fd) || put_user(kp->reserved, &up->reserved) || put_user(kp->length, &up->length)) return -EFAULT; diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index ec4ecd5aa8bf..fdd2f784c264 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/drivers/media/v4l2-core/videobuf2-v4l2.c b/drivers/media/v4l2-core/videobuf2-v4l2.c index 0c0669976bdc..0f8edbdebe30 100644 --- a/drivers/media/v4l2-core/videobuf2-v4l2.c +++ b/drivers/media/v4l2-core/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 = vbuf->request_fd; b->reserved = 0; if (q->is_multiplanar) { @@ -320,6 +320,7 @@ static int __fill_vb2_buffer(struct vb2_buffer *vb, } vb->timestamp = 0; vbuf->sequence = 0; + vbuf->request_fd = b->request_fd; if (V4L2_TYPE_IS_MULTIPLANAR(b->type)) { if (b->memory == VB2_MEMORY_USERPTR) { diff --git a/include/media/videobuf2-v4l2.h b/include/media/videobuf2-v4l2.h index 036127c54bbf..d7cf4c66db38 100644 --- a/include/media/videobuf2-v4l2.h +++ b/include/media/videobuf2-v4l2.h @@ -31,6 +31,7 @@ * @field: enum v4l2_field; field order of the image in the buffer * @timecode: frame timecode * @sequence: sequence count of this frame + * @request_fd: fd of the request used by the buffer * * Should contain enough information to be able to cover all the fields * of struct v4l2_buffer at videodev2.h @@ -42,6 +43,7 @@ struct vb2_v4l2_buffer { __u32 field; struct v4l2_timecode timecode; __u32 sequence; + __u32 request_fd; }; /* diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 1c095b5a99c5..89bd716c66a6 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -902,6 +902,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. @@ -925,7 +926,7 @@ struct v4l2_buffer { __s32 fd; } m; __u32 length; - __u32 reserved2; + __s32 request_fd; __u32 reserved; }; -- 2.16.0.rc1.238.g530d649a79-goog