From 1ace6fc01d086145b42b0406bcdf7e0e4eec3d63 Mon Sep 17 00:00:00 2001 From: Brian Zhu Date: Wed, 24 Apr 2019 11:30:22 +0800 Subject: [PATCH] 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 --- drivers/amlogic/media/video_sink/video.c | 42 ++++++++++++++++++++++----- drivers/amlogic/media/video_sink/video_priv.h | 1 + drivers/amlogic/media/video_sink/vpp.c | 13 +++++++++ include/linux/amlogic/media/video_sink/vpp.h | 1 + 4 files changed, 49 insertions(+), 8 deletions(-) diff --git a/drivers/amlogic/media/video_sink/video.c b/drivers/amlogic/media/video_sink/video.c index 394be7c..1e90619 100644 --- a/drivers/amlogic/media/video_sink/video.c +++ b/drivers/amlogic/media/video_sink/video.c @@ -277,6 +277,8 @@ static u32 frame_detect_fps = 60000; static u32 frame_detect_receive_count; static u32 frame_detect_drop_count; +static u32 vpp_hold_setting_cnt; + #ifdef FIQ_VSYNC #define BRIDGE_IRQ INT_TIMER_C #define BRIDGE_IRQ_SET() WRITE_CBUS_REG(ISA_TIMERC, 1) @@ -3172,7 +3174,7 @@ static void pip_toggle_frame(struct vframe_s *vf) } if (pip_property_changed) { - first_picture = 1; + force_toggle = true; pip_property_changed = 0; } if (cur_pipbuf != vf) @@ -3795,11 +3797,11 @@ static void vsync_toggle_frame(struct vframe_s *vf, int line) if (video_property_changed) { property_changed_true = 2; video_property_changed = 0; - first_picture = 1; + force_toggle = true; } if (property_changed_true > 0) { property_changed_true--; - first_picture = 1; + force_toggle = true; } if ((debug_flag & DEBUG_FLAG_BLACKOUT) @@ -4022,14 +4024,31 @@ static void vsync_toggle_frame(struct vframe_s *vf, int line) (is_dolby_vision_on() && is_dolby_vision_stb_mode()), 1); - if (iret == VppFilter_Success_and_Changed) - video_property_changed = 1; - memcpy(&gPic_info[0], &vf->pic_mode, sizeof(struct vframe_pic_mode_s)); - /* apply new vpp settings */ - frame_par_ready_to_set = 1; + if ((iret == VppFilter_Success_and_Changed) + || (iret == VppFilter_Changed_but_Hold)) + video_property_changed = 1; + + if (iret == VppFilter_Changed_but_Hold) { + video_notify_flag |= + VIDEO_NOTIFY_NEED_NO_COMP; + vpp_hold_setting_cnt++; + if (debug_flag & DEBUG_FLAG_BLACKOUT) + pr_info("toggle_frame vpp hold setting cnt: %d\n", + vpp_hold_setting_cnt); + } else {/* apply new vpp settings */ + if ((next_frame_par->vscale_skip_count <= 1) + && (vf->type & VIDTYPE_SUPPORT_COMPRESS)) { + video_notify_flag |= + VIDEO_NOTIFY_NEED_NO_COMP; + if (debug_flag & DEBUG_FLAG_BLACKOUT) + pr_info("disable no compress mode\n"); + } + vpp_hold_setting_cnt = 0; + frame_par_ready_to_set = 1; + } if (((vf->width > 1920) && (vf->height > 1088)) || ((vf->type & VIDTYPE_COMPRESS) && @@ -5595,6 +5614,13 @@ static void vsync_notify(void) video_notify_flag &= ~(VIDEO_NOTIFY_PROVIDER_GET | VIDEO_NOTIFY_PROVIDER_PUT); } + if (video_notify_flag & VIDEO_NOTIFY_NEED_NO_COMP) { + /* FIXME: can not use fixed provider name */ + vf_notify_provider_by_name("vdin0", + VFRAME_EVENT_RECEIVER_NEED_NO_COMP, + (void *)&vpp_hold_setting_cnt); + video_notify_flag &= ~VIDEO_NOTIFY_NEED_NO_COMP; + } #ifdef CONFIG_CLK81_DFS check_and_set_clk81(); #endif diff --git a/drivers/amlogic/media/video_sink/video_priv.h b/drivers/amlogic/media/video_sink/video_priv.h index 34e19ee..656a5ed 100644 --- a/drivers/amlogic/media/video_sink/video_priv.h +++ b/drivers/amlogic/media/video_sink/video_priv.h @@ -48,6 +48,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; diff --git a/drivers/amlogic/media/video_sink/vpp.c b/drivers/amlogic/media/video_sink/vpp.c index 1c89853..541ae60 100644 --- a/drivers/amlogic/media/video_sink/vpp.c +++ b/drivers/amlogic/media/video_sink/vpp.c @@ -1487,6 +1487,7 @@ RESTART: } if ((vf->type & VIDTYPE_COMPRESS) && + !(vf->type & VIDTYPE_NO_DW) && (vf->canvas0Addr != 0) && (!next_frame_par->nocomp)) { if ((next_frame_par->vscale_skip_count > 1) @@ -1687,6 +1688,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; } /* @@ -2890,6 +2895,7 @@ RESTART: } if ((vf->type & VIDTYPE_COMPRESS) && + !(vf->type & VIDTYPE_NO_DW) && (vf->canvas0Addr != 0) && (!next_frame_par->nocomp)) { if ((next_frame_par->vscale_skip_count > 1) @@ -2954,6 +2960,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; } @@ -3122,6 +3132,9 @@ int vpp_set_filters( 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( diff --git a/include/linux/amlogic/media/video_sink/vpp.h b/include/linux/amlogic/media/video_sink/vpp.h index 3520e9c..d33a3ea 100644 --- a/include/linux/amlogic/media/video_sink/vpp.h +++ b/include/linux/amlogic/media/video_sink/vpp.h @@ -53,6 +53,7 @@ enum vppfilter_state_e { VppFilter_Fail = -1, VppFilter_Success = 0, VppFilter_Success_and_Changed, + VppFilter_Changed_but_Hold, }; enum f2v_vphase_type_e { -- 2.7.4