disp: msm: sde: remove idle time from Qsync threshold calculation

Remove idle time from the Qsync calculation, round down to
the nearest multiple of 4 and remove a couple of extra lines
to compensate for possible latencies. This helps to reduce
the possibility of causing tearing due to the driver calculation
mismatching with the DDIC's expected timeout value.

Change-Id: I8a53a989e26cbd7f0e2b94caa8df8f5bee3ad26c
Signed-off-by: Steve Cohen <cohens@codeaurora.org>
This commit is contained in:
Steve Cohen 2021-03-24 16:14:46 -04:00 committed by Gerrit - the friendly Code Review server
parent 043cd065b3
commit 77d385f62d
3 changed files with 13 additions and 43 deletions

View File

@ -4286,24 +4286,6 @@ void sde_encoder_helper_get_pp_line_count(struct drm_encoder *drm_enc,
}
}
void sde_encoder_helper_get_transfer_time(struct drm_encoder *drm_enc,
u32 *transfer_time_us)
{
struct sde_encoder_virt *sde_enc;
struct msm_mode_info *info;
if (!drm_enc || !transfer_time_us) {
SDE_ERROR("bad arg: encoder:%d transfer_time:%d\n", !drm_enc,
!transfer_time_us);
return;
}
sde_enc = to_sde_encoder_virt(drm_enc);
info = &sde_enc->mode_info;
*transfer_time_us = info->mdp_transfer_time_us;
}
int sde_encoder_helper_reset_mixers(struct sde_encoder_phys *phys_enc,
struct drm_framebuffer *fb)
{

View File

@ -541,14 +541,6 @@ void sde_encoder_phys_setup_cdm(struct sde_encoder_phys *phys_enc,
void sde_encoder_helper_get_pp_line_count(struct drm_encoder *drm_enc,
struct sde_hw_pp_vsync_info *info);
/**
* sde_encoder_helper_get_transfer_time - get the mdp transfer time in usecs
* @drm_enc: Pointer to drm encoder structure
* @transfer_time_us: Pointer to store the output value
*/
void sde_encoder_helper_get_transfer_time(struct drm_encoder *drm_enc,
u32 *transfer_time_us);
/**
* sde_encoder_helper_trigger_flush - control flush helper function
* This helper function may be optionally specified by physical

View File

@ -963,8 +963,6 @@ static int _get_tearcheck_threshold(struct sde_encoder_phys *phys_enc)
u32 default_time_ns;
u32 extra_time_ns;
u32 default_line_time_ns;
u32 idle_time_ns = 0;
u32 transfer_time_us = 0;
if (phys_enc->parent_ops.get_qsync_fps)
phys_enc->parent_ops.get_qsync_fps(
@ -985,28 +983,26 @@ static int _get_tearcheck_threshold(struct sde_encoder_phys *phys_enc)
}
/* Calculate the number of extra lines*/
slow_time_ns = (1 * 1000000000) / qsync_min_fps;
default_time_ns = (1 * 1000000000) / default_fps;
sde_encoder_helper_get_transfer_time(phys_enc->parent,
&transfer_time_us);
if (transfer_time_us)
idle_time_ns = default_time_ns -
(1000 * transfer_time_us);
extra_time_ns = slow_time_ns - default_time_ns + idle_time_ns;
default_line_time_ns = (1 * 1000000000) / (default_fps * yres);
slow_time_ns = 1000000000 / qsync_min_fps;
default_time_ns = 1000000000 / default_fps;
extra_time_ns = slow_time_ns - default_time_ns;
default_line_time_ns = default_time_ns / yres;
threshold_lines = extra_time_ns / default_line_time_ns;
/* round down to nearest multiple of 4 to compensate for rounding in DDIC */
threshold_lines &= ~(4 - 1);
/* additional compensation for latency */
if (threshold_lines - 2 > DEFAULT_TEARCHECK_SYNC_THRESH_START)
threshold_lines -= 2;
SDE_DEBUG_CMDENC(cmd_enc, "slow:%d default:%d extra:%d(ns)\n",
slow_time_ns, default_time_ns, extra_time_ns);
SDE_DEBUG_CMDENC(cmd_enc, "xfer:%d(us) idle:%d(ns) lines:%d\n",
transfer_time_us, idle_time_ns, threshold_lines);
SDE_DEBUG_CMDENC(cmd_enc, "min_fps:%d fps:%d yres:%d\n",
qsync_min_fps, default_fps, yres);
SDE_DEBUG_CMDENC(cmd_enc, "min_fps:%d fps:%d yres:%d lines:%d\n",
qsync_min_fps, default_fps, yres, threshold_lines);
SDE_EVT32(qsync_mode, qsync_min_fps, extra_time_ns, default_fps,
yres, transfer_time_us, threshold_lines);
yres, threshold_lines);
}
exit: