vpp: support 3D with afbc format [1/1]

PD#TV-3042

Problem:
3D function did not support afbc format before

Solution:
Add the support case which format is afbc.

Verify:
x301

Change-Id: I38189bfa78eec6ac811fb81631514d7d7b8b3d62
Signed-off-by: Brian Zhu <brian.zhu@amlogic.com>

b8d9145 vpp: add interface to force non-afbc path [1/1]
c807fc4 vpp: tm2: add vd2 function for tm2 [2/2]
eea348a vpp: tm2: add vpp and sr support [1/2]
f08c28c video: Some interlace stream will stuck when pts rebound [1/1]
53b2624 amlvideo: reset video_inuse when amlvideo stop [1/1]
17cdaf3 amvideo: set black_threshold_height default 48 [1/1]
1cd025d vpp: set default aspect when the ratecontrol is zero [1/1]
58a2e8f vpp: Modify vframe epoll event [1/1]
94b0dc8 vpp: Modify vframe epoll event [1/1]
e98d6d3 video: enable pts calculation when hold video state changes [1/1]
43d30c4 vpp: add histgram test interface for vpp slt test [1/1]
2677784 amvecm: optimize amvecm update in vsync [1/1]
af78b0f vpp: increase the afbc burst len as 4 for txlx [1/1]
1ace6fc vpp: hold the vpp setting when meet the non-dw afbc frame [1/1]
e8a3758 vpp: 3d: disable crop when 3d playback or hdmi in [1/1]
4e6774d vpp: add black_threshold to disable video when window is too small[1/1]
3ae164f vpp: including crop info when AFBC switch to normal frame [1/1]
c67657f vpp: add the pic_mode backup to check difference [1/1]
33b1aee video: timming gets error when switching channels [1/1]
233779e vpp: add log switch in vpp_set_filters [1/1]
b00582b vpp: config the vd1 canvas1 correctly when 3D enabled [1/1]
607bc19 vpp: support 3D with afbc format [1/1]

vpp: config the vd1 canvas1 correctly when 3D enabled [1/1]

PD#TV-3086

Problem:
3D display abnormal. The vd1 canvas1 was incorrect.

Solution:
When enabled 3D function, config vd1 canvas1 correctly

Verify:
x301

Change-Id: I201cda2f33badf1af54ab4f177a17f761c7cea8d
Signed-off-by: Brian Zhu <brian.zhu@amlogic.com>

vpp: add log switch in vpp_set_filters [1/1]

PD#SWPL-5942

Problem:
Too many log when DI process called the vpp_set_filters with AFBC.

Solution:
Add log switch to disable it.

Verify:
verified on X301

Change-Id: I34c8573bed78e49d27ec386279e929e617bf76d5
Signed-off-by: Brian Zhu <brian.zhu@amlogic.com>

video: timming gets error when switching channels [1/1]

PD#TV-3062

Problem:
When switching channels, Hisense platform needs hold video,
and the timming obtained at this time is wrong

Solution:
because we have add hold video function, so get width and
height interface give the last video frame width and height,
and so on change the video

Verify:
X301

Change-Id: I331a4589dcb5f5785dce7eea6d8cd03c92d733d2
Signed-off-by: Xiaoming Sui <xiaoming.sui@amlogic.com>

vpp: add the pic_mode backup to check difference [1/1]

PD#TV-2929

Problem:
The pic_mode in cur_dispbuf was changed but not be detected.

Solution:
Add global pic_mode variable to check if the pic_mode in cur_dispbuf
is changed. If so, force vpp_set_filters.

Verify:
verified on x301

Change-Id: I5b95f512ad0823b031989f05526f114694887f2b
Signed-off-by: Brian Zhu <brian.zhu@amlogic.com>

vpp: including crop info when AFBC switch to normal frame [1/1]

PD#SWPL-6347

Problem:
When AFBC switch to normal frame, excluding the crop information, the pps
parameters are calculated with wrong input size.

Solution:
1.Add the crop information, when afbc swicth to normal frame.
2.check ratio of compress_width/width, sync to crop value

Verify:
verified on x301

Change-Id: Ib943f8a11263ce577952e589bc172d8b7bafd954
Signed-off-by: Brian Zhu <brian.zhu@amlogic.com>
Signed-off-by: Luan Yuan <luan.yuan@amlogic.com>

vpp: add black_threshold to disable video when window is too small [1/1]

PD#TV-3641

Problem:
Add new interface to disable video when window is too small

Solution:
Add the black_threshold interface to control the threshold size.
And set the default value is width=20, height=30.

Verify:
verified by x301

Change-Id: Ifeb376c2e2edbb5706b2cdc2d08421bd0086b01e
Signed-off-by: Brian Zhu <brian.zhu@amlogic.com>

vpp: 3d: disable crop when 3d playback or hdmi in [1/1]

PD#TV-3962

Problem:
3D mode does not support crop function

Solution:
Remove crop when 3D display.

Verify:
Verified on x301

Change-Id: Id35dd662886be24e3ec78d070e3a70f513f89b16
Signed-off-by: Brian Zhu <brian.zhu@amlogic.com>

vpp: hold the vpp setting when meet the non-dw afbc frame [1/1]

PD#SWPL-7513

Problem:
When meet the non-dw afbc frame, vpp can not display with
scaling down as expected.

Solution:
Hold the current vpp setting and wait provider to switch
non-afbc.

Verify:
x301

Change-Id: I3c0e678d2da42376f3a77e334b8c5ce48460273b
Signed-off-by: Brian Zhu <brian.zhu@amlogic.com>

vpp: increase the afbc burst len as 4 for txlx [1/1]

PD#TV-3132

Problem:
When playing 4K afbc and scaling down to small window,
the vskip is 1 and DDR freq is also lower, the display will
flicker caused by DDR bandwidth issue.

Solution:
Increase the afbc mif burst len from 2 to 4. And enable
the dmc adjustment in that case.

Verify:
r311, verify pass

Change-Id: Ia431a93f6083fd584b7e2eb14f777c5a5e7c20e7
Signed-off-by: Brian Zhu <brian.zhu@amlogic.com>

amvecm: optimize amvecm update in vsync [1/1]

PD#SWPL-6475

Problem:
hdmi input signal, video flicker

Solution:
optimize amvecm update in vsync

Verify:
verify on TL1

Change-Id: I3379333053fc52b8a33747ca83b1d6d68ea874ab
Signed-off-by: MingLiang Dong <mingliang.dong@amlogic.com>

vpp: add histgram test interface for vpp slt test [1/1]

PD#GH-31

Problem:
Need pattern to filter the error vpp modules in SLT test

Solution:
Using clipping and histgram function to create the test pattern
and get the histgram data.

Verify:
verified on w400

Change-Id: I52680c96f568980f71ac8c27c4b66352fea96651
Signed-off-by: Brian Zhu <brian.zhu@amlogic.com>

video: enable pts calculation when hold video state changes [1/1]

PD#TV-3999

Problem:
dtmb individual channel switching speed is slow,
it takes about 16s

Solution:
enable pts calculation when hold video
state changes.

Verify:
X301

Change-Id: I4c8eda3af3df894d8116461abf63c3dda45c8ce3
Signed-off-by: Rui Wang <rui.wang@amlogic.com>

vpp: Modify vframe epoll event [1/1]

PD#SWPL-8850

Problem:
too many print when channel change.

Solution:
Modify vframe epoll event flow to avoid same event.

Verify:
verify on marconi.

Change-Id: Id709439f24d3cad82df6082c477cacce1a9b9cc7
Signed-off-by: qiyao.zhou <qiyao.zhou@amlogic.com>

vpp: Modify vframe epoll event [1/1]

PD#SWPL-8850

Problem:
too many print when channel change.

Solution:
Modify vframe epoll event flow to avoid same event.

Verify:
verify on marconi.

Change-Id: Iefbd190c0280276bf941c48bf99706a0f2573df1
Signed-off-by: qiyao.zhou <qiyao.zhou@amlogic.com>

vpp: set default aspect when the ratecontrol is zero [1/1]

PD#TV-5266

Problem:
Vpp used the wrong aspect ratio in 3D, screen mode = normal
and aspect ratio is 0 in ratecontrol variable.

Solution:
When the aspect ratio is 0, set the default value as
(height << 8) / width

Verify:
Verified by x301

Change-Id: I34f7cd3ce5ed1818d3090ebb4be934225038625e
Signed-off-by: Brian Zhu <brian.zhu@amlogic.com>

amvideo: set black_threshold_height default 48 [1/1]

PD#OTT-1836

Problem:
disable video when window is too small

Solution:
set black_threshold_height default 48

Verify:
U212

Change-Id: I9ed7deb54baef1c44bb9cc0c1a4d699140663864
Signed-off-by: jintao xu <jintao.xu@amlogic.com>

amlvideo: reset video_inuse when amlvideo stop [1/1]

PD#TV-6189

Problem:
video_inuse always is 1 when codec server crash

Solution:
reset video_inuse when amlvideo stop

Verify:
TL1

Change-Id: I5b1b808668e3b2fb78781a4ea1ccbaefc3507d2b
Signed-off-by: Lifeng Cao <lifeng.cao@amlogic.com>

video: Some interlace stream will stuck when pts rebound [1/1]

PD#TV-6236

Problem:
Some interlace stream di has buffer count more than 16
If video pts rebound in this stream. The condition that
(abs(omx_pts_set_index - next_vf->omx_index) <= 16) is
not true. So this frame can not toggle always.

Solution:
Delete this condition that
(abs(omx_pts_set_index - next_vf->omx_index) <= 16)

Verify:
verify TL1

Change-Id: I7e8c12ec72d086b0516f7c7490b492e16e36e8fe
Signed-off-by: Lifeng Cao <lifeng.cao@amlogic.com>

vpp: tm2: add vpp and sr support [1/2]

PD#SWPL-6615

Problem:
Need vpp and sr supprt for sm2

Solution:
add support for tm2

Verify:
test pass on tm2 skt

Change-Id: I0ae2cb178fcbe047cdfec6b4e200424178993e6e
Signed-off-by: Brian Zhu <brian.zhu@amlogic.com>

vpp: tm2: add vd2 function for tm2 [2/2]

PD#SWPL-6615

Problem:
Need vd2 function

Solution:
add vd2 function for tm2:
1.vd2 pps scaler
2.disable vd2 afbc

Verify:
test pass on tm2 skt

Change-Id: I7af5de741b90e443ee065218aecb823ef06d66a7
Signed-off-by: Brian Zhu <brian.zhu@amlogic.com>
Signed-off-by: Luan Yuan <luan.yuan@amlogic.com>

vpp: add interface to force non-afbc path [1/1]

PD#SWPL-7035

Problem:
When DI switched to use VD AFBC, need vpp force to non-afbc first.
Otherwise, display willl flash.

Solution:
Provide new interface to request the vpp release afbc hardware first.
Then return the current afbc status.

Verify:
verified on x301

Change-Id: Ibb2b897db7d2f2c40006433d63709988992c84f1
Signed-off-by: Brian Zhu <brian.zhu@amlogic.com>
This commit is contained in:
Brian Zhu
2019-03-07 17:35:36 +08:00
committed by Chris KIM
parent 7fc81e1db5
commit 3e0689913d
9 changed files with 1138 additions and 415 deletions

View File

@@ -6360,15 +6360,6 @@ static void video_process(
pr_csc("saturation offset = %d.\n",
saturation_offset);
cur_csc_type = csc_type;
if (vf) {
if ((cur_csc_type == VPP_MATRIX_BT2020YUV_BT2020RGB) &&
(cur_csc_type != 0xffff) &&
(vf->source_type == VFRAME_SOURCE_TYPE_HDMI)) {
amvecm_wakeup_queue();
pr_csc("wake up hdr status queue.\n");
}
}
}
}

View File

@@ -780,6 +780,8 @@ static int amlvideo_close(struct file *file)
mutex_lock(&dev->mutex);
dev->users--;
mutex_unlock(&dev->mutex);
if (dev->inst == 0)
video_inuse = 0;
AMLVIDEO_DBG("amlvideo close");
return 0;
}

View File

@@ -104,6 +104,7 @@ struct vivi_fh {
enum v4l2_buf_type type;
};
extern bool video_inuse;
extern bool omx_secret_mode;
extern void get_ppmgr_buf_info(char **start, unsigned int *size);

File diff suppressed because it is too large Load Diff

View File

@@ -50,6 +50,7 @@
#define VIDEO_NOTIFY_PROVIDER_PUT 0x04
#define VIDEO_NOTIFY_FRAME_WAIT 0x08
#define VIDEO_NOTIFY_POS_CHANGED 0x10
#define VIDEO_NOTIFY_NEED_NO_COMP 0x20
struct video_dev_s {
int vpp_off;

View File

@@ -589,6 +589,9 @@ module_param(cur_skip_ratio, uint, 0444);
static unsigned int cur_vf_type;
MODULE_PARM_DESC(cur_vf_type, "cur_vf_type");
module_param(cur_vf_type, uint, 0444);
static unsigned int cur_freq_ratio;
MODULE_PARM_DESC(cur_freq_ratio, "cur_freq_ratio");
module_param(cur_freq_ratio, uint, 0444);
static unsigned int custom_ar;
MODULE_PARM_DESC(custom_ar, "custom_ar");
@@ -598,6 +601,10 @@ static unsigned int force_use_ext_ar;
MODULE_PARM_DESC(force_use_ext_ar, "force_use_ext_ar");
module_param(force_use_ext_ar, uint, 0664);
static unsigned int force_no_compress;
MODULE_PARM_DESC(force_no_compress, "force_no_compress");
module_param(force_no_compress, uint, 0664);
/*
*test on txlx:
*Time_out = (V_out/V_screen_total)/FPS_out;
@@ -629,6 +636,8 @@ static int vpp_process_speed_check(
{
u32 cur_ratio, bpp = 1;
int min_ratio_1000 = 0;
int freq_ratio = 1;
u32 sync_duration_den = 1;
u32 vtotal, htotal = 0, clk_in_pps = 0, clk_vpu = 0, clk_temp;
u32 input_time_us = 0, display_time_us = 0, dummy_time_us = 0;
u32 width_out = 0;
@@ -647,6 +656,9 @@ static int vpp_process_speed_check(
if (next_frame_par->vscale_skip_count < force_vskip_cnt)
return SPEED_CHECK_VSKIP;
if (vinfo->sync_duration_den > 0)
sync_duration_den = vinfo->sync_duration_den;
if (vf->type & VIDTYPE_PRE_INTERLACE) {
if (is_meson_txlx_cpu())
clk_in_pps = 250000000;
@@ -694,13 +706,22 @@ static int vpp_process_speed_check(
if (clk_temp)
dummy_time_us = (vtotal * htotal -
height_out * width_out) / clk_temp;
display_time_us = 1000000 * vinfo->sync_duration_den /
display_time_us = 1000000 * sync_duration_den /
vinfo->sync_duration_num;
if (display_time_us > dummy_time_us)
display_time_us = display_time_us - dummy_time_us;
if (input_time_us > display_time_us)
return SPEED_CHECK_VSKIP;
}
if ((vinfo->sync_duration_num / sync_duration_den) > 60)
freq_ratio = vinfo->sync_duration_num /
sync_duration_den / 60;
if (freq_ratio < 1)
freq_ratio = 1;
cur_freq_ratio = freq_ratio;
/* #if (MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8) */
if ((get_cpu_type() >= MESON_CPU_MAJOR_ID_M8) && !is_meson_mtvd_cpu()) {
if ((width_in <= 0) || (height_in <= 0) || (height_out <= 0)
@@ -723,7 +744,7 @@ static int vpp_process_speed_check(
MESON_CPU_MAJOR_ID_GXBB) {
cur_ratio = div_u64((u64)height_in *
(u64)vinfo->height *
1000,
1000 * freq_ratio,
height_out * max_height);
/* di process first, need more a bit of ratio */
if (vf->type & VIDTYPE_PRE_INTERLACE)
@@ -752,7 +773,7 @@ static int vpp_process_speed_check(
(u64)vinfo->sync_duration_num *
(u64)vtotal,
height_out *
vinfo->sync_duration_den *
sync_duration_den *
bypass_ratio) > clk_in_pps)
return SPEED_CHECK_VSKIP;
else
@@ -766,7 +787,7 @@ static int vpp_process_speed_check(
(u64)vinfo->sync_duration_num *
(u64)vtotal,
height_out *
vinfo->sync_duration_den * 256)
sync_duration_den * 256)
> clk_in_pps)
return SPEED_CHECK_VSKIP;
/* 4K down scaling to non 4K > 30hz,*/
@@ -776,7 +797,7 @@ static int vpp_process_speed_check(
&& (height_in > 2048)
&& (height_out < 2048)
&& (vinfo->sync_duration_num >
(30 * vinfo->sync_duration_den))
(30 * sync_duration_den))
&& (get_cpu_type() !=
MESON_CPU_MAJOR_ID_GXTVBB)
&& (get_cpu_type() !=
@@ -789,7 +810,7 @@ static int vpp_process_speed_check(
/*TODO vpu */
if (div_u64(VPP_SPEED_FACTOR * width_in *
vinfo->sync_duration_num * height_screen,
vinfo->sync_duration_den * 256)
sync_duration_den * 256)
> get_vpu_clk())
return SPEED_CHECK_HSKIP;
else
@@ -871,8 +892,11 @@ static int vpp_set_filters_internal(
u32 vert_chroma_filter;
struct filter_info_s *cur_filter;
s32 vpp_zoom_center_x, vpp_zoom_center_y;
u32 crop_ratio = 1;
u32 crop_left, crop_right, crop_top, crop_bottom;
u32 sar_width = 0, sar_height = 0;
bool ext_sar = false;
bool no_compress = false;
if (!input)
return VppFilter_Fail;
@@ -896,7 +920,8 @@ static int vpp_set_filters_internal(
reverse = input->reverse;
#endif
if (vf->type & VIDTYPE_MVC) {
if ((vf->type & VIDTYPE_MVC) ||
(input->proc_3d_type & MODE_3D_ENABLE)) {
video_source_crop_left = 0;
video_source_crop_right = 0;
video_source_crop_top = 0;
@@ -908,20 +933,6 @@ static int vpp_set_filters_internal(
video_source_crop_bottom = input->crop_bottom;
}
if (likely(w_in >
(video_source_crop_left + video_source_crop_right))) {
w_in -= video_source_crop_left;
w_in -= video_source_crop_right;
h_crop_enable = true;
}
if (likely(h_in >
(video_source_crop_top + video_source_crop_bottom))) {
h_in -= video_source_crop_top;
h_in -= video_source_crop_bottom;
v_crop_enable = true;
}
#ifndef TV_3D_FUNCTION_OPEN
next_frame_par->vscale_skip_count = 0;
next_frame_par->hscale_skip_count = 0;
@@ -947,6 +958,25 @@ static int vpp_set_filters_internal(
pr_info("sar_width=%d, sar_height = %d, %d\n",
vf->sar_width, vf->sar_height,
force_use_ext_ar);
RESTART_ALL:
crop_left = video_source_crop_left / crop_ratio;
crop_right = video_source_crop_right / crop_ratio;
crop_top = video_source_crop_top / crop_ratio;
crop_bottom = video_source_crop_bottom / crop_ratio;
if (likely(w_in >
(crop_left + crop_right))) {
w_in -= crop_left;
w_in -= crop_right;
h_crop_enable = true;
}
if (likely(h_in >
(crop_top + crop_bottom))) {
h_in -= crop_top;
h_in -= crop_bottom;
v_crop_enable = true;
}
RESTART:
aspect_factor = (vpp_flags & VPP_FLAG_AR_MASK) >> VPP_FLAG_AR_BITS;
@@ -1268,8 +1298,8 @@ RESTART:
}
if (v_crop_enable) {
next_frame_par->VPP_vd_start_lines_ += video_source_crop_top;
next_frame_par->VPP_vd_end_lines_ += video_source_crop_top;
next_frame_par->VPP_vd_start_lines_ += crop_top;
next_frame_par->VPP_vd_end_lines_ += crop_top;
}
if (vpp_flags & VPP_FLAG_INTERLACE_IN)
@@ -1386,8 +1416,8 @@ RESTART:
}
if (h_crop_enable) {
next_frame_par->VPP_hd_start_lines_ += video_source_crop_left;
next_frame_par->VPP_hd_end_lines_ += video_source_crop_left;
next_frame_par->VPP_hd_start_lines_ += crop_left;
next_frame_par->VPP_hd_end_lines_ += crop_left;
}
next_frame_par->VPP_line_in_length_ =
@@ -1467,10 +1497,21 @@ RESTART:
}
if ((vf->type & VIDTYPE_COMPRESS) &&
!(vf->type & VIDTYPE_NO_DW) &&
(vf->canvas0Addr != 0) &&
(next_frame_par->vscale_skip_count > 1) &&
(!next_frame_par->nocomp)) {
pr_info(
if ((vpp_flags & VPP_FLAG_FORCE_NO_COMPRESS)
|| (next_frame_par->vscale_skip_count > 1)
|| !input->afbc_support
|| force_no_compress)
no_compress = true;
} else
no_compress = false;
if (no_compress) {
if ((vpp_flags & VPP_FLAG_MORE_LOG)
&& input->afbc_support)
pr_info(
"layer%d: Try DW buffer for compressed frame scaling.\n",
input->layer_id);
@@ -1482,7 +1523,9 @@ RESTART:
h_in = height_in = vf->height;
next_frame_par->hscale_skip_count = 0;
next_frame_par->vscale_skip_count = 0;
goto RESTART;
if (vf->width && vf->compWidth)
crop_ratio = vf->compWidth / vf->width;
goto RESTART_ALL;
}
if ((skip_policy & 0xf0) && (skip_policy_check == true)) {
@@ -1657,6 +1700,10 @@ RESTART:
next_frame_par->vscale_skip_count;
}
if ((next_frame_par->vscale_skip_count > 1)
&& (vf->type & VIDTYPE_COMPRESS)
&& (vf->type & VIDTYPE_NO_DW))
ret = VppFilter_Changed_but_Hold;
return ret;
}
/*
@@ -1812,10 +1859,12 @@ int vpp_set_super_scaler_regs(
if (is_meson_txhd_cpu() ||
is_meson_g12a_cpu() ||
is_meson_g12b_cpu() ||
is_meson_sm1_cpu() ||
(is_meson_tl1_cpu() &&
is_meson_sm1_cpu())
tmp_data = ((reg_srscl0_hsize & 0x1fff) << 16) |
(reg_srscl0_vsize & 0x1fff);
else if ((is_meson_tl1_cpu() || is_meson_tm2_cpu()) &&
((scaler_path_sel == PPS_CORE0_CORE1) ||
(scaler_path_sel == PPS_CORE0_POSTBLEND_CORE1))))
(scaler_path_sel == PPS_CORE0_POSTBLEND_CORE1)))
tmp_data = ((reg_srscl0_hsize & 0x1fff) << 16) |
(reg_srscl0_vsize & 0x1fff);
else
@@ -2212,7 +2261,7 @@ static void vpp_set_super_scaler(
sr_path = next_frame_par->supscl_path;
/* path config */
if (is_meson_tl1_cpu()) {
if (is_meson_tl1_cpu() || is_meson_tm2_cpu()) {
if (sr_path == CORE0_PPS_CORE1) {
next_frame_par->sr0_position = 1;
next_frame_par->sr1_position = 1;
@@ -2325,7 +2374,15 @@ static void vpp_get_video_source_size(
u32 process_3d_type, struct vframe_s *vf,
struct vpp_frame_par_s *next_frame_par)
{
int frame_width, frame_height;
if (vf->type & VIDTYPE_COMPRESS) {
frame_width = vf->compWidth;
frame_height = vf->compHeight;
} else {
frame_width = vf->width;
frame_height = vf->height;
}
if ((process_3d_type & MODE_3D_AUTO) ||
(((process_3d_type & MODE_3D_TO_2D_R) ||
(process_3d_type & MODE_3D_TO_2D_L) ||
@@ -2369,8 +2426,8 @@ static void vpp_get_video_source_size(
break;
case TVIN_TFMT_3D_DET_CHESSBOARD:
default:
*src_width = vf->width;
*src_height = vf->height;
*src_width = frame_width;
*src_height = frame_height;
next_frame_par->vpp_3d_mode = VPP_3D_MODE_NULL;
next_frame_par->vpp_3d_scale = 0;
next_frame_par->vpp_2pic_mode = 0;
@@ -2381,15 +2438,15 @@ static void vpp_get_video_source_size(
(process_3d_type & MODE_FORCE_3D_LR)) {
next_frame_par->vpp_3d_mode = VPP_3D_MODE_LR;
if (process_3d_type & MODE_3D_TO_2D_MASK) {
*src_width = vf->width >> 1;
*src_height = vf->height;
*src_width = frame_width >> 1;
*src_height = frame_height;
} else if (process_3d_type & MODE_3D_OUT_LR) {
*src_width = vf->width;
*src_height = vf->height;
*src_width = frame_width;
*src_height = frame_height;
next_frame_par->vpp_2pic_mode = 1;
} else {
*src_width = vf->width >> 1;
*src_height = vf->height << 1;
*src_width = frame_width >> 1;
*src_height = frame_height << 1;
next_frame_par->vpp_2pic_mode = 1;
}
@@ -2397,38 +2454,38 @@ static void vpp_get_video_source_size(
(process_3d_type & MODE_FORCE_3D_TB)) {
next_frame_par->vpp_3d_mode = VPP_3D_MODE_TB;
if (process_3d_type & MODE_3D_TO_2D_MASK) {
*src_width = vf->width;
*src_height = vf->height >> 1;
*src_width = frame_width;
*src_height = frame_height >> 1;
} else if (process_3d_type & MODE_3D_OUT_LR) {
*src_width = vf->width << 1;
*src_height = vf->height >> 1;
*src_width = frame_width << 1;
*src_height = frame_height >> 1;
next_frame_par->vpp_2pic_mode = 1;
} else {
*src_width = vf->width;
*src_height = vf->height;
*src_width = frame_width;
*src_height = frame_height;
next_frame_par->vpp_2pic_mode = 1;
}
if (process_3d_type & MODE_3D_MVC) {
*src_width = vf->width;
*src_height = vf->height << 1;
*src_width = frame_width;
*src_height = frame_height << 1;
next_frame_par->vpp_2pic_mode = 2;
next_frame_par->vpp_3d_mode = VPP_3D_MODE_FA;
}
} else if (process_3d_type & MODE_3D_LA) {
next_frame_par->vpp_3d_mode = VPP_3D_MODE_LA;
*src_height = vf->height - 1;
*src_width = vf->width;
*src_height = frame_height - 1;
*src_width = frame_width;
next_frame_par->vpp_2pic_mode = 0;
next_frame_par->vpp_3d_scale = 1;
if (process_3d_type & MODE_3D_TO_2D_MASK) {
next_frame_par->vscale_skip_count = 1;
next_frame_par->vpp_3d_scale = 0;
} else if (process_3d_type & MODE_3D_OUT_TB) {
*src_height = vf->height << 1;
*src_height = frame_height << 1;
next_frame_par->vscale_skip_count = 1;
next_frame_par->vpp_3d_scale = 0;
} else if (process_3d_type & MODE_3D_OUT_LR) {
*src_width = vf->width << 1;
*src_width = frame_width << 1;
next_frame_par->vscale_skip_count = 1;
next_frame_par->vpp_3d_scale = 0;
}
@@ -2440,37 +2497,37 @@ static void vpp_get_video_source_size(
if (process_3d_type & MODE_3D_TO_2D_MASK) {
if (process_3d_type & MODE_FORCE_3D_FA_TB) {
next_frame_par->vpp_3d_mode = VPP_3D_MODE_TB;
*src_width = vf->width;
*src_height = vf->height >> 1;
*src_width = frame_width;
*src_height = frame_height >> 1;
}
if (process_3d_type & MODE_FORCE_3D_FA_LR) {
next_frame_par->vpp_3d_mode = VPP_3D_MODE_LR;
*src_width = vf->width >> 1;
*src_height = vf->height;
*src_width = frame_width >> 1;
*src_height = frame_height;
}
if (process_3d_type & MODE_3D_MVC) {
*src_width = vf->width;
*src_height = vf->height;
*src_width = frame_width;
*src_height = frame_height;
next_frame_par->vpp_3d_mode = VPP_3D_MODE_FA;
}
if (vf->trans_fmt == TVIN_TFMT_3D_FP) {
next_frame_par->vpp_3d_mode = VPP_3D_MODE_TB;
*src_width = vf->width;
*src_width = frame_width;
*src_height = vf->left_eye.height;
}
next_frame_par->vpp_2pic_mode = 0;
} else if (process_3d_type & MODE_3D_OUT_LR) {
*src_width = vf->width << 1;
*src_height = vf->height;
*src_width = frame_width << 1;
*src_height = frame_height;
next_frame_par->vpp_2pic_mode = 2;
} else {
*src_width = vf->width;
*src_height = vf->height << 1;
*src_width = frame_width;
*src_height = frame_height << 1;
next_frame_par->vpp_2pic_mode = 2;
}
} else {
*src_width = vf->width;
*src_height = vf->height;
*src_width = frame_width;
*src_height = frame_height;
next_frame_par->vpp_3d_mode = VPP_3D_MODE_NULL;
next_frame_par->vpp_2pic_mode = 0;
next_frame_par->vpp_3d_scale = 0;
@@ -2497,8 +2554,8 @@ static void vpp_get_video_source_size(
}
/*avoid dividing 0 error */
if (*src_width == 0 || *src_height == 0) {
*src_width = vf->width;
*src_height = vf->height;
*src_width = frame_width;
*src_height = frame_height;
}
}
#endif
@@ -2538,6 +2595,9 @@ static int vpp_set_filters_no_scaler_internal(
bool reverse = false;
#endif
int ret = VppFilter_Success;
u32 crop_ratio = 1;
u32 crop_left, crop_right, crop_top, crop_bottom;
bool no_compress = false;
if (!input)
return VppFilter_Fail;
@@ -2553,7 +2613,8 @@ static int vpp_set_filters_no_scaler_internal(
reverse = input->reverse;
#endif
if (vf->type & VIDTYPE_MVC) {
if ((vf->type & VIDTYPE_MVC) ||
(input->proc_3d_type & MODE_3D_ENABLE)) {
video_source_crop_left = 0;
video_source_crop_right = 0;
video_source_crop_top = 0;
@@ -2565,20 +2626,6 @@ static int vpp_set_filters_no_scaler_internal(
video_source_crop_bottom = input->crop_bottom;
}
if (likely(w_in >
(video_source_crop_left + video_source_crop_right))) {
w_in -= video_source_crop_left;
w_in -= video_source_crop_right;
h_crop_enable = true;
}
if (likely(h_in >
(video_source_crop_top + video_source_crop_bottom))) {
h_in -= video_source_crop_top;
h_in -= video_source_crop_bottom;
v_crop_enable = true;
}
next_frame_par->vscale_skip_count = 0;
next_frame_par->hscale_skip_count = 0;
next_frame_par->nocomp = false;
@@ -2592,6 +2639,26 @@ static int vpp_set_filters_no_scaler_internal(
else
vskip_step = 1;
RESTART_ALL:
crop_left = video_source_crop_left / crop_ratio;
crop_right = video_source_crop_right / crop_ratio;
crop_top = video_source_crop_top / crop_ratio;
crop_bottom = video_source_crop_bottom / crop_ratio;
if (likely(w_in >
(crop_left + crop_right))) {
w_in -= crop_left;
w_in -= crop_right;
h_crop_enable = true;
}
if (likely(h_in >
(crop_top + crop_bottom))) {
h_in -= crop_top;
h_in -= crop_bottom;
v_crop_enable = true;
}
RESTART:
/* don't use input->wide_mode */
wide_mode = vpp_flags & VPP_FLAG_WIDEMODE_MASK;
@@ -2678,8 +2745,8 @@ RESTART:
}
if (v_crop_enable) {
next_frame_par->VPP_vd_start_lines_ += video_source_crop_top;
next_frame_par->VPP_vd_end_lines_ += video_source_crop_top;
next_frame_par->VPP_vd_start_lines_ += crop_top;
next_frame_par->VPP_vd_end_lines_ += crop_top;
}
if (vpp_flags & VPP_FLAG_INTERLACE_IN)
@@ -2791,8 +2858,8 @@ RESTART:
}
if (h_crop_enable) {
next_frame_par->VPP_hd_start_lines_ += video_source_crop_left;
next_frame_par->VPP_hd_end_lines_ += video_source_crop_left;
next_frame_par->VPP_hd_start_lines_ += crop_left;
next_frame_par->VPP_hd_end_lines_ += crop_left;
}
next_frame_par->VPP_line_in_length_ =
@@ -2846,10 +2913,21 @@ RESTART:
}
if ((vf->type & VIDTYPE_COMPRESS) &&
!(vf->type & VIDTYPE_NO_DW) &&
(vf->canvas0Addr != 0) &&
(next_frame_par->vscale_skip_count > 1) &&
(!next_frame_par->nocomp)) {
pr_info(
if ((vpp_flags & VPP_FLAG_FORCE_NO_COMPRESS)
|| (next_frame_par->vscale_skip_count > 1)
|| !input->afbc_support
|| force_no_compress)
no_compress = true;
} else
no_compress = false;
if (no_compress) {
if ((vpp_flags & VPP_FLAG_MORE_LOG)
&& input->afbc_support)
pr_info(
"layer%d: Try DW buffer for compressed frame scaling.\n",
input->layer_id);
@@ -2861,7 +2939,9 @@ RESTART:
h_in = height_in = vf->height;
next_frame_par->hscale_skip_count = 0;
next_frame_par->vscale_skip_count = 0;
goto RESTART;
if (vf->width && vf->compWidth)
crop_ratio = vf->compWidth / vf->width;
goto RESTART_ALL;
}
if ((skip_policy & 0xf0) && (skip_policy_check == true)) {
@@ -2899,6 +2979,10 @@ RESTART:
next_frame_par->VPP_line_in_length_ >>= 1;
}
if ((next_frame_par->vscale_skip_count > 1)
&& (vf->type & VIDTYPE_COMPRESS)
&& (vf->type & VIDTYPE_NO_DW))
ret = VppFilter_Changed_but_Hold;
return ret;
}
@@ -2907,7 +2991,7 @@ int vpp_set_filters(
struct vframe_s *vf,
struct vpp_frame_par_s *next_frame_par,
const struct vinfo_s *vinfo,
bool bypass_sr)
bool bypass_sr, u32 op_flag)
{
u32 src_width = 0;
u32 src_height = 0;
@@ -2933,34 +3017,46 @@ int vpp_set_filters(
next_frame_par->VPP_post_blend_vd_h_start_ = 0;
next_frame_par->VPP_postproc_misc_ = 0x200;
#ifdef TV_3D_FUNCTION_OPEN
next_frame_par->vscale_skip_count = 0;
next_frame_par->hscale_skip_count = 0;
if (vf->type & VIDTYPE_COMPRESS) {
src_width = vf->compWidth;
src_height = vf->compHeight;
} else {
src_width = vf->width;
src_height = vf->height;
}
#ifdef TV_3D_FUNCTION_OPEN
/*
*check 3d mode change in display buffer or 3d type
*get the source size according to 3d mode
*/
if (process_3d_type & MODE_3D_ENABLE) {
vpp_get_video_source_size(&src_width, &src_height,
process_3d_type, vf, next_frame_par);
} else {
if (vf->type & VIDTYPE_COMPRESS) {
src_width = vf->compWidth;
src_height = vf->compHeight;
if (local_input.layer_id == 0) {
if (process_3d_type & MODE_3D_ENABLE) {
vpp_get_video_source_size(
&src_width, &src_height,
process_3d_type,
vf, next_frame_par);
} else {
src_width = vf->width;
src_height = vf->height;
next_frame_par->vpp_3d_mode =
VPP_3D_MODE_NULL;
next_frame_par->vpp_2pic_mode = 0;
next_frame_par->vpp_3d_scale = 0;
}
next_frame_par->trans_fmt = vf->trans_fmt;
get_vpp_3d_mode(process_3d_type,
next_frame_par->trans_fmt,
&next_frame_par->vpp_3d_mode);
if (local_input.vpp_3d_scale)
next_frame_par->vpp_3d_scale = 1;
} else {
next_frame_par->vpp_3d_mode = VPP_3D_MODE_NULL;
next_frame_par->vpp_2pic_mode = 0;
next_frame_par->vpp_3d_scale = 0;
next_frame_par->trans_fmt = vf->trans_fmt;
}
next_frame_par->trans_fmt = vf->trans_fmt;
get_vpp_3d_mode(process_3d_type,
next_frame_par->trans_fmt,
&next_frame_par->vpp_3d_mode);
if (local_input.vpp_3d_scale)
next_frame_par->vpp_3d_scale = 1;
amlog_mask(LOG_MASK_VPP, "%s: src_width %u,src_height %u.\n", __func__,
src_width, src_height);
#endif
@@ -2985,6 +3081,18 @@ int vpp_set_filters(
aspect_ratio = (vf->ratio_control & DISP_RATIO_ASPECT_RATIO_MASK)
>> DISP_RATIO_ASPECT_RATIO_BIT;
if (!aspect_ratio) {
u32 sar_width, sar_height;
if (vf->type & VIDTYPE_COMPRESS) {
sar_width = vf->compWidth;
sar_height = vf->compHeight;
} else {
sar_width = vf->width;
sar_height = vf->height;
}
aspect_ratio = (sar_height << 8) / sar_width;
}
/* the height from vdin afbc will be half */
/* so need no interlace in */
if ((vf->type & VIDTYPE_INTERLACE)
@@ -2996,15 +3104,6 @@ int vpp_set_filters(
if (vf->type & VIDTYPE_VSCALE_DISABLE)
vpp_flags |= VPP_FLAG_VSCALE_DISABLE;
#ifndef TV_3D_FUNCTION_OPEN
if (vf->type & VIDTYPE_COMPRESS) {
src_width = vf->compWidth;
src_height = vf->compHeight;
} else {
src_width = vf->width;
src_height = vf->height;
}
#endif
if ((vf->ratio_control & DISP_RATIO_ADAPTED_PICMODE)
&& !disable_adapted) {
@@ -3036,6 +3135,9 @@ int vpp_set_filters(
}
}
if (!local_input.pps_support)
wide_mode = VIDEO_WIDEOPTION_NORMAL;
/* don't restore the wide mode */
/* input->wide_mode = wide_mode; */
vpp_flags |= wide_mode | (aspect_ratio << VPP_FLAG_AR_BITS);
@@ -3043,15 +3145,30 @@ int vpp_set_filters(
if (vinfo->field_height != vinfo->height)
vpp_flags |= VPP_FLAG_INTERLACE_OUT;
if (op_flag & 1)
vpp_flags |= VPP_FLAG_MORE_LOG;
if (local_input.need_no_compress)
vpp_flags |= VPP_FLAG_FORCE_NO_COMPRESS;
next_frame_par->VPP_post_blend_vd_v_end_ = vinfo->field_height - 1;
next_frame_par->VPP_post_blend_vd_h_end_ = vinfo->width - 1;
next_frame_par->VPP_post_blend_h_size_ = vinfo->width;
ret = vpp_set_filters_internal(
&local_input, src_width, src_height,
vinfo->width, vinfo->height,
vinfo, vpp_flags, next_frame_par, vf);
if (local_input.pps_support)
ret = vpp_set_filters_internal(
&local_input, src_width, src_height,
vinfo->width, vinfo->height,
vinfo, vpp_flags, next_frame_par, vf);
else
ret = vpp_set_filters_no_scaler_internal(
&local_input, src_width, src_height,
vinfo->width, vinfo->height,
vinfo, vpp_flags, next_frame_par, vf);
/* bypass sr since the input w/h may be wrong */
if (ret == VppFilter_Changed_but_Hold)
bypass_sr = true;
/*config super scaler after set next_frame_par is calc ok for pps*/
if (local_input.layer_id == 0)
vpp_set_super_scaler(
@@ -3062,90 +3179,6 @@ int vpp_set_filters(
return ret;
}
int vpp_set_filters_no_scaler(
struct disp_info_s *input,
struct vframe_s *vf,
struct vpp_frame_par_s *next_frame_par,
const struct vinfo_s *vinfo)
{
u32 src_width = 0;
u32 src_height = 0;
u32 vpp_flags = 0;
u32 aspect_ratio = 0;
u32 wide_mode;
int ret = VppFilter_Fail;
struct disp_info_s local_input;
if (!input)
return ret;
WARN_ON(vinfo == NULL);
/* use local var to avoid the input data be overwriten */
memcpy(&local_input, input, sizeof(struct disp_info_s));
/* wide_mode = local_input.wide_mode; */
wide_mode = VIDEO_WIDEOPTION_NORMAL;
next_frame_par->VPP_post_blend_vd_v_start_ = 0;
next_frame_par->VPP_post_blend_vd_h_start_ = 0;
next_frame_par->VPP_postproc_misc_ = 0x200;
next_frame_par->vscale_skip_count = 0;
next_frame_par->hscale_skip_count = 0;
if (vf->type & VIDTYPE_COMPRESS) {
src_width = vf->compWidth;
src_height = vf->compHeight;
} else {
src_width = vf->width;
src_height = vf->height;
}
#ifdef TV_3D_FUNCTION_OPEN
next_frame_par->vpp_3d_mode = VPP_3D_MODE_NULL;
next_frame_par->vpp_2pic_mode = 0;
next_frame_par->vpp_3d_scale = 0;
next_frame_par->trans_fmt = vf->trans_fmt;
#endif
if (vf->type & VIDTYPE_INTERLACE)
vpp_flags = VPP_FLAG_INTERLACE_IN;
if ((vf->ratio_control & DISP_RATIO_ADAPTED_PICMODE)
&& !disable_adapted) {
if (vf->pic_mode.provider == PIC_MODE_PROVIDER_WSS) {
/* from wss, need add global setting */
local_input.crop_top += vf->pic_mode.vs;
local_input.crop_left += vf->pic_mode.hs;
local_input.crop_bottom += vf->pic_mode.ve;
local_input.crop_right += vf->pic_mode.he;
} else {
/* from PQ database, final setting */
local_input.crop_top = vf->pic_mode.vs;
local_input.crop_left = vf->pic_mode.hs;
local_input.crop_bottom = vf->pic_mode.ve;
local_input.crop_right = vf->pic_mode.he;
}
}
aspect_ratio =
(vf->ratio_control & DISP_RATIO_ASPECT_RATIO_MASK)
>> DISP_RATIO_ASPECT_RATIO_BIT;
/* don't restore the wide mode */
/* input->wide_mode = wide_mode; */
vpp_flags |= wide_mode | (aspect_ratio << VPP_FLAG_AR_BITS);
if (vinfo->field_height != vinfo->height)
vpp_flags |= VPP_FLAG_INTERLACE_OUT;
next_frame_par->VPP_post_blend_vd_v_end_ = vinfo->field_height - 1;
next_frame_par->VPP_post_blend_vd_h_end_ = vinfo->width - 1;
next_frame_par->VPP_post_blend_h_size_ = vinfo->width;
ret = vpp_set_filters_no_scaler_internal(
&local_input, src_width, src_height,
vinfo->width, vinfo->height,
vinfo, vpp_flags, next_frame_par, vf);
return ret;
}
s32 vpp_set_nonlinear_factor(
struct disp_info_s *info, u32 f)
{
@@ -3187,8 +3220,11 @@ void vpp_super_scaler_support(void)
is_meson_sm1_cpu()) {
sr_support |= SUPER_CORE0_SUPPORT;
sr_support &= ~SUPER_CORE1_SUPPORT;
} else if (is_meson_gxtvbb_cpu() || is_meson_txl_cpu() ||
is_meson_txlx_cpu() || is_meson_tl1_cpu()) {
} else if (is_meson_gxtvbb_cpu()
|| is_meson_txl_cpu()
|| is_meson_txlx_cpu()
|| is_meson_tl1_cpu()
|| is_meson_tm2_cpu()) {
sr_support |= SUPER_CORE0_SUPPORT;
sr_support |= SUPER_CORE1_SUPPORT;
} else {
@@ -3204,7 +3240,8 @@ void vpp_super_scaler_support(void)
is_meson_sm1_cpu()) {
sr_reg_offt = 0xc00;
sr_reg_offt2 = 0x00;
} else if (is_meson_tl1_cpu()) {
} else if (is_meson_tl1_cpu()
|| is_meson_tm2_cpu()) {
sr_reg_offt = 0xc00;
sr_reg_offt2 = 0xc80;
} else {

View File

@@ -192,6 +192,8 @@
#define VPP_CLIP_MISC0 0x1dd9
#define VPP_CLIP_MISC1 0x1dda
#define VPP_VD1_CLIP_MISC0 0x1de1
#define VPP_VD1_CLIP_MISC1 0x1de2
#define VPP2_MISC 0x1e26
#define VPP2_OFIFO_SIZE 0x1e27

View File

@@ -49,6 +49,7 @@
#define VIDTYPE_COMB_MODE 0x2000000
#define VIDTYPE_NO_DW 0x4000000
#define VIDTYPE_SUPPORT_COMPRESS 0x8000000
#define VIDTYPE_PRE_DI_AFBC 0x10000000
#define DISP_RATIO_FORCECONFIG 0x80000000
#define DISP_RATIO_FORCE_NORMALWIDE 0x40000000

View File

@@ -34,6 +34,8 @@ extern bool super_scaler;
#define VPP_FLAG_AR_BITS 8
#define VPP_FLAG_PORTRAIT_MODE 0x00040000
#define VPP_FLAG_VSCALE_DISABLE 0x00080000
#define VPP_FLAG_MORE_LOG 0x00100000
#define VPP_FLAG_FORCE_NO_COMPRESS 0x00200000
#define IDX_H (2 << 8)
#define IDX_V_Y (1 << 13)
@@ -52,6 +54,7 @@ enum vppfilter_state_e {
VppFilter_Fail = -1,
VppFilter_Success = 0,
VppFilter_Success_and_Changed,
VppFilter_Changed_but_Hold,
};
enum f2v_vphase_type_e {
@@ -187,6 +190,11 @@ struct disp_info_s {
u32 zorder;
u32 cur_sel_port;
u32 last_sel_port;
bool afbc_support;
bool pps_support;
bool need_no_compress;
};
enum select_scaler_path_e {
@@ -285,13 +293,7 @@ extern int vpp_set_filters(
struct vframe_s *vf,
struct vpp_frame_par_s *next_frame_par,
const struct vinfo_s *vinfo,
bool bypass_sr);
extern int vpp_set_filters_no_scaler(
struct disp_info_s *input,
struct vframe_s *vf,
struct vpp_frame_par_s *next_frame_par,
const struct vinfo_s *vinfo);
bool bypass_sr, u32 op_flag);
extern s32 vpp_set_nonlinear_factor(
struct disp_info_s *info, u32 f);