From f55fdcfe88c5a23115b6d93674ad1e082e841091 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Thu, 3 Jun 2010 16:27:46 +0300 Subject: OMAP: DSS2: adjust YUV overlay width to be even An overlay in YUV mode has to have an even input width, because data for each pixel is divided between two adjacent pixels. The algorithm handling manual update overlay adjusting may adjust the overlay width to be odd. This patch adds a check for that situation, and makes the width even. The width is increased by one if it is possible (the unadjusted input width is larger than the width), and decreased by one if increasing is not possible. Signed-off-by: Tomi Valkeinen --- drivers/video/omap2/dss/manager.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'drivers/video/omap2') diff --git a/drivers/video/omap2/dss/manager.c b/drivers/video/omap2/dss/manager.c index 4b09fcb..6a649ab 100644 --- a/drivers/video/omap2/dss/manager.c +++ b/drivers/video/omap2/dss/manager.c @@ -813,6 +813,21 @@ static int configure_overlay(enum omap_plane plane) w = w * outw / orig_outw; h = h * outh / orig_outh; + + /* YUV mode overlay's input width has to be even and the + * algorithm above may adjust the width to be odd. + * + * Here we adjust the width if needed, preferring to increase + * the width if the original width was bigger. + */ + if ((w & 1) && + (c->color_mode == OMAP_DSS_COLOR_YUV2 || + c->color_mode == OMAP_DSS_COLOR_UYVY)) { + if (orig_w > w) + w += 1; + else + w -= 1; + } } r = dispc_setup_plane(plane, -- cgit v1.1