osd: add canvas alignment for line length [1/4]
authorCao Jian <jian.cao@amlogic.com>
Fri, 22 Nov 2019 02:14:42 +0000 (10:14 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Mon, 9 Dec 2019 12:11:36 +0000 (05:11 -0700)
PD#SWPL-16902

Problem:
garbage screen for portrait panel in recovery mode

Solution:
add canvas alignment for line length
recovery takes it as framebuffer row_bytes

Verify:
g12b-w400

Change-Id: I9e94df3a7294fa3e388390e41eeb44e0588ec9d2
Signed-off-by: Cao Jian <jian.cao@amlogic.com>
(cherry picked from commit 0b339b85f174b00cf213e9aaaa439591e6f279e5)

drivers/amlogic/media/osd/osd_fb.c
drivers/amlogic/media/osd/osd_hw.c
drivers/amlogic/media/osd/osd_hw.h

index eb3152cb4ba6a1cb886ed35ba24534e6d6a9491c..b6875cc0ea4d757b6bc95a449fd5400b78f935a5 100644 (file)
@@ -634,7 +634,8 @@ static int osd_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
                    var->transp.length, var->transp.offset);
        fix->visual = color_format_pt->color_type;
        /* adjust memory length. */
-       fix->line_length = var->xres_virtual * var->bits_per_pixel / 8;
+       fix->line_length =
+               CANVAS_ALIGNED(var->xres_virtual * var->bits_per_pixel / 8);
        osd_log_dbg(MODULE_BASE, "xvirtual=%d, bpp:%d, line_length=%d\n",
                var->xres_virtual, var->bits_per_pixel, fix->line_length);
 
@@ -4371,7 +4372,7 @@ static int osd_probe(struct platform_device *pdev)
                                (fbdev->color->color_index > 16 ?
                                (fbdev->color->color_index > 24 ?
                                 4 : 3) : 2) : 1);
-               fix->line_length = var->xres_virtual * bpp;
+               fix->line_length = CANVAS_ALIGNED(var->xres_virtual * bpp);
                fix->smem_start = fbdev->fb_mem_paddr;
                fix->smem_len = fbdev->fb_len;
                if (fb_alloc_cmap(&fbi->cmap, 16, 0) != 0) {
index 3865b7d107761e8d972ee4f1f07a7db6199555c2..68e07d6f750881ea14de7298ee117733331b3d5c 100644 (file)
@@ -587,7 +587,6 @@ static int pxp_mode;
 s64 timestamp[VIU_COUNT];
 
 static unsigned int osd_h_filter_mode = 1;
-#define CANVAS_ALIGNED(x)      (((x) + 31) & ~31)
 #define BYTE_32_ALIGNED(x)     (((x) + 31) & ~31)
 #define BYTE_16_ALIGNED(x)     (((x) + 15) & ~15)
 #define BYTE_8_ALIGNED(x)      (((x) + 7) & ~7)
@@ -2894,7 +2893,7 @@ void osd_setup_hw(u32 index,
                else {
                        canvas_config(osd_hw.fb_gem[index].canvas_idx,
                                osd_hw.fb_gem[index].addr,
-                               osd_hw.fb_gem[index].width,
+                               CANVAS_ALIGNED(osd_hw.fb_gem[index].width),
                                osd_hw.fb_gem[index].height,
                                CANVAS_ADDR_NOWRAP, CANVAS_BLKMODE_LINEAR);
                }
@@ -4332,7 +4331,7 @@ static bool osd_direct_compose_pan_display(struct osd_fence_map_s *fence_map)
        if (!osd_hw.osd_afbcd[index].enable) {
                canvas_config(osd_hw.fb_gem[index].canvas_idx,
                        ext_addr,
-                       fence_map->byte_stride,
+                       CANVAS_ALIGNED(fence_map->byte_stride),
                        fence_map->height,
                        CANVAS_ADDR_NOWRAP, CANVAS_BLKMODE_LINEAR);
                osd_hw.screen_base[index] = ext_addr;
@@ -4685,7 +4684,8 @@ static void osd_pan_display_single_fence(struct osd_fence_map_s *fence_map)
 
                                canvas_config(osd_hw.fb_gem[index].canvas_idx,
                                        osd_hw.fb_gem[index].addr,
-                                       osd_hw.fb_gem[index].width,
+                                       CANVAS_ALIGNED(
+                                               osd_hw.fb_gem[index].width),
                                        osd_hw.fb_gem[index].height,
                                        CANVAS_ADDR_NOWRAP,
                                        CANVAS_BLKMODE_LINEAR);
@@ -8586,7 +8586,7 @@ static int osd_setting_order(u32 output_index)
                        if (!osd_hw.osd_afbcd[i].enable)
                                canvas_config(osd_hw.fb_gem[i].canvas_idx,
                                        osd_hw.fb_gem[i].addr,
-                                       osd_hw.fb_gem[i].width,
+                                       CANVAS_ALIGNED(osd_hw.fb_gem[i].width),
                                        osd_hw.fb_gem[i].height,
                                        CANVAS_ADDR_NOWRAP,
                                        CANVAS_BLKMODE_LINEAR);
@@ -8808,7 +8808,7 @@ static void osd_setting_old_hwc(void)
        if (!osd_hw.osd_afbcd[index].enable)
                canvas_config(osd_hw.fb_gem[index].canvas_idx,
                        osd_hw.fb_gem[index].addr,
-                       osd_hw.fb_gem[index].width,
+                       CANVAS_ALIGNED(osd_hw.fb_gem[index].width),
                        osd_hw.fb_gem[index].height,
                        CANVAS_ADDR_NOWRAP,
                        CANVAS_BLKMODE_LINEAR);
@@ -8850,7 +8850,7 @@ static void osd_setting_viu2(void)
        if (!osd_hw.osd_afbcd[index].enable)
                canvas_config(osd_hw.fb_gem[index].canvas_idx,
                        osd_hw.fb_gem[index].addr,
-                       osd_hw.fb_gem[index].width,
+                       CANVAS_ALIGNED(osd_hw.fb_gem[index].width),
                        osd_hw.fb_gem[index].height,
                        CANVAS_ADDR_NOWRAP,
                        CANVAS_BLKMODE_LINEAR);
@@ -10337,7 +10337,7 @@ void osd_restore_hw(void)
                for (i = 0; i < osd_hw.osd_meson_dev.osd_count; i++)
                canvas_config(osd_hw.fb_gem[i].canvas_idx,
                        osd_hw.fb_gem[i].addr,
-                       osd_hw.fb_gem[i].width,
+                       CANVAS_ALIGNED(osd_hw.fb_gem[i].width),
                        osd_hw.fb_gem[i].height,
                        CANVAS_ADDR_NOWRAP, CANVAS_BLKMODE_LINEAR);
        }
@@ -10679,7 +10679,7 @@ static bool osd_direct_render(struct osd_plane_map_s *plane_map)
        } else {
                canvas_config(osd_hw.fb_gem[index].canvas_idx,
                        phy_addr,
-                       plane_map->byte_stride,
+                       CANVAS_ALIGNED(plane_map->byte_stride),
                        plane_map->src_h,
                        CANVAS_ADDR_NOWRAP, CANVAS_BLKMODE_LINEAR);
        }
@@ -10928,7 +10928,7 @@ static void osd_cursor_move(struct osd_plane_map_s *plane_map)
                plane_map->byte_stride * plane_map->src_h;
        canvas_config(osd_hw.fb_gem[index].canvas_idx,
                phy_addr,
-               plane_map->byte_stride,
+               CANVAS_ALIGNED(plane_map->byte_stride),
                plane_map->src_h,
                CANVAS_ADDR_NOWRAP, CANVAS_BLKMODE_LINEAR);
 
index b043cef6ea10e1238a55d4718fa3b32399c2b131..d4ec6a0904cb0869041080d1d0317a2faca713b8 100644 (file)
@@ -23,6 +23,7 @@
 #include "osd_sync.h"
 #include "osd_drm.h"
 
+#define CANVAS_ALIGNED(x) (((x) + 63) & ~63)
 #define MAX_HOLD_LINE     0x1f
 #define MIN_HOLD_LINE     0x04
 #define VIU1_DEFAULT_HOLD_LINE  0x08