summaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2015-02-27 06:07:58 -0500
committerTomi Valkeinen <tomi.valkeinen@ti.com>2015-06-17 08:38:43 -0400
commitc4661b33181708cddb96c72f629eae9cdeea271f (patch)
treefb8f14e865474e22bcf38765ec32a1c2953ceb0b /drivers/video
parent3397cc6a7199993150d09d9bf055ae130058a684 (diff)
OMAPDSS: DISPC: fix predecimation for YUV modes
DISPC needs even input buffer width for YUV modes. The DISPC driver doesn't check this at the moment (although omapdrm does), but worse, when DISPC driver does x predecimation the result may be uneven. This causes sometimes sync losts, underflows, or just visual errors. This patch makes DISPC driver return an error if the user gives uneven input width for a YUV buffer. It also makes the input width even in case of predecimation. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/fbdev/omap2/dss/dispc.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/video/fbdev/omap2/dss/dispc.c b/drivers/video/fbdev/omap2/dss/dispc.c
index a074d8b70591..db60aa98f661 100644
--- a/drivers/video/fbdev/omap2/dss/dispc.c
+++ b/drivers/video/fbdev/omap2/dss/dispc.c
@@ -2542,6 +2542,21 @@ static int dispc_ovl_setup_common(enum omap_plane plane,
2542 if (paddr == 0 && rotation_type != OMAP_DSS_ROT_TILER) 2542 if (paddr == 0 && rotation_type != OMAP_DSS_ROT_TILER)
2543 return -EINVAL; 2543 return -EINVAL;
2544 2544
2545 switch (color_mode) {
2546 case OMAP_DSS_COLOR_YUV2:
2547 case OMAP_DSS_COLOR_UYVY:
2548 case OMAP_DSS_COLOR_NV12:
2549 if (in_width & 1) {
2550 DSSERR("input width %d is not even for YUV format\n",
2551 in_width);
2552 return -EINVAL;
2553 }
2554 break;
2555
2556 default:
2557 break;
2558 }
2559
2545 out_width = out_width == 0 ? width : out_width; 2560 out_width = out_width == 0 ? width : out_width;
2546 out_height = out_height == 0 ? height : out_height; 2561 out_height = out_height == 0 ? height : out_height;
2547 2562
@@ -2572,6 +2587,27 @@ static int dispc_ovl_setup_common(enum omap_plane plane,
2572 in_width = in_width / x_predecim; 2587 in_width = in_width / x_predecim;
2573 in_height = in_height / y_predecim; 2588 in_height = in_height / y_predecim;
2574 2589
2590 if (x_predecim > 1 || y_predecim > 1)
2591 DSSDBG("predecimation %d x %x, new input size %d x %d\n",
2592 x_predecim, y_predecim, in_width, in_height);
2593
2594 switch (color_mode) {
2595 case OMAP_DSS_COLOR_YUV2:
2596 case OMAP_DSS_COLOR_UYVY:
2597 case OMAP_DSS_COLOR_NV12:
2598 if (in_width & 1) {
2599 DSSDBG("predecimated input width is not even for YUV format\n");
2600 DSSDBG("adjusting input width %d -> %d\n",
2601 in_width, in_width & ~1);
2602
2603 in_width &= ~1;
2604 }
2605 break;
2606
2607 default:
2608 break;
2609 }
2610
2575 if (color_mode == OMAP_DSS_COLOR_YUV2 || 2611 if (color_mode == OMAP_DSS_COLOR_YUV2 ||
2576 color_mode == OMAP_DSS_COLOR_UYVY || 2612 color_mode == OMAP_DSS_COLOR_UYVY ||
2577 color_mode == OMAP_DSS_COLOR_NV12) 2613 color_mode == OMAP_DSS_COLOR_NV12)