osd: calc osd parameters used num/den replace left/right shift [1/1]

PD#OTT-3615

Problem:
a line on the right displayed

Solution:
calc osd parameters used num/den replace left/right shift

Verify:
Verfied on u212

Change-Id: If59d9de0bb3c525d2b67d05ec449d458fbbcdfe2
Signed-off-by: Pengcheng Chen <pengcheng.chen@amlogic.com>
This commit is contained in:
Pengcheng Chen
2019-05-05 16:54:58 +08:00
committed by Tao Zeng
parent db946d0bd3
commit ff60d1531d
2 changed files with 54 additions and 39 deletions

View File

@@ -613,8 +613,10 @@ struct hw_osd_blending_s {
bool osd1_freescale_disable; bool osd1_freescale_disable;
u32 vinfo_width; u32 vinfo_width;
u32 vinfo_height; u32 vinfo_height;
u32 screen_ratio_w; u32 screen_ratio_w_num;
u32 screen_ratio_h; u32 screen_ratio_w_den;
u32 screen_ratio_h_num;
u32 screen_ratio_h_den;
struct dispdata_s dst_data; struct dispdata_s dst_data;
struct layer_blend_reg_s blend_reg; struct layer_blend_reg_s blend_reg;
struct layer_blend_s layer_blend; struct layer_blend_s layer_blend;

View File

@@ -94,7 +94,6 @@
#define osd_tprintk(...) #define osd_tprintk(...)
#define OSD_CALC 14
#define FREE_SCALE_MAX_WIDTH 1920 #define FREE_SCALE_MAX_WIDTH 1920
struct hw_para_s osd_hw; struct hw_para_s osd_hw;
static DEFINE_MUTEX(osd_mutex); static DEFINE_MUTEX(osd_mutex);
@@ -6690,10 +6689,12 @@ static void osd_set_freescale(u32 index,
osd_hw.free_dst_data[index].x_start = 0; osd_hw.free_dst_data[index].x_start = 0;
osd_hw.free_dst_data[index].y_start = 0; osd_hw.free_dst_data[index].y_start = 0;
width = layer_blend->output_data.w width = layer_blend->output_data.w *
* blending->screen_ratio_w >> OSD_CALC; blending->screen_ratio_w_num /
height = (layer_blend->output_data.h - workaround_line) blending->screen_ratio_w_den;
* blending->screen_ratio_h >> OSD_CALC; height = (layer_blend->output_data.h - workaround_line) *
blending->screen_ratio_h_num /
blending->screen_ratio_h_den;
if (osd_hw.field_out_en[output_index]) if (osd_hw.field_out_en[output_index])
height = height >> 1; height = height >> 1;
} else { } else {
@@ -6712,15 +6713,19 @@ static void osd_set_freescale(u32 index,
(blending->osd_blend_mode == OSD_BLEND_ABC)) { (blending->osd_blend_mode == OSD_BLEND_ABC)) {
/* combine mode, need uniformization */ /* combine mode, need uniformization */
osd_hw.free_dst_data[index].x_start = osd_hw.free_dst_data[index].x_start =
(osd_hw.dst_data[index].x << OSD_CALC) / osd_hw.dst_data[index].x *
blending->screen_ratio_w; blending->screen_ratio_w_den /
blending->screen_ratio_w_num;
osd_hw.free_dst_data[index].y_start = osd_hw.free_dst_data[index].y_start =
(osd_hw.dst_data[index].y << OSD_CALC) / osd_hw.dst_data[index].y *
blending->screen_ratio_h; blending->screen_ratio_h_den /
width = (osd_hw.dst_data[index].w << OSD_CALC) / blending->screen_ratio_h_num;
blending->screen_ratio_w; width = osd_hw.dst_data[index].w *
height = (osd_hw.dst_data[index].h << OSD_CALC) / blending->screen_ratio_w_den /
blending->screen_ratio_h; blending->screen_ratio_w_num;
height = osd_hw.dst_data[index].h *
blending->screen_ratio_h_den /
blending->screen_ratio_h_num;
if (width > FREE_SCALE_MAX_WIDTH) if (width > FREE_SCALE_MAX_WIDTH)
width = FREE_SCALE_MAX_WIDTH; width = FREE_SCALE_MAX_WIDTH;
} else if (blending->osd_blend_mode == OSD_BLEND_AB_C) { } else if (blending->osd_blend_mode == OSD_BLEND_AB_C) {
@@ -6729,17 +6734,19 @@ static void osd_set_freescale(u32 index,
if (blending->blend_din != BLEND_DIN4) { if (blending->blend_din != BLEND_DIN4) {
/* combine mode, need uniformization */ /* combine mode, need uniformization */
osd_hw.free_dst_data[index].x_start = osd_hw.free_dst_data[index].x_start =
(osd_hw.dst_data[index].x << OSD_CALC) / osd_hw.dst_data[index].x *
blending->screen_ratio_w; blending->screen_ratio_w_den /
blending->screen_ratio_w_num;
osd_hw.free_dst_data[index].y_start = osd_hw.free_dst_data[index].y_start =
(osd_hw.dst_data[index].y << OSD_CALC) / osd_hw.dst_data[index].y *
blending->screen_ratio_h; blending->screen_ratio_h_den /
width = (osd_hw.dst_data[index].w blending->screen_ratio_h_num;
<< OSD_CALC) / width = osd_hw.dst_data[index].w *
blending->screen_ratio_w; blending->screen_ratio_w_den /
height = (osd_hw.dst_data[index].h blending->screen_ratio_w_num;
<< OSD_CALC) / height = osd_hw.dst_data[index].h *
blending->screen_ratio_h; blending->screen_ratio_h_den /
blending->screen_ratio_h_num;
} else { } else {
/* direct used dst as freescale dst */ /* direct used dst as freescale dst */
osd_hw.free_dst_data[index].x_start = osd_hw.free_dst_data[index].x_start =
@@ -8115,14 +8122,18 @@ static void set_blend_reg(struct layer_blend_reg_s *blend_reg)
static void uniformization_fb(u32 index, static void uniformization_fb(u32 index,
struct hw_osd_blending_s *blending) struct hw_osd_blending_s *blending)
{ {
blending->dst_data.x = (osd_hw.dst_data[index].x << OSD_CALC) / blending->dst_data.x = osd_hw.dst_data[index].x *
blending->screen_ratio_w; blending->screen_ratio_w_den /
blending->dst_data.y = (osd_hw.dst_data[index].y << OSD_CALC) / blending->screen_ratio_w_num;
blending->screen_ratio_h; blending->dst_data.y = osd_hw.dst_data[index].y *
blending->dst_data.w = (osd_hw.dst_data[index].w << OSD_CALC) / blending->screen_ratio_h_den /
blending->screen_ratio_w; blending->screen_ratio_h_num;
blending->dst_data.h = (osd_hw.dst_data[index].h << OSD_CALC) / blending->dst_data.w = osd_hw.dst_data[index].w *
blending->screen_ratio_h; blending->screen_ratio_w_den /
blending->screen_ratio_w_num;
blending->dst_data.h = osd_hw.dst_data[index].h *
blending->screen_ratio_h_den /
blending->screen_ratio_h_num;
osd_log_dbg2(MODULE_BLEND, osd_log_dbg2(MODULE_BLEND,
"uniformization:osd%d:dst_data:%d,%d,%d,%d\n", "uniformization:osd%d:dst_data:%d,%d,%d,%d\n",
index, index,
@@ -8190,12 +8201,14 @@ static int osd_setting_order(u32 output_index)
blending->vinfo_width = osd_hw.vinfo_width[output_index]; blending->vinfo_width = osd_hw.vinfo_width[output_index];
blending->vinfo_height = osd_hw.vinfo_height[output_index]; blending->vinfo_height = osd_hw.vinfo_height[output_index];
blending->screen_ratio_w = blending->screen_ratio_w_num =
(osd_hw.disp_info[output_index].position_w << OSD_CALC) osd_hw.disp_info[output_index].position_w;
/ osd_hw.disp_info[output_index].background_w; blending->screen_ratio_w_den =
blending->screen_ratio_h = osd_hw.disp_info[output_index].background_w;
(osd_hw.disp_info[output_index].position_h << OSD_CALC) blending->screen_ratio_h_num =
/ osd_hw.disp_info[output_index].background_h; osd_hw.disp_info[output_index].position_h;
blending->screen_ratio_h_den =
osd_hw.disp_info[output_index].background_h;
blending->layer_cnt = get_available_layers(); blending->layer_cnt = get_available_layers();
set_blend_order(blending); set_blend_order(blending);