1 From 849b51e0dea1746f17b8b0b59c5e6cc831e23697 Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Mon, 6 Dec 2021 16:31:33 +0100
4 Subject: [PATCH] drm/vc4: hvs: Move the dlist setup to its own
7 The vc4_hvs_update_dlist function mostly deals with setting up the
8 vblank events and setting up the dlist entry pointer to our current
11 We'll want to do the former separately from the vblank handling in later
12 patches, so let's move it to a function of its own.
14 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
16 drivers/gpu/drm/vc4/vc4_hvs.c | 19 ++++++++++++++-----
17 1 file changed, 14 insertions(+), 5 deletions(-)
19 --- a/drivers/gpu/drm/vc4/vc4_hvs.c
20 +++ b/drivers/gpu/drm/vc4/vc4_hvs.c
21 @@ -596,10 +596,19 @@ int vc4_hvs_atomic_check(struct drm_crtc
22 return vc4_hvs_gamma_check(crtc, state);
25 -static void vc4_hvs_update_dlist(struct drm_crtc *crtc)
26 +static void vc4_hvs_install_dlist(struct drm_crtc *crtc)
28 struct drm_device *dev = crtc->dev;
29 struct vc4_dev *vc4 = to_vc4_dev(dev);
30 + struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(crtc->state);
32 + HVS_WRITE(SCALER_DISPLISTX(vc4_state->assigned_channel),
33 + vc4_state->mm.start);
36 +static void vc4_hvs_update_dlist(struct drm_crtc *crtc)
38 + struct drm_device *dev = crtc->dev;
39 struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
40 struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(crtc->state);
42 @@ -619,9 +628,6 @@ static void vc4_hvs_update_dlist(struct
43 spin_unlock_irqrestore(&dev->event_lock, flags);
46 - HVS_WRITE(SCALER_DISPLISTX(vc4_state->assigned_channel),
47 - vc4_state->mm.start);
49 spin_lock_irqsave(&vc4_crtc->irq_lock, flags);
50 vc4_crtc->current_dlist = vc4_state->mm.start;
51 spin_unlock_irqrestore(&vc4_crtc->irq_lock, flags);
52 @@ -648,6 +654,7 @@ void vc4_hvs_atomic_enable(struct drm_cr
53 struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
54 bool oneshot = vc4_crtc->feeds_txp;
56 + vc4_hvs_install_dlist(crtc);
57 vc4_hvs_update_dlist(crtc);
58 vc4_hvs_init_channel(vc4, crtc, mode, oneshot);
60 @@ -723,8 +730,10 @@ void vc4_hvs_atomic_flush(struct drm_crt
61 * If the CRTC is being disabled, there's no point in updating this
64 - if (crtc->state->active && old_state->active)
65 + if (crtc->state->active && old_state->active) {
66 + vc4_hvs_install_dlist(crtc);
67 vc4_hvs_update_dlist(crtc);
70 if (crtc->state->color_mgmt_changed) {
71 u32 dispbkgndx = HVS_READ(SCALER_DISPBKGNDX(channel));