From patchwork Wed May 23 12:10:24 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Stanislawski X-Patchwork-Id: 8911 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 DEBAE23E49 for ; Wed, 23 May 2012 12:11:07 +0000 (UTC) Received: from mail-qc0-f180.google.com (mail-qc0-f180.google.com [209.85.216.180]) by fiordland.canonical.com (Postfix) with ESMTP id B0DDFA187D3 for ; Wed, 23 May 2012 12:11:07 +0000 (UTC) Received: by mail-qc0-f180.google.com with SMTP id v28so5750530qcm.11 for ; Wed, 23 May 2012 05:11:07 -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=EZKpFE30S1seFGeRXEOi67eURjf+h4UgF97TlLrh+8w=; b=oUz301NtIO4N57YjhrKedJK/OCY+vYEzyJmMnY8WY/cp096bjOFZu3pTXa+wtFMJEA iq+03Ywp/Y3lQr+w7M+uNhNfr9GftVICrp4VXmkCRBkkDQbJoK6oXD12x2/dVnvt/Ofv mtyUciK7f9Qlzqr12cHFw870hIytHt3OxMjEDcGA+4K7Ay/5zTmvRdlPpS0k66XTY6Mg UAKn3Wu3KwpoN0OxmJyAqAgoWno3G/1SEVENcW5W1Mf2EhQ2rBci7JeC/CcKvNJH1ozx w11DfvSx9/JLZyhfXDXulu8eDjy6NO8F34TLMSBXX+jyXjCHT3WECeTHWQN6rMS7AbDq 1sAw== Received: by 10.50.203.39 with SMTP id kn7mr12539880igc.53.1337775067117; Wed, 23 May 2012 05:11:07 -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.35.72 with SMTP id o8csp439870ibd; Wed, 23 May 2012 05:11:01 -0700 (PDT) Received: by 10.204.145.89 with SMTP id c25mr11875667bkv.5.1337775059261; Wed, 23 May 2012 05:10:59 -0700 (PDT) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id fs20si15084135bkc.63.2012.05.23.05.10.56; Wed, 23 May 2012 05:10:59 -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 1SXAP1-000695-Hd; Wed, 23 May 2012 12:10:55 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SXAOu-00060w-0P for linaro-mm-sig@lists.linaro.org; Wed, 23 May 2012 12:10:48 +0000 Received: from euspt2 (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 <0M4H000B35TL1U@mailout2.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Wed, 23 May 2012 13:10:35 +0100 (BST) Received: from linux.samsung.com ([106.116.38.10]) by spt2.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0M4H00D9V5TTYM@spt2.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Wed, 23 May 2012 13:10:41 +0100 (BST) Received: from mcdsrvbld02.digital.local (unknown [106.116.37.23]) by linux.samsung.com (Postfix) with ESMTP id 3F072270056; Wed, 23 May 2012 14:21:59 +0200 (CEST) Date: Wed, 23 May 2012 14:10:24 +0200 From: Tomasz Stanislawski In-reply-to: <1337775027-9489-1-git-send-email-t.stanislaws@samsung.com> To: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org Message-id: <1337775027-9489-11-git-send-email-t.stanislaws@samsung.com> MIME-version: 1.0 X-Mailer: git-send-email 1.7.10 References: <1337775027-9489-1-git-send-email-t.stanislaws@samsung.com> Cc: pawel@osciak.com, sumit.semwal@ti.com, 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] [PATCHv6 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: ALoCoQk7uXyi7qkZvbkEUf/+PsKX+jKkUSeR/RqP1lDlUvb3d26M9pR68cLEqCY2Wlg9eiXiCb33 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 068ec11..bb32e7e 100644 --- a/drivers/media/video/videobuf2-dma-contig.c +++ b/drivers/media/video/videobuf2-dma-contig.c @@ -150,6 +150,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 */ /*********************************************/ @@ -403,6 +425,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);