summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorSumit Semwal <sumit.semwal@ti.com>2009-11-07 21:17:49 -0600
committerSantosh Shilimkar <santosh.shilimkar@ti.com>2009-11-11 04:33:01 +0530
commitfb066125fd22bdfb8abbbf4e676c51fdcccbfb86 (patch)
tree0d146d5392fc2e6c1fbc00b05886a630fdb7e6d6 /drivers
parent07142944e6207d495a1df111b09719f71fcbcc66 (diff)
OMAP4: V4L2 / DSS2: Enable rotation by correction tiler rotation APIs in use. Also corrected s_fmt ioctl for the same.
Signed-off-by: Sumit Semwal <sumit.semwal@ti.com>, Archit Taneja <archit@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/omap/omap_vout.c55
-rw-r--r--drivers/video/omap2/dss/dispc.c45
2 files changed, 64 insertions, 36 deletions
diff --git a/drivers/media/video/omap/omap_vout.c b/drivers/media/video/omap/omap_vout.c
index b15eb0bd716f..6bab4cb933eb 100644
--- a/drivers/media/video/omap/omap_vout.c
+++ b/drivers/media/video/omap/omap_vout.c
@@ -91,8 +91,8 @@ MODULE_LICENSE("GPL");
#define NUM_OF_VIDEO_CHANNELS 2
#endif
-#define VID_MAX_WIDTH 1280 /* Largest width */
-#define VID_MAX_HEIGHT 720/* Largest height */
+#define VID_MAX_WIDTH 1920 /* Largest width */
+#define VID_MAX_HEIGHT 1080 /* Largest height */
/* Mimimum requirement is 2x2 for DSS */
#define VID_MIN_WIDTH 2
@@ -352,6 +352,9 @@ static int omap_vout_try_format(struct v4l2_pix_format *pix)
pix->sizeimage = pix->bytesperline * pix->height;
+#ifdef TILER_ALLOCATE_V4L2
+ pix->bytesperline = 4096;
+#endif
return bpp;
}
@@ -584,7 +587,8 @@ static int omap_vout_tiler_buffer_setup(struct omap_vout_device *vout,
if (!vout->buf_phy_uv_addr[i]) { /* UV-buffer */
if (DMM_NO_ERROR !=
tiler_alloc_buf(TILFMT_16BIT,
- vout->pix.width, (vout->pix.height / 2),
+ (vout->pix.width/2),
+ (vout->pix.height / 2),
&vout->buf_phy_uv_addr[i])) {
vout->buf_phy_uv_addr[i] = 0;
} else
@@ -631,6 +635,7 @@ static void omap_vout_free_tiler_buffers(struct omap_vout_device *vout)
tiler_free_buf(vout->buf_phy_addr[j]);
tiler_free_buf(vout->buf_phy_uv_addr[j]);
vout->buf_phy_addr[j] = 0;
+ vout->buf_phy_uv_addr[j] = 0;
}
vout->buffer_allocated = 0;
}
@@ -805,6 +810,8 @@ int omapvid_init(struct omap_vout_device *vout, u32 addr, u32 uv_addr)
outw = win->w.width;
outh = win->w.height;
+ posx = win->w.left;
+ posy = win->w.top;
switch (rotation) {
case dss_rotation_90_degree:
@@ -814,30 +821,34 @@ int omapvid_init(struct omap_vout_device *vout, u32 addr, u32 uv_addr)
temp = outw;
outw = outh;
outh = temp;
+#ifndef CONFIG_ARCH_OMAP4
posy = (timing->y_res - win->w.width)-
win->w.left;
posx = win->w.top;
+#endif
break;
case dss_rotation_180_degree:
+#ifndef CONFIG_ARCH_OMAP4
posx = (timing->x_res - win->w.width) -
win->w.left;
posy = (timing->y_res - win->w.height) -
win->w.top;
+#endif
break;
case dss_rotation_270_degree:
temp = outw;
outw = outh;
outh = temp;
+#ifndef CONFIG_ARCH_OMAP4
posy = win->w.left;
posx = (timing->x_res - win->w.height)
- win->w.top;
+#endif
break;
default:
- posx = win->w.left;
- posy = win->w.top;
break;
}
@@ -942,21 +953,21 @@ int omapvid_setup_overlay(struct omap_vout_device *vout,
info.out_width = outw;
info.out_height = outh;
info.global_alpha = vout->win.global_alpha;
+#ifdef CONFIG_ARCH_OMAP4
+ info.rotation_type = OMAP_DSS_ROT_TILER;
+ info.screen_width = pixwidth;
+ info.rotation = vout->rotation;
+#else
if (!rotation_enabled(vout)) {
info.rotation = 0;
info.rotation_type = OMAP_DSS_ROT_DMA;
info.screen_width = pixwidth;
} else {
info.rotation = vout->rotation;
-#ifdef CONFIG_ARCH_OMAP4
- info.rotation_type = OMAP_DSS_ROT_TILER;
- info.screen_width = pixwidth;
-#else
info.rotation_type = OMAP_DSS_ROT_VRFB;
info.screen_width = 2048;
+ }
#endif
- }
-
v4l2_dbg(1, debug, &vout->vid_dev->v4l2_dev,
"%s info.enable=%d info.addr=%x info.width=%d\n info.height=%d \
info.color_mode=%d info.rotation=%d info.mirror=%d\n \
@@ -1524,7 +1535,13 @@ static int omap_vout_release(struct file *file)
printk(KERN_WARNING VOUT_NAME "Unable to apply changes\n");
/* Free all buffers */
+
+#ifndef TILER_ALLOCATE_V4L2
omap_vout_free_allbuffers(vout);
+#else
+ omap_vout_free_tiler_buffers(vout);
+#endif
+
videobuf_mmap_free(q);
/* Even if apply changes fails we should continue
@@ -1692,14 +1709,17 @@ static int vidioc_s_fmt_vid_out(struct file *file, void *fh,
/* get the framebuffer parameters */
+#ifndef CONFIG_ARCH_OMAP4
if (rotate_90_or_270(vout)) {
vout->fbuf.fmt.height = timing->x_res;
vout->fbuf.fmt.width = timing->y_res;
} else {
+#endif
vout->fbuf.fmt.height = timing->y_res;
vout->fbuf.fmt.width = timing->x_res;
+#ifndef CONFIG_ARCH_OMAP4
}
-
+#endif
/* change to samller size is OK */
bpp = omap_vout_try_format(&f->fmt.pix);
@@ -2508,7 +2528,7 @@ static int __init omap_vout_setup_video_data(struct omap_vout_device *vout)
control[0].id = V4L2_CID_ROTATE;
control[0].value = 0;
- vout->rotation = -1;
+ vout->rotation = 0;
vout->mirror = 0;
vout->vrfb_bpp = 2;
@@ -2919,8 +2939,10 @@ void omap_vout_isr(void *arg, unsigned int irqstatus)
/* do_gettimeofday(&timevalue); TODO: uncomment this!! */
if (cur_display->type == OMAP_DISPLAY_TYPE_DPI) {
- if (!(irqstatus & DISPC_IRQ_VSYNC))
+ if (!(irqstatus & DISPC_IRQ_VSYNC)) {
+ spin_unlock(&vout->vbq_lock);
return;
+ }
if (!vout->first_int && (vout->cur_frm != vout->next_frm)) {
vout->cur_frm->ts = timevalue;
vout->cur_frm->state = VIDEOBUF_DONE;
@@ -2956,9 +2978,8 @@ void omap_vout_isr(void *arg, unsigned int irqstatus)
if (r)
printk(KERN_ERR VOUT_NAME "failed to change mode\n");
} else {
-#if 1
- if (!(irqstatus & DISPC_IRQ_EVSYNC_ODD) &&
- !(irqstatus & DISPC_IRQ_EVSYNC_EVEN)) {
+#if CONFIG_OMAP2_DSS_HDMI
+ if (!(irqstatus & DISPC_IRQ_EVSYNC_EVEN)) {
spin_unlock(&vout->vbq_lock);
return;
}
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index a23b6f41c24b..97f1100b876d 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -2171,6 +2171,9 @@ static int _dispc_setup_plane(enum omap_plane plane,
u8 orientation = 0;
struct dmmViewOrientT orient;
+ unsigned long r, mir_x, mir_y;
+ unsigned long tiler_width, tiler_height;
+ void __iomem *reg = NULL;
if (paddr == 0)
return -EINVAL;
@@ -2309,28 +2312,32 @@ static int _dispc_setup_plane(enum omap_plane plane,
color_mode, &row_inc);
orientation = calc_tiler_orientation(rotation, (u8)mirror);
-#if 1
- paddr &= ~(0x7 << 29);
- paddr |= (orientation << 29);
- if (puv_addr) {
- puv_addr &= ~(0x7 << 29);
- puv_addr |= (orientation << 29);
+ /* get rotated top-left coordinate
+ (if rotation is applied before mirroring) */
+ memset(&orient, 0, sizeof(orient));
+ tiler_rotate_view(&orient, rotation * 90);
+ orient.dmmXInvert ^= mir_x;
+ orient.dmmYInvert ^= mir_y;
+
+ printk(KERN_INFO "RYX = %d %d %d\n", orient.dmm90Rotate,
+ orient.dmmYInvert, orient.dmmXInvert);
+
+ if (orient.dmm90Rotate & 1) {
+ tiler_height = width;
+ tiler_width = height;
+ } else {
+ tiler_height = height;
+ tiler_width = width;
}
-#else
- orient.dmm90Rotate = ((orientation & 0x04) ? 1 : 0);
- orient.dmmYInvert = ((orientation & 0x02) ? 1 : 0);
- orient.dmmXInvert = ((orientation & 0x01) ? 1 : 0);
-
- paddr = tiler_get_tiler_address(paddr, orient, width,
- frame_height, 0, 0);
-
- if (puv_addr)
- puv_addr = tiler_get_tiler_address(puv_addr,
- orient, width, frame_height,
- 1, 0);
-#endif
+ printk(KERN_INFO "w, h = %d %d\n", tiler_width, tiler_height);
+ paddr = tiler_reorient_topleft(tiler_get_natural_addr(paddr),
+ orient, tiler_width, tiler_height);
+ if (puv_addr)
+ puv_addr = tiler_reorient_topleft(
+ tiler_get_natural_addr(puv_addr),
+ orient, tiler_width/2, tiler_height/2);
printk(KERN_INFO
"rotated addresses: 0x%0x, 0x%0x\n",
paddr, puv_addr);