disp: msm: sde: add vsync count in virtual encoder

Introduce vsync count variable in virtual encoder structure
to keep the vsync count variable value in sync while performing
the poms. Consequently, this prevents the blocking of
drm_vblank_put and the invocation of
drm_crtc_funcs.disable_vblank.

Change-Id: I74903a89b17a8f46fb1b21338500553f36771dd0
Signed-off-by: Akash Gajjar <quic_agajjar@quicinc.com>
This commit is contained in:
Akash Gajjar
2023-05-30 13:59:50 +05:30
parent 1bb44a8184
commit 3e3c2b50a2
2 changed files with 10 additions and 2 deletions

View File

@@ -4054,7 +4054,12 @@ static void sde_encoder_vblank_callback(struct drm_encoder *drm_enc,
spin_lock_irqsave(&sde_enc->enc_spinlock, lock_flags); spin_lock_irqsave(&sde_enc->enc_spinlock, lock_flags);
phy_enc->last_vsync_timestamp = ts; phy_enc->last_vsync_timestamp = ts;
if (phy_enc->ops.is_master && phy_enc->ops.is_master(phy_enc))
atomic_inc(&sde_enc->vsync_cnt);
/* update count for debugfs */
atomic_inc(&phy_enc->vsync_cnt); atomic_inc(&phy_enc->vsync_cnt);
if (sde_enc->crtc_vblank_cb) if (sde_enc->crtc_vblank_cb)
sde_enc->crtc_vblank_cb(sde_enc->crtc_vblank_cb_data, ts); sde_enc->crtc_vblank_cb(sde_enc->crtc_vblank_cb_data, ts);
spin_unlock_irqrestore(&sde_enc->enc_spinlock, lock_flags); spin_unlock_irqrestore(&sde_enc->enc_spinlock, lock_flags);
@@ -4065,7 +4070,7 @@ static void sde_encoder_vblank_callback(struct drm_encoder *drm_enc,
if (phy_enc->sde_kms->debugfs_hw_fence) if (phy_enc->sde_kms->debugfs_hw_fence)
sde_encoder_hw_fence_status(phy_enc->sde_kms, sde_enc->crtc, phy_enc->hw_ctl); sde_encoder_hw_fence_status(phy_enc->sde_kms, sde_enc->crtc, phy_enc->hw_ctl);
SDE_EVT32(DRMID(drm_enc), ktime_to_us(ts), atomic_read(&phy_enc->vsync_cnt)); SDE_EVT32(DRMID(drm_enc), ktime_to_us(ts), atomic_read(&sde_enc->vsync_cnt));
SDE_ATRACE_END("encoder_vblank_callback"); SDE_ATRACE_END("encoder_vblank_callback");
} }
@@ -6034,6 +6039,7 @@ static int sde_encoder_setup_display(struct sde_encoder_virt *sde_enc,
phys_params.parent_ops = parent_ops; phys_params.parent_ops = parent_ops;
phys_params.enc_spinlock = &sde_enc->enc_spinlock; phys_params.enc_spinlock = &sde_enc->enc_spinlock;
phys_params.vblank_ctl_lock = &sde_enc->vblank_ctl_lock; phys_params.vblank_ctl_lock = &sde_enc->vblank_ctl_lock;
atomic_set(&sde_enc->vsync_cnt, 0);
SDE_DEBUG("\n"); SDE_DEBUG("\n");
@@ -6381,7 +6387,7 @@ u32 sde_encoder_get_frame_count(struct drm_encoder *encoder)
phys = sde_enc->cur_master; phys = sde_enc->cur_master;
return phys ? atomic_read(&phys->vsync_cnt) : 0; return phys ? atomic_read(&sde_enc->vsync_cnt) : 0;
} }
bool sde_encoder_get_vblank_timestamp(struct drm_encoder *encoder, bool sde_encoder_get_vblank_timestamp(struct drm_encoder *encoder,

View File

@@ -181,6 +181,7 @@ enum sde_sim_qsync_event {
* @rsc_state_init: boolean to indicate rsc config init * @rsc_state_init: boolean to indicate rsc config init
* @disp_info: local copy of msm_display_info struct * @disp_info: local copy of msm_display_info struct
* @misr_enable: misr enable/disable status * @misr_enable: misr enable/disable status
* @vsync_cnt: Vsync count for the physical encoder
* @misr_reconfigure: boolean entry indicates misr reconfigure status * @misr_reconfigure: boolean entry indicates misr reconfigure status
* @misr_frame_count: misr frame count before start capturing the data * @misr_frame_count: misr frame count before start capturing the data
* @idle_pc_enabled: indicate if idle power collapse is enabled * @idle_pc_enabled: indicate if idle power collapse is enabled
@@ -262,6 +263,7 @@ struct sde_encoder_virt {
bool rsc_state_init; bool rsc_state_init;
struct msm_display_info disp_info; struct msm_display_info disp_info;
atomic_t misr_enable; atomic_t misr_enable;
atomic_t vsync_cnt;
bool misr_reconfigure; bool misr_reconfigure;
u32 misr_frame_count; u32 misr_frame_count;