Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4448439ybl; Tue, 21 Jan 2020 21:06:24 -0800 (PST) X-Google-Smtp-Source: APXvYqxFGvqBDi9XounV7Ty3Tf/SqpJzEE2z4DIrsRQXTGFwdCjEFeVWl3egfn0fkcA21pxRtiXg X-Received: by 2002:aca:d15:: with SMTP id 21mr5761415oin.127.1579669584023; Tue, 21 Jan 2020 21:06:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579669584; cv=none; d=google.com; s=arc-20160816; b=V/dvDVOrOR98NjMuar0V+h5XrLp2peoCQs20GZkG5OZhjgD2BJEjF5JhBXndnda6RK iHT7IV1dHaRqsaP52PzqQr+T6VFQ5rZJWPU4F+jx46IIUORacw2tFffi9bUBvKnPy0r2 nzzQKryHmfeViBgtyeYx5yqNXRF0zfvQSEIFEQZUalhmNmsdicBdv+jAB+mEy6JdaR8J 663TNA1FNHbNGAdr7VB6YPC9aCfoH5cFBy6Fz/nYd1ZklRKeRmZeaNMdWGMAgumyE0Qt rnOAWGfg3Jf4jQXxNc9F2eXCH6ZhTWp0mcneo54Fr6BRcsykcJSf+dWqqSB+xux7GG83 tnnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=W3QtAa0GpCqU3ZzHtwssyYyBXTxGEn8WOK20xfN/i70=; b=Kl9xq4DIn6wn6tl4TbvJM4LK5Z2Ow4OqzRdrj5/69SCOvrZJvYbMo0GLDeArKMt8y8 y9M96UxCy4kKyIq9ui163WnpLYZwi1GYNZxefH9txCBiKhTqo+YzBhAY1Y/Fr4dlT0Eu s0m85O0O1SdQ9UQav8YNugoAMFVBCwz/a+LA4nwHtVig6Wue8Ht7PuPHH/qCjmmNptIG rale6/ud/O9QF+RSusAV/rMrapg6/31Ic0LRYU1navSMCLVs9F90wK1ozG1xSATMxAbf 0+ZxIP9WwHL1weV/TCB6OUoVWMyv830NrPyOPy/1u+2LEJTG2eE8625w5xTJ7DbSBtx6 nuuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KOXqe+cg; 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 m9si19964948oie.148.2020.01.21.21.06.12; Tue, 21 Jan 2020 21:06:24 -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=KOXqe+cg; 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 S1725868AbgAVFFS (ORCPT + 99 others); Wed, 22 Jan 2020 00:05:18 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:45721 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725796AbgAVFFS (ORCPT ); Wed, 22 Jan 2020 00:05:18 -0500 Received: by mail-pf1-f195.google.com with SMTP id 2so2718129pfg.12 for ; Tue, 21 Jan 2020 21:05:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=W3QtAa0GpCqU3ZzHtwssyYyBXTxGEn8WOK20xfN/i70=; b=KOXqe+cgyOzv6v1zYpW2D5il/19yMEKhdDjOyKMcgPAp1jl4dG6xkhxbUj5vF4qAJk z2ylcP+/AduEA7qzIiP1BXwbM8M3Qf2O0iw+nWjNXFNzD+BSitSCCwO4ThGVoaUd4OuX IjqBOYsTwCTVvbmsnjbEug21kTgCMsHD00/kY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=W3QtAa0GpCqU3ZzHtwssyYyBXTxGEn8WOK20xfN/i70=; b=QaQCTQkrfmmNVKidT1NQvEi48hmxl94ZxOsJXn0N1twMxVOC+UEKpLOnfAJpKrBNn1 yJ/wKPJacDAtxYKRSR+jVqe86ilKf/X0izaOsoywafQqRWUlT246Jo3ONCxrVxG/Lm77 Y4J36HY+W8cabjXAFIkZ7hAWEVESayVCz6CElKeAQYdKKNpDAd5LNErS3fnzB0I1oE+J 1cD7mWx21BBneoriY9f0SXHgsXYBJxTqo/oGchCmizEBo/i3v0Jlbh2dc9v5x6HibYZp KQAiU5HV+jRPgx+bajziTyLWezrneF81fELvN3rHjtW9QK0Jx47zoDgbmG6bVjZKVjf9 0fog== X-Gm-Message-State: APjAAAV6Z5cGYaH+CFaYnc9wJfx5FoZgOb0BZtXosdK3AcXZrS7lCoqF oEJJDOVWUorP+/14UKBFKf1hNA== X-Received: by 2002:a63:6f8a:: with SMTP id k132mr9489382pgc.70.1579669517546; Tue, 21 Jan 2020 21:05:17 -0800 (PST) Received: from localhost ([2401:fa00:8f:203:5bbb:c872:f2b1:f53b]) by smtp.gmail.com with ESMTPSA id x65sm47362058pfb.171.2020.01.21.21.05.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jan 2020 21:05:16 -0800 (PST) Date: Wed, 22 Jan 2020 14:05:15 +0900 From: Sergey Senozhatsky To: Hans Verkuil Cc: Sergey Senozhatsky , 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 Subject: Re: [RFC][PATCH 13/15] videobuf2: do not sync buffers for DMABUF queues Message-ID: <20200122050515.GB49953@google.com> References: <20191217032034.54897-1-senozhatsky@chromium.org> <20191217032034.54897-14-senozhatsky@chromium.org> <2d0e1a9b-6c5e-ff70-9862-32c8b8aaf65f@xs4all.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2d0e1a9b-6c5e-ff70-9862-32c8b8aaf65f@xs4all.nl> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (20/01/10 11:30), Hans Verkuil wrote: [..] > > diff --git a/drivers/media/common/videobuf2/videobuf2-v4l2.c b/drivers/media/common/videobuf2/videobuf2-v4l2.c > > index 1762849288ae..2b9d3318e6fb 100644 > > --- a/drivers/media/common/videobuf2/videobuf2-v4l2.c > > +++ b/drivers/media/common/videobuf2/videobuf2-v4l2.c > > @@ -341,8 +341,22 @@ static void set_buffer_cache_hints(struct vb2_queue *q, > > struct vb2_buffer *vb, > > struct v4l2_buffer *b) > > { > > - vb->need_cache_sync_on_prepare = 1; > > + /* > > + * DMA exporter should take care of cache syncs, so we can avoid > > + * explicit ->prepare()/->finish() syncs. > > + */ > > + if (q->memory == VB2_MEMORY_DMABUF) { > > + vb->need_cache_sync_on_finish = 0; > > + vb->need_cache_sync_on_prepare = 0; > > + return; > > + } > > > > + /* > > + * For other ->memory types we always need ->prepare() cache > > + * sync. ->finish() cache sync, however, can be avoided when queue > > + * direction is TO_DEVICE. > > + */ > > + vb->need_cache_sync_on_prepare = 1; > > I'm trying to remember: what needs to be done in prepare() > for a capture buffer? I thought that for capture you only > needed to invalidate the cache in finish(), but nothing needs > to be done in the prepare(). Hmm. Not sure. A precaution in case if user-space wrote to that buffer? + if (q->dma_dir == DMA_FROM_DEVICE) + q->need_cache_sync_on_prepare = 0; ? -ss