Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp371171ybv; Wed, 19 Feb 2020 01:12:05 -0800 (PST) X-Google-Smtp-Source: APXvYqwQT3VDuI27cwFgKj4P5SAdjHO8RfTZuKuh2gricf+8nn/KW66NwAc7jr/RdjsHqlzzMYbu X-Received: by 2002:a05:6830:1d4:: with SMTP id r20mr4785228ota.107.1582103525040; Wed, 19 Feb 2020 01:12:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582103525; cv=none; d=google.com; s=arc-20160816; b=h9OIH7eKPjFK69PdQ6DwJUNVM4vu6JV9YgQhn3E7/zEj2tF55rVsMu2UfZkZasawD5 R4KvIULwVWFWu44VKi5tyTToLoCIuwNJeRiaWGRv6AP3NLkIPu5PyTwiFltmKXNCv0Vg 6lNIM+1dTT6r1Rs3yiWxWpMpy3UQFtc+wQLcm0bleBmZDsTA+UJFBflHirHtmRCVcLeg Agls0Okf7xUoIuXiWon7dNECP5+ZXnpxXxvtLM83Njq2THBxuplcwMboiBYfob8E18Xh dn+1lWuQK0fR/wit4VqLxM0ssF4eYIL5bKyarE1weJ7l1PE2LFfsgIErLyZ/hpUxHmqm wpZQ== 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:dkim-signature; bh=xsN8vhfHa7tW/G+6aX+0P4BNgzapyUwsBGOb49UIpYU=; b=Uw6EoCDHI8WqYqlXdKxFNRqiJOE1BYP5D4RzFMJCQEjLI3TYliTx0k6axArQef7nY4 ferLKBZ88Bd/sF1VvftSuWS6LLR5nbBWbeSs3xhYc83fQRTFs7cyCqxcmmamDBx2RK2A zK7p8UvDdboRxaDBJt3+NlKjVj9ROrrm2VbMf2gIFQ53oqCxG9GKv9jFsOKy0W6b86fw bN4W9W6NTANlivc9CVLTi7/hiAXbHMUVS4Jsg70kES0OLcQp7vIZaoSFv1id9O6D2paJ bwwdVpFriqMerPdSzrsbs99vQdEIezYDA8TeWY5nn8U8+WeIR/zO4WrUD0HTvA+SMCou Sx1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xs4all.nl header.s=s1 header.b=udinrWQO; 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 y23si834665oti.65.2020.02.19.01.11.51; Wed, 19 Feb 2020 01:12:05 -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=@xs4all.nl header.s=s1 header.b=udinrWQO; 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 S1726496AbgBSJLp (ORCPT + 99 others); Wed, 19 Feb 2020 04:11:45 -0500 Received: from lb3-smtp-cloud7.xs4all.net ([194.109.24.31]:48735 "EHLO lb3-smtp-cloud7.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726260AbgBSJLp (ORCPT ); Wed, 19 Feb 2020 04:11:45 -0500 Received: from [192.168.2.10] ([46.9.235.248]) by smtp-cloud7.xs4all.net with ESMTPA id 4LONjze0uP9a94LOQjnfLP; Wed, 19 Feb 2020 10:11:43 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xs4all.nl; s=s1; t=1582103503; bh=xsN8vhfHa7tW/G+6aX+0P4BNgzapyUwsBGOb49UIpYU=; h=Subject:To:From:Message-ID:Date:MIME-Version:Content-Type:From: Subject; b=udinrWQOgb62fcBFlTUaRKjgx4/5BXVbXBc0URjtyG0AazxHRKsVcmiXkrJYHWsAd sd1iA8eHUhHmh0huM+aJGJ6gFNUp/sWnBvhjC7aXVImmnvoRGVP9huDG+1ujiU53QU NzZEyDtSIfQW/5UTrfxOQXppJ8vi4/JkoAPxKDb9Gbb+YWtTD/Ovta0KSulMYbHJ0a sqsO9NHhQGscck6tlVgaGMRxuQtiYwLBw5zU1icY8ltrM/ncbyxQsOlYwYAUFnWRgT GqRbQI5wMkCdRZ8BvRkl25v0WQGLhvC734MIYLk4U8EQhln4I7xLLed/INo8jYOiWD 9XBO3t0xa0iUw== Subject: Re: [RFC][PATCHv2 05/12] videobuf2: handle V4L2_FLAG_MEMORY_NON_CONSISTENT flag To: Sergey Senozhatsky Cc: Hans Verkuil , Tomasz Figa , Mauro Carvalho Chehab , Kyungmin Park , Marek Szyprowski , Sakari Ailus , Laurent Pinchart , Pawel Osciak , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org References: <20200204025641.218376-1-senozhatsky@chromium.org> <20200204025641.218376-6-senozhatsky@chromium.org> <83147032-25a4-9450-d455-437e82e09dc8@xs4all.nl> <20200219090547.GF122464@google.com> From: Hans Verkuil Message-ID: <9bd88d23-9c4f-05dd-2514-b7c46f03a578@xs4all.nl> Date: Wed, 19 Feb 2020 10:11:39 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200219090547.GF122464@google.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfNLD2qyH4WWBgDvGKIxeVc0YKijOhw/xXNM0IXvd+FD9r53kiC1OnbaA/pniGBduWa7/ZNwXVVZMK3ohTj75fe2FP/wA89cPd7km2yn79QqCRumHXpRS 6PGtrwWptkDkSVqmuTfUeWLWOhmAmsqK6QaGRKFcgQcgmZAFuuwLLBBTo4RYC+xrWLAsIKHkhzzhFaFpyUOAXBDr4OPUAvpcW/haVl+EWfziSVXpSJdUO2+W fQbRDpVq3N5tK3tm/g/0Cby0wY6yTvja2B4L6R8RpRDMbqMbvOfhzbq72N6mllfXUp6tG4aqoS+k3AZG4vB12m5dBBbnaqbJJtX5/stnqxYf/tg7Sk6QLmgt eiRW+/dZ7W+0x22vr7FxEzkl4Fg/SENWrSCQoKKZ+YKzyTNQDYVcr0SQiPmh6fxZJNHxQYAX8wA0r2a0a5BBh7kZbZA+26UUyNGmbjXPWj1OuPZDd9St/8z2 NBm0hmc+c+bgSTdaw7QNL/nLyoLHEFDqrqCN4s6ISfKEz+0eFosRNva2zuImI7/4XoMdIdxBFpR9PAnN Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/19/20 10:05 AM, Sergey Senozhatsky wrote: > On (20/02/19 09:48), Hans Verkuil wrote: > [..] >>> int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req) >>> { >>> int ret = vb2_verify_memory_type(q, req->memory, req->type); >>> + bool consistent = true; >>> + >>> + if (req->flags & V4L2_FLAG_MEMORY_NON_CONSISTENT) >>> + consistent = false; >> >> There is no check against allow_cache_hints: if that's 0, then >> the V4L2_FLAG_MEMORY_NON_CONSISTENT flag should be cleared since it is >> not supported. > > The check is in set_queue_consistency() That's the check against the functionality. I'm talking about the API level: if !q->allow_cache_hints, then clear V4L2_FLAG_MEMORY_NON_CONSISTENT from req->flags so that, when the ioctl returns to userspace, the application can tell that that flag was rejected. Regards, Hans > > static void set_queue_consistency(struct vb2_queue *q, bool consistent_mem) > { > if (!q->allow_cache_hints) > return; > > if (consistent_mem) > q->dma_attrs &= ~DMA_ATTR_NON_CONSISTENT; > else > q->dma_attrs |= DMA_ATTR_NON_CONSISTENT; > } > > I don't explicitly clear DMA_ATTR_NON_CONSISTENT attr for > !->allow_cache_hints queues just in case if the driver for > some reason sets that flag. ->allow_cache_hints is, thus, > only for cases when user-space asks us to set or clear it. > > -ss >