blob: d1780469945c8f67c4b7c34863046cb469fd1b8f [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001From f109eb9cb4a1916f6ec6c96addf4182ca781ff47 Mon Sep 17 00:00:00 2001
2From: Eric Anholt <eric@anholt.net>
3Date: Mon, 5 Feb 2018 18:22:03 +0000
4Subject: [PATCH] drm/vc4: Remove duplicate primary/cursor fields from
5 FKMS driver.
6
7The CRTC has those fields and we can just use them.
8
9Signed-off-by: Eric Anholt <eric@anholt.net>
10---
11 drivers/gpu/drm/vc4/vc4_firmware_kms.c | 24 +++++++-----------------
12 1 file changed, 7 insertions(+), 17 deletions(-)
13
14--- a/drivers/gpu/drm/vc4/vc4_firmware_kms.c
15+++ b/drivers/gpu/drm/vc4/vc4_firmware_kms.c
16@@ -37,8 +37,6 @@ struct vc4_crtc {
17 struct drm_crtc base;
18 struct drm_encoder *encoder;
19 struct drm_connector *connector;
20- struct drm_plane *primary;
21- struct drm_plane *cursor;
22 void __iomem *regs;
23
24 struct drm_pending_vblank_event *event;
25@@ -356,29 +354,24 @@ static void vc4_crtc_mode_set_nofb(struc
26
27 static void vc4_crtc_disable(struct drm_crtc *crtc, struct drm_crtc_state *old_state)
28 {
29- struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
30-
31 /* Always turn the planes off on CRTC disable. In DRM, planes
32 * are enabled/disabled through the update/disable hooks
33 * above, and the CRTC enable/disable independently controls
34 * whether anything scans out at all, but the firmware doesn't
35 * give us a CRTC-level control for that.
36 */
37- vc4_cursor_plane_atomic_disable(vc4_crtc->cursor,
38- vc4_crtc->cursor->state);
39- vc4_plane_set_primary_blank(vc4_crtc->primary, true);
40+ vc4_cursor_plane_atomic_disable(crtc->cursor, crtc->cursor->state);
41+ vc4_plane_set_primary_blank(crtc->primary, true);
42 }
43
44 static void vc4_crtc_enable(struct drm_crtc *crtc, struct drm_crtc_state *old_state)
45 {
46- struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
47-
48 /* Unblank the planes (if they're supposed to be displayed). */
49- if (vc4_crtc->primary->state->fb)
50- vc4_plane_set_primary_blank(vc4_crtc->primary, false);
51- if (vc4_crtc->cursor->state->fb) {
52- vc4_cursor_plane_atomic_update(vc4_crtc->cursor,
53- vc4_crtc->cursor->state);
54+ if (crtc->primary->state->fb)
55+ vc4_plane_set_primary_blank(crtc->primary, false);
56+ if (crtc->cursor->state->fb) {
57+ vc4_cursor_plane_atomic_update(crtc->cursor,
58+ crtc->cursor->state);
59 }
60 }
61
62@@ -689,9 +682,6 @@ static int vc4_fkms_bind(struct device *
63 primary_plane->crtc = crtc;
64 cursor_plane->crtc = crtc;
65
66- vc4_crtc->primary = primary_plane;
67- vc4_crtc->cursor = cursor_plane;
68-
69 vc4_encoder = devm_kzalloc(dev, sizeof(*vc4_encoder), GFP_KERNEL);
70 if (!vc4_encoder)
71 return -ENOMEM;