From 916b094f76ae8b8b0da443094a21c5b0e116d92e Mon Sep 17 00:00:00 2001 From: Jin-young Jeon Date: Thu, 10 Nov 2016 17:18:58 +0900 Subject: [PATCH] video/sprdfb: dispc: fix clipping problem for yuv buffer. Aligned width(pitch) instead of width of buffer should be used to calculate base address of UV and V of YUV image format, then this will solve clipping problem for YUV image. This commit comes from product kernel. Change-Id: Idafe5d0231888693a41450fe65b1af85d35f6911 Signed-off-by: Jin-young Jeon [jy0922.shim: rewrite commit messages] Signed-off-by: Joonyoung Shim --- drivers/video/sprdfb/sprdfb_dispc.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/video/sprdfb/sprdfb_dispc.c b/drivers/video/sprdfb/sprdfb_dispc.c index 8b6b63a..9c6836e 100644 --- a/drivers/video/sprdfb/sprdfb_dispc.c +++ b/drivers/video/sprdfb/sprdfb_dispc.c @@ -2056,8 +2056,7 @@ static int32_t sprdfb_dispc_disable_overlay(struct sprdfb_device *dev, int layer static int32_t sprdfb_dispc_display_overlay(struct sprdfb_device *dev, struct overlay_display* setting) { - struct overlay_rect *rect = NULL; - uint32_t size = 0; + struct overlay_size *size = NULL; unsigned char *osd_buffer = NULL; unsigned char *img_buffer = NULL; #ifdef CONFIG_DRM_SPRD @@ -2080,7 +2079,7 @@ static int32_t sprdfb_dispc_display_overlay(struct sprdfb_device *dev, struct ov #endif if (SPRD_LAYER_IMG == setting->layer_index) { - rect = &dispc_ctx.overlay_img_info.rect; + size = &dispc_ctx.overlay_img_info.size; #ifdef CONFIG_DRM_SPRD #ifdef CONFIG_SPRDFB_USE_GEM_INDEX @@ -2095,7 +2094,7 @@ static int32_t sprdfb_dispc_display_overlay(struct sprdfb_device *dev, struct ov img_buffer = setting->img_buffer; #endif } else if (SPRD_LAYER_OSD == setting->layer_index) { - rect = &dispc_ctx.overlay_osd_info.rect; + size = &dispc_ctx.overlay_osd_info.size; #ifdef CONFIG_DRM_SPRD #ifdef CONFIG_SPRDFB_USE_GEM_INDEX @@ -2110,7 +2109,7 @@ static int32_t sprdfb_dispc_display_overlay(struct sprdfb_device *dev, struct ov osd_buffer = setting->osd_buffer; #endif } else if (SPRD_LAYER_BOTH == setting->layer_index) { - rect = &dispc_ctx.overlay_img_info.rect; + size = &dispc_ctx.overlay_img_info.size; #ifdef CONFIG_DRM_SPRD #ifdef CONFIG_SPRDFB_USE_GEM_INDEX phys_addr = *((unsigned long *)sprd_drm_gem_get_obj_addr( @@ -2136,8 +2135,6 @@ static int32_t sprdfb_dispc_display_overlay(struct sprdfb_device *dev, struct ov } else return 0; - size = ((rect->h << 16) | (rect->w & 0xffff)); - #ifdef SPRDFB_OVERLAY_DEBUG dev->overlay_data.layer_index = setting->layer_index; dev->overlay_data.osd_buffer = osd_buffer; @@ -2177,15 +2174,15 @@ static int32_t sprdfb_dispc_display_overlay(struct sprdfb_device *dev, struct ov DISPC_IMG_Y_BASE_ADDR); if (dispc_is_yuv_format(dispc_ctx.overlay_img_info.data_type)) { - uint32_t size = rect->w * rect->h; + uint32_t buf_size = size->hsize * size->vsize; - dispc_write((uint32_t)(img_buffer + size), DISPC_IMG_UV_BASE_ADDR); + dispc_write((uint32_t)(img_buffer + buf_size), DISPC_IMG_UV_BASE_ADDR); if (dispc_ctx.overlay_img_info.data_type == SPRD_DATA_FORMAT_YUV422_3P) - dispc_write((uint32_t)(img_buffer + size * 3 / 2), + dispc_write((uint32_t)(img_buffer + buf_size * 3 / 2), DISPC_IMG_V_BASE_ADDR); else if (dispc_ctx.overlay_img_info.data_type == SPRD_DATA_FORMAT_YUV420_3P) - dispc_write((uint32_t)(img_buffer + size * 5 / 4), + dispc_write((uint32_t)(img_buffer + buf_size * 5 / 4), DISPC_IMG_V_BASE_ADDR); } } -- 2.7.4