Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/msm/atomic: Switch to vblank_start helper

Drop our custom thing and switch to drm_crtc_next_vblank_start() for
calculating the time of the start of the next vblank period.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Patchwork: https://patchwork.freedesktop.org/patch/525819/
Link: https://lore.kernel.org/r/20230308155322.344664-15-robdclark@gmail.com

+5 -26
-15
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
··· 411 411 pm_runtime_put_sync(&dpu_kms->pdev->dev); 412 412 } 413 413 414 - static ktime_t dpu_kms_vsync_time(struct msm_kms *kms, struct drm_crtc *crtc) 415 - { 416 - struct drm_encoder *encoder; 417 - 418 - drm_for_each_encoder_mask(encoder, crtc->dev, crtc->state->encoder_mask) { 419 - ktime_t vsync_time; 420 - 421 - if (dpu_encoder_vsync_time(encoder, &vsync_time) == 0) 422 - return vsync_time; 423 - } 424 - 425 - return ktime_get(); 426 - } 427 - 428 414 static void dpu_kms_prepare_commit(struct msm_kms *kms, 429 415 struct drm_atomic_state *state) 430 416 { ··· 939 953 .irq = dpu_core_irq, 940 954 .enable_commit = dpu_kms_enable_commit, 941 955 .disable_commit = dpu_kms_disable_commit, 942 - .vsync_time = dpu_kms_vsync_time, 943 956 .prepare_commit = dpu_kms_prepare_commit, 944 957 .flush_commit = dpu_kms_flush_commit, 945 958 .wait_flush = dpu_kms_wait_flush,
+5 -3
drivers/gpu/drm/msm/msm_atomic.c
··· 186 186 struct msm_kms *kms = priv->kms; 187 187 struct drm_crtc *async_crtc = NULL; 188 188 unsigned crtc_mask = get_crtc_mask(state); 189 - bool async = kms->funcs->vsync_time && 190 - can_do_async(state, &async_crtc); 189 + bool async = can_do_async(state, &async_crtc); 191 190 192 191 trace_msm_atomic_commit_tail_start(async, crtc_mask); 193 192 ··· 230 231 231 232 kms->pending_crtc_mask |= crtc_mask; 232 233 233 - vsync_time = kms->funcs->vsync_time(kms, async_crtc); 234 + if (drm_crtc_next_vblank_start(async_crtc, &vsync_time)) 235 + goto fallback; 236 + 234 237 wakeup_time = ktime_sub(vsync_time, ms_to_ktime(1)); 235 238 236 239 msm_hrtimer_queue_work(&timer->work, wakeup_time, ··· 254 253 return; 255 254 } 256 255 256 + fallback: 257 257 /* 258 258 * If there is any async flush pending on updated crtcs, fold 259 259 * them into the current flush.
-8
drivers/gpu/drm/msm/msm_kms.h
··· 60 60 void (*disable_commit)(struct msm_kms *kms); 61 61 62 62 /** 63 - * If the kms backend supports async commit, it should implement 64 - * this method to return the time of the next vsync. This is 65 - * used to determine a time slightly before vsync, for the async 66 - * commit timer to run and complete an async commit. 67 - */ 68 - ktime_t (*vsync_time)(struct msm_kms *kms, struct drm_crtc *crtc); 69 - 70 - /** 71 63 * Prepare for atomic commit. This is called after any previous 72 64 * (async or otherwise) commit has completed. 73 65 */