From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> To: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org Cc: linux-renesas-soc@vger.kernel.org Subject: [PATCH 5/6] v4l: vsp1: Add API to map and unmap DRM buffers through the VSP Date: Fri, 19 Aug 2016 11:39:33 +0300 [thread overview] Message-ID: <1471595974-28960-6-git-send-email-laurent.pinchart+renesas@ideasonboard.com> (raw) In-Reply-To: <1471595974-28960-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com> 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 <laurent.pinchart+renesas@ideasonboard.com> --- 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 f76131b192a4..0472cb4bc2e4 100644 --- a/drivers/media/platform/vsp1/vsp1_drm.c +++ b/drivers/media/platform/vsp1/vsp1_drm.c @@ -12,9 +12,11 @@ */ #include <linux/device.h> +#include <linux/dma-mapping.h> #include <linux/slab.h> #include <media/media-entity.h> +#include <media/rcar-fcp.h> #include <media/v4l2-subdev.h> #include <media/vsp1.h> @@ -521,6 +523,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 458b400373d4..8d3d07a3715e 100644 --- a/include/media/vsp1.h +++ b/include/media/vsp1.h @@ -13,6 +13,7 @@ #ifndef __MEDIA_VSP1_H__ #define __MEDIA_VSP1_H__ +#include <linux/scatterlist.h> #include <linux/types.h> #include <linux/videodev2.h> @@ -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__ */ -- Regards, Laurent Pinchart
WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> To: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org Cc: linux-renesas-soc@vger.kernel.org Subject: [PATCH 5/6] v4l: vsp1: Add API to map and unmap DRM buffers through the VSP Date: Fri, 19 Aug 2016 11:39:33 +0300 [thread overview] Message-ID: <1471595974-28960-6-git-send-email-laurent.pinchart+renesas@ideasonboard.com> (raw) In-Reply-To: <1471595974-28960-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com> 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 <laurent.pinchart+renesas@ideasonboard.com> --- 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 f76131b192a4..0472cb4bc2e4 100644 --- a/drivers/media/platform/vsp1/vsp1_drm.c +++ b/drivers/media/platform/vsp1/vsp1_drm.c @@ -12,9 +12,11 @@ */ #include <linux/device.h> +#include <linux/dma-mapping.h> #include <linux/slab.h> #include <media/media-entity.h> +#include <media/rcar-fcp.h> #include <media/v4l2-subdev.h> #include <media/vsp1.h> @@ -521,6 +523,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 458b400373d4..8d3d07a3715e 100644 --- a/include/media/vsp1.h +++ b/include/media/vsp1.h @@ -13,6 +13,7 @@ #ifndef __MEDIA_VSP1_H__ #define __MEDIA_VSP1_H__ +#include <linux/scatterlist.h> #include <linux/types.h> #include <linux/videodev2.h> @@ -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__ */ -- Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2016-08-19 8:39 UTC|newest] Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-08-19 8:39 [PATCH 0/6] R-Car DU: Fix IOMMU operation when connected to VSP Laurent Pinchart 2016-08-19 8:39 ` Laurent Pinchart 2016-08-19 8:39 ` [PATCH 1/6] drm: Don't implement empty prepare_fb()/cleanup_fb() Laurent Pinchart 2016-08-19 8:39 ` Laurent Pinchart 2016-08-19 8:59 ` Daniel Vetter 2016-08-19 8:59 ` Daniel Vetter 2016-08-19 8:39 ` [PATCH 2/6] drm: Unconstify state argument to prepare_fb()/cleanup_fb() Laurent Pinchart 2016-08-19 8:39 ` Laurent Pinchart 2016-08-19 8:39 ` [PATCH 3/6] v4l: rcar-fcp: Don't get/put module reference Laurent Pinchart 2016-08-19 8:39 ` Laurent Pinchart 2016-08-19 8:44 ` Geert Uytterhoeven 2016-08-19 8:44 ` Geert Uytterhoeven 2016-08-19 8:39 ` [PATCH 4/6] v4l: rcar-fcp: Add an API to retrieve the FCP device Laurent Pinchart 2016-08-19 8:39 ` Laurent Pinchart 2016-08-19 8:39 ` Laurent Pinchart [this message] 2016-08-19 8:39 ` [PATCH 5/6] v4l: vsp1: Add API to map and unmap DRM buffers through the VSP Laurent Pinchart 2016-08-19 8:39 ` [PATCH 6/6] drm: rcar-du: Map memory through the VSP device Laurent Pinchart 2016-08-19 8:39 ` Laurent Pinchart 2016-09-07 8:01 ` [PATCH 0/6] R-Car DU: Fix IOMMU operation when connected to VSP Magnus Damm 2016-09-07 8:01 ` Magnus Damm 2017-05-14 17:01 ` Laurent Pinchart 2017-05-14 17:01 ` Laurent Pinchart 2017-01-10 10:09 ` Geert Uytterhoeven
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1471595974-28960-6-git-send-email-laurent.pinchart+renesas@ideasonboard.com \ --to=laurent.pinchart+renesas@ideasonboard.com \ --cc=dri-devel@lists.freedesktop.org \ --cc=linux-media@vger.kernel.org \ --cc=linux-renesas-soc@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.