Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1865738ybf; Sun, 1 Mar 2020 20:15:08 -0800 (PST) X-Google-Smtp-Source: APXvYqyDNCMEhqPlUycfwWYyTIxmfZvoqNSeN+t+vB5IozrHLPrSwnqSy1Tx0Il38fXcXPdFxf41 X-Received: by 2002:a9d:6446:: with SMTP id m6mr11460942otl.122.1583122508008; Sun, 01 Mar 2020 20:15:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583122508; cv=none; d=google.com; s=arc-20160816; b=IA3SFSflSjLFVC+9XFOqYsKLAtlDqUUM5FdpTYZ0bBPa8EUxhdNBh3pl0iB2Nxb3VS W+ssdXmQH3k/2IpTYep3CXdS0MHoUMfYhtoeJRTSnX9srDtd7Fa+Ji73FUd53GGZ68BY ManG2uSd+9TtjHtC15C3uYl71iuYOyGQAGA29EEMBwsz9cYAV85f/fKvV0alw9T5cZ4U B7GoZnZFxK/khs9cW06x6W0Bbhl1tDRJD8lKkQPpt6VfmsqjqzFkeBJfA1LlNXLDk8VG ULdPdijwGt9O6jOlVsxZHxJyScWj+EpRtwiN7s+V/PeiI9aTDMbby7PWaDuztxUx2cgW mgIQ== 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=CxsIIu+/8DSr9yF0CIvvdp+l+R1SqYNd7xvzR+EPPKE=; b=tDEAbhFr55gPMl+7m2p20rIU3okkrmnSBql9jaK9duw7wzND/IlE5TSOPPzQBMjyDi C+jfWXsIxYyf6IYoWhsqAlGp5yOuxU9B8XW5RU0/6zVOCpTWQxzaS3jwrVF7Fryp1b5n 3Q3euXvqaJdIEf1lK2isNwImhdpBqfS1IVr3xPqMDejmCrbcGaSNO1wNHsVSo7qj1voz WL6lA/TMagCWWPO90VU5gHDEoRe0AD465PKFfptnaWmbedirkqC+aFi6ZVnRenUDHgdZ m05lRZdzRN9+pMA7y6keDfPpUjguox2U0bFw14pFv26NHbh/5C1bzuj1bSLhHaKWU2MC 3BkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=NfkXxwE0; 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 w11si1308572oti.51.2020.03.01.20.14.56; Sun, 01 Mar 2020 20:15:07 -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=NfkXxwE0; 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 S1727194AbgCBEN0 (ORCPT + 99 others); Sun, 1 Mar 2020 23:13:26 -0500 Received: from mail-pf1-f176.google.com ([209.85.210.176]:43303 "EHLO mail-pf1-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727222AbgCBENZ (ORCPT ); Sun, 1 Mar 2020 23:13:25 -0500 Received: by mail-pf1-f176.google.com with SMTP id s1so4886101pfh.10 for ; Sun, 01 Mar 2020 20:13:25 -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=CxsIIu+/8DSr9yF0CIvvdp+l+R1SqYNd7xvzR+EPPKE=; b=NfkXxwE0BJXx6VznfLq3+TLrkcYj+Bd8JMt7XwZ/gLY6AnA12lM4KgasNRpqCaHJ/3 WZDZRB0oBnZGfd9KLE+ZF4S+mVBeMuImh9aIpm+02SemxBUTOmOHkPwlK0TxSw87erKC EHpO7rLpaKKo5/AgmsafdCRkBQkS3yWp37CsE= 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=CxsIIu+/8DSr9yF0CIvvdp+l+R1SqYNd7xvzR+EPPKE=; b=Co6J/l06yAvMDftNRRgMp56ekcwY/chWd8yEh9lP7RUdOiRQDbAOIjssijiqILDoYn GnScbKxcA+4ws48N2hOu0PsGRBsoxoOFsdY0HAoTr5Tigq3bJX1O9pp9EFNM7U49ptDi IMycZH0GlSzvBc+p35zPnkQP8wKoHWuXkXGNHI3wqtAzRcrZYqy4CNCcUo47RaDJCeO8 F/AETMMF2vBu+oa049vuPPBiNMfk0koUHsQty7nhbuPmLemxmKjNLNIJwCv2i5TSHJBe qdBdFKtU5jubDxjR6QiwfPHomyMObIk7Lj688bpIMKaleNtpRlpN/4PeFqck5KZzppfQ dmsw== X-Gm-Message-State: APjAAAX/LfbzD1A0htx0TQCgR0ZuUE7jeYXWTd5nr1htief/1qB+TO9n mLP8wpCXUO13H3dPCNNVpzro9g== X-Received: by 2002:aa7:9789:: with SMTP id o9mr14416433pfp.138.1583122404529; Sun, 01 Mar 2020 20:13:24 -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.13.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Mar 2020 20:13:24 -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 11/11] videobuf2: don't test db_attach in dma-contig prepare and finish Date: Mon, 2 Mar 2020 13:12:13 +0900 Message-Id: <20200302041213.27662-12-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 We moved cache management decision making to the upper layer and rely on buffer's need_cache_sync flags and videobuf2 core. If the upper layer (core) has decided to invoke ->prepare() or ->finish() then we must sync. For DMABUF ->need_cache_sync_on_prepare and ->need_cache_sync_on_flush are always false so videobuf core does not call ->prepare() and ->finish() on such buffers. Additionally, scratch the DMABUF comment. Signed-off-by: Sergey Senozhatsky --- drivers/media/common/videobuf2/videobuf2-dma-contig.c | 6 ++---- drivers/media/common/videobuf2/videobuf2-dma-sg.c | 8 -------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/media/common/videobuf2/videobuf2-dma-contig.c b/drivers/media/common/videobuf2/videobuf2-dma-contig.c index a387260fb321..6ea0961149d7 100644 --- a/drivers/media/common/videobuf2/videobuf2-dma-contig.c +++ b/drivers/media/common/videobuf2/videobuf2-dma-contig.c @@ -100,8 +100,7 @@ static void vb2_dc_prepare(void *buf_priv) struct vb2_dc_buf *buf = buf_priv; struct sg_table *sgt = buf->dma_sgt; - /* DMABUF exporter will flush the cache for us */ - if (!sgt || buf->db_attach) + if (!sgt) return; dma_sync_sg_for_device(buf->dev, sgt->sgl, sgt->orig_nents, @@ -113,8 +112,7 @@ static void vb2_dc_finish(void *buf_priv) struct vb2_dc_buf *buf = buf_priv; struct sg_table *sgt = buf->dma_sgt; - /* DMABUF exporter will flush the cache for us */ - if (!sgt || buf->db_attach) + if (!sgt) return; dma_sync_sg_for_cpu(buf->dev, sgt->sgl, sgt->orig_nents, buf->dma_dir); diff --git a/drivers/media/common/videobuf2/videobuf2-dma-sg.c b/drivers/media/common/videobuf2/videobuf2-dma-sg.c index ddc67c9aaedb..2a01bc567321 100644 --- a/drivers/media/common/videobuf2/videobuf2-dma-sg.c +++ b/drivers/media/common/videobuf2/videobuf2-dma-sg.c @@ -204,10 +204,6 @@ static void vb2_dma_sg_prepare(void *buf_priv) struct vb2_dma_sg_buf *buf = buf_priv; struct sg_table *sgt = buf->dma_sgt; - /* DMABUF exporter will flush the cache for us */ - if (buf->db_attach) - return; - dma_sync_sg_for_device(buf->dev, sgt->sgl, sgt->orig_nents, buf->dma_dir); } @@ -217,10 +213,6 @@ static void vb2_dma_sg_finish(void *buf_priv) struct vb2_dma_sg_buf *buf = buf_priv; struct sg_table *sgt = buf->dma_sgt; - /* DMABUF exporter will flush the cache for us */ - if (buf->db_attach) - return; - dma_sync_sg_for_cpu(buf->dev, sgt->sgl, sgt->orig_nents, buf->dma_dir); } -- 2.25.0.265.gbab2e86ba0-goog