Received: by 10.192.165.148 with SMTP id m20csp3038165imm; Mon, 7 May 2018 05:43:10 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoEWxOMUNVxxGOndieT7mBmrBNnFytIKE/xibYJnerbpNyyJX1fBbArMtyJp904Fwqx2Wgd X-Received: by 2002:a63:4c1:: with SMTP id 184-v6mr11092949pge.244.1525696990177; Mon, 07 May 2018 05:43:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525696990; cv=none; d=google.com; s=arc-20160816; b=azHsAbP8tRVapsKBFqEbQmtFlpS444XPF+DJAZfVRVG0jIpPBdtdCbFX7/4sHoQfo4 Z3925r6aJQe3yqDuk9+C8k3xE2kq1cpXooj2W6Tl4MVbFm1NZ1+Omq5WNwQBebXfICDU GGcCaMKQ4phrh4AsnvR80ummHSlUNFg3CJ1b9pb2npruzsRkyvg8vlOjo6LPK8jXZhXB NwKsWXka/XgU607La3DwMlwL5T90c7xDZKObY0FUsu5w0P9yvd4JhGH2+4ekt4NvAFmH gn/olmzYjgHyaacwz04NtaaVAb5hWq1WGGG20VdjKqCjcMerStrizPQ60oIgsGLgeKwA /GZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=A6kuAAFwXVw29pZgy66g8bPPJgbZ1pH5xsmAuMI26Co=; b=Ap50VVDS0Wn/a1AGxK9b9bpJbWkL/N2TX1TqZUj1sF+Ir25senXshGaolvTssPKcFF HIC+HyGSv4B7nDoS4VgBjKzhvpm6aztuItgC1gkOwIv5keMAPDU24FPvtTpbky9xGF+G 8w88t59dhRMz2NwaZQgFPFRfvYbN8MEcOyViktfKWlPHSTevlRPrWgd89RIn7geOMZ+l 6urB8ubcnaLHXLWjy4MUoWFswBVNGoZwiq4kQf6yOXWupDjoPW+j2lCb4k9khoeALErC 5jF1aBvuv436tyf60nQX6pPEjWKc+JTJ7CPCJu5CYqI7kkDkiZaiithte2blPyS5YLXg 7E1w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f12-v6si9984365pgn.479.2018.05.07.05.42.55; Mon, 07 May 2018 05:43:10 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752211AbeEGMmj (ORCPT + 99 others); Mon, 7 May 2018 08:42:39 -0400 Received: from lb2-smtp-cloud9.xs4all.net ([194.109.24.26]:40337 "EHLO lb2-smtp-cloud9.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751860AbeEGMmi (ORCPT ); Mon, 7 May 2018 08:42:38 -0400 Received: from [IPv6:2001:983:e9a7:1:2913:d371:8c33:6f] ([IPv6:2001:983:e9a7:1:2913:d371:8c33:6f]) by smtp-cloud9.xs4all.net with ESMTPA id FfTPfdZ03HgC9FfTRfGPRx; Mon, 07 May 2018 14:42:37 +0200 Subject: Re: [PATCH v9 14/15] v4l: Add V4L2_CAP_FENCES to drivers To: Ezequiel Garcia , linux-media@vger.kernel.org Cc: kernel@collabora.com, Mauro Carvalho Chehab , Shuah Khan , Pawel Osciak , Alexandre Courbot , Sakari Ailus , Brian Starkey , linux-kernel@vger.kernel.org, Gustavo Padovan References: <20180504200612.8763-1-ezequiel@collabora.com> <20180504200612.8763-15-ezequiel@collabora.com> From: Hans Verkuil Message-ID: <1aafc4ae-2c43-a67f-e060-e3afc06c8716@xs4all.nl> Date: Mon, 7 May 2018 14:42:35 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180504200612.8763-15-ezequiel@collabora.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfLnGYIXtLaj3HLOfmfQnxqPD44VQbBMB3NHxziiW57Nd6E/zwCB1+weg+QcbpUB9ngawp5rpw8BLZ/hUOEfWKq01vCFxLw97lgjLu3WD4Wx7+oZQEayQ ZU7Phy/j4QXQ80X1HAKt/3I5tIWHTuLxnfKnW3jxXUk5UqLSS/AGSLNNk69MtVx4QC7iIbbLTPVuKhyPAWvYk/JIU4IbYnm2c+SPXrCn3UFB6FloquJdW8cD WGn1rsH/90Rx5rDeqObRs4ngROhuUW2FcRW/UNHgyAB78XoRKKTnrrU6vUWDUHvm6oQ+2Rt18m4NhvdP5M15rwMQI/ocYkIO3aJk2g1dlyTnjL6PX3AaoaDi VYW+vuQ4m0ViU9U331nx+GhIGzELBwhE78PToWCqbldD/j8ooC41zt6jjA1SPgVNQmVcIuEEC8IQeZNedAYkMVmCFybdLZDxEA+3ZljwagxUYxf9o0CoxPUC /rbN/HNSStmFs6b51aRWLZNxAG9BA3Vwk+4eJkC1mTuWVKJyCLEuaE4jPTL2vby4E4CCi96XQ+RoW7fjeoILvzecHQUYsQ08yhbw3CWVFmvTuMp+50/DYP3Z Qs420H81twwrD4+YkDR1gmke Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/05/18 22:06, Ezequiel Garcia wrote: > From: Gustavo Padovan > > Drivers that use videobuf2 are capable of using fences and > should report that to userspace. > > v9: Add in the core. > > Signed-off-by: Gustavo Padovan > Signed-off-by: Ezequiel Garcia > --- > drivers/media/v4l2-core/v4l2-ioctl.c | 8 ++++++++ > include/media/v4l2-fh.h | 2 -- > 2 files changed, 8 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c > index f75ad954a6f2..2ae527ef0bc7 100644 > --- a/drivers/media/v4l2-core/v4l2-ioctl.c > +++ b/drivers/media/v4l2-core/v4l2-ioctl.c > @@ -1002,12 +1002,20 @@ static int v4l_querycap(const struct v4l2_ioctl_ops *ops, > { > struct v4l2_capability *cap = (struct v4l2_capability *)arg; > struct video_device *vfd = video_devdata(file); > + struct v4l2_fh *vfh = > + test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) ? fh : NULL; > int ret; > > cap->version = LINUX_VERSION_CODE; > cap->device_caps = vfd->device_caps; > cap->capabilities = vfd->device_caps | V4L2_CAP_DEVICE_CAPS; > > + /* If it has a queue or a m2m context, then the > + * device supports fence synchronization. > + */ > + if (vfd->queue || (vfh && vfh->m2m_ctx)) > + cap->device_caps |= V4L2_CAP_FENCES; This should also be set in cap->capabilities. I would actually do this after the ops->vidioc_querycap call to avoid drivers overwriting this capability flag. It also should only be set if device_caps has V4L2_CAP_STREAMING set (not all drivers do!). Note that not all m2m drivers use m2m_ctx, so some of them might have to set the capability manually in the driver. > + > ret = ops->vidioc_querycap(file, fh, cap); > > cap->capabilities |= V4L2_CAP_EXT_PIX_FORMAT; > diff --git a/include/media/v4l2-fh.h b/include/media/v4l2-fh.h > index ea73fef8bdc0..e993ddc06991 100644 > --- a/include/media/v4l2-fh.h > +++ b/include/media/v4l2-fh.h > @@ -57,9 +57,7 @@ struct v4l2_fh { > unsigned int navailable; > u32 sequence; > > -#if IS_ENABLED(CONFIG_V4L2_MEM2MEM_DEV) I prefer is this #if was kept (so it needs to be added to v4l_querycap as well). > struct v4l2_m2m_ctx *m2m_ctx; > -#endif > }; > > /** > Regards, Hans