From 49292f62619b75dc8a88766fa29784d4a80f5ce7 Mon Sep 17 00:00:00 2001 From: huangdesheng Date: Mon, 29 Aug 2011 10:59:25 +0800 Subject: [PATCH] add dynamic change rgb565 in postfb --- arch/arm/mach-rk29/board-rk29-ddr3sdk.c | 2 +- drivers/video/rk29_fb.c | 36 +++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-rk29/board-rk29-ddr3sdk.c b/arch/arm/mach-rk29/board-rk29-ddr3sdk.c index ce80511a1da5..c99ddae92339 100755 --- a/arch/arm/mach-rk29/board-rk29-ddr3sdk.c +++ b/arch/arm/mach-rk29/board-rk29-ddr3sdk.c @@ -104,7 +104,7 @@ #else #define MEM_CAMIPP_SIZE 0 #endif -#define MEM_FB_SIZE (3*SZ_2M) +#define MEM_FB_SIZE (9*SZ_1M) #ifdef CONFIG_FB_WORK_IPP #define MEM_FBIPP_SIZE SZ_8M //1920 x 1080 x 2 x 2 //RGB565 = x2;RGB888 = x4 #else diff --git a/drivers/video/rk29_fb.c b/drivers/video/rk29_fb.c index 737b1f4c9cce..59898681b122 100755 --- a/drivers/video/rk29_fb.c +++ b/drivers/video/rk29_fb.c @@ -1384,7 +1384,7 @@ static int fb0_check_var(struct fb_var_screeninfo *var, struct fb_info *info) } if( (var->xoffset+var->xres)>var->xres_virtual || - (var->yoffset+var->yres)>var->yres_virtual ) + (var->yoffset+var->yres)>var->yres_virtual*2 ) { printk(">>>>>> fb0_check_var fail 2!!! \n"); printk(">>>>>> (%d+%d)>%d || ", var->xoffset,var->xres,var->xres_virtual); @@ -1456,6 +1456,8 @@ static int fb0_set_par(struct fb_info *info) ipp_req.dst0.fmt = IPP_RGB_565; #endif offset = (ypos_virtual*xres_virtual + xpos_virtual)*(inf->fb0_color_deepth ? 4:2); + if(ypos_virtual == 3*var->yres && inf->fb0_color_deepth) + offset -= var->yres * var->xres *2; break; case 32: // rgb888 default: @@ -1466,11 +1468,26 @@ static int fb0_set_par(struct fb_info *info) fb0_second_buff_bits = 32; fix->line_length = 4 * xres_virtual; #ifdef CONFIG_FB_SCALING_OSD - dstoffset = ((ypos_virtual*screen->y_res/var->yres) *screen->x_res + (xpos_virtual*screen->x_res)/var->xres )*4; + dstoffset = ((ypos_virtual*screen->y_res/var->yres) *screen->x_res + (xpos_virtual*screen->x_res)/var->xres )*4; + ipp_req.src0.fmt = IPP_XRGB_8888; ipp_req.dst0.fmt = IPP_XRGB_8888; #endif offset = (ypos_virtual*xres_virtual + xpos_virtual)*4; + + if(ypos_virtual >= 2*var->yres) + { + par->format = 1; + #ifdef CONFIG_FB_SCALING_OSD + dstoffset = ((ypos_virtual*screen->y_res/var->yres) *screen->x_res + (xpos_virtual*screen->x_res)/var->xres )*2; + ipp_req.src0.fmt = IPP_RGB_565; + ipp_req.dst0.fmt = IPP_RGB_565; + #endif + if(ypos_virtual == 3*var->yres) + { + offset -= var->yres * var->xres *2; + } + } break; } @@ -1579,6 +1596,8 @@ static int fb0_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) ipp_req.dst0.fmt = IPP_RGB_565; #endif offset = (ypos_virtual*var1->xres_virtual + xpos_virtual)*(inf->fb0_color_deepth ? 4:2); + if(ypos_virtual == 3*var->yres && inf->fb0_color_deepth) + offset -= var->yres * var->xres *2; break; case 32: // rgb888 #ifdef CONFIG_FB_SCALING_OSD @@ -1587,6 +1606,19 @@ static int fb0_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) ipp_req.dst0.fmt = IPP_XRGB_8888; #endif offset = (ypos_virtual*var1->xres_virtual + xpos_virtual)*4; + if(ypos_virtual >= 2*var->yres) + { + par->format = 1; + #ifdef CONFIG_FB_SCALING_OSD + dstoffset = ((ypos_virtual*screen->y_res/var->yres) *screen->x_res + (xpos_virtual*screen->x_res)/var->xres )*2; + ipp_req.src0.fmt = IPP_RGB_565; + ipp_req.dst0.fmt = IPP_RGB_565; + #endif + if(ypos_virtual == 3*var->yres) + { + offset -= var->yres * var->xres *2; + } + } break; default: return -EINVAL; -- 2.34.1