msm_fb: display: MSM V4l2 video overlay driver
Provides a V4L2 device that uses the MDP overlay pipes (on MDP4),
or the PPP interface (MDP3) to overlay frames on top of display
framebuffer.
Signed-off-by: Alhad Purnapatre <alhadp@codeaurora.org>
Change-Id: Iab69d0a5acfe993d13cb7a585e292b9a87eb90ee
diff --git a/arch/arm/mach-msm/board-msm7x30.c b/arch/arm/mach-msm/board-msm7x30.c
index cd1e5b8..972cb22 100644
--- a/arch/arm/mach-msm/board-msm7x30.c
+++ b/arch/arm/mach-msm/board-msm7x30.c
@@ -99,6 +99,11 @@
#else
#define MSM_FB_SIZE 0x500000
#endif
+/*
+ * Reserve space for double buffered full screen
+ * res V4L2 video overlay - i.e. 1280x720x1.5x2
+ */
+#define MSM_V4L2_VIDEO_OVERLAY_BUF_SIZE 2764800
#define MSM_PMEM_ADSP_SIZE 0x1E00000
#define MSM_FLUID_PMEM_ADSP_SIZE 0x2800000
#define PMEM_KERNEL_EBI0_SIZE 0x600000
@@ -3770,6 +3775,14 @@
}
};
+#ifdef CONFIG_MSM_V4L2_VIDEO_OVERLAY_DEVICE
+static struct resource msm_v4l2_video_overlay_resources[] = {
+ {
+ .flags = IORESOURCE_DMA,
+ }
+};
+#endif
+
static int msm_fb_detect_panel(const char *name)
{
if (machine_is_msm7x30_fluid()) {
@@ -3803,6 +3816,16 @@
}
};
+#ifdef CONFIG_MSM_V4L2_VIDEO_OVERLAY_DEVICE
+
+static struct platform_device msm_v4l2_video_overlay_device = {
+ .name = "msm_v4l2_overlay_pd",
+ .id = 0,
+ .num_resources = ARRAY_SIZE(msm_v4l2_video_overlay_resources),
+ .resource = msm_v4l2_video_overlay_resources,
+};
+#endif
+
static struct platform_device msm_migrate_pages_device = {
.name = "msm_migrate_pages",
.id = -1,
@@ -5192,6 +5215,9 @@
#endif
&android_pmem_device,
&msm_fb_device,
+#ifdef CONFIG_MSM_V4L2_VIDEO_OVERLAY_DEVICE
+ &msm_v4l2_video_overlay_device,
+#endif
&msm_migrate_pages_device,
&mddi_toshiba_device,
&lcdc_toshiba_panel_device,
@@ -7025,6 +7051,16 @@
msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
size, addr, __pa(addr));
+
+#ifdef CONFIG_MSM_V4L2_VIDEO_OVERLAY_DEVICE
+ size = MSM_V4L2_VIDEO_OVERLAY_BUF_SIZE;
+ addr = alloc_bootmem_align(size, 0x1000);
+ msm_v4l2_video_overlay_resources[0].start = __pa(addr);
+ msm_v4l2_video_overlay_resources[0].end =
+ msm_v4l2_video_overlay_resources[0].start + size - 1;
+ pr_debug("allocating %lu bytes at %p (%lx physical) for v4l2\n",
+ size, addr, __pa(addr));
+#endif
}
static void __init msm7x30_map_io(void)