Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1864963ybf; Sun, 1 Mar 2020 20:13:58 -0800 (PST) X-Google-Smtp-Source: APXvYqyDDS9KEEe5adDSAnoM4QdH3FLeee+fgEDxqhsNWzTpdt/PVV7Xk18n+73PsQBCRasPNieJ X-Received: by 2002:a05:6830:1ca:: with SMTP id r10mr11441608ota.319.1583122438196; Sun, 01 Mar 2020 20:13:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583122438; cv=none; d=google.com; s=arc-20160816; b=nQo0b0Z7PtBdbuG88hgedQMACmbEKalGntQIRCsLfJM8txhXqoVaihfAEkoLD0G9io E5KnuwU8PPOze+5s4qatAxilbtvtqBBwSjsN9Mpye4puYDWaIzXGW7Soom0dGEPybcSN 1AomTViyT+LB6tBATVhGzoJRxw6ArEtHvG+OBGhfwAHuczffigTsCNtV2AZy+tyMhWGd 33U6D5lMOhaH0rXTOSQlPsZLQFm4VAmAYLXAf60xgtcQ74ENcmHtTGDwEGi1YeCNAY3I zaRGuESb9xSz0og6Vh855IIos8BlOmm6JonCP37rKq8vCWDyx+bzxom4v8h2iA0TvK8k G4Jg== 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=n1tFCzw75kCxqGljRqUUqQ24ppDX2CtviVmHlh9ZwXI=; b=H54PoEyMAVuPGeQJXv/kNMZwe28aVDyJ6+NnpnkUBiXgJ44wPSWaeljCp7+uP4Wsx+ icO+KH0jGYit80yKocuy+TzpRG3SrnLDGnlN1Ye0THnn0JMNqoo+Xftp6sPX5HQ5nbmA 5kNpFzlu+ci0K2VzeayvsOm9NhJFmApjeV/8p1NNIXwrs+ekSiwR7h91I8pxrvlU0S1p FrvNwZRAAopbvwmCH2hie3oSIU7pH0zKU0mUXIFljXW7H4beAlhtxlGXm7t0pLprMFwi 58QMKLrseiH9P3wuLP5jDOf0tiUP3eTfXtPTcmrzjj2Izsj4XXnH75f4of/ySxHVWoum +D8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=SVTwb9xC; 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 x186si5434084oig.209.2020.03.01.20.13.46; Sun, 01 Mar 2020 20:13:58 -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=SVTwb9xC; 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 S1727205AbgCBENJ (ORCPT + 99 others); Sun, 1 Mar 2020 23:13:09 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:42345 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727053AbgCBENJ (ORCPT ); Sun, 1 Mar 2020 23:13:09 -0500 Received: by mail-pf1-f195.google.com with SMTP id 15so4888650pfo.9 for ; Sun, 01 Mar 2020 20:13:08 -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=n1tFCzw75kCxqGljRqUUqQ24ppDX2CtviVmHlh9ZwXI=; b=SVTwb9xCDylxA8meFAf4DNHy1L02yYnt+Xnqp7zusYHBzO777tMWuyug3GcSsAPwDz Afs+J9ArrufHaKwPHWwVG6Orv3Pcf8BzOc7FTjbdW7LOw4N79tS+Up+hBW+/3WzsjDn3 D4Cg4w9UK83GxIvJmjR3tAKaoyO8fbMFtX5D4= 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=n1tFCzw75kCxqGljRqUUqQ24ppDX2CtviVmHlh9ZwXI=; b=CoZkcmrOxOFBTOeuYqBKLNlp6pLe1CWnxKddtPk7QZBO6EE3/cix1aeZHTxQjQysps fP9t1LOMeS0ZwD7U86VnhMD1Lel7dtlOIig/AMY0AMfx4a+Uo9hp3COFBWvKlQQoMyFU KtLteuei+Ici9uWZa+dyXR3/WEGR8NOXSqjeFJo8GYatMwOpIBnv8BU8HNNrJlJdK3zU kzobAGghPpg8SF05tCmwwAXIqz9wKd/+wQT5ZyqknfUcRR73uNV0VPqOch5hA2/a1om7 U8wzKptwg6tBsLF+7KZIusytoqO/x+D/+83ElxcCj60udsK4k1y30Njz1aBk+8B1kQzs jd9w== X-Gm-Message-State: APjAAAVnXAd+uVMcn6LxvmBDFUK8chBk3tS+fnnRv/fHMdDa/y1b6jcj oISnCYNqQKuiAYBby/BtlmsdiwqoV3o= X-Received: by 2002:a62:768d:: with SMTP id r135mr15601049pfc.108.1583122388345; Sun, 01 Mar 2020 20:13:08 -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.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Mar 2020 20:13:07 -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 08/11] videobuf2: check ->synced flag in prepare() and finish() Date: Mon, 2 Mar 2020 13:12:10 +0900 Message-Id: <20200302041213.27662-9-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 This simplifies the code a tiny bit and let's us to avoid unneeded ->prepare()/->finish() calls. Signed-off-by: Sergey Senozhatsky --- drivers/media/common/videobuf2/videobuf2-core.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c index 988e8796de4f..7f637e3a50ab 100644 --- a/drivers/media/common/videobuf2/videobuf2-core.c +++ b/drivers/media/common/videobuf2/videobuf2-core.c @@ -304,6 +304,9 @@ static void __vb2_buf_mem_prepare(struct vb2_buffer *vb) { unsigned int plane; + if (vb->synced) + return; + if (vb->need_cache_sync_on_prepare) { for (plane = 0; plane < vb->num_planes; ++plane) call_void_memop(vb, prepare, @@ -320,6 +323,9 @@ static void __vb2_buf_mem_finish(struct vb2_buffer *vb) { unsigned int plane; + if (!vb->synced) + return; + if (vb->need_cache_sync_on_finish) { for (plane = 0; plane < vb->num_planes; ++plane) call_void_memop(vb, finish, @@ -1991,8 +1997,7 @@ static void __vb2_queue_cancel(struct vb2_queue *q) call_void_vb_qop(vb, buf_request_complete, vb); } - if (vb->synced) - __vb2_buf_mem_finish(vb); + __vb2_buf_mem_finish(vb); if (vb->prepared) { call_void_vb_qop(vb, buf_finish, vb); -- 2.25.0.265.gbab2e86ba0-goog