From patchwork Mon Mar 2 04:12:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 210779 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.9 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C39EBC3F2D2 for ; Mon, 2 Mar 2020 04:13:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 95D8224699 for ; Mon, 2 Mar 2020 04:13:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="iQoz4D3G" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727181AbgCBEND (ORCPT ); Sun, 1 Mar 2020 23:13:03 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:41649 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727084AbgCBENC (ORCPT ); Sun, 1 Mar 2020 23:13:02 -0500 Received: by mail-pf1-f195.google.com with SMTP id j9so4891253pfa.8 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=nyQhSenojjpS2qe/2knI4zFVO9oqSn40wliohncD68PlqPpqumM/uIOwI4OszgzW2a 02UwjFscOqQ0JJHvGHXIm9S5GkcJeSX8UfW5nPPqG02ETpxBbV7Nrndw4MLHFl837pW9 5vbzfAXI/KLVxasJLDz+EKhvnS1WcYcbC4bbieEr/pfejqQBvgrQlGHfXhjRQg2Tn4sD 9nYNdwAEjcpAxJb5T8q06e49ZJbDDIjqqTIF1Ck/k/T5zR9pmXlVjASXmqOjx9dnFAWh XwkK8gq0lSz9aEmNnkpCOyp34rdgydtMWHNLFYKvMVxzrV+EO/X7pHEPlQv50zCesnH+ 21Eg== X-Gm-Message-State: APjAAAXUeHFdw7LTGbu6BwDIr25DzsfE+Re5uqKiBYgyPxUrwfVE2x3a NoXHOSZUFHAdaTedBpnjGRpkQYsiX68= X-Google-Smtp-Source: APXvYqzfiVrxV9y838Pte2LCUED/pNzCk7VJWEWdqJQlV3pzdVO6cxXqP0Ax/IK/3vv50IjpTeBGBw== 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 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@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; }