From patchwork Fri Dec 9 12:35:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Hecht X-Patchwork-Id: 9469949 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CF18A60476 for ; Mon, 12 Dec 2016 00:58:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C0793283C2 for ; Mon, 12 Dec 2016 00:58:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B4BDB283F3; Mon, 12 Dec 2016 00:58:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4EFFF283C2 for ; Mon, 12 Dec 2016 00:58:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 444026E25F; Mon, 12 Dec 2016 00:58:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9BCAC6E9A0 for ; Fri, 9 Dec 2016 12:35:26 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id g23so3803716wme.1 for ; Fri, 09 Dec 2016 04:35:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Pv6wkWp0VhfQ9xFMcO1BXl5DXZziTcR1VbttR2nZeFw=; b=Fa8z8O/Qs11fkYSk+qEAhQgqxk81ROgP9gnJ6AAT4GMq5vOQfq95kQ289Z7YaMEhfk nF6MgK4cFpKc3oxVSMe/+Mc9OQYVBrfyIFGnHVm5aKNmy14w6Ig8R8IOu1r4/3oOho74 XDpdlbqhmrOGCeHNmQuMZ4hyKzbFAj1mlcQr5lfwdOuWI7geGoC2p+gZTb3pq4mVGFY6 fqYbqE4f99Z50Jg5TVyxSrmwj33o1PuMaJZ93d9UxkZkNsx3BbWfVjvfNCJidxMJqjtJ 4FvHWr5oYe1mrAXGxtAjoJO7GJggKkhbG2RF/9/8n4tn9TjwZE89oFsvjvCsI0QFPDdd v6sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Pv6wkWp0VhfQ9xFMcO1BXl5DXZziTcR1VbttR2nZeFw=; b=N4xFCLXzQ5Px6t310lyk41Hk36h6Up4MwxWMYVPVqQaPMxHc5+QNqEBCBHxStJweh3 WWmi40bLtedZG2WC3VM+1JMaz7z54HCjGMaUTCzxYahDrSvmpGC3ge/n20nwY8Kx9oAJ hHodjt6n/8W3mqLTGcL9XYB+iTxbjJQOEiJkfMEXkA1ix6+jenrBR1Xj1wFuhZbETLOZ TnrcTqpEEImACrEUEqU5sclYXfFI7AcYaOwDt5sKq+7LObHDnfuWQqBD+GqpzGVYLdmX Ien+l8CivclUcI7Oa/s+WQnuoGknmkyQXjVzq01Jscpfkpo2N9LAXaOfLSJ1/BOQ4APf OdsQ== X-Gm-Message-State: AKaTC02MoeYvz1+YqTsrRk9gGLPTzjokoI01QcdvXgVnbq6FVcoarGzCDm1x3AjagQhhmA== X-Received: by 10.28.165.131 with SMTP id o125mr6674732wme.9.1481286924964; Fri, 09 Dec 2016 04:35:24 -0800 (PST) Received: from groucho.site (ipbcc17b88.dynamic.kabel-deutschland.de. [188.193.123.136]) by smtp.gmail.com with ESMTPSA id x140sm20360920wme.19.2016.12.09.04.35.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Dec 2016 04:35:24 -0800 (PST) From: Ulrich Hecht To: linux-renesas-soc@vger.kernel.org Subject: [PATCH v1.5 3/6] v4l: vsp1: Add API to map and unmap DRM buffers through the VSP Date: Fri, 9 Dec 2016 13:35:09 +0100 Message-Id: <1481286912-16555-4-git-send-email-ulrich.hecht+renesas@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481286912-16555-1-git-send-email-ulrich.hecht+renesas@gmail.com> References: <1481286912-16555-1-git-send-email-ulrich.hecht+renesas@gmail.com> X-Mailman-Approved-At: Mon, 12 Dec 2016 00:58:03 +0000 Cc: Laurent Pinchart , magnus.damm@gmail.com, laurent.pinchart@ideasonboard.com, dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Laurent Pinchart The display buffers must be mapped for DMA through the device that performs memory access. Expose an API to map and unmap memory through the VSP device to be used by the DU. Signed-off-by: Laurent Pinchart --- drivers/media/platform/vsp1/vsp1_drm.c | 24 ++++++++++++++++++++++++ include/media/vsp1.h | 3 +++ 2 files changed, 27 insertions(+) diff --git a/drivers/media/platform/vsp1/vsp1_drm.c b/drivers/media/platform/vsp1/vsp1_drm.c index cd209dc..bb35603 100644 --- a/drivers/media/platform/vsp1/vsp1_drm.c +++ b/drivers/media/platform/vsp1/vsp1_drm.c @@ -12,9 +12,11 @@ */ #include +#include #include #include +#include #include #include @@ -519,6 +521,28 @@ void vsp1_du_atomic_flush(struct device *dev) } EXPORT_SYMBOL_GPL(vsp1_du_atomic_flush); +int vsp1_du_map_sg(struct device *dev, struct sg_table *sgt) +{ + struct vsp1_device *vsp1 = dev_get_drvdata(dev); + struct device *map_dev; + + map_dev = vsp1->fcp ? rcar_fcp_get_device(vsp1->fcp) : dev; + + return dma_map_sg(map_dev, sgt->sgl, sgt->nents, DMA_TO_DEVICE); +} +EXPORT_SYMBOL_GPL(vsp1_du_map_sg); + +void vsp1_du_unmap_sg(struct device *dev, struct sg_table *sgt) +{ + struct vsp1_device *vsp1 = dev_get_drvdata(dev); + struct device *map_dev; + + map_dev = vsp1->fcp ? rcar_fcp_get_device(vsp1->fcp) : dev; + + dma_unmap_sg(map_dev, sgt->sgl, sgt->nents, DMA_TO_DEVICE); +} +EXPORT_SYMBOL_GPL(vsp1_du_unmap_sg); + /* ----------------------------------------------------------------------------- * Initialization */ diff --git a/include/media/vsp1.h b/include/media/vsp1.h index 458b400..8d3d07a 100644 --- a/include/media/vsp1.h +++ b/include/media/vsp1.h @@ -13,6 +13,7 @@ #ifndef __MEDIA_VSP1_H__ #define __MEDIA_VSP1_H__ +#include #include #include @@ -37,5 +38,7 @@ void vsp1_du_atomic_begin(struct device *dev); int vsp1_du_atomic_update(struct device *dev, unsigned int rpf, const struct vsp1_du_atomic_config *cfg); void vsp1_du_atomic_flush(struct device *dev); +int vsp1_du_map_sg(struct device *dev, struct sg_table *sgt); +void vsp1_du_unmap_sg(struct device *dev, struct sg_table *sgt); #endif /* __MEDIA_VSP1_H__ */