osd: fix afbc dd length error issue [1/1]
authorpengcheng chen <pengcheng.chen@amlogic.com>
Mon, 26 Nov 2018 12:14:26 +0000 (20:14 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Fri, 7 Dec 2018 08:06:49 +0000 (00:06 -0800)
PD#SWPL-2674

Problem:
fix afbc dd length error issue

Solution:
add afbc_len to set screen_size

Verify:
verified on g12a-u200

Change-Id: I00df7945f0f928efe2b8be88c56f10f20bb1700f
Signed-off-by: pengcheng chen <pengcheng.chen@amlogic.com>
drivers/amlogic/media/osd/osd.h
drivers/amlogic/media/osd/osd_fb.c
drivers/amlogic/media/osd/osd_hw.c
drivers/amlogic/media/osd/osd_hw.h

index 3e6c4f0a0d452f4fca5dad5f140f31fa49326ad0..fc9c4194151b824421f1a3f3a7b9559d0c4d05cb 100644 (file)
@@ -437,6 +437,7 @@ struct osd_fence_map_s {
        u32 afbc_inter_format;
        u32 background_w;
        u32 background_h;
+       size_t afbc_len;
        struct fence *in_fence;
 };
 
@@ -464,6 +465,7 @@ struct layer_fence_map_s {
        u32 plane_alpha;
        u32 dim_layer;
        u32 dim_color;
+       size_t afbc_len;
        struct file *buf_file;
        struct fence *in_fence;
 };
@@ -621,7 +623,8 @@ struct hw_list_s {
 
 typedef int (*sync_render_fence)(u32 index, u32 yres,
        struct sync_req_render_s *request,
-       u32 phys_addr);
+       u32 phys_addr,
+       size_t len);
 typedef void (*osd_toggle_buffer_op)(
        struct kthread_work *work);
 struct osd_fence_fun_s {
index 48c92ae599b0b731c96f097f6d395b9b76962ce0..2731b9fe66d690d423ddd1f58b4d8ecd0ae23699 100644 (file)
@@ -1009,7 +1009,7 @@ static int osd_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
                        sync_request_render->out_fen_fd =
                                osd_sync_request_render(info->node,
                                info->var.yres,
-                               sync_request_render, phys_addr);
+                               sync_request_render, phys_addr, len);
                        osd_restore_screen_info(info->node,
                                &info->screen_base, &info->screen_size);
                        ret = copy_to_user(argp,
index 5b3ac8577f5db3ed858e355fc4b65249efec7c55..64bd36b9f5d7560831631b5cb9eb1e3b5afebb16 100644 (file)
@@ -1133,7 +1133,8 @@ int osd_sync_request(u32 index, u32 yres, struct fb_sync_request_s *request)
 
 static int sync_render_single_fence(u32 index, u32 yres,
        struct sync_req_render_s *request,
-       u32 phys_addr)
+       u32 phys_addr,
+       size_t len)
 {
        int out_fence_fd = -1;
        int buf_num = 0;
@@ -1169,6 +1170,7 @@ static int sync_render_single_fence(u32 index, u32 yres,
                fence_map->byte_stride = request->byte_stride;
                fence_map->pxiel_stride = request->pxiel_stride;
                fence_map->afbc_inter_format = request->afbc_inter_format;
+               fence_map->afbc_len = len;
        }
        fence_map->format = request->format;
        fence_map->compose_type = request->type;
@@ -1189,7 +1191,8 @@ static int sync_render_single_fence(u32 index, u32 yres,
 
 static int sync_render_layers_fence(u32 index, u32 yres,
        struct sync_req_render_s *request,
-       u32 phys_addr)
+       u32 phys_addr,
+       size_t len)
 {
        int out_fence_fd = -1;
        s32 in_fence_fd;
@@ -1233,6 +1236,7 @@ static int sync_render_layers_fence(u32 index, u32 yres,
                request->plane_alpha;
        fence_map->layer_map[index].dim_layer = request->dim_layer;
        fence_map->layer_map[index].dim_color = request->dim_color;
+       fence_map->layer_map[index].afbc_len = len;
        /* just return out_fd,but not signal */
        /* no longer put list, will put them via do_hwc */
        fence_map->layer_map[index].in_fence = osd_get_fenceobj(in_fence_fd);
@@ -1251,7 +1255,8 @@ static int sync_render_layers_fence(u32 index, u32 yres,
 
 int osd_sync_request_render(u32 index, u32 yres,
        struct sync_req_render_s *request,
-       u32 phys_addr)
+       u32 phys_addr,
+       size_t len)
 {
        int line;
 
@@ -1269,7 +1274,7 @@ int osd_sync_request_render(u32 index, u32 yres,
        else
                osd_hw.viu_type = VIU1;
        osd_hw.osd_fence[osd_hw.hwc_enable].sync_fence_handler(
-               index, yres, request, phys_addr);
+               index, yres, request, phys_addr, len);
        return request->out_fen_fd;
 }
 
@@ -1386,7 +1391,8 @@ int osd_sync_request(u32 index, u32 yres, struct fb_sync_request_s *request)
 
 int osd_sync_request_render(u32 index, u32 yres,
        struct sync_req_render_s *request,
-       u32 phys_addr)
+       u32 phys_addr,
+       size_t len)
 {
        osd_log_err("osd_sync_request_render not supported\n");
        return -5566;
@@ -3818,6 +3824,9 @@ static bool osd_direct_compose_pan_display(struct osd_fence_map_s *fence_map)
                        fence_map->byte_stride,
                        fence_map->height,
                        CANVAS_ADDR_NOWRAP, CANVAS_BLKMODE_LINEAR);
+               osd_hw.screen_base[index] = vaddr;
+               osd_hw.screen_size[index] =
+                       fence_map->byte_stride * fence_map->height;
        } else {
                osd_hw.osd_afbcd[index].phy_addr = ext_addr;
                osd_hw.osd_afbcd[index].frame_width =
@@ -3838,6 +3847,8 @@ static bool osd_direct_compose_pan_display(struct osd_fence_map_s *fence_map)
                        else
                                osd_hw.osd_afbcd[index].conv_lbuf_len = 1024;
                }
+               osd_hw.screen_base[index] = vaddr;
+               osd_hw.screen_size[index] = fence_map->afbc_len;
        }
        width_dst = osd_hw.free_dst_data_backup[index].x_end -
                osd_hw.free_dst_data_backup[index].x_start + 1;
@@ -3848,8 +3859,7 @@ static bool osd_direct_compose_pan_display(struct osd_fence_map_s *fence_map)
                osd_hw.free_dst_data_backup[index].y_start + 1;
        height_src = osd_hw.free_src_data_backup[index].y_end -
                osd_hw.free_src_data_backup[index].y_start + 1;
-       osd_hw.screen_base[index] = vaddr;
-       osd_hw.screen_size[index] = fence_map->byte_stride * fence_map->height;
+
        if (osd_hw.free_scale_enable[index] ||
                (width_src != width_dst) ||
                (height_src != height_dst) ||
@@ -4342,6 +4352,9 @@ static void osd_pan_display_update_info(struct layer_fence_map_s *layer_map)
                                layer_map->src_h + layer_map->src_y,
                                CANVAS_ADDR_NOWRAP,
                                CANVAS_BLKMODE_LINEAR);
+                       osd_hw.screen_base[index] = vaddr;
+                       osd_hw.screen_size[index] =
+                               layer_map->byte_stride * layer_map->src_h;
                } else {
                        osd_hw.osd_afbcd[index].phy_addr = ext_addr;
                        if (osd_hw.osd_meson_dev.afbc_type ==
@@ -4368,6 +4381,10 @@ static void osd_pan_display_update_info(struct layer_fence_map_s *layer_map)
                                else
                                        osd_hw.osd_afbcd[index]
                                                .conv_lbuf_len = 1024;
+                               osd_hw.screen_base[index] = vaddr;
+                               osd_hw.screen_size[index] =
+                                       layer_map->afbc_len;
+
                        } else if (osd_hw.osd_meson_dev
                                .afbc_type == MALI_AFBC) {
                                osd_hw.osd_afbcd[index].frame_width =
@@ -4375,11 +4392,12 @@ static void osd_pan_display_update_info(struct layer_fence_map_s *layer_map)
                                        //BYTE_32_ALIGNED(layer_map->src_w);
                                osd_hw.osd_afbcd[index].frame_height =
                                        BYTE_8_ALIGNED(layer_map->src_h);
+                               osd_hw.screen_base[index] = vaddr;
+                               osd_hw.screen_size[index] =
+                                       layer_map->afbc_len;
                        }
                }
-               osd_hw.screen_base[index] = vaddr;
-               osd_hw.screen_size[index] =
-                       layer_map->byte_stride * layer_map->src_h;
+
                /* just get para, need update via do_hwc */
                osd_hw.order[index] = layer_map->zorder;
                switch (layer_map->blend_mode) {
index ee15fcb6f33b23464748240f21fec885e66cc8b0..ee43d396c5649dc5e99427f3c0f3fc86ac78aa03 100644 (file)
@@ -123,7 +123,8 @@ extern int osd_sync_request(u32 index, u32 yres,
        struct fb_sync_request_s *request);
 extern int osd_sync_request_render(u32 index, u32 yres,
        struct sync_req_render_s *request,
-       u32 phys_addr);
+       u32 phys_addr,
+       size_t len);
 extern int osd_sync_do_hwc(struct do_hwc_cmd_s *hwc_cmd);
 extern s64  osd_wait_vsync_event(void);
 extern void osd_cursor_hw(u32 index, s16 x, s16 y, s16 xstart, s16 ystart,