From patchwork Fri Dec 16 01:24:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 9477165 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6CA6160827 for ; Fri, 16 Dec 2016 01:24:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 68C9428876 for ; Fri, 16 Dec 2016 01:24:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5DE6F288A9; Fri, 16 Dec 2016 01:24:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B684828876 for ; Fri, 16 Dec 2016 01:24:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757247AbcLPBYA (ORCPT ); Thu, 15 Dec 2016 20:24:00 -0500 Received: from galahad.ideasonboard.com ([185.26.127.97]:50175 "EHLO galahad.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757087AbcLPBX6 (ORCPT ); Thu, 15 Dec 2016 20:23:58 -0500 Received: from avalon.bb.dnainternet.fi (dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804]) by galahad.ideasonboard.com (Postfix) with ESMTPSA id 10B7B207B0; Fri, 16 Dec 2016 02:23:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1481851421; bh=BQgLogRRX0p4m8plR7ahc02WQFPhtO4OA4pfzoxaPGQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LSMHC/PSb04AhpOGSpjStCni2zLbmV+xUgh7BSA5tOj3OgKm5cYDn/qHAQgtTWUQI qxYp9WCkOJmTrDP8HNqdrOlHTYObkP3Div8KlyOwWdbwNvVWYpIWKWboKzsCW3FbgM stm1e85B5OWrUUpe9xKrVqTE572MBTFpfnIqijU0= From: Laurent Pinchart To: linux-media@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, Pawel Osciak , Marek Szyprowski , Kyungmin Park , Hans Verkuil , Sumit Semwal , Rob Clark , Daniel Vetter , Laura Abbott , Sakari Ailus Subject: [RFC v2 03/11] vb2: Move cache synchronisation from buffer done to dqbuf handler Date: Fri, 16 Dec 2016 03:24:17 +0200 Message-Id: <20161216012425.11179-4-laurent.pinchart+renesas@ideasonboard.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161216012425.11179-1-laurent.pinchart+renesas@ideasonboard.com> References: <20161216012425.11179-1-laurent.pinchart+renesas@ideasonboard.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sakari Ailus The cache synchronisation may be a time consuming operation and thus not best performed in an interrupt which is a typical context for vb2_buffer_done() calls. This may consume up to tens of ms on some machines, depending on the buffer size. Signed-off-by: Sakari Ailus --- Changes since v1: - Don't rename the 'i' loop counter to 'plane' --- drivers/media/v4l2-core/videobuf2-core.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 8ba48703b189..15a83f338072 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -889,7 +889,6 @@ void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state) { struct vb2_queue *q = vb->vb2_queue; unsigned long flags; - unsigned int plane; if (WARN_ON(vb->state != VB2_BUF_STATE_ACTIVE)) return; @@ -910,10 +909,6 @@ void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state) dprintk(4, "done processing on buffer %d, state: %d\n", vb->index, state); - /* sync buffers */ - for (plane = 0; plane < vb->num_planes; ++plane) - call_void_memop(vb, finish, vb->planes[plane].mem_priv); - spin_lock_irqsave(&q->done_lock, flags); if (state == VB2_BUF_STATE_QUEUED || state == VB2_BUF_STATE_REQUEUEING) { @@ -1571,6 +1566,10 @@ static void __vb2_dqbuf(struct vb2_buffer *vb) vb->state = VB2_BUF_STATE_DEQUEUED; + /* sync buffers */ + for (i = 0; i < vb->num_planes; ++i) + call_void_memop(vb, finish, vb->planes[i].mem_priv); + /* unmap DMABUF buffer */ if (q->memory == VB2_MEMORY_DMABUF) for (i = 0; i < vb->num_planes; ++i) {