From 29c4a59b2c608d2f55ca08b3477175cee03d87e4 Mon Sep 17 00:00:00 2001 From: "shuanglong.wang" Date: Fri, 19 Jul 2019 10:48:07 +0800 Subject: [PATCH] tsync: tunnel mode do not set first vpts for stream mode [1/2] PD#SWPL-11210 Problem: stream mode set vpts in check in pts Solution: tunnel mode do not set first vpts for stream mode Verify: verify by u212 Change-Id: Ic369b83411051a819eb65ad5d1585e26e0342f3f Signed-off-by: shuanglong.wang --- drivers/amlogic/media/frame_sync/ptsserv.c | 2 +- drivers/amlogic/media/frame_sync/tsync.c | 13 +++++++++++++ drivers/amlogic/media/video_sink/video.c | 11 +++++++++++ include/linux/amlogic/media/frame_sync/tsync.h | 4 ++++ include/linux/amlogic/media/utils/amstream.h | 1 + 5 files changed, 30 insertions(+), 1 deletion(-) diff --git a/drivers/amlogic/media/frame_sync/ptsserv.c b/drivers/amlogic/media/frame_sync/ptsserv.c index efe867c..615a408 100644 --- a/drivers/amlogic/media/frame_sync/ptsserv.c +++ b/drivers/amlogic/media/frame_sync/ptsserv.c @@ -516,7 +516,7 @@ static int pts_checkin_offset_inline(u8 type, u32 offset, u32 val, u64 uS64) if (tsync_get_debug_apts() && (type == PTS_TYPE_AUDIO)) pr_info("init apts[%d] at 0x%x\n", type, val); - if (type == PTS_TYPE_VIDEO) + if (type == PTS_TYPE_VIDEO && !tsync_get_tunnel_mode()) timestamp_vpts_set(val); else if (type == PTS_TYPE_AUDIO) timestamp_apts_set(val); diff --git a/drivers/amlogic/media/frame_sync/tsync.c b/drivers/amlogic/media/frame_sync/tsync.c index 7e2f691..5a66abd 100644 --- a/drivers/amlogic/media/frame_sync/tsync.c +++ b/drivers/amlogic/media/frame_sync/tsync.c @@ -214,6 +214,7 @@ static int tsync_dec_reset_flag; static int tsync_dec_reset_video_start; static int tsync_automute_on; static int tsync_video_started; +static int is_tunnel_mode; static int debug_pts_checkin; static int debug_pts_checkout; @@ -1432,6 +1433,18 @@ int tsync_set_startsync_mode(int mode) } EXPORT_SYMBOL(tsync_set_startsync_mode); +int tsync_set_tunnel_mode(int mode) +{ + return is_tunnel_mode = mode; +} +EXPORT_SYMBOL(tsync_set_tunnel_mode); + +int tsync_get_tunnel_mode(void) +{ + return is_tunnel_mode; +} +EXPORT_SYMBOL(tsync_get_tunnel_mode); + bool tsync_check_vpts_discontinuity(unsigned int vpts) { unsigned int systemtime; diff --git a/drivers/amlogic/media/video_sink/video.c b/drivers/amlogic/media/video_sink/video.c index b77c320..bf7e62d 100644 --- a/drivers/amlogic/media/video_sink/video.c +++ b/drivers/amlogic/media/video_sink/video.c @@ -9906,6 +9906,16 @@ static long amvideo_ioctl(struct file *file, unsigned int cmd, ulong arg) break; } + case AMSTREAM_IOC_SET_TUNNEL_MODE: { + u32 tunnelmode = 0; + + if (copy_from_user(&tunnelmode, argp, sizeof(u32)) == 0) + tsync_set_tunnel_mode(tunnelmode); + else + ret = -EFAULT; + break; + } + case AMSTREAM_IOC_GET_FIRST_FRAME_TOGGLED: put_user(first_frame_toggled, (u32 __user *)argp); break; @@ -10058,6 +10068,7 @@ static long amvideo_compat_ioctl(struct file *file, unsigned int cmd, ulong arg) case AMSTREAM_IOC_SET_VSYNC_UPINT: case AMSTREAM_IOC_SET_VSYNC_SLOW_FACTOR: case AMSTREAM_IOC_GLOBAL_SET_VIDEO_OUTPUT: + case AMSTREAM_IOC_SET_TUNNEL_MODE: case AMSTREAM_IOC_GET_FIRST_FRAME_TOGGLED: case AMSTREAM_IOC_SET_VIDEOPEEK: return amvideo_ioctl(file, cmd, arg); diff --git a/include/linux/amlogic/media/frame_sync/tsync.h b/include/linux/amlogic/media/frame_sync/tsync.h index 0d0203a..71b9316 100644 --- a/include/linux/amlogic/media/frame_sync/tsync.h +++ b/include/linux/amlogic/media/frame_sync/tsync.h @@ -157,6 +157,10 @@ extern int tsync_set_av_threshold_max(int max); extern void set_pts_realign(void); +extern int tsync_set_tunnel_mode(int mode); + +extern int tsync_get_tunnel_mode(void); + extern void timestamp_set_pcrlatency(u32 latency); extern u32 timestamp_get_pcrlatency(void); extern bool tsync_check_vpts_discontinuity(unsigned int vpts); diff --git a/include/linux/amlogic/media/utils/amstream.h b/include/linux/amlogic/media/utils/amstream.h index d2e36e0..faf1328 100644 --- a/include/linux/amlogic/media/utils/amstream.h +++ b/include/linux/amlogic/media/utils/amstream.h @@ -205,6 +205,7 @@ #define AMSTREAM_IOC_GET_OMX_VERSION _IOW((_A_M), 0xb1, int) #define AMSTREAM_IOC_GET_OMX_INFO _IOR((_A_M), 0xb2, unsigned int) #define AMSTREAM_IOC_SET_HDR_INFO _IOW((_A_M), 0xb3, int) +#define AMSTREAM_IOC_SET_TUNNEL_MODE _IOR(_A_M, 0xbd, unsigned int) #define AMSTREAM_IOC_GET_FIRST_FRAME_TOGGLED _IOR(_A_M, 0xbe, unsigned int) #define AMSTREAM_IOC_SET_VIDEOPEEK _IOW(_A_M, 0xbf, unsigned int) -- 2.7.4