From patchwork Fri Apr 20 14:45:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Stanislawski X-Patchwork-Id: 7995 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 89AB423E00 for ; Fri, 20 Apr 2012 14:51:37 +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 30E1FA1810B for ; Fri, 20 Apr 2012 14:51:37 +0000 (UTC) Received: by iage36 with SMTP id e36so18442630iag.11 for ; Fri, 20 Apr 2012 07:51:36 -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:date:from :in-reply-to:to:message-id:mime-version:x-mailer:references:cc :subject:x-beenthere:x-mailman-version:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :content-type:content-transfer-encoding:sender:errors-to :x-gm-message-state; bh=lONI/4QP09svK9UOLVShnjLMT9lDkrdHR6cpGUM1g6U=; b=HU9k5O0e9/u8OOZMDFdd7tvpSFH6tSFwW9RFu2Y8JknfxpgF7CuNxg6UYsad0LujHt ctc78yt1dsQ62tyCJ7PQJDfcJH0TWt8uQbQG8IBmevuOq1CgTOYP2RTpnnyZOwfWF7yD SQT59oQwl3aQzmU+YDsVzkilreEZ5dE+tvS+TDyxthRst4isxZjxzJLE6ukOZy4GhGkp rBuZiuCG3P6SeW7XdMEaRhdi+L6gTOeNFTAGkpcUeFL3db43x950lNc3G0jKHLcvYDlm ByWFvUoeHMwjpHOP2Zz9gRW2o8grxICntzBKOlOnrWej2s/mt4fFFA7dzpImz+LsG17s JXZw== Received: by 10.43.49.201 with SMTP id vb9mr5379867icb.35.1334933496639; Fri, 20 Apr 2012 07:51:36 -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.231.137.198 with SMTP id x6csp39458ibt; Fri, 20 Apr 2012 07:51:36 -0700 (PDT) Received: by 10.180.80.9 with SMTP id n9mr15806793wix.4.1334933166390; Fri, 20 Apr 2012 07:46:06 -0700 (PDT) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id h14si2999015wiv.35.2012.04.20.07.45.56; Fri, 20 Apr 2012 07:46:06 -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 1SLF5u-0008BG-Dn; Fri, 20 Apr 2012 14:45:54 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SLF5i-00085e-Bx for linaro-mm-sig@lists.linaro.org; Fri, 20 Apr 2012 14:45:42 +0000 Received: from euspt1 (mailout2.w1.samsung.com [210.118.77.12]) by mailout2.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTP id <0M2S00GVM8ZZF0@mailout2.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Fri, 20 Apr 2012 15:45:35 +0100 (BST) Received: from linux.samsung.com ([106.116.38.10]) by spt1.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0M2S00C5O9021T@spt1.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Fri, 20 Apr 2012 15:45:39 +0100 (BST) Received: from mcdsrvbld02.digital.local (unknown [106.116.37.23]) by linux.samsung.com (Postfix) with ESMTP id 5CBE1270071; Fri, 20 Apr 2012 16:59:13 +0200 (CEST) Date: Fri, 20 Apr 2012 16:45:31 +0200 From: Tomasz Stanislawski In-reply-to: <1334933134-4688-1-git-send-email-t.stanislaws@samsung.com> To: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org Message-id: <1334933134-4688-11-git-send-email-t.stanislaws@samsung.com> MIME-version: 1.0 X-Mailer: git-send-email 1.7.9.5 References: <1334933134-4688-1-git-send-email-t.stanislaws@samsung.com> Cc: pawel@osciak.com, sumit.semwal@ti.com, linux-doc@vger.kernel.org, mchehab@redhat.com, robdclark@gmail.com, linaro-mm-sig@lists.linaro.org, kyungmin.park@samsung.com, airlied@redhat.com, remi@remlab.net, g.liakhovetski@gmx.de Subject: [Linaro-mm-sig] [PATCHv5 10/13] 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: , Sender: linaro-mm-sig-bounces@lists.linaro.org Errors-To: linaro-mm-sig-bounces@lists.linaro.org X-Gm-Message-State: ALoCoQmd8ZnI324CznUgxRVBBmkZW/EjJd8fX6RFne4jM/rJUPzVep011hinl+q33rUJFuXRlcnc 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 files changed, 24 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/videobuf2-dma-contig.c b/drivers/media/video/videobuf2-dma-contig.c index 9cbc8d4..93f86a0 100644 --- a/drivers/media/video/videobuf2-dma-contig.c +++ b/drivers/media/video/videobuf2-dma-contig.c @@ -149,6 +149,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 */ /*********************************************/ @@ -411,6 +433,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);