b494bc3861c65a387f5f37c12cfc3e525313ae57
[openwrt/staging/blogic.git] /
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
5 function
6
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
9 active one.
10
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.
13
14 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
15 ---
16 drivers/gpu/drm/vc4/vc4_hvs.c | 19 ++++++++++++++-----
17 1 file changed, 14 insertions(+), 5 deletions(-)
18
19 --- a/drivers/gpu/drm/vc4/vc4_hvs.c
20 +++ b/drivers/gpu/drm/vc4/vc4_hvs.c
21 @@ -619,10 +619,19 @@ int vc4_hvs_atomic_check(struct drm_crtc
22 return vc4_hvs_gamma_check(crtc, state);
23 }
24
25 -static void vc4_hvs_update_dlist(struct drm_crtc *crtc)
26 +static void vc4_hvs_install_dlist(struct drm_crtc *crtc)
27 {
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);
31 +
32 + HVS_WRITE(SCALER_DISPLISTX(vc4_state->assigned_channel),
33 + vc4_state->mm.start);
34 +}
35 +
36 +static void vc4_hvs_update_dlist(struct drm_crtc *crtc)
37 +{
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);
41 unsigned long flags;
42 @@ -642,9 +651,6 @@ static void vc4_hvs_update_dlist(struct
43 spin_unlock_irqrestore(&dev->event_lock, flags);
44 }
45
46 - HVS_WRITE(SCALER_DISPLISTX(vc4_state->assigned_channel),
47 - vc4_state->mm.start);
48 -
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 @@ -671,6 +677,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;
55
56 + vc4_hvs_install_dlist(crtc);
57 vc4_hvs_update_dlist(crtc);
58 vc4_hvs_init_channel(vc4, crtc, mode, oneshot);
59 }
60 @@ -746,8 +753,10 @@ void vc4_hvs_atomic_flush(struct drm_crt
61 * If the CRTC is being disabled, there's no point in updating this
62 * information.
63 */
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);
68 + }
69
70 if (crtc->state->color_mgmt_changed) {
71 u32 dispbkgndx = HVS_READ(SCALER_DISPBKGNDX(channel));