#include <linux/sched.h>
#include <linux/amlogic/media/video_sink/video_keeper.h>
#include "video_priv.h"
+#include <trace/events/meson_atrace.h>
#if defined(CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_VECM)
#include <linux/amlogic/media/amvecm/amvecm.h>
return tmp;
}
-static void vsync_toggle_frame(struct vframe_s *vf)
+static void vsync_toggle_frame(struct vframe_s *vf, int line)
{
+ static u32 last_pts;
+ u32 diff_pts;
u32 first_picture = 0;
unsigned long flags = 0;
bool vf_with_el = false;
long long *clk_array;
bool is_mvc = false;
+ ATRACE_COUNTER(__func__, line);
if (vf == NULL)
return;
+ ATRACE_COUNTER("vsync_toggle_frame_pts", vf->pts);
+
+ diff_pts = vf->pts - last_pts;
+ if (last_pts && diff_pts < 90000)
+ ATRACE_COUNTER("vsync_toggle_frame_inc", diff_pts);
+ else
+ ATRACE_COUNTER("vsync_toggle_frame_inc", 0); /* discontinue */
+ last_pts = vf->pts;
+
frame_count++;
toggle_count++;
if ((vf->width == 0) && (vf->height == 0)) {
amlog_level(LOG_LEVEL_ERROR,
"Video: invalid frame dimension\n");
+ ATRACE_COUNTER(__func__, __LINE__);
return;
}
}
}
video_vf_put(vf);
+ ATRACE_COUNTER(__func__, __LINE__);
return;
}
}
}
if (stop_update)
frame_par_ready_to_set = 0;
+ ATRACE_COUNTER(__func__, 0);
}
static void viu_set_dcu(struct vpp_frame_par_s *frame_par, struct vframe_s *vf)
cur_index;
}
}
- vsync_toggle_frame(cur_dispbuf);
+ vsync_toggle_frame(cur_dispbuf, __LINE__);
} else
video_property_changed = 0;
} else {
/* setting video display property in underflow mode */
if ((!vf) && cur_dispbuf && (video_property_changed))
- vsync_toggle_frame(cur_dispbuf);
+ vsync_toggle_frame(cur_dispbuf, __LINE__);
/*debug info for skip & repeate vframe case*/
if (!vf) {
underflow++;
+ ATRACE_COUNTER("underflow", 1);
if (video_dbg_vf&(1<<0))
dump_vframe_status("vdin0");
if (video_dbg_vf&(1<<1))
dump_vframe_status("ppmgr");
if (video_dbg_vf&(1<<4))
dump_vdin_reg();
+ } else {
+ ATRACE_COUNTER("underflow", 0);
}
video_get_vf_cnt = 0;
if (platform_type == 1) {
}
while (vf) {
if (vpts_expire(cur_dispbuf, vf, toggle_cnt) || show_nosync) {
+ ATRACE_COUNTER(MODULE_NAME, __LINE__);
if (debug_flag & DEBUG_FLAG_PTS_TRACE)
pr_info("vpts = 0x%x, c.dur=0x%x, n.pts=0x%x, scr = 0x%x, pcr-pts-diff=%d, ptstrace=%d\n",
timestamp_vpts_get(),
hdmiin_frame_check_cnt = 0;
vf = video_vf_get();
- if (!vf)
+ if (!vf) {
+ ATRACE_COUNTER(MODULE_NAME, __LINE__);
break;
+ }
if (debug_flag & DEBUG_FLAG_LATENCY) {
vf->ready_clock[2] = sched_clock();
pr_info("video get latency %lld ms vdin put latency %lld ms. first %lld ms.\n",
func_div(vf->ready_clock[1], 1000),
func_div(vf->ready_clock[0], 1000));
}
- if (video_vf_dirty_put(vf))
+ if (video_vf_dirty_put(vf)) {
+ ATRACE_COUNTER(MODULE_NAME, __LINE__);
break;
+ }
if (vf && hdmiin_frame_check && (vf->source_type ==
VFRAME_SOURCE_TYPE_HDMI) &&
video_vf_disp_mode_check(vf))
video_3d_format = vf->trans_fmt;
}
}
- vsync_toggle_frame(vf);
+ vsync_toggle_frame(vf, __LINE__);
toggle_frame = vf;
#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
if (is_dolby_vision_enable()) {
if (video_get_vf_cnt >= 2)
video_drop_vf_cnt++;
} else {
+ ATRACE_COUNTER(MODULE_NAME, __LINE__);
/* check if current frame's duration has expired,
*in this example
* it compares current frame display duration
* The playback can be smoother than previous method.
*/
if (slowsync_repeat_enable) {
+ ATRACE_COUNTER(MODULE_NAME, __LINE__);
if (duration_expire
(cur_dispbuf, vf,
frame_repeat_count * vsync_pts_inc)
break;
#endif
vf = video_vf_get();
- if (!vf)
+ if (!vf) {
+ ATRACE_COUNTER(MODULE_NAME,
+ __LINE__);
break;
- vsync_toggle_frame(vf);
+ }
+ vsync_toggle_frame(vf, __LINE__);
toggle_frame = vf;
#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
if (is_dolby_vision_enable())
if (blackout | force_blackout) {
if (cur_dispbuf != &vf_local)
vsync_toggle_frame(
- cur_dispbuf);
+ cur_dispbuf,
+ __LINE__);
} else
- vsync_toggle_frame(cur_dispbuf);
+ vsync_toggle_frame(cur_dispbuf,
+ __LINE__);
if (is_dolby_vision_enable()) {
pause_vf = cur_dispbuf;
video_pause_global = 1;