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: 1537461 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 02ED4DFFAD for ; Tue, 2 Oct 2012 14:37:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D8BAF9F6C7 for ; Tue, 2 Oct 2012 07:37:47 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by gabe.freedesktop.org (Postfix) with ESMTP id 508FA9F5EC for ; Tue, 2 Oct 2012 07:29:06 -0700 (PDT) Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MB900EUES8GIC00@mailout4.samsung.com> for dri-devel@lists.freedesktop.org; Tue, 02 Oct 2012 23:29:05 +0900 (KST) X-AuditID: cbfee61a-b7f726d000000ec7-23-506afa3110ec Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 35.9E.03783.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 dri-devel@lists.freedesktop.org; Tue, 02 Oct 2012 23:29:05 +0900 (KST) From: Tomasz Stanislawski To: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCHv9 10/25] v4l: vb2-dma-contig: add prepare/finish to dma-contig allocator 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+t9jQV3DX1kBBq9uallc+fqezYHR4373 caYAxigum5TUnMyy1CJ9uwSujGU34wsaeCs2dXewNjA2cHcxcnJICJhI9M5uYYWwxSQu3FvP BmILCUxnlHg6U7KLkQvIXsck8eXdebAiNqCGY0s+M4LYIgIOEqfvzmIGKWIWWMMs8WLlDbBu YYEoiT9r1rCD2CwCqhIz170Fs3kFPCQ+/H3LBrFNXuLp/T4wmxMo/vPJBRaIze4Se5Y3sU1g 5F3AyLCKUTS1ILmgOCk911CvODG3uDQvXS85P3cTI9jnz6R2MK5ssDjEKMDBqMTDu/NkZoAQ a2JZcWXuIUYJDmYlEV7r+1kBQrwpiZVVqUX58UWlOanFhxilOViUxHmbPVIChATSE0tSs1NT C1KLYLJMHJxSDYyRUX9n7gpwDziSNr/i49TIfWu6pbepvZ17T+V9W/WJENata06rHUo0l/7P 6x66wXyn3pU1tfMM6t/vWzUvZT1vQPhx/qqACkYf35DNTkEFB6JdNV4vXlVXWNjIG/rUwufO h/VGbIc2Ws06kWH/UlQ+25N3f4jf/XTbyd6Xjmo23dX7MHE6J4cSS3FGoqEWc1FxIgBV5Zsl 9QEAAA== Cc: t.stanislaws@samsung.com, s.nawrocki@samsung.com, pawel@osciak.com, mchehab@redhat.com, daniel.vetter@ffwll.ch, subashrp@gmail.com, linaro-mm-sig@lists.linaro.org, kyungmin.park@samsung.com, laurent.pinchart@ideasonboard.com, zhangfei.gao@gmail.com, airlied@redhat.com, remi@remlab.net, m.szyprowski@samsung.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org 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);