From 8d239b2c7f05acf2f732d292f5d7c5abc3c7ce1a Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Tue, 26 May 2009 10:49:24 +0300 Subject: [PATCH 078/146] DSS2: Enable replication logic feature Replication logic will make colors a bit better on active matrix LCD when the fb is in 16bpp mode and the LCD interface is 18/24bpp. Signed-off-by: Tomi Valkeinen --- drivers/video/omap2/dss/dispc.c | 19 +++++++++++++++++++ drivers/video/omap2/dss/display.c | 34 ++++++++++++++++++++++++++++++++++ drivers/video/omap2/dss/dss.h | 3 +++ drivers/video/omap2/dss/manager.c | 5 +++++ 4 files changed, 61 insertions(+), 0 deletions(-) diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index 2471cfe..e936c59 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c @@ -908,6 +908,20 @@ static void _dispc_set_vid_color_conv(enum omap_plane plane, bool enable) dispc_write_reg(dispc_reg_att[plane], val); } +void dispc_enable_replication(enum omap_plane plane, bool enable) +{ + int bit; + + if (plane == OMAP_DSS_GFX) + bit = 5; + else + bit = 10; + + enable_clocks(1); + REG_FLD_MOD(dispc_reg_att[plane], enable, bit, bit); + enable_clocks(0); +} + void dispc_set_lcd_size(u16 width, u16 height) { u32 val; @@ -3293,6 +3307,11 @@ void dispc_setup_partial_planes(struct omap_display *display, pi->mirror, pi->global_alpha); + if (dss_use_replication(display, ovl->info.color_mode)) + dispc_enable_replication(ovl->id, true); + else + dispc_enable_replication(ovl->id, false); + dispc_enable_plane(ovl->id, 1); } diff --git a/drivers/video/omap2/dss/display.c b/drivers/video/omap2/dss/display.c index 50ced29..77a6dc4 100644 --- a/drivers/video/omap2/dss/display.c +++ b/drivers/video/omap2/dss/display.c @@ -411,6 +411,40 @@ static int default_get_recommended_bpp(struct omap_display *display) } } +/* Checks if replication logic should be used. Only use for active matrix, + * when overlay is in RGB12U or RGB16 mode, and LCD interface is + * 18bpp or 24bpp */ +bool dss_use_replication(struct omap_display *display, + enum omap_color_mode mode) +{ + int bpp; + + if (mode != OMAP_DSS_COLOR_RGB12U && mode != OMAP_DSS_COLOR_RGB16) + return false; + + if (display->type == OMAP_DISPLAY_TYPE_DPI && + (display->panel->config & OMAP_DSS_LCD_TFT) == 0) + return false; + + switch (display->type) { + case OMAP_DISPLAY_TYPE_DPI: + bpp = display->hw_config.u.dpi.data_lines; + break; + case OMAP_DISPLAY_TYPE_VENC: + case OMAP_DISPLAY_TYPE_SDI: + bpp = 24; + break; + case OMAP_DISPLAY_TYPE_DBI: + case OMAP_DISPLAY_TYPE_DSI: + bpp = display->ctrl->pixel_size; + break; + default: + BUG(); + } + + return bpp > 16; +} + void dss_init_displays(struct platform_device *pdev) { struct omap_dss_board_info *pdata = pdev->dev.platform_data; diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h index 20cef0a..d51ffe4 100644 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/omap2/dss/dss.h @@ -173,6 +173,8 @@ void dss_uninit_displays(struct platform_device *pdev); int dss_suspend_all_displays(void); int dss_resume_all_displays(void); struct omap_display *dss_get_display(int no); +bool dss_use_replication(struct omap_display *display, + enum omap_color_mode mode); /* manager */ int dss_init_overlay_managers(struct platform_device *pdev); @@ -280,6 +282,7 @@ void dispc_go(enum omap_channel channel); void dispc_enable_lcd_out(bool enable); void dispc_enable_digit_out(bool enable); int dispc_enable_plane(enum omap_plane plane, bool enable); +void dispc_enable_replication(enum omap_plane plane, bool enable); void dispc_set_parallel_interface_mode(enum omap_parallel_interface_mode mode); void dispc_set_tft_data_lines(u8 data_lines); diff --git a/drivers/video/omap2/dss/manager.c b/drivers/video/omap2/dss/manager.c index 1e6cd8d..8d5d00f 100644 --- a/drivers/video/omap2/dss/manager.c +++ b/drivers/video/omap2/dss/manager.c @@ -474,6 +474,11 @@ static int omap_dss_mgr_apply(struct omap_overlay_manager *mgr) continue; } + if (dss_use_replication(display, ovl->info.color_mode)) + dispc_enable_replication(ovl->id, true); + else + dispc_enable_replication(ovl->id, false); + dispc_enable_plane(ovl->id, 1); } -- 1.6.2.4