From patchwork Tue Aug 14 15:34:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Stanislawski X-Patchwork-Id: 10739 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 9960B23F34 for ; Tue, 14 Aug 2012 15:36:38 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 47E56A18539 for ; Tue, 14 Aug 2012 15:36:38 +0000 (UTC) Received: by iadj38 with SMTP id j38so28866iad.11 for ; Tue, 14 Aug 2012 08:36:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:x-auditid :from:to:date:message-id:x-mailer:in-reply-to:references :x-brightmail-tracker:x-tm-as-mml:cc:subject:x-beenthere :x-mailman-version:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-gm-message-state; bh=+ErLI+6929W7MmNXxqB9Wt4rWTevvgQ+iREAfrfi2C0=; b=HM12obKC2zI1MIc4DWaurruPfAuca69uUUvF6hx0rTBZt2HQUw8XJbxS7DzfOuVoM0 R6qMiH6JuwHgq8hMlxoOWwsNvLqPBC73P153dtXzSdEi4tbIp4BuUHvpV4JbTmjPnptr 1/G4vs9kDuWfDgwTY/Tx6aZWc9XrzJqQNk88YDL7YuL6zCqQZKrGIwKzVC2CBpBy1ftZ H3IQhZU8PdFLoAcgON0kLI6b3OUrXVuGMHAPZvuX/SIaHgG4LknLBnoAXmCih0vHNiFn BKOwjfsSvBchZaGLOkhzqhaKfT7bmpohJdtlGtqkIV2sU6DWqtYfjP4ADM/Qa7itha8u uggQ== Received: by 10.42.75.73 with SMTP id z9mr13111017icj.46.1344958597517; Tue, 14 Aug 2012 08:36:37 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.200 with SMTP id ew8csp20606igc; Tue, 14 Aug 2012 08:36:36 -0700 (PDT) Received: by 10.205.125.4 with SMTP id gq4mr6362165bkc.109.1344958595971; Tue, 14 Aug 2012 08:36:35 -0700 (PDT) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id ht6si4095999bkc.3.2012.08.14.08.36.34; Tue, 14 Aug 2012 08:36:35 -0700 (PDT) Received-SPF: neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) client-ip=91.189.95.16; Authentication-Results: mx.google.com; spf=neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) smtp.mail=linaro-mm-sig-bounces@lists.linaro.org Received: from localhost ([127.0.0.1] helo=mombin.canonical.com) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1T1JAX-0008Ai-K5; Tue, 14 Aug 2012 15:36:33 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1T1JAW-0008AW-3E for linaro-mm-sig@lists.linaro.org; Tue, 14 Aug 2012 15:36:32 +0000 Received: from epcpsbgm2.samsung.com (mailout4.samsung.com [203.254.224.34]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M8R00B264OU1P10@mailout4.samsung.com> for linaro-mm-sig@lists.linaro.org; Wed, 15 Aug 2012 00:36:30 +0900 (KST) X-AuditID: cbfee61b-b7faf6d00000476a-11-502a707e1e39 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 9F.D9.18282.E707A205; Wed, 15 Aug 2012 00:36:30 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0M8R004J44MBC810@mmp1.samsung.com> for linaro-mm-sig@lists.linaro.org; Wed, 15 Aug 2012 00:36:30 +0900 (KST) From: Tomasz Stanislawski To: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org Date: Tue, 14 Aug 2012 17:34:40 +0200 Message-id: <1344958496-9373-11-git-send-email-t.stanislaws@samsung.com> X-Mailer: git-send-email 1.7.10 In-reply-to: <1344958496-9373-1-git-send-email-t.stanislaws@samsung.com> References: <1344958496-9373-1-git-send-email-t.stanislaws@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMJMWRmVeSWpSXmKPExsVy+t9jAd26Aq0Ag1evTC2+XHnI5MDocfvf Y+YAxigum5TUnMyy1CJ9uwSujB27NrEWHOCpeP5oPlsD41GuLkZODgkBE4kbx3cyQdhiEhfu rWfrYuTiEBJYxCjx8t0BKGctk8TT/edZQKrYgDqOLfnMCGKLCDhInL47ixmkiFngELPE/t7X 7CAJYYEoid//D7CC2CwCqhK/Xh4Aa+AV8JA40buZHWKdvMTT+31sIDYnUPzlpm6gGg6gbe4S C3/6T2DkXcDIsIpRNLUguaA4KT3XSK84Mbe4NC9dLzk/dxMj2OvPpHcwrmqwOMQowMGoxMNb mKgZIMSaWFZcmXuIUYKDWUmEtyhIK0CINyWxsiq1KD++qDQntfgQozQHi5I4r4n3V38hgfTE ktTs1NSC1CKYLBMHp1QDI9vaffffed7nOuPPyST0ejlXM7/LRaXzD9NS3EP1WC3ZEx8VM93K m29fI3fu77TZOVlHMu6t29IvflQtUUj6W96DNwo+PIY2V+4H1ySe+Sq9e4bep9MPZ971jpsq n3jb++OcNR07ZwUtTPv6OiKy5MOLU27W0hNlr695cPnb7U0GAtET16peLVZiKc5INNRiLipO BACUEo119gEAAA== X-TM-AS-MML: No Cc: k.debski@samsung.com, pawel@osciak.com, sumit.semwal@ti.com, mchehab@redhat.com, robdclark@gmail.com, linaro-mm-sig@lists.linaro.org, kyungmin.park@samsung.com, dmitriyz@google.com, laurent.pinchart@ideasonboard.com, s.nawrocki@samsung.com, airlied@redhat.com, remi@remlab.net, g.liakhovetski@gmx.de Subject: [Linaro-mm-sig] [PATCHv8 10/26] v4l: vb2-dma-contig: add prepare/finish to dma-contig allocator X-BeenThere: linaro-mm-sig@lists.linaro.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Unified memory management interest group." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linaro-mm-sig-bounces@lists.linaro.org Errors-To: linaro-mm-sig-bounces@lists.linaro.org X-Gm-Message-State: ALoCoQnnf6KRMtWPIwzz/RegnkYLjl6LY4oa4y/iYWrbJb9Aqen3wYSHt22pRivYmEbJ2kuT+Xjo From: Marek Szyprowski Add prepare/finish callbacks to vb2-dma-contig allocator. Signed-off-by: Marek Szyprowski --- drivers/media/video/videobuf2-dma-contig.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/media/video/videobuf2-dma-contig.c b/drivers/media/video/videobuf2-dma-contig.c index 8486e06..494a824 100644 --- a/drivers/media/video/videobuf2-dma-contig.c +++ b/drivers/media/video/videobuf2-dma-contig.c @@ -103,6 +103,28 @@ static unsigned int vb2_dc_num_users(void *buf_priv) return atomic_read(&buf->refcount); } +static void vb2_dc_prepare(void *buf_priv) +{ + struct vb2_dc_buf *buf = buf_priv; + struct sg_table *sgt = buf->dma_sgt; + + if (!sgt) + return; + + dma_sync_sg_for_device(buf->dev, sgt->sgl, sgt->nents, buf->dma_dir); +} + +static void vb2_dc_finish(void *buf_priv) +{ + struct vb2_dc_buf *buf = buf_priv; + struct sg_table *sgt = buf->dma_sgt; + + if (!sgt) + return; + + dma_sync_sg_for_cpu(buf->dev, sgt->sgl, sgt->nents, buf->dma_dir); +} + /*********************************************/ /* callbacks for MMAP buffers */ /*********************************************/ @@ -366,6 +388,8 @@ const struct vb2_mem_ops vb2_dma_contig_memops = { .mmap = vb2_dc_mmap, .get_userptr = vb2_dc_get_userptr, .put_userptr = vb2_dc_put_userptr, + .prepare = vb2_dc_prepare, + .finish = vb2_dc_finish, .num_users = vb2_dc_num_users, }; EXPORT_SYMBOL_GPL(vb2_dma_contig_memops);