From patchwork Fri Jun 16 07:39:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 9790785 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1B13760326 for ; Fri, 16 Jun 2017 07:39:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FC6B28417 for ; Fri, 16 Jun 2017 07:39:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 04B7528634; Fri, 16 Jun 2017 07:39:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 51DD028417 for ; Fri, 16 Jun 2017 07:39:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752758AbdFPHj3 (ORCPT ); Fri, 16 Jun 2017 03:39:29 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:33936 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752369AbdFPHj2 (ORCPT ); Fri, 16 Jun 2017 03:39:28 -0400 Received: by mail-pf0-f193.google.com with SMTP id d5so4718836pfe.1 for ; Fri, 16 Jun 2017 00:39:27 -0700 (PDT) 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=fb7rurJnr0/tX3mZMrYMmoWlmEtjadmq+asDdljaVE0=; b=AzbY/bA+hUUuYqXJuczNwlyyGz1eg58ozy/h/hMlIvwJrnUEy/snHIUkIP3GExRTun +SIGtgovUhWGTdRyaW+LsS7RqR1Jqw0cw3l05RlgeK/jD5G5Dx9inhSil58bn1+tLsop n+7d/60PYeUhYy0oUU3vIxWPklJaUT7boAHRV/DK4adXp2PVCq4Hwmle11VvSBjOjkf+ 3Slh3wb3gKHuZo3Ol7Hf177gIvEknFY+5bjNTn2rKvpZffPd7IFsUbeQ8hHhT1+0t3du jkHQKWy19Km/cwlh5FVVS0RaNsMK732pMU+SQDdaUJgOEokABxh+opk24WRFgLrlzQNm 46XQ== X-Gm-Message-State: AKS2vOwMEippM0Fvj4SmtCRGtXSKk8MOhyebaXHx1eX6UbG77A55CKgh vIIiEfkF4mdmd5FGGn0= X-Received: by 10.98.245.136 with SMTP id b8mr9664086pfm.113.1497598767067; Fri, 16 Jun 2017 00:39:27 -0700 (PDT) Received: from jade.nodan1.kt.home.ne.jp (202-72-64-244.koalanet.ne.jp. [202.72.64.244]) by smtp.gmail.com with ESMTPSA id a2sm2760568pfj.8.2017.06.16.00.39.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Jun 2017 00:39:26 -0700 (PDT) From: Gustavo Padovan To: linux-media@vger.kernel.org Cc: Hans Verkuil , Javier Martinez Canillas , Mauro Carvalho Chehab , Shuah Khan , Gustavo Padovan Subject: [PATCH 01/12] [media] vb2: add explicit fence user API Date: Fri, 16 Jun 2017 16:39:04 +0900 Message-Id: <20170616073915.5027-2-gustavo@padovan.org> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170616073915.5027-1-gustavo@padovan.org> References: <20170616073915.5027-1-gustavo@padovan.org> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Gustavo Padovan Turn the reserved2 field into fence_fd that we will use to send an in-fence to the kernel and return an out-fence from the kernel to userspace. Two new flags were added, V4L2_BUF_FLAG_IN_FENCE, that should be used when sending a fence to the kernel to be waited on, and V4L2_BUF_FLAG_OUT_FENCE, to ask the kernel to give back an out-fence. Signed-off-by: Gustavo Padovan --- drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 4 ++-- drivers/media/v4l2-core/videobuf2-v4l2.c | 2 +- include/uapi/linux/videodev2.h | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c index 6f52970..8f6ab85 100644 --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c @@ -367,7 +367,7 @@ struct v4l2_buffer32 { __s32 fd; } m; __u32 length; - __u32 reserved2; + __s32 fence_fd; __u32 reserved; }; @@ -530,7 +530,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->fence_fd, &up->fence_fd) || put_user(kp->reserved, &up->reserved) || put_user(kp->length, &up->length)) return -EFAULT; diff --git a/drivers/media/v4l2-core/videobuf2-v4l2.c b/drivers/media/v4l2-core/videobuf2-v4l2.c index 0c06699..110fb45 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->fence_fd = -1; b->reserved = 0; if (q->is_multiplanar) { diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 2b8feb8..750d511 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -916,7 +916,7 @@ struct v4l2_buffer { __s32 fd; } m; __u32 length; - __u32 reserved2; + __s32 fence_fd; __u32 reserved; }; @@ -953,6 +953,8 @@ struct v4l2_buffer { #define V4L2_BUF_FLAG_TSTAMP_SRC_SOE 0x00010000 /* mem2mem encoder/decoder */ #define V4L2_BUF_FLAG_LAST 0x00100000 +#define V4L2_BUF_FLAG_IN_FENCE 0x00200000 +#define V4L2_BUF_FLAG_OUT_FENCE 0x00400000 /** * struct v4l2_exportbuffer - export of video buffer as DMABUF file descriptor