Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1864884ybf; Sun, 1 Mar 2020 20:13:48 -0800 (PST) X-Google-Smtp-Source: APXvYqyK0QHC4UGMqp3fv0QCWm7NFR5ahNFhNLYlmjEMzoxR4hZQHSWCJA1t1nh7i48EIiVFmwy8 X-Received: by 2002:aca:be57:: with SMTP id o84mr10484764oif.138.1583122428876; Sun, 01 Mar 2020 20:13:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583122428; cv=none; d=google.com; s=arc-20160816; b=09bQ0FacID6dtRzYUWqM3fbrxMVB9pzOelx+M7Qj/RkFcwRCNqu0MpH8XTA1YPzUgJ VOXqoT9Fvyuq7lOhDUwXTB/jGlbQWzlx6/OUPGNp7TgyfnhJGYs7kLo+9Qz0Sf1ewfB0 bDfQXFFuJo3f0zc3DFIx+bXZgriUbVt3WScu/k2NCEKoOcwnm9tUf6PeqM6K/gqJEx7l qG13lPtfzY1PR0BPL3ZG/pJhfFzxMEcVto48adGt1CnWcAHX4zdCZjJcIJcslT9Z+Ory TLwP5WWe+zDqNYf3GMj2cZh/Z/9s5pUs6zDSHMF2SQ4QiQglAX0o3W43drmeNQxiU3Ns JAdg== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3A85FNkQVK15E41Jw/YnZSYCbOfj7OMPE9KsvpyVprI=; b=ZRg5oMJLeGHy1K9+fK+sg+1GfGQkWj3kPBmnO23eL83B6b6LhrEjRjUsbzAqeyCaUz G5Vdk6RubeXNP9hpcS7yyGjkNIMTztLe6tT/pzHmGRjqNggTbDwAvHl3HskpaVflDxQl dtMVDYipYOkC5n7IQrllVQiSRii2sD4av0rB+oGQIKgOeBeelFRSHOlg9qTwsBCSrzv+ 8wxybBDdXeG1s1T9LDtNBtkE880HE2MrO4OgoHIaJjVeA6m0i93Gk86CRF9E8DBMxUJv cRMVZqa8dKMjslG/luVRir9AaAiUpq8Bl4YDJDwAkPf8kbgWrf6hO1a75D+yusMgOtG/ cDVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=iQoz4D3G; 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 z10si5292032oic.77.2020.03.01.20.13.36; Sun, 01 Mar 2020 20:13:48 -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=iQoz4D3G; 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 S1727176AbgCBEND (ORCPT + 99 others); Sun, 1 Mar 2020 23:13:03 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:40538 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727053AbgCBEND (ORCPT ); Sun, 1 Mar 2020 23:13:03 -0500 Received: by mail-pg1-f193.google.com with SMTP id t24so4743399pgj.7 for ; Sun, 01 Mar 2020 20:13:02 -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 :mime-version:content-transfer-encoding; bh=3A85FNkQVK15E41Jw/YnZSYCbOfj7OMPE9KsvpyVprI=; b=iQoz4D3GwiW8h0XeU8c1Et605eWVY/JK+54169MH68UJ0X99a18+0g9Tm8xc/DDmAp mj8ZAhEVfO7rt3RTDu/RzFnPjOY4zldofCKucp1E6RT9nL4gfhu0c5e3+dEF17zFAFSg Td/fdZ3uqYCSPBmyLKwkHZa3JvzRlak5lPFXU= 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:mime-version:content-transfer-encoding; bh=3A85FNkQVK15E41Jw/YnZSYCbOfj7OMPE9KsvpyVprI=; b=WS3KV1jluwztU6FavMQm82EpdXx360IfYX7IRgi7+ZNUEO7MKHJHJEj1satm+zfx5X s6LwBjSTyR1QHdRYgyIxKCbAwZ8XDdvPoag6tin2CRdxbJF0Waz8UZJR7FUsmRz1JI1C HzCC+o7RfnT1LETqMhsaT0gTEX0rEm27UH8Iqf8jSFif5srPGwsbwNmGG0TCSrh6eUei reHpyhz9X0kVSH9mg5DObfW8RUaIt3Pebviq5ZoiezORgzeGqO3wsoGIGWWLLx3OK3/v 7XLF13xKRQBLgDhZ0VoSlkkVytkkbSviQNnSU8FW2KyMQXpy2efDnOvu1cd1DSKpQdlp QExw== X-Gm-Message-State: APjAAAWIpnAb/C1qSXz2fD/9uza1Y5ZzBpiJ1YSDvFb0/K0pekFYgQoa y5EXDjavZ2u/myaXEyK9/pR/tg== X-Received: by 2002:aa7:8299:: with SMTP id s25mr15628477pfm.261.1583122381683; Sun, 01 Mar 2020 20:13:01 -0800 (PST) Received: from tigerii.tok.corp.google.com ([2401:fa00:8f:203:5bbb:c872:f2b1:f53b]) by smtp.gmail.com with ESMTPSA id d82sm1698114pfd.187.2020.03.01.20.12.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Mar 2020 20:13:01 -0800 (PST) From: Sergey Senozhatsky To: Hans Verkuil , Tomasz Figa Cc: Mauro Carvalho Chehab , Kyungmin Park , Marek Szyprowski , Sakari Ailus , Laurent Pinchart , Pawel Osciak , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: [PATCHv4 07/11] videobuf2: do not sync caches when we are allowed not to Date: Mon, 2 Mar 2020 13:12:09 +0900 Message-Id: <20200302041213.27662-8-senozhatsky@chromium.org> X-Mailer: git-send-email 2.25.0.265.gbab2e86ba0-goog In-Reply-To: <20200302041213.27662-1-senozhatsky@chromium.org> References: <20200302041213.27662-1-senozhatsky@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Skip ->prepare() or/and ->finish() cache synchronisation if user-space requested us to do so (or when queue dma direction permits us to skip cache syncs). Signed-off-by: Sergey Senozhatsky --- drivers/media/common/videobuf2/videobuf2-core.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c index c2a1eadb26cf..988e8796de4f 100644 --- a/drivers/media/common/videobuf2/videobuf2-core.c +++ b/drivers/media/common/videobuf2/videobuf2-core.c @@ -304,8 +304,11 @@ static void __vb2_buf_mem_prepare(struct vb2_buffer *vb) { unsigned int plane; - for (plane = 0; plane < vb->num_planes; ++plane) - call_void_memop(vb, prepare, vb->planes[plane].mem_priv); + if (vb->need_cache_sync_on_prepare) { + for (plane = 0; plane < vb->num_planes; ++plane) + call_void_memop(vb, prepare, + vb->planes[plane].mem_priv); + } vb->synced = 1; } @@ -317,8 +320,11 @@ static void __vb2_buf_mem_finish(struct vb2_buffer *vb) { unsigned int plane; - for (plane = 0; plane < vb->num_planes; ++plane) - call_void_memop(vb, finish, vb->planes[plane].mem_priv); + if (vb->need_cache_sync_on_finish) { + for (plane = 0; plane < vb->num_planes; ++plane) + call_void_memop(vb, finish, + vb->planes[plane].mem_priv); + } vb->synced = 0; } -- 2.25.0.265.gbab2e86ba0-goog