rk3288 lcdc: add support x and y mirror
authorhjc <hjc@rock-chips.com>
Mon, 31 Mar 2014 06:00:45 +0000 (14:00 +0800)
committerhjc <hjc@rock-chips.com>
Mon, 31 Mar 2014 06:01:02 +0000 (14:01 +0800)
drivers/video/rockchip/lcdc/rk3288_lcdc.c
drivers/video/rockchip/rk_fb.c
drivers/video/rockchip/screen/rk_screen.c [changed mode: 0644->0755]

index 0ccd58eebf2298c7b6ab5dc997d0c7190bb5e061..c0929692315c1a911b3ff187853b5fd70e6e9656 100755 (executable)
@@ -334,7 +334,7 @@ static int rk3288_lcdc_post_cfg(struct rk_lcdc_driver *dev_drv)
        }else{
                post_dsp_vact_end = v_total - screen->mode.lower_margin -
                                        - screen->post_dsp_sty;
-               post_dsp_hact_st = post_dsp_vact_end - screen->post_ysize;
+               post_dsp_vact_st = post_dsp_vact_end - screen->post_ysize;
        }
        if((screen->post_ysize < y_res)&&(screen->post_ysize != 0)){
                post_vsd_en = 1;
@@ -555,6 +555,35 @@ static int rk3288_lcdc_alpha_cfg(struct rk_lcdc_driver *dev_drv,int win_id)
 
        return 0;
 }
+static int rk3288_lcdc_area_swap(struct rk_lcdc_win *win,int area_num)
+{
+       struct rk_lcdc_win_area area_temp;
+       switch(area_num){
+       case 2:
+               area_temp = win->area[0];
+               win->area[0] = win->area[1];
+               win->area[1] = area_temp;
+               break;
+       case 3:
+               area_temp = win->area[0];
+               win->area[0] = win->area[2];
+               win->area[2] = area_temp;
+               break;
+       case 4:
+               area_temp = win->area[0];
+               win->area[0] = win->area[3];
+               win->area[3] = area_temp;
+               
+               area_temp = win->area[1];
+               win->area[1] = win->area[2];
+               win->area[2] = area_temp;       
+               break;
+       default:
+               printk(KERN_WARNING "un supported area num!\n");
+               break;
+       }
+       return 0;
+}
 
 static int rk3288_win_0_1_reg_update(struct rk_lcdc_driver *dev_drv,int win_id)
 {
@@ -642,9 +671,13 @@ static int rk3288_win_2_3_reg_update(struct rk_lcdc_driver *dev_drv,int win_id)
        struct lcdc_device *lcdc_dev =
            container_of(dev_drv, struct lcdc_device, driver);
        struct rk_lcdc_win *win = dev_drv->win[win_id];
+       struct rk_screen *screen = dev_drv->cur_screen;
        unsigned int mask, val, off;
        off = (win_id-2) * 0x50;
-
+       if((screen->y_mirror == 1)&&(win->area_num > 1)){
+               rk3288_lcdc_area_swap(win,win->area_num);
+       }
+       
        if(win->state == 1){
                mask =  m_WIN2_EN | m_WIN2_DATA_FMT | m_WIN2_RB_SWAP;
                val  =  v_WIN2_EN(1) | v_WIN2_DATA_FMT(win->fmt_cfg) |
index ec2e916eb47b1cdda213abd185bba40e0d67e8da..3ca60b665c3e1daf2ba6abbd0ff83ab06d0f90c2 100755 (executable)
@@ -803,7 +803,7 @@ static int rk_fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info
        u32 stride_32bit_2;
        u32 stride_128bit_1;
        u32 stride_128bit_2;
-       u16 uv_x_off,uv_y_off,dsp_height,uv_y_act;
+       u16 uv_x_off,uv_y_off,uv_y_act;
        u8  is_pic_yuv=0;
 
        win_id = dev_drv->ops->fb_get_win_id(dev_drv, info->fix.id);
@@ -829,7 +829,6 @@ static int rk_fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info
 
        stride    = stride_32bit_1;//default rgb
        fix->line_length = stride;
-       dsp_height = win->area[0].ysize;
 
        switch (win->format){
        case YUV422:
@@ -839,7 +838,7 @@ static int rk_fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info
                uv_x_off   = xoffset >> 1 ;//
                uv_y_off   = yoffset;//0
                fix->line_length = stride;
-               uv_y_act = dsp_height>>1;
+               uv_y_act = win->area[0].yact>>1;
                break;
        case YUV420://420sp
                is_pic_yuv = 1;
@@ -848,7 +847,7 @@ static int rk_fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info
                uv_x_off   = xoffset;
                uv_y_off   = yoffset >> 1;
                fix->line_length = stride;
-               uv_y_act = dsp_height>>1;
+               uv_y_act = win->area[0].yact>>1;
                break;
        case YUV444:
                is_pic_yuv = 1;
@@ -857,7 +856,7 @@ static int rk_fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info
                uv_x_off   = xoffset*2;
                uv_y_off   = yoffset;
                fix->line_length = stride<<2;
-               uv_y_act = dsp_height;
+               uv_y_act = win->area[0].yact;
                break;
        default:
                break;
@@ -1268,7 +1267,7 @@ static int rk_fb_set_win_buffer(struct fb_info *info,
        u32 stride_32bit_2;
        u32 stride_128bit_1;
        u32 stride_128bit_2;
-       u16 uv_x_off,uv_y_off,uv_y_act,dsp_height;
+       u16 uv_x_off,uv_y_off,uv_y_act;
        u8  is_pic_yuv=0;
        u8  ppixel_a=0,global_a=0;
 #ifdef USE_ION_MMU     
@@ -1354,7 +1353,6 @@ static int rk_fb_set_win_buffer(struct fb_info *info,
                reg_win_data->win_id  = -1;
        }
        for(i=0;i<reg_win_data->area_num;i++){
-               dsp_height = reg_win_data->reg_area_data[i].ysize;
                reg_win_data->reg_area_data[i].xpos = win_par->area_par[i].xpos;//visiable pos in panel
                reg_win_data->reg_area_data[i].ypos = win_par->area_par[i].ypos;
 
@@ -1418,7 +1416,7 @@ static int rk_fb_set_win_buffer(struct fb_info *info,
                uv_x_off   = xoffset >> 1 ;//
                uv_y_off   = yoffset;//0
                fix->line_length = stride;
-               uv_y_act = dsp_height>>1;
+               uv_y_act = win_par->area_par[0].yact>>1;
                break;
        case YUV420://420sp
                is_pic_yuv = 1;
@@ -1427,7 +1425,7 @@ static int rk_fb_set_win_buffer(struct fb_info *info,
                uv_x_off   = xoffset;
                uv_y_off   = yoffset >> 1;
                fix->line_length = stride;
-               uv_y_act = dsp_height>>1;
+               uv_y_act = win_par->area_par[0].yact>>1;
                break;
        case YUV444:
                is_pic_yuv = 1;
@@ -1436,7 +1434,7 @@ static int rk_fb_set_win_buffer(struct fb_info *info,
                uv_x_off   = xoffset*2;
                uv_y_off   = yoffset;
                fix->line_length = stride<<2;
-               uv_y_act = dsp_height;
+               uv_y_act = win_par->area_par[0].yact;
                break;
        default:
                break;
@@ -1942,7 +1940,7 @@ static int rk_fb_set_par(struct fb_info *info)
        u32 stride_32bit_2;
        u32 stride_128bit_1;
        u32 stride_128bit_2;
-       u16 uv_x_off,uv_y_off,dsp_height,uv_y_act;
+       u16 uv_x_off,uv_y_off,uv_y_act;
        u8  is_pic_yuv=0;
 
        var->pixclock = dev_drv->pixclock;
@@ -1994,7 +1992,6 @@ if (rk_fb->disp_mode != DUAL) {
 
        stride    = stride_32bit_1;//default rgb
        fix->line_length = stride;
-       dsp_height = win->area[0].ysize;
        switch (fb_data_fmt){
        case YUV422:
                is_pic_yuv = 1;
@@ -2004,7 +2001,7 @@ if (rk_fb->disp_mode != DUAL) {
                uv_y_off   = yoffset;//0
                fix->line_length = stride;
                cblen = crlen = (xvir*yvir)>>1;
-               uv_y_act = dsp_height;
+               uv_y_act = win->area[0].yact>>1;
                break;
        case YUV420://420sp
                is_pic_yuv = 1;
@@ -2014,7 +2011,7 @@ if (rk_fb->disp_mode != DUAL) {
                uv_y_off   = yoffset >> 1;
                fix->line_length = stride;
                cblen = crlen = (xvir*yvir)>>2;
-               uv_y_act = dsp_height>>1;
+               uv_y_act = win->area[0].yact>>1;
                break;
        case YUV444:
                is_pic_yuv = 1;
@@ -2024,7 +2021,7 @@ if (rk_fb->disp_mode != DUAL) {
                uv_y_off   = yoffset;
                fix->line_length = stride<<2;
                cblen = crlen = (xvir*yvir);
-               uv_y_act = dsp_height;
+               uv_y_act = win->area[0].yact;
                break;
        default:
                break;
old mode 100644 (file)
new mode 100755 (executable)
index 7a82107..49a1a8a
@@ -15,6 +15,8 @@ int rk_fb_set_prmry_screen(struct rk_screen *screen)
 {
        rk_screen->lcdc_id = screen->lcdc_id;
        rk_screen->screen_id = screen->screen_id;
+       rk_screen->x_mirror = screen->x_mirror;
+       rk_screen->y_mirror = screen->y_mirror;
        return 0;
 }