summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiu Ying <Ying.Liu@freescale.com>2013-03-27 15:45:49 +0800
committerLiu Ying <Ying.Liu@freescale.com>2013-04-03 15:22:21 +0800
commit31e5761b2e4094385627ea37c27a550b27310e30 (patch)
tree541a2c90361e430882c9a4c37b84b3d60acf2cec
parentd7739c0ed897da749c1210a8dcb8166fde6f141f (diff)
ENGR00255371 v4l2 fg overlay:workaround ipu warning
There is annoying ipu warning when doing preview by using v4l2 fg overlay component: /unit_tests/mxc_v4l2_overlay.out -iw 320 -ih 240 -ow 1280 -oh 720 -r 0 -fg -t 5 imx-ipuv3 imx-ipuv3.0: IDMAC12's EBA0 is not 8-byte aligned This warning can be seen only when preview size is bigger than 1024*1024(ipu device driver split mode is enabled). After debug, it appears that the unaligned buffer address is caused by input cropping for left strip, and this cropping is triggered by the split mode algrithm. The algrithm is complex, so currently this patch only changes the input pixel format of the ipu task from UYVY to NV12 to workaround this warning. Signed-off-by: Liu Ying <Ying.Liu@freescale.com> (cherry picked from commit aaf14db7afe5ce603857782e96033b259606594b)
-rw-r--r--drivers/media/video/mxc/capture/ipu_fg_overlay_sdc.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/drivers/media/video/mxc/capture/ipu_fg_overlay_sdc.c b/drivers/media/video/mxc/capture/ipu_fg_overlay_sdc.c
index f324f4eac489..6d8d4399d7ad 100644
--- a/drivers/media/video/mxc/capture/ipu_fg_overlay_sdc.c
+++ b/drivers/media/video/mxc/capture/ipu_fg_overlay_sdc.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2004-2012 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright 2004-2013 Freescale Semiconductor, Inc. All Rights Reserved.
*/
/* * The code contained herein is licensed under the GNU General Public
* License. You may obtain a copy of the GNU General Public License
@@ -55,7 +55,7 @@ static void csi_buf_work_func(struct work_struct *work)
task.input.paddr = cam->vf_bufs[1];
task.input.width = cam->crop_current.width;
task.input.height = cam->crop_current.height;
- task.input.format = IPU_PIX_FMT_UYVY;
+ task.input.format = IPU_PIX_FMT_NV12;
if (buffer_num == 0)
task.output.paddr = fbi->fix.smem_start +
@@ -124,7 +124,7 @@ static irqreturn_t csi_enc_callback(int irq, void *dev_id)
ipu_select_buffer(cam->ipu, CSI_MEM, IPU_OUTPUT_BUFFER, csi_buffer_num);
if ((cam->crop_current.width != cam->win.w.width) ||
(cam->crop_current.height != cam->win.w.height) ||
- (vf_out_format != IPU_PIX_FMT_UYVY) ||
+ (vf_out_format != IPU_PIX_FMT_NV12) ||
(cam->rotation >= IPU_ROTATE_VERT_FLIP))
schedule_work(&cam->csi_work_struct);
csi_buffer_num = (csi_buffer_num == 0) ? 1 : 0;
@@ -134,7 +134,6 @@ static irqreturn_t csi_enc_callback(int irq, void *dev_id)
static int csi_enc_setup(cam_data *cam)
{
ipu_channel_params_t params;
- u32 pixel_fmt;
int err = 0, sensor_protocol = 0;
#ifdef CONFIG_MXC_MIPI_CSI2
void *mipi_csi2_info;
@@ -213,7 +212,8 @@ static int csi_enc_setup(cam_data *cam)
cam->vf_bufs_vaddr[1],
(dma_addr_t) cam->vf_bufs[1]);
}
- csi_mem_bufsize = cam->crop_current.width * cam->crop_current.height * 2;
+ csi_mem_bufsize = cam->crop_current.width *
+ cam->crop_current.height * 3/2;
cam->vf_bufs_size[0] = PAGE_ALIGN(csi_mem_bufsize);
cam->vf_bufs_vaddr[0] = (void *)dma_alloc_coherent(0,
cam->vf_bufs_size[0],
@@ -246,13 +246,13 @@ static int csi_enc_setup(cam_data *cam)
goto out_1;
}
- pixel_fmt = IPU_PIX_FMT_UYVY;
if ((cam->crop_current.width == cam->win.w.width) &&
(cam->crop_current.height == cam->win.w.height) &&
- (vf_out_format == IPU_PIX_FMT_UYVY) &&
+ (vf_out_format == IPU_PIX_FMT_NV12) &&
(cam->rotation < IPU_ROTATE_VERT_FLIP)) {
err = ipu_init_channel_buffer(cam->ipu, CSI_MEM, IPU_OUTPUT_BUFFER,
- pixel_fmt, cam->crop_current.width,
+ IPU_PIX_FMT_NV12,
+ cam->crop_current.width,
cam->crop_current.height,
cam->crop_current.width, IPU_ROTATE_NONE,
fbi->fix.smem_start + (fbi->fix.line_length * fbvar.yres),
@@ -260,7 +260,8 @@ static int csi_enc_setup(cam_data *cam)
cam->offset.u_offset, cam->offset.u_offset);
} else {
err = ipu_init_channel_buffer(cam->ipu, CSI_MEM, IPU_OUTPUT_BUFFER,
- pixel_fmt, cam->crop_current.width,
+ IPU_PIX_FMT_NV12,
+ cam->crop_current.width,
cam->crop_current.height,
cam->crop_current.width, IPU_ROTATE_NONE,
cam->vf_bufs[0], cam->vf_bufs[1], 0,
@@ -347,8 +348,8 @@ out1:
static int foreground_start(void *private)
{
cam_data *cam = (cam_data *) private;
- int err = 0, i = 0;
- short *tmp, color;
+ int err = 0, i = 0, screen_size;
+ char *base;
if (!cam) {
printk(KERN_ERR "private is NULL\n");
@@ -383,13 +384,11 @@ static int foreground_start(void *private)
if (OVERLAY_FB_SUPPORT_NONSTD) {
/* Use DP to do CSC so that we can get better performance */
- vf_out_format = IPU_PIX_FMT_UYVY;
+ vf_out_format = IPU_PIX_FMT_NV12;
fbvar.nonstd = vf_out_format;
- color = 0x80;
} else {
vf_out_format = IPU_PIX_FMT_RGB565;
fbvar.nonstd = 0;
- color = 0x0;
}
fbvar.bits_per_pixel = 16;
@@ -405,10 +404,17 @@ static int foreground_start(void *private)
cam->win.w.top);
/* Fill black color for framebuffer */
- tmp = (short *) fbi->screen_base;
- for (i = 0; i < (fbi->fix.line_length * fbi->var.yres)/2;
- i++, tmp++)
- *tmp = color;
+ base = (char *) fbi->screen_base;
+ screen_size = fbi->var.xres * fbi->var.yres;
+ if (OVERLAY_FB_SUPPORT_NONSTD) {
+ memset(base, 0, screen_size);
+ base += screen_size;
+ for (i = 0; i < screen_size / 2; i++, base++)
+ *base = 0x80;
+ } else {
+ for (i = 0; i < screen_size * 2; i++, base++)
+ *base = 0x00;
+ }
console_lock();
fb_blank(fbi, FB_BLANK_UNBLANK);