From: pengcheng chen Date: Mon, 26 Nov 2018 12:14:26 +0000 (+0800) Subject: osd: fix afbc dd length error issue [1/1] X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4fb64e4e530990e9ffb6874391d9bb20b0445611;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git osd: fix afbc dd length error issue [1/1] 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 --- diff --git a/drivers/amlogic/media/osd/osd.h b/drivers/amlogic/media/osd/osd.h index 3e6c4f0a0d45..fc9c4194151b 100644 --- a/drivers/amlogic/media/osd/osd.h +++ b/drivers/amlogic/media/osd/osd.h @@ -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 { diff --git a/drivers/amlogic/media/osd/osd_fb.c b/drivers/amlogic/media/osd/osd_fb.c index 48c92ae599b0..2731b9fe66d6 100644 --- a/drivers/amlogic/media/osd/osd_fb.c +++ b/drivers/amlogic/media/osd/osd_fb.c @@ -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, diff --git a/drivers/amlogic/media/osd/osd_hw.c b/drivers/amlogic/media/osd/osd_hw.c index 5b3ac8577f5d..64bd36b9f5d7 100644 --- a/drivers/amlogic/media/osd/osd_hw.c +++ b/drivers/amlogic/media/osd/osd_hw.c @@ -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) { diff --git a/drivers/amlogic/media/osd/osd_hw.h b/drivers/amlogic/media/osd/osd_hw.h index ee15fcb6f33b..ee43d396c564 100644 --- a/drivers/amlogic/media/osd/osd_hw.h +++ b/drivers/amlogic/media/osd/osd_hw.h @@ -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,