From patchwork Wed Oct 10 14:46:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Stanislawski X-Patchwork-Id: 12119 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 06FAC23EFB for ; Wed, 10 Oct 2012 14:54:09 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 984EBA18EEB for ; Wed, 10 Oct 2012 14:54:08 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id f6so418520iag.11 for ; Wed, 10 Oct 2012 07:54:08 -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=bOelhGap8tLc0AW7d5wZk0PjKgY/0ZhFHaMfkLTsdMw=; b=jdbgBwK0xxY3im51wgwYknIhsToYPni/vdXkZ0xvDUbj79lx5saX7Rk+Vp7mIoGj67 OFKlOlgAvXRxoK2B7Kr85k91TIty4A2Fjr5MLn0S+dVWpYziDE3lWKHnR5GlO40nvRPN eCVK9//KL8kugNxkvrFr4sXnrjZYGFcezhKs+PrVZsYrQKBEpB7nB0AszTIMbjAHFZwf VXj/OKVw3aUKa28bezI4av95pwb3e9XHIp9h0c//UrErOtB9cHGiSWoXvaGq8pf6t20Y KZ68pNP2NI4MxnPAolDcUtX0k3Grc+Lx2Imwr0Ez+PkvJTTkJ2aJTTm/vz/jPPOcKpS5 9/+g== Received: by 10.50.91.195 with SMTP id cg3mr5477981igb.57.1349880848085; Wed, 10 Oct 2012 07:54:08 -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.67.148 with SMTP id n20csp236242igt; Wed, 10 Oct 2012 07:54:07 -0700 (PDT) Received: by 10.204.128.89 with SMTP id j25mr8221899bks.23.1349880846392; Wed, 10 Oct 2012 07:54:06 -0700 (PDT) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id hu13si2834454bkc.52.2012.10.10.07.54.05; Wed, 10 Oct 2012 07:54: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 1TLxfg-0001Qt-10; Wed, 10 Oct 2012 14:54:04 +0000 Received: from mailout1.samsung.com ([203.254.224.24]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1TLxfe-0001Qo-9d for linaro-mm-sig@lists.linaro.org; Wed, 10 Oct 2012 14:54:02 +0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MBO002SDMQ0ZT10@mailout1.samsung.com> for linaro-mm-sig@lists.linaro.org; Wed, 10 Oct 2012 23:54:00 +0900 (KST) X-AuditID: cbfee61a-b7f726d000000ec7-5d-50758c0874b3 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 43.D9.03783.80C85705; Wed, 10 Oct 2012 23:54:00 +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 <0MBO002YDME0EC70@mmp1.samsung.com> for linaro-mm-sig@lists.linaro.org; Wed, 10 Oct 2012 23:54:00 +0900 (KST) From: Tomasz Stanislawski To: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org Date: Wed, 10 Oct 2012 16:46:29 +0200 Message-id: <1349880405-26049-11-git-send-email-t.stanislaws@samsung.com> X-Mailer: git-send-email 1.7.10 In-reply-to: <1349880405-26049-1-git-send-email-t.stanislaws@samsung.com> References: <1349880405-26049-1-git-send-email-t.stanislaws@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMJMWRmVeSWpSXmKPExsVy+t9jAV2OntIAgy93NS2+XHnI5MDocfvf Y+YAxigum5TUnMyy1CJ9uwSujLnX9rEWHOWtOHZbs4HxAHcXIyeHhICJxNebB9ghbDGJC/fW s3UxcnEICSxilJiw+CALhLOWSeL/5xdMIFVsQB3HlnxmBLFFBBwkTt+dxQxSxCywhlnixcob bCAJYYFoib07toEVsQioSiz/t5IFxOYV8JRoXDuNEWKdvMTT+31g9ZxA8QvzpjOD2EICHhL/ 129mmsDIu4CRYRWjaGpBckFxUnquoV5xYm5xaV66XnJ+7iZGsNefSe1gXNlgcYhRgINRiYc3 I6okQIg1say4MvcQowQHs5IIr6lPaYAQb0piZVVqUX58UWlOavEhRmkOFiVx3maPlAAhgfTE ktTs1NSC1CKYLBMHp1QDI9/DEzaOYQ5Xfh+a7RtYU+G5xI5jjlpM4U+pBWfEQ9x2c7IcfzLb 8xDvv99X+9SLQn77fGa8vIftP995CXtJ8XqpUjemn6/E3jmrdT9lOGztcFy77NSDSN1nL+fW W3Vc2P+91+bR0+0fbrzb/mrjlYm1LK6MUmdf9dzmvCh/2OIX7x+/737sB5RYijMSDbWYi4oT AXwtrwz2AQAA 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] [PATCHv10 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: ALoCoQkAW7B0GFMTBL0DWVtMQoEuPh0i/AjvO4e6PooTJQDH9AHZ5rg7uYIjp0OrFrdHpQhhnXq7 From: Marek Szyprowski Add prepare/finish callbacks to vb2-dma-contig allocator. Signed-off-by: Marek Szyprowski Acked-by: Laurent Pinchart Acked-by: Hans Verkuil --- drivers/media/v4l2-core/videobuf2-dma-contig.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c b/drivers/media/v4l2-core/videobuf2-dma-contig.c index 8486e06..494a824 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-contig.c +++ b/drivers/media/v4l2-core/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);