From patchwork Tue Oct 2 14:27:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Stanislawski X-Patchwork-Id: 11931 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 3989A1A52FC for ; Tue, 2 Oct 2012 14:29:17 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id E1F2EA186E7 for ; Tue, 2 Oct 2012 14:29:16 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so14258231iej.11 for ; Tue, 02 Oct 2012 07:29:16 -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: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=6KRSt6rvzdnbSXRDhdubCM1BjQnzCo5ukCUNVTzy7Go=; b=B0SXDJoYSpqBCLLNx8dRLmQWnaz3vbW0Yg31D2c85x8WOl0h9ERHURRnk0qdr78rrF Bm7uVA4zCE9mZsLe5vaYCty0oO+ndCeMq652JQVwipc1E4o68DHlTlgieLZsjXx9D73x h+jHY7LMI4lIhYo5I6jF401HClpAMtmUjzb1V5Hi6SnwCcBllSkc8rD/Dglgir4pGrwt 8SRJmbHyVG4seMN6W2l3UHNHyDWnNRHAcm/M1t2ZE8UGESAXgrix7hRCmrSrKC4MnXvk jkS+L3jX92esWcHmNUM7gfomxr/id2AwyzcO569upM+xYp2Zybt988PzCnFo/tjbxhZq nzeA== Received: by 10.50.154.137 with SMTP id vo9mr8368753igb.28.1349188156617; Tue, 02 Oct 2012 07:29:16 -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.232 with SMTP id ex8csp84979igc; Tue, 2 Oct 2012 07:29:15 -0700 (PDT) Received: by 10.204.156.209 with SMTP id y17mr6616026bkw.134.1349188154922; Tue, 02 Oct 2012 07:29:14 -0700 (PDT) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id he3si1692554bkc.149.2012.10.02.07.29.09; Tue, 02 Oct 2012 07:29:14 -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 1TJ3TA-0004fN-E4; Tue, 02 Oct 2012 14:29:08 +0000 Received: from mailout3.samsung.com ([203.254.224.33]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1TJ3T8-0004ev-Rf for linaro-mm-sig@lists.linaro.org; Tue, 02 Oct 2012 14:29:07 +0000 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MB900FNZS8A6O90@mailout3.samsung.com> for linaro-mm-sig@lists.linaro.org; Tue, 02 Oct 2012 23:29:05 +0900 (KST) X-AuditID: cbfee61b-b7f2b6d000000f14-f7-506afa310819 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 45.91.03860.13AFA605; Tue, 02 Oct 2012 23:29:05 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MB9005A7S65K790@mmp2.samsung.com> for linaro-mm-sig@lists.linaro.org; Tue, 02 Oct 2012 23:29:05 +0900 (KST) From: Tomasz Stanislawski To: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org Date: Tue, 02 Oct 2012 16:27:21 +0200 Message-id: <1349188056-4886-11-git-send-email-t.stanislaws@samsung.com> X-Mailer: git-send-email 1.7.10 In-reply-to: <1349188056-4886-1-git-send-email-t.stanislaws@samsung.com> References: <1349188056-4886-1-git-send-email-t.stanislaws@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrEJMWRmVeSWpSXmKPExsVy+t9jQV3DX1kBBhc2aVt8ufKQyYHR4/a/ x8wBjFFcNimpOZllqUX6dglcGctuxhc08FZs6u5gbWBs4O5i5OCQEDCRaNzk3sXICWSKSVy4 t56ti5GLQ0hgOqPE30vN7BDOWiaJ/Tv/sYNUsQE1HFvymRHEFhFwkDh9dxYzSBGzwBpmiRcr b7CBJIQFoiT+rFkD1sAioCoxc91bMJtXwEPiw9+3bBDr5CWe3u8DszmB4j+fXGABsYUE3CX2 LG9im8DIu4CRYRWjaGpBckFxUnqukV5xYm5xaV66XnJ+7iZGsM+fSe9gXNVgcYhRgINRiYd3 18nMACHWxLLiytxDjBIczEoivNb3swKEeFMSK6tSi/Lji0pzUosPMUpzsCiJ8zZ7pAQICaQn lqRmp6YWpBbBZJk4OKUaGLmPi511XC6afeDVz88pjT2bzh+qMvqkaiQk/Cv9q/+8Q5LxCle0 Tc0/zP4wsb4kRvFCXVZB5cygg7/2r5td2K+8MUD9+yXGq+qyB/jfRYYaCaS89y/IEZKJfdO3 +LzUtBnha2V1mjffuv7sOu+8WX93z3ziavjvD2PTv2mR6RUVR7OkXjM1vlJiKc5INNRiLipO BABwfqoJ9QEAAA== Cc: k.debski@samsung.com, s.nawrocki@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, laurent.pinchart@ideasonboard.com, airlied@redhat.com, remi@remlab.net Subject: [Linaro-mm-sig] [PATCHv9 10/25] 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: ALoCoQljNlbJxrSTzAnA1/06L4+8OELGvSf1BTqbdvTg4h0W3mjotsz63dMd+HVVtVwGru4cS2l6 From: Marek Szyprowski Add prepare/finish callbacks to vb2-dma-contig allocator. Signed-off-by: Marek Szyprowski Acked-by: Laurent Pinchart --- 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);