From: yxj Date: Fri, 25 Jan 2013 13:31:13 +0000 (+0800) Subject: rk fb,rk3188 lcdc:overlay support and modify some macro for RGB order X-Git-Tag: firefly_0821_release~7732 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=52af41525a532e7e567d525be42a01961e0a3ce3;p=firefly-linux-kernel-4.4.55.git rk fb,rk3188 lcdc:overlay support and modify some macro for RGB order --- diff --git a/drivers/video/rockchip/lcdc/rk3188_lcdc.c b/drivers/video/rockchip/lcdc/rk3188_lcdc.c index 3916ea4f3cd0..92314867302f 100644 --- a/drivers/video/rockchip/lcdc/rk3188_lcdc.c +++ b/drivers/video/rockchip/lcdc/rk3188_lcdc.c @@ -166,6 +166,7 @@ static int win1_open(struct rk3188_lcdc_device *lcdc_dev,bool open) if(!lcdc_dev->atv_layer_cnt) //if no layer used,disable lcdc { printk(KERN_INFO "no layer of lcdc%d is used,go to standby!\n",lcdc_dev->id); + lcdc_msk_reg(lcdc_dev,ALPHA_CTRL,m_WIN0_ALPHA_EN,v_WIN0_ALPHA_EN(0)); lcdc_msk_reg(lcdc_dev, SYS_CTRL,m_LCDC_STANDBY,v_LCDC_STANDBY(1)); } lcdc_cfg_done(lcdc_dev); @@ -294,6 +295,7 @@ static int rk3188_lcdc_init(struct rk_lcdc_device_driver *dev_drv) } lcdc_set_bit(lcdc_dev,SYS_CTRL,m_AUTO_GATING_EN);//eanble axi-clk auto gating for low power + //lcdc_set_bit(lcdc_dev,DSP_CTRL0,m_WIN0_TOP); if(dev_drv->cur_screen->dsp_lut) { lcdc_msk_reg(lcdc_dev,SYS_CTRL,m_DSP_LUT_EN,v_DSP_LUT_EN(0)); @@ -443,7 +445,8 @@ static int win0_set_par(struct rk3188_lcdc_device *lcdc_dev,rk_screen *screen, switch (par->format) { case ARGB888: - case XRGB888: + case XBGR888: + case ABGR888: fmt_cfg = 0; break; case RGB888: @@ -468,6 +471,7 @@ static int win0_set_par(struct rk3188_lcdc_device *lcdc_dev,rk_screen *screen, ScaleCbrY = CalScale(yact, par->ysize); break; default: + dev_err(lcdc_dev->driver.dev,"%s:un supported format!\n",__func__); break; } @@ -487,30 +491,42 @@ static int win0_set_par(struct rk3188_lcdc_device *lcdc_dev,rk_screen *screen, switch(par->format) { - case XRGB888: + case XBGR888: lcdc_msk_reg(lcdc_dev, WIN_VIR,m_WIN0_VIR,v_ARGB888_VIRWIDTH(xvir)); lcdc_msk_reg(lcdc_dev,ALPHA_CTRL,m_WIN0_ALPHA_EN,v_WIN0_ALPHA_EN(0)); + lcdc_msk_reg(lcdc_dev,SYS_CTRL,m_WIN0_RB_SWAP,v_WIN0_RB_SWAP(1)); + break; + case ABGR888: + lcdc_msk_reg(lcdc_dev,WIN_VIR,m_WIN0_VIR,v_ARGB888_VIRWIDTH(xvir)); + //lcdc_msk_reg(lcdc_dev,ALPHA_CTRL,m_WIN0_ALPHA_EN,v_WIN0_ALPHA_EN(1)); + lcdc_msk_reg(lcdc_dev,DSP_CTRL0,m_WIN0_ALPHA_MODE | m_ALPHA_MODE_SEL0 | + m_ALPHA_MODE_SEL1,v_WIN0_ALPHA_MODE(1) | v_ALPHA_MODE_SEL0(1) | + v_ALPHA_MODE_SEL1(0));//default set to per-pixel alpha + lcdc_msk_reg(lcdc_dev,SYS_CTRL,m_WIN0_RB_SWAP,v_WIN0_RB_SWAP(1)); break; case ARGB888: lcdc_msk_reg(lcdc_dev,WIN_VIR,m_WIN0_VIR,v_ARGB888_VIRWIDTH(xvir)); - lcdc_msk_reg(lcdc_dev,ALPHA_CTRL,m_WIN0_ALPHA_EN,v_WIN0_ALPHA_EN(1)); - lcdc_msk_reg(lcdc_dev,DSP_CTRL0,m_WIN0_ALPHA_MODE,v_WIN0_ALPHA_MODE(1));//default set to per-pixel alpha - //lcdc_msk_reg(lcdc_dev,SYS_CTRL1,m_W0_RGB_RB_SWAP,v_W0_RGB_RB_SWAP(1)); + //lcdc_msk_reg(lcdc_dev,ALPHA_CTRL,m_WIN0_ALPHA_EN,v_WIN0_ALPHA_EN(1)); + lcdc_msk_reg(lcdc_dev,DSP_CTRL0,m_WIN0_ALPHA_MODE | m_ALPHA_MODE_SEL0, + v_WIN0_ALPHA_MODE(1) | v_ALPHA_MODE_SEL0(1));//default set to per-pixel alpha + lcdc_msk_reg(lcdc_dev,SYS_CTRL,m_WIN0_RB_SWAP,v_WIN0_RB_SWAP(0)); break; case RGB888: //rgb888 lcdc_msk_reg(lcdc_dev, WIN_VIR,m_WIN0_VIR,v_RGB888_VIRWIDTH(xvir)); lcdc_msk_reg(lcdc_dev,ALPHA_CTRL,m_WIN0_ALPHA_EN,v_WIN0_ALPHA_EN(0)); - //lcdc_msk_reg(lcdc_dev,SYS_CTRL1,m_W0_RGB_RB_SWAP,v_W0_RGB_RB_SWAP(1)); + lcdc_msk_reg(lcdc_dev,SYS_CTRL,m_WIN0_RB_SWAP,v_WIN0_RB_SWAP(0)); break; case RGB565: //rgb565 lcdc_msk_reg(lcdc_dev, WIN_VIR,m_WIN0_VIR,v_RGB565_VIRWIDTH(xvir)); lcdc_msk_reg(lcdc_dev,ALPHA_CTRL,m_WIN0_ALPHA_EN,v_WIN0_ALPHA_EN(0)); + lcdc_msk_reg(lcdc_dev,SYS_CTRL,m_WIN0_RB_SWAP,v_WIN0_RB_SWAP(0)); break; case YUV422: case YUV420: case YUV444: lcdc_msk_reg(lcdc_dev, WIN_VIR,m_WIN0_VIR,v_YUV_VIRWIDTH(xvir)); lcdc_msk_reg(lcdc_dev,ALPHA_CTRL,m_WIN0_ALPHA_EN,v_WIN0_ALPHA_EN(0)); + lcdc_msk_reg(lcdc_dev,SYS_CTRL,m_WIN0_RB_SWAP,v_WIN0_RB_SWAP(0)); break; default: dev_err(lcdc_dev->driver.dev,"%s:un supported format!\n",__func__); @@ -552,28 +568,38 @@ static int win1_set_par(struct rk3188_lcdc_device *lcdc_dev,rk_screen *screen, lcdc_msk_reg(lcdc_dev, WIN1_COLOR_KEY,m_COLOR_KEY_EN,v_COLOR_KEY_EN(0)); switch(par->format) { - case XRGB888: + case XBGR888: fmt_cfg = 0; lcdc_msk_reg(lcdc_dev, WIN_VIR,m_WIN1_VIR,v_WIN1_ARGB888_VIRWIDTH(xvir)); lcdc_msk_reg(lcdc_dev,ALPHA_CTRL,m_WIN1_ALPHA_EN,v_WIN1_ALPHA_EN(0)); + lcdc_msk_reg(lcdc_dev,SYS_CTRL,m_WIN1_RB_SWAP,v_WIN1_RB_SWAP(1)); + break; + case ABGR888: + fmt_cfg = 0; + lcdc_msk_reg(lcdc_dev, WIN_VIR,m_WIN1_VIR,v_WIN1_ARGB888_VIRWIDTH(xvir)); + lcdc_msk_reg(lcdc_dev,ALPHA_CTRL,m_WIN1_ALPHA_EN,v_WIN1_ALPHA_EN(1)); + lcdc_msk_reg(lcdc_dev,DSP_CTRL0,m_WIN1_ALPHA_MODE,v_WIN1_ALPHA_MODE(1));//default set to per-pixel alpha + lcdc_msk_reg(lcdc_dev,SYS_CTRL,m_WIN1_RB_SWAP,v_WIN1_RB_SWAP(1)); break; case ARGB888: fmt_cfg = 0; lcdc_msk_reg(lcdc_dev, WIN_VIR,m_WIN1_VIR,v_WIN1_ARGB888_VIRWIDTH(xvir)); lcdc_msk_reg(lcdc_dev,ALPHA_CTRL,m_WIN1_ALPHA_EN,v_WIN1_ALPHA_EN(1)); lcdc_msk_reg(lcdc_dev,DSP_CTRL0,m_WIN1_ALPHA_MODE,v_WIN1_ALPHA_MODE(1));//default set to per-pixel alpha - //lcdc_msk_reg(lcdc_dev,SYS_CTRL1,m_W1_RGB_RB_SWAP,v_W1_RGB_RB_SWAP(1)); + lcdc_msk_reg(lcdc_dev,SYS_CTRL,m_WIN1_RB_SWAP,v_WIN1_RB_SWAP(0)); break; case RGB888: //rgb888 fmt_cfg = 1; lcdc_msk_reg(lcdc_dev, WIN_VIR,m_WIN1_VIR,v_WIN1_RGB888_VIRWIDTH(xvir)); lcdc_msk_reg(lcdc_dev,ALPHA_CTRL,m_WIN1_ALPHA_EN,v_WIN1_ALPHA_EN(0)); + lcdc_msk_reg(lcdc_dev,SYS_CTRL,m_WIN1_RB_SWAP,v_WIN1_RB_SWAP(0)); // lcdc_msk_reg(lcdc_dev,SYS_CTRL1,m_W1_RGB_RB_SWAP,v_W1_RGB_RB_SWAP(1)); break; case RGB565: //rgb565 fmt_cfg = 2; lcdc_msk_reg(lcdc_dev, WIN_VIR,m_WIN1_VIR,v_WIN1_RGB565_VIRWIDTH(xvir)); lcdc_msk_reg(lcdc_dev,ALPHA_CTRL,m_WIN1_ALPHA_EN,v_WIN1_ALPHA_EN(0)); + lcdc_msk_reg(lcdc_dev,SYS_CTRL,m_WIN1_RB_SWAP,v_WIN1_RB_SWAP(0)); break; default: dev_err(lcdc_dev->driver.dev,"%s:un supported format!\n",__func__); diff --git a/drivers/video/rockchip/rk_fb.c b/drivers/video/rockchip/rk_fb.c index d6de49d7c23a..f756440e8226 100644 --- a/drivers/video/rockchip/rk_fb.c +++ b/drivers/video/rockchip/rk_fb.c @@ -214,8 +214,9 @@ static int rk_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) } switch (par->format) { - case XRGB888: + case XBGR888: case ARGB888: + case ABGR888: par->y_offset = (yoffset*xvir + xoffset)*4; break; case RGB888: @@ -471,12 +472,17 @@ static int rk_fb_set_par(struct fb_info *info) { case HAL_PIXEL_FORMAT_RGBX_8888: #if defined(CONFIG_ARCH_RK3188) - par->format = XRGB888; + par->format = XBGR888; fix->line_length = 4 * xvir; par->y_offset = (yoffset*xvir + xoffset)*4; break; #endif case HAL_PIXEL_FORMAT_RGBA_8888 : // rgb + par->format = ABGR888; + fix->line_length = 4 * xvir; + par->y_offset = (yoffset*xvir + xoffset)*4; + break; + case HAL_PIXEL_FORMAT_BGRA_8888 : // rgb par->format = ARGB888; fix->line_length = 4 * xvir; par->y_offset = (yoffset*xvir + xoffset)*4; diff --git a/include/linux/rk_fb.h b/include/linux/rk_fb.h index e18c0e39bc51..8a220269a78c 100644 --- a/include/linux/rk_fb.h +++ b/include/linux/rk_fb.h @@ -144,6 +144,8 @@ enum data_format{ YUV422, YUV444, XRGB888, + XBGR888, + ABGR888, }; enum fb_win_map_order{