diff options
author | Archit Taneja <archit@ti.com> | 2010-08-02 13:26:46 +0530 |
---|---|---|
committer | Ricardo Perez Olivares <x0081762@ti.com> | 2010-09-14 19:26:46 -0500 |
commit | 3397bde0693467656e9569c940361abf8ccd6a5d (patch) | |
tree | 3c90f362be4703578f5602edea7dc27b130b2fda /drivers/media | |
parent | e179e6dda2a8ccba85d66c7cc16ca214aafa089d (diff) |
V4L2: Writeback changes for omap_vout.c and omap_voutdef.h
Signed-off-by: Archit Taneja <archit@ti.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/omap/omap_vout.c | 71 | ||||
-rw-r--r-- | drivers/media/video/omap/omap_voutdef.h | 4 |
2 files changed, 60 insertions, 15 deletions
diff --git a/drivers/media/video/omap/omap_vout.c b/drivers/media/video/omap/omap_vout.c index 233d15068755..03accb7f66ab 100644 --- a/drivers/media/video/omap/omap_vout.c +++ b/drivers/media/video/omap/omap_vout.c @@ -145,7 +145,7 @@ module_param(debug, bool, S_IRUGO); MODULE_PARM_DESC(debug, "Debug level (0-1)"); -static enum omap_color_mode video_mode_to_dss_mode( +enum omap_color_mode video_mode_to_dss_mode( struct v4l2_pix_format *pix); /* list of image formats supported by OMAP2 video pipelines */ @@ -278,7 +278,7 @@ static int omap_vout_allocate_vrfb_buffers(struct omap_vout_device *vout, /* * Try format */ -static int omap_vout_try_format(struct v4l2_pix_format *pix) +int omap_vout_try_format(struct v4l2_pix_format *pix) { int ifmt, bpp = 0; @@ -793,7 +793,7 @@ static int omap_vout_calculate_offset(struct omap_vout_device *vout, int idx) /* * Convert V4L2 pixel format to DSS pixel format */ -static int video_mode_to_dss_mode(struct v4l2_pix_format *pix) +enum omap_color_mode video_mode_to_dss_mode(struct v4l2_pix_format *pix) { #if 0 /* TODO: Take care of OMAP2,OMAP3 Video1 also */ struct omap_overlay *ovl; @@ -1057,6 +1057,11 @@ void omap_vout_isr(void *arg, unsigned int irqstatus) if (!vout->streaming) return; + if (vout->wb_enabled) { + if ((irqstatus & DISPC_IRQ_GFX_END_WIN) && + !(irqstatus & DISPC_IRQ_FRAMEDONE_WB)) + return; + } ovid = &vout->vid_info; ovl = ovid->overlays[0]; /* get the display device attached to the overlay */ @@ -1072,6 +1077,11 @@ void omap_vout_isr(void *arg, unsigned int irqstatus) spin_lock_irqsave(&vout->vbq_lock, flags); do_gettimeofday(&timevalue); + + if (vout->wb_enabled && + (irqstatus & DISPC_IRQ_FRAMEDONE_WB)) + goto wb; + switch (cur_display->type) { case OMAP_DISPLAY_TYPE_DSI: if (!(irqstatus & irq)) @@ -1132,6 +1142,7 @@ void omap_vout_isr(void *arg, unsigned int irqstatus) default: goto vout_isr_err; } +wb: if (!vout->first_int && (vout->cur_frm != vout->next_frm)) { vout->cur_frm->ts = timevalue; vout->cur_frm->state = VIDEOBUF_DONE; @@ -1140,8 +1151,10 @@ void omap_vout_isr(void *arg, unsigned int irqstatus) } vout->first_int = 0; - if (list_empty(&vout->dma_queue)) + if (list_empty(&vout->dma_queue)){ + vout->buf_empty = true; goto vout_isr_err; + } #if !(CONFIG_OMAP2_DSS_HDMI) venc: @@ -1163,11 +1176,13 @@ venc: if (ret) printk(KERN_ERR VOUT_NAME "failed to set overlay info\n"); - /* Enable the pipeline and set the Go bit */ - ret = omapvid_apply_changes(vout); - if (ret) - printk(KERN_ERR VOUT_NAME - "failed to change mode\n"); + if (!vout->wb_enabled) { + /* Enable the pipeline and set the Go bit */ + ret = omapvid_apply_changes(vout); + if (ret) + printk(KERN_ERR VOUT_NAME + "failed to change mode\n"); + } #ifdef CONFIG_PANEL_PICO_DLP if (sysfs_streq(cur_display->name, "pico_DLP")) dispc_go(OMAP_DSS_CHANNEL_LCD2); @@ -2152,6 +2167,17 @@ static int vidioc_s_ctrl(struct file *file, void *fh, struct v4l2_control *a) mutex_unlock(&vout->lock); break; } + case V4L2_CID_WB: + { + int enabled = a->value; + mutex_lock(&vout->lock); + if (enabled) + vout->wb_enabled = true; + else + vout->wb_enabled = false; + mutex_unlock(&vout->lock); + return 0; + } default: ret = -EINVAL; } @@ -2247,6 +2273,7 @@ static int vidioc_qbuf(struct file *file, void *fh, struct omap_vout_device *vout = fh; struct videobuf_queue *q = &vout->vbq; int ret = 0; + u32 addr = 0, uv_addr = 0; if ((V4L2_BUF_TYPE_VIDEO_OUTPUT != buffer->type) || (buffer->index >= vout->buffer_allocated) || @@ -2274,6 +2301,14 @@ static int vidioc_qbuf(struct file *file, void *fh, printk(KERN_ERR "Could not calculate buffer offset\n"); return -EINVAL; } + if (vout->wb_enabled && vout->streaming && vout->buf_empty) { + addr = (unsigned long) vout->queued_buf_addr[vout->cur_frm->i] + + vout->cropped_offset[vout->cur_frm->i]; + uv_addr = (unsigned long) vout->queued_buf_uv_addr[vout->cur_frm->i] + + vout->cropped_uv_offset[vout->cur_frm->i]; + vout->buf_empty = false; + omapvid_init(vout, addr, uv_addr); + } return ret; } @@ -2341,6 +2376,10 @@ static int vidioc_streamon(struct file *file, void *fh, enum v4l2_buf_type i) mask = DISPC_IRQ_VSYNC | DISPC_IRQ_EVSYNC_EVEN | DISPC_IRQ_EVSYNC_ODD | DISPC_IRQ_FRAMEDONE | DISPC_IRQ_FRAMEDONE2 | DISPC_IRQ_VSYNC2; + + if (vout->wb_enabled) + mask |= DISPC_IRQ_FRAMEDONE_WB; + omap_dispc_register_isr(omap_vout_isr, vout, mask); for (j = 0; j < ovid->num_overlays; j++) { @@ -2364,11 +2403,12 @@ static int vidioc_streamon(struct file *file, void *fh, enum v4l2_buf_type i) if (ret) v4l2_err(&vout->vid_dev->v4l2_dev, "failed to set overlay info\n"); - /* Enable the pipeline and set the Go bit */ - ret = omapvid_apply_changes(vout); - if (ret) - v4l2_err(&vout->vid_dev->v4l2_dev, "failed to change mode\n"); - + if (!vout->wb_enabled) { + /* Enable the pipeline and set the Go bit */ + ret = omapvid_apply_changes(vout); + if (ret) + v4l2_err(&vout->vid_dev->v4l2_dev, "failed to change mode\n"); + } ret = 0; streamon_err1: @@ -2394,6 +2434,9 @@ static int vidioc_streamoff(struct file *file, void *fh, enum v4l2_buf_type i) DISPC_IRQ_EVSYNC_ODD | DISPC_IRQ_FRAMEDONE | DISPC_IRQ_FRAMEDONE2 | DISPC_IRQ_VSYNC2; + if (vout->wb_enabled) + mask |= DISPC_IRQ_FRAMEDONE_WB; + omap_dispc_unregister_isr(omap_vout_isr, vout, mask); for (j = 0; j < ovid->num_overlays; j++) { diff --git a/drivers/media/video/omap/omap_voutdef.h b/drivers/media/video/omap/omap_voutdef.h index d1a5409aaab1..e32a5ac2bdae 100644 --- a/drivers/media/video/omap/omap_voutdef.h +++ b/drivers/media/video/omap/omap_voutdef.h @@ -156,6 +156,8 @@ struct omap_vout_device { enum v4l2_buf_type type; struct videobuf_queue vbq; int io_allowed; - + /* writeback variables*/ + bool wb_enabled; + bool buf_empty; }; #endif /* ifndef OMAP_VOUTDEF_H */ |