rk fb: add support 4k video rotate and cancel map rotate fb
authorzwl <zwl@rock-chips.com>
Fri, 18 Jul 2014 02:40:44 +0000 (10:40 +0800)
committerzwl <zwl@rock-chips.com>
Fri, 18 Jul 2014 02:40:59 +0000 (10:40 +0800)
drivers/video/rockchip/rk_fb.c
drivers/video/rockchip/screen/rk_screen.c
include/linux/rk_screen.h

index 39f7d69d31582af6fdfe6dec0ef35e7ef0da410d..5f181a2056d74e9f736a2b864903d4873e762f5c 100755 (executable)
@@ -1504,7 +1504,7 @@ static int rk_fb_update_hdmi_win(struct rk_lcdc_win *ext_win,
                 if (ext_win->id == 0) {
                         ext_win->area[0].smem_start =
                                rk_fb->fb[rk_fb->num_fb >> 1]->fix.smem_start;
-                        ext_win->area[0].y_offset = (get_fb_size() >> 1) * fb_index;
+                        ext_win->area[0].y_offset = (get_rotate_fb_size() >> 1) * fb_index;
                         if ((++fb_index) > 1)
                                 fb_index = 0;
                 } else {
@@ -3271,7 +3271,8 @@ static int rk_fb_alloc_buffer_by_ion(struct fb_info *fbi,
                goto err_share_dma_buf;
        }
        win->area[0].ion_hdl = handle;
-       fbi->screen_base = ion_map_kernel(rk_fb->ion_client, handle);
+        if (dev_drv->prop == PRMRY)
+               fbi->screen_base = ion_map_kernel(rk_fb->ion_client, handle);
 #ifdef CONFIG_ROCKCHIP_IOMMU
        if (dev_drv->iommu_enabled)
                ion_map_iommu(dev_drv->dev, rk_fb->ion_client, handle,
@@ -3335,7 +3336,7 @@ static int rk_fb_alloc_buffer(struct fb_info *fbi, int fb_id)
                       fbi->fix.smem_len);
        } else {
                if (dev_drv->rotate_mode > X_Y_MIRROR) {
-                       fb_mem_size = get_fb_size();
+                       fb_mem_size = get_rotate_fb_size();
 #if defined(CONFIG_ION_ROCKCHIP)
                        if (rk_fb_alloc_buffer_by_ion(fbi, win, fb_mem_size) < 0)
                                return -ENOMEM;
index 0c031275d414fbdc4b753424c6b266681704a950..bb7e8cb40077f3533393341fffb9b63441cfe94b 100755 (executable)
@@ -53,6 +53,27 @@ size_t get_fb_size(void)
        return ALIGN(size, SZ_1M);
 }
 
+#define FB_4K_SIZE      (3840UL*2160UL*2)
+size_t get_rotate_fb_size(void)
+{
+       size_t size = 0;
+       u32 xres = 0;
+       u32 yres = 0;
+
+       if (unlikely(!rk_screen))
+               return 0;
+
+       xres = rk_screen->mode.xres;
+       yres = rk_screen->mode.yres;
+
+       /* align as 64 bytes(16*4) number of times */
+       xres = ALIGN_N_TIMES(xres, ALIGN_PIXEL_64BYTE_RGB8888);
+
+       size = (xres * yres << 2) << 1; /* two buffer */
+        size += 2 * FB_4K_SIZE; /* two full RGB size and two 4k size */
+       return ALIGN(size, SZ_1M);
+}
+
 static int rk_screen_probe(struct platform_device *pdev)
 {
        struct device_node *np = pdev->dev.of_node;
index 4ee4960d49d5529459b2b1104481dfe3917f0e0a..367d7c97ad79e56633f81534de4dee515037557e 100755 (executable)
@@ -141,6 +141,7 @@ struct rk29fb_info {
 
 extern void set_lcd_info(struct rk_screen *screen, struct rk29lcd_info *lcd_info);
 extern size_t get_fb_size(void);
+extern size_t get_rotate_fb_size(void);
 
 extern void set_tv_info(struct rk_screen *screen);
 extern void set_hdmi_info(struct rk_screen *screen);