summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberto Aguirre <a-aguirre@ti.com>2010-09-30 16:29:10 -0500
committerSebastien Jan <s-jan@ti.com>2010-11-03 15:58:00 +0100
commita95f9fbd778fe06e809e3780294896b67da757e8 (patch)
tree67918c55a921eba9ed05d705f13918b924807b36
parent6954f3ca792590bff62bfd1b4194301c1fedb2a3 (diff)
OMAP4: V4L2/DSS - Fix wrong configuration for YUV422
Correct configuration for YUV422 formats involves allocating YUV422 format in a 32-bit tiler container with half width. Video pipeline rotation attributes must be configured when using YUV422 formats. Change-Id: I7126440874fb5e9eede600bf287704ecfa5ac481 Signed-off-by: Alberto Aguirre <a-aguirre@ti.com> Signed-off-by: Archit Taneja <archit@ti.com>
-rw-r--r--drivers/media/video/omap/omap_vout.c16
-rw-r--r--drivers/video/omap2/dss/dispc.c49
2 files changed, 37 insertions, 28 deletions
diff --git a/drivers/media/video/omap/omap_vout.c b/drivers/media/video/omap/omap_vout.c
index d1dc9adca9f6..74dfab416740 100644
--- a/drivers/media/video/omap/omap_vout.c
+++ b/drivers/media/video/omap/omap_vout.c
@@ -552,7 +552,6 @@ static int omap_vout_tiler_buffer_setup(struct omap_vout_device *vout,
{
int i, aligned = 1;
enum tiler_fmt fmt;
- int width;
/* normalize buffers to allocate so we stay within bounds */
int start = (startindex < 0) ? 0 : startindex;
@@ -573,17 +572,22 @@ static int omap_vout_tiler_buffer_setup(struct omap_vout_device *vout,
(void **) vout->buf_phy_uv_addr_alloced + start,
aligned);
} else {
+ unsigned int width = pix->width;
+ switch (video_mode_to_dss_mode(pix)) {
+ case OMAP_DSS_COLOR_UYVY:
+ case OMAP_DSS_COLOR_YUV2:
+ width /= 2;
+ bpp = 4;
+ break;
+ default:
+ break;
+ }
/* Only bpp of 1, 2, and 4 is supported by tiler */
fmt = (bpp == 1 ? TILFMT_8BIT :
bpp == 2 ? TILFMT_16BIT :
bpp == 4 ? TILFMT_32BIT : TILFMT_INVALID);
if (fmt == TILFMT_INVALID)
return -ENOMEM;
- if ((OMAP_DSS_COLOR_YUV2 == video_mode_to_dss_mode(pix))
- || (OMAP_DSS_COLOR_UYVY == video_mode_to_dss_mode(pix)))
- width = pix->width >> 1;
- else
- width = pix->width;
tiler_alloc_packed(&n_alloc, fmt, width,
pix->height,
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 361a9667805e..28f137a7f6f9 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -2256,10 +2256,12 @@ static void _dispc_set_rotation_attrs(enum omap_plane plane, u8 rotation,
else
REG_FLD_MOD(dispc_reg_att[plane], 0x1, 22, 22);
}
-
- if (color_mode == OMAP_DSS_COLOR_YUV2 ||
- color_mode == OMAP_DSS_COLOR_UYVY)
+ /* Set the rotation value for pipeline */
+ if (color_mode == OMAP_DSS_COLOR_UYVY ||
+ color_mode == OMAP_DSS_COLOR_YUV2)
REG_FLD_MOD(dispc_reg_att[plane], rotation, 13, 12);
+ else
+ REG_FLD_MOD(dispc_reg_att[plane], 0, 13, 12);
}
}
@@ -2320,12 +2322,7 @@ void calc_tiler_row_rotation(u8 rotation,
switch (color_mode) {
case OMAP_DSS_COLOR_RGB16:
case OMAP_DSS_COLOR_ARGB16:
-
- case OMAP_DSS_COLOR_YUV2:
- case OMAP_DSS_COLOR_UYVY:
- ps = 4;
- if (!(rotation & 1))
- width >>= 1;
+ ps = 2;
break;
case OMAP_DSS_COLOR_RGB24P:
@@ -2333,6 +2330,8 @@ void calc_tiler_row_rotation(u8 rotation,
case OMAP_DSS_COLOR_ARGB32:
case OMAP_DSS_COLOR_RGBA32:
case OMAP_DSS_COLOR_RGBX32:
+ case OMAP_DSS_COLOR_YUV2:
+ case OMAP_DSS_COLOR_UYVY:
ps = 4;
break;
@@ -2347,6 +2346,9 @@ void calc_tiler_row_rotation(u8 rotation,
switch (rotation) {
case 0:
case 2:
+ if (color_mode == OMAP_DSS_COLOR_YUV2 ||
+ color_mode == OMAP_DSS_COLOR_UYVY)
+ width /= 2;
line_size = (1 == ps) ? 16384 : 32768 ;
break;
@@ -2878,18 +2880,19 @@ static int _dispc_setup_plane(enum omap_plane plane,
if (orient.rotate_90 & 1) {
tiler_height = width;
- if (color_mode == OMAP_DSS_COLOR_YUV2
- || color_mode == OMAP_DSS_COLOR_UYVY)
- tiler_width = height / 2 ;
- else
- tiler_width = height;
+ tiler_width = height;
} else {
tiler_height = height;
- if (color_mode == OMAP_DSS_COLOR_YUV2
- || color_mode == OMAP_DSS_COLOR_UYVY)
- tiler_width = width / 2;
- else
- tiler_width = width;
+ tiler_width = width;
+ }
+
+ switch (color_mode) {
+ case OMAP_DSS_COLOR_YUV2:
+ case OMAP_DSS_COLOR_UYVY:
+ tiler_width /= 2;
+ break;
+ default:
+ break;
}
DSSDBG("w, h = %ld %ld\n", tiler_width, tiler_height);
@@ -2956,14 +2959,16 @@ static int _dispc_setup_plane(enum omap_plane plane,
/* account for chroma decimation */
switch (color_mode) {
case OMAP_DSS_COLOR_NV12:
- ch_height >>= 1; /* Y downsampled by 2 */
+ ch_height >>= 1; /* UV is subsampled by 2 vertically*/
case OMAP_DSS_COLOR_YUV2:
case OMAP_DSS_COLOR_UYVY:
+ /*For YUV422 with rotation, we don't upsample chroma*/
+ if (!(rotation & 1) ||
+ color_mode == OMAP_DSS_COLOR_NV12)
+ ch_width >>= 1; /* UV is subsampled by 2 horz.*/
/* must use FIR for YUV422 if rotated */
if (color_mode != OMAP_DSS_COLOR_NV12 && rotation % 4)
scale_x = scale_y = 1;
- if (!(rotation & 1))
- ch_width >>= 1; /* X downsampled by 2 */
scale_uv = 1;
break;
default: