From patchwork Tue Apr 10 13:10:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Stanislawski X-Patchwork-Id: 7720 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 B8EFE23E1D for ; Tue, 10 Apr 2012 13:11:21 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id 72A31A186F9 for ; Tue, 10 Apr 2012 13:11:21 +0000 (UTC) Received: by yhpp61 with SMTP id p61so2763083yhp.11 for ; Tue, 10 Apr 2012 06:11:21 -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=DIxZS9wmQyJK++4iAO2LVQhm9QOA2BHvSgtyy765AJc=; b=lCCCd6MogtYyqmu/0ustKFIEJ9CD3IozuylMOLfEM7uHgnkQiSl7cHAto6dqJlXXV6 oPGHEmPGGsGrWFq07Jh6n8Vi6DYtzG7x8n3Q4bmhLYtXplYms3aOTxS0C4npyb8HfKeG 1QoRwTz3kMNQRa3BwogZ/0x9voTSurrkgtW6Q3IdAphXQF/zG9xCBG3vaLsv8wFzHXLl 3bpkdWwkr9kzjt6jD6wmt5Me+NQ+Xdj8LGcmTbkN6WuEc+Ffj3q6Z3o3cSQetzoeoJvs R3tzTlytRS7VjOFPTYMbLFRtG0cepeJJW0I/+mf+tSYDphdhQWajxWVlzVk7SYlupDES UVpw== Received: by 10.50.187.225 with SMTP id fv1mr2299650igc.28.1334063480807; Tue, 10 Apr 2012 06:11:20 -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.164.217 with SMTP id f25csp20446iby; Tue, 10 Apr 2012 06:11:19 -0700 (PDT) Received: by 10.180.88.169 with SMTP id bh9mr7028966wib.5.1334063473248; Tue, 10 Apr 2012 06:11:13 -0700 (PDT) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id m34si18225227weq.12.2012.04.10.06.10.56; Tue, 10 Apr 2012 06:11:13 -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 1SHaqW-0004Qp-Cn; Tue, 10 Apr 2012 13:10:56 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SHaqT-0004PD-5l for linaro-mm-sig@lists.linaro.org; Tue, 10 Apr 2012 13:10:53 +0000 Received: from euspt2 (mailout1.w1.samsung.com [210.118.77.11]) by mailout1.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTP id <0M2900LOJLWHUU@mailout1.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Tue, 10 Apr 2012 14:09:53 +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 <0M2900ML4LY1QL@spt2.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Tue, 10 Apr 2012 14:10:49 +0100 (BST) Received: from mcdsrvbld02.digital.local (unknown [106.116.37.23]) by linux.samsung.com (Postfix) with ESMTP id BB4F327005D; Tue, 10 Apr 2012 15:19:55 +0200 (CEST) Date: Tue, 10 Apr 2012 15:10:40 +0200 From: Tomasz Stanislawski In-reply-to: <1334063447-16824-1-git-send-email-t.stanislaws@samsung.com> To: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org Message-id: <1334063447-16824-7-git-send-email-t.stanislaws@samsung.com> MIME-version: 1.0 X-Mailer: git-send-email 1.7.9.1 References: <1334063447-16824-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 Subject: [Linaro-mm-sig] [RFC 06/13] v4l: vb2-dma-contig: add vmap/kmap for dmabuf exporting 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: ALoCoQkGuRTUZ3mhlWKQVsSQ/dydsQR9ESVKZ2vh91uAN2kEmNh8IQhayGf78HZTc4phRqCa7bwo This patch adds support for vmap and kmap callbacks for DMABUF exporter. Signed-off-by: Tomasz Stanislawski Signed-off-by: Kyungmin Park --- drivers/media/video/videobuf2-dma-contig.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/videobuf2-dma-contig.c b/drivers/media/video/videobuf2-dma-contig.c index e1ad47e..537926b 100644 --- a/drivers/media/video/videobuf2-dma-contig.c +++ b/drivers/media/video/videobuf2-dma-contig.c @@ -403,11 +403,28 @@ static void vb2_dc_dmabuf_ops_release(struct dma_buf *dbuf) vb2_dc_put(dbuf->priv); } +static void *vb2_dc_dmabuf_ops_kmap(struct dma_buf *dbuf, unsigned long pgnum) +{ + struct vb2_dc_buf *buf = dbuf->priv; + + return buf->vaddr + pgnum * PAGE_SIZE; +} + +static void *vb2_dc_dmabuf_ops_vmap(struct dma_buf *dbuf) +{ + struct vb2_dc_buf *buf = dbuf->priv; + + return buf->vaddr; +} + static struct dma_buf_ops vb2_dc_dmabuf_ops = { .attach = vb2_dc_dmabuf_ops_attach, .detach = vb2_dc_dmabuf_ops_detach, .map_dma_buf = vb2_dc_dmabuf_ops_map, .unmap_dma_buf = vb2_dc_dmabuf_ops_unmap, + .kmap = vb2_dc_dmabuf_ops_kmap, + .kmap_atomic = vb2_dc_dmabuf_ops_kmap, + .vmap = vb2_dc_dmabuf_ops_vmap, .release = vb2_dc_dmabuf_ops_release, };