Commit 2e039186 authored by Sean Paul's avatar Sean Paul Committed by Rob Clark
Browse files

drm/msm: dpu: Simplify frame_done watchdog timeout calculation



Instead of setting the timeout and then immediately reading it back
(along with the hand-rolled msecs_to_jiffies calculation), just
calculate it once and set it in both places at the same time.

Reviewed-by: default avatarAbhinav Kumar <abhinavk@codeaurora.org>
Signed-off-by: default avatarSean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190128204306.95076-2-sean@poorly.run



Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
parent 6117f862
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -1788,6 +1788,7 @@ void dpu_encoder_kickoff(struct drm_encoder *drm_enc, bool async)
{
	struct dpu_encoder_virt *dpu_enc;
	struct dpu_encoder_phys *phys;
	unsigned long timeout_ms;
	ktime_t wakeup_time;
	unsigned int i;

@@ -1800,11 +1801,12 @@ void dpu_encoder_kickoff(struct drm_encoder *drm_enc, bool async)

	trace_dpu_enc_kickoff(DRMID(drm_enc));

	atomic_set(&dpu_enc->frame_done_timeout,
			DPU_FRAME_DONE_TIMEOUT * 1000 /
			drm_mode_vrefresh(&drm_enc->crtc->state->adjusted_mode));
	mod_timer(&dpu_enc->frame_done_timer, jiffies +
		((atomic_read(&dpu_enc->frame_done_timeout) * HZ) / 1000));
	timeout_ms = DPU_FRAME_DONE_TIMEOUT * 1000 /
		drm_mode_vrefresh(&drm_enc->crtc->state->adjusted_mode);

	atomic_set(&dpu_enc->frame_done_timeout, timeout_ms);
	mod_timer(&dpu_enc->frame_done_timer,
		  jiffies + msecs_to_jiffies(timeout_ms));

	/* All phys encs are ready to go, trigger the kickoff */
	_dpu_encoder_kickoff_phys(dpu_enc, async);