diff --git a/msm/sde/sde_encoder.c b/msm/sde/sde_encoder.c index 2608cc47f6..c6218427d2 100644 --- a/msm/sde/sde_encoder.c +++ b/msm/sde/sde_encoder.c @@ -158,15 +158,16 @@ ktime_t sde_encoder_calc_last_vsync_timestamp(struct drm_encoder *drm_enc) struct intf_status intf_status = {0}; unsigned long features; u32 fps; + bool is_cmd, is_vid; sde_enc = to_sde_encoder_virt(drm_enc); cur_master = sde_enc->cur_master; fps = sde_encoder_get_fps(drm_enc); + is_cmd = sde_encoder_check_curr_mode(drm_enc, MSM_DISPLAY_CMD_MODE); + is_vid = sde_encoder_check_curr_mode(drm_enc, MSM_DISPLAY_VIDEO_MODE); if (!cur_master || !cur_master->hw_intf || !fps - || !cur_master->hw_intf->ops.get_vsync_timestamp - || (!sde_encoder_check_curr_mode(drm_enc, MSM_DISPLAY_CMD_MODE) - && !sde_encoder_check_curr_mode(drm_enc, MSM_DISPLAY_VIDEO_MODE))) + || !cur_master->hw_intf->ops.get_vsync_timestamp || (!is_cmd && !is_vid)) return 0; features = cur_master->hw_intf->cap->features; @@ -182,7 +183,7 @@ ktime_t sde_encoder_calc_last_vsync_timestamp(struct drm_encoder *drm_enc) return 0; } - vsync_counter = cur_master->hw_intf->ops.get_vsync_timestamp(cur_master->hw_intf); + vsync_counter = cur_master->hw_intf->ops.get_vsync_timestamp(cur_master->hw_intf, is_vid); qtmr_counter = arch_timer_read_counter(); cur_time = ktime_get_ns(); diff --git a/msm/sde/sde_hw_intf.c b/msm/sde/sde_hw_intf.c index 49c453bf6a..9ba8c75da4 100644 --- a/msm/sde/sde_hw_intf.c +++ b/msm/sde/sde_hw_intf.c @@ -224,14 +224,14 @@ static void sde_hw_intf_reset_counter(struct sde_hw_intf *ctx) SDE_REG_WRITE(c, INTF_LINE_COUNT, BIT(31)); } -static u64 sde_hw_intf_get_vsync_timestamp(struct sde_hw_intf *ctx) +static u64 sde_hw_intf_get_vsync_timestamp(struct sde_hw_intf *ctx, bool is_vid) { struct sde_hw_blk_reg_map *c = &ctx->hw; u32 timestamp_lo, timestamp_hi; u64 timestamp = 0; u32 reg_ts_0, reg_ts_1; - if (ctx->cap->features & BIT(SDE_INTF_MDP_VSYNC_TS)) { + if (ctx->cap->features & BIT(SDE_INTF_MDP_VSYNC_TS) && is_vid) { reg_ts_0 = INTF_MDP_VSYNC_TIMESTAMP0; reg_ts_1 = INTF_MDP_VSYNC_TIMESTAMP1; } else { diff --git a/msm/sde/sde_hw_intf.h b/msm/sde/sde_hw_intf.h index 3c5737051a..5c33b11eff 100644 --- a/msm/sde/sde_hw_intf.h +++ b/msm/sde/sde_hw_intf.h @@ -236,7 +236,7 @@ struct sde_hw_intf_ops { /** * Get the HW vsync timestamp counter */ - u64 (*get_vsync_timestamp)(struct sde_hw_intf *intf); + u64 (*get_vsync_timestamp)(struct sde_hw_intf *intf, bool is_vid); /** * Enable processing of 2 pixels per clock