0373e4ab7197883fe9f276a27567c28788d0cf41
[openwrt/staging/robimarko.git] /
1 From d584fdf44b251f77cc29330d17b60be078acb440 Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Mon, 7 Dec 2020 16:57:11 +0100
4 Subject: [PATCH] drm/vc4: hvs: Align the HVS atomic hooks to the new
5 API
6
7 Since the CRTC setup in vc4 is split between the PixelValves/TXP and the
8 HVS, only the PV/TXP atomic hooks were updated in the previous commits, but
9 it makes sense to update the HVS ones too.
10
11 Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
12 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
13 ---
14 drivers/gpu/drm/vc4/vc4_crtc.c | 4 +---
15 drivers/gpu/drm/vc4/vc4_drv.h | 4 ++--
16 drivers/gpu/drm/vc4/vc4_hvs.c | 8 +++++---
17 drivers/gpu/drm/vc4/vc4_txp.c | 8 ++------
18 4 files changed, 10 insertions(+), 14 deletions(-)
19
20 --- a/drivers/gpu/drm/vc4/vc4_crtc.c
21 +++ b/drivers/gpu/drm/vc4/vc4_crtc.c
22 @@ -520,8 +520,6 @@ static void vc4_crtc_atomic_disable(stru
23 static void vc4_crtc_atomic_enable(struct drm_crtc *crtc,
24 struct drm_atomic_state *state)
25 {
26 - struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state,
27 - crtc);
28 struct drm_device *dev = crtc->dev;
29 struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
30 struct drm_encoder *encoder = vc4_get_crtc_encoder(crtc);
31 @@ -534,7 +532,7 @@ static void vc4_crtc_atomic_enable(struc
32 */
33 drm_crtc_vblank_on(crtc);
34
35 - vc4_hvs_atomic_enable(crtc, old_state);
36 + vc4_hvs_atomic_enable(crtc, state);
37
38 if (vc4_encoder->pre_crtc_configure)
39 vc4_encoder->pre_crtc_configure(encoder);
40 --- a/drivers/gpu/drm/vc4/vc4_drv.h
41 +++ b/drivers/gpu/drm/vc4/vc4_drv.h
42 @@ -926,8 +926,8 @@ extern struct platform_driver vc4_hvs_dr
43 void vc4_hvs_stop_channel(struct drm_device *dev, unsigned int output);
44 int vc4_hvs_get_fifo_from_output(struct drm_device *dev, unsigned int output);
45 int vc4_hvs_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state);
46 -void vc4_hvs_atomic_enable(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
47 -void vc4_hvs_atomic_disable(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
48 +void vc4_hvs_atomic_enable(struct drm_crtc *crtc, struct drm_atomic_state *state);
49 +void vc4_hvs_atomic_disable(struct drm_crtc *crtc, struct drm_atomic_state *state);
50 void vc4_hvs_atomic_flush(struct drm_crtc *crtc,
51 struct drm_atomic_state *state);
52 void vc4_hvs_dump_state(struct drm_device *dev);
53 --- a/drivers/gpu/drm/vc4/vc4_hvs.c
54 +++ b/drivers/gpu/drm/vc4/vc4_hvs.c
55 @@ -430,11 +430,12 @@ static void vc4_hvs_update_dlist(struct
56 }
57
58 void vc4_hvs_atomic_enable(struct drm_crtc *crtc,
59 - struct drm_crtc_state *old_state)
60 + struct drm_atomic_state *state)
61 {
62 struct drm_device *dev = crtc->dev;
63 struct vc4_dev *vc4 = to_vc4_dev(dev);
64 - struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(crtc->state);
65 + struct drm_crtc_state *new_crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
66 + struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(new_crtc_state);
67 struct drm_display_mode *mode = &crtc->state->adjusted_mode;
68 bool oneshot = vc4_state->feed_txp;
69
70 @@ -443,9 +444,10 @@ void vc4_hvs_atomic_enable(struct drm_cr
71 }
72
73 void vc4_hvs_atomic_disable(struct drm_crtc *crtc,
74 - struct drm_crtc_state *old_state)
75 + struct drm_atomic_state *state)
76 {
77 struct drm_device *dev = crtc->dev;
78 + struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state, crtc);
79 struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(old_state);
80 unsigned int chan = vc4_state->assigned_channel;
81
82 --- a/drivers/gpu/drm/vc4/vc4_txp.c
83 +++ b/drivers/gpu/drm/vc4/vc4_txp.c
84 @@ -406,23 +406,19 @@ static int vc4_txp_atomic_check(struct d
85 static void vc4_txp_atomic_enable(struct drm_crtc *crtc,
86 struct drm_atomic_state *state)
87 {
88 - struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state,
89 - crtc);
90 drm_crtc_vblank_on(crtc);
91 - vc4_hvs_atomic_enable(crtc, old_state);
92 + vc4_hvs_atomic_enable(crtc, state);
93 }
94
95 static void vc4_txp_atomic_disable(struct drm_crtc *crtc,
96 struct drm_atomic_state *state)
97 {
98 - struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state,
99 - crtc);
100 struct drm_device *dev = crtc->dev;
101
102 /* Disable vblank irq handling before crtc is disabled. */
103 drm_crtc_vblank_off(crtc);
104
105 - vc4_hvs_atomic_disable(crtc, old_state);
106 + vc4_hvs_atomic_disable(crtc, state);
107
108 /*
109 * Make sure we issue a vblank event after disabling the CRTC if