diff options
author | Anatolij Gustschin <agust@denx.de> | 2011-05-04 16:19:28 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-05-20 08:29:57 -0400 |
commit | 791ae6991051729697dfe60f277744ad6de42316 (patch) | |
tree | be088a538e92b930d7206de39505683fc10b6dab /drivers/media/video/fsl-viu.c | |
parent | dadefe3b710b706b607b51e901bbe6fb05cc515c (diff) |
[media] fsl_viu: add VIDIOC_OVERLAY ioctl
Currently the driver enables overlay when running
VIDIOC_S_FMT ioctl with fmt type V4L2_BUF_TYPE_VIDEO_OVERLAY.
Actually, this is wrong. Add proper VIDIOC_OVERLAY support
instead of using VIDIOC_S_FMT for overlay enable.
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/fsl-viu.c')
-rw-r--r-- | drivers/media/video/fsl-viu.c | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/drivers/media/video/fsl-viu.c b/drivers/media/video/fsl-viu.c index 575f39b3c677..ab0e09d391f1 100644 --- a/drivers/media/video/fsl-viu.c +++ b/drivers/media/video/fsl-viu.c | |||
@@ -766,7 +766,7 @@ inline void viu_activate_overlay(struct viu_reg *viu_reg) | |||
766 | out_be32(&vr->picture_count, reg_val.picture_count); | 766 | out_be32(&vr->picture_count, reg_val.picture_count); |
767 | } | 767 | } |
768 | 768 | ||
769 | static int viu_start_preview(struct viu_dev *dev, struct viu_fh *fh) | 769 | static int viu_setup_preview(struct viu_dev *dev, struct viu_fh *fh) |
770 | { | 770 | { |
771 | int bpp; | 771 | int bpp; |
772 | 772 | ||
@@ -805,11 +805,6 @@ static int viu_start_preview(struct viu_dev *dev, struct viu_fh *fh) | |||
805 | /* setup the base address of the overlay buffer */ | 805 | /* setup the base address of the overlay buffer */ |
806 | reg_val.field_base_addr = (u32)dev->ovbuf.base; | 806 | reg_val.field_base_addr = (u32)dev->ovbuf.base; |
807 | 807 | ||
808 | dev->ovenable = 1; | ||
809 | viu_activate_overlay(dev->vr); | ||
810 | |||
811 | /* start dma */ | ||
812 | viu_start_dma(dev); | ||
813 | return 0; | 808 | return 0; |
814 | } | 809 | } |
815 | 810 | ||
@@ -828,7 +823,7 @@ static int vidioc_s_fmt_overlay(struct file *file, void *priv, | |||
828 | fh->win = f->fmt.win; | 823 | fh->win = f->fmt.win; |
829 | 824 | ||
830 | spin_lock_irqsave(&dev->slock, flags); | 825 | spin_lock_irqsave(&dev->slock, flags); |
831 | viu_start_preview(dev, fh); | 826 | viu_setup_preview(dev, fh); |
832 | spin_unlock_irqrestore(&dev->slock, flags); | 827 | spin_unlock_irqrestore(&dev->slock, flags); |
833 | return 0; | 828 | return 0; |
834 | } | 829 | } |
@@ -839,6 +834,28 @@ static int vidioc_try_fmt_overlay(struct file *file, void *priv, | |||
839 | return 0; | 834 | return 0; |
840 | } | 835 | } |
841 | 836 | ||
837 | static int vidioc_overlay(struct file *file, void *priv, unsigned int on) | ||
838 | { | ||
839 | struct viu_fh *fh = priv; | ||
840 | struct viu_dev *dev = (struct viu_dev *)fh->dev; | ||
841 | unsigned long flags; | ||
842 | |||
843 | if (on) { | ||
844 | spin_lock_irqsave(&dev->slock, flags); | ||
845 | viu_activate_overlay(dev->vr); | ||
846 | dev->ovenable = 1; | ||
847 | |||
848 | /* start dma */ | ||
849 | viu_start_dma(dev); | ||
850 | spin_unlock_irqrestore(&dev->slock, flags); | ||
851 | } else { | ||
852 | viu_stop_dma(dev); | ||
853 | dev->ovenable = 0; | ||
854 | } | ||
855 | |||
856 | return 0; | ||
857 | } | ||
858 | |||
842 | int vidioc_g_fbuf(struct file *file, void *priv, struct v4l2_framebuffer *arg) | 859 | int vidioc_g_fbuf(struct file *file, void *priv, struct v4l2_framebuffer *arg) |
843 | { | 860 | { |
844 | struct viu_fh *fh = priv; | 861 | struct viu_fh *fh = priv; |
@@ -1414,6 +1431,7 @@ static const struct v4l2_ioctl_ops viu_ioctl_ops = { | |||
1414 | .vidioc_g_fmt_vid_overlay = vidioc_g_fmt_overlay, | 1431 | .vidioc_g_fmt_vid_overlay = vidioc_g_fmt_overlay, |
1415 | .vidioc_try_fmt_vid_overlay = vidioc_try_fmt_overlay, | 1432 | .vidioc_try_fmt_vid_overlay = vidioc_try_fmt_overlay, |
1416 | .vidioc_s_fmt_vid_overlay = vidioc_s_fmt_overlay, | 1433 | .vidioc_s_fmt_vid_overlay = vidioc_s_fmt_overlay, |
1434 | .vidioc_overlay = vidioc_overlay, | ||
1417 | .vidioc_g_fbuf = vidioc_g_fbuf, | 1435 | .vidioc_g_fbuf = vidioc_g_fbuf, |
1418 | .vidioc_s_fbuf = vidioc_s_fbuf, | 1436 | .vidioc_s_fbuf = vidioc_s_fbuf, |
1419 | .vidioc_reqbufs = vidioc_reqbufs, | 1437 | .vidioc_reqbufs = vidioc_reqbufs, |