Skip to content

Commit 52ff0d3

Browse files
committed
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
1 parent b5a24e1 commit 52ff0d3

File tree

3 files changed

+5
-26
lines changed

3 files changed

+5
-26
lines changed

drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c

-15
Original file line numberDiff line numberDiff line change
@@ -411,20 +411,6 @@ static void dpu_kms_disable_commit(struct msm_kms *kms)
411411
pm_runtime_put_sync(&dpu_kms->pdev->dev);
412412
}
413413

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-
428414
static void dpu_kms_prepare_commit(struct msm_kms *kms,
429415
struct drm_atomic_state *state)
430416
{
@@ -953,7 +939,6 @@ static const struct msm_kms_funcs kms_funcs = {
953939
.irq = dpu_core_irq,
954940
.enable_commit = dpu_kms_enable_commit,
955941
.disable_commit = dpu_kms_disable_commit,
956-
.vsync_time = dpu_kms_vsync_time,
957942
.prepare_commit = dpu_kms_prepare_commit,
958943
.flush_commit = dpu_kms_flush_commit,
959944
.wait_flush = dpu_kms_wait_flush,

drivers/gpu/drm/msm/msm_atomic.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,7 @@ void msm_atomic_commit_tail(struct drm_atomic_state *state)
186186
struct msm_kms *kms = priv->kms;
187187
struct drm_crtc *async_crtc = NULL;
188188
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);
191190

192191
trace_msm_atomic_commit_tail_start(async, crtc_mask);
193192

@@ -231,7 +230,9 @@ void msm_atomic_commit_tail(struct drm_atomic_state *state)
231230

232231
kms->pending_crtc_mask |= crtc_mask;
233232

234-
vsync_time = kms->funcs->vsync_time(kms, async_crtc);
233+
if (drm_crtc_next_vblank_start(async_crtc, &vsync_time))
234+
goto fallback;
235+
235236
wakeup_time = ktime_sub(vsync_time, ms_to_ktime(1));
236237

237238
msm_hrtimer_queue_work(&timer->work, wakeup_time,
@@ -253,6 +254,7 @@ void msm_atomic_commit_tail(struct drm_atomic_state *state)
253254
return;
254255
}
255256

257+
fallback:
256258
/*
257259
* If there is any async flush pending on updated crtcs, fold
258260
* them into the current flush.

drivers/gpu/drm/msm/msm_kms.h

-8
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,6 @@ struct msm_kms_funcs {
5959
void (*enable_commit)(struct msm_kms *kms);
6060
void (*disable_commit)(struct msm_kms *kms);
6161

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-
7062
/**
7163
* Prepare for atomic commit. This is called after any previous
7264
* (async or otherwise) commit has completed.

0 commit comments

Comments
 (0)