brcm2708: add kernel 4.14 support
[openwrt/staging/chunkeey.git] / target / linux / brcm2708 / patches-4.14 / 950-0346-drm-vc4-Move-plane-state-to-header.patch
1 From 3747cef056a2b6def75521dc2fd9157b009715e2 Mon Sep 17 00:00:00 2001
2 From: Stefan Schake <stschake@gmail.com>
3 Date: Fri, 9 Mar 2018 01:53:36 +0100
4 Subject: [PATCH 346/454] drm/vc4: Move plane state to header
5
6 commit 823646983b5a31732ae82ffa60b74555857eb8a0 upstream.
7
8 We need to reference it from the CRTC to make a decision for enabling
9 background color fill.
10
11 Signed-off-by: Stefan Schake <stschake@gmail.com>
12 Signed-off-by: Eric Anholt <eric@anholt.net>
13 Reviewed-by: Eric Anholt <eric@anholt.net>
14 Link: https://patchwork.freedesktop.org/patch/msgid/1520556817-97297-4-git-send-email-stschake@gmail.com
15 ---
16 drivers/gpu/drm/vc4/vc4_drv.h | 60 +++++++++++++++++++++++++++++++++
17 drivers/gpu/drm/vc4/vc4_plane.c | 60 ---------------------------------
18 2 files changed, 60 insertions(+), 60 deletions(-)
19
20 --- a/drivers/gpu/drm/vc4/vc4_drv.h
21 +++ b/drivers/gpu/drm/vc4/vc4_drv.h
22 @@ -278,6 +278,66 @@ to_vc4_plane(struct drm_plane *plane)
23 return (struct vc4_plane *)plane;
24 }
25
26 +enum vc4_scaling_mode {
27 + VC4_SCALING_NONE,
28 + VC4_SCALING_TPZ,
29 + VC4_SCALING_PPF,
30 +};
31 +
32 +struct vc4_plane_state {
33 + struct drm_plane_state base;
34 + /* System memory copy of the display list for this element, computed
35 + * at atomic_check time.
36 + */
37 + u32 *dlist;
38 + u32 dlist_size; /* Number of dwords allocated for the display list */
39 + u32 dlist_count; /* Number of used dwords in the display list. */
40 +
41 + /* Offset in the dlist to various words, for pageflip or
42 + * cursor updates.
43 + */
44 + u32 pos0_offset;
45 + u32 pos2_offset;
46 + u32 ptr0_offset;
47 +
48 + /* Offset where the plane's dlist was last stored in the
49 + * hardware at vc4_crtc_atomic_flush() time.
50 + */
51 + u32 __iomem *hw_dlist;
52 +
53 + /* Clipped coordinates of the plane on the display. */
54 + int crtc_x, crtc_y, crtc_w, crtc_h;
55 + /* Clipped area being scanned from in the FB. */
56 + u32 src_x, src_y;
57 +
58 + u32 src_w[2], src_h[2];
59 +
60 + /* Scaling selection for the RGB/Y plane and the Cb/Cr planes. */
61 + enum vc4_scaling_mode x_scaling[2], y_scaling[2];
62 + bool is_unity;
63 + bool is_yuv;
64 +
65 + /* Offset to start scanning out from the start of the plane's
66 + * BO.
67 + */
68 + u32 offsets[3];
69 +
70 + /* Our allocation in LBM for temporary storage during scaling. */
71 + struct drm_mm_node lbm;
72 +
73 + /* Set when the plane has per-pixel alpha content or does not cover
74 + * the entire screen. This is a hint to the CRTC that it might need
75 + * to enable background color fill.
76 + */
77 + bool needs_bg_fill;
78 +};
79 +
80 +static inline struct vc4_plane_state *
81 +to_vc4_plane_state(struct drm_plane_state *state)
82 +{
83 + return (struct vc4_plane_state *)state;
84 +}
85 +
86 enum vc4_encoder_type {
87 VC4_ENCODER_TYPE_NONE,
88 VC4_ENCODER_TYPE_HDMI,
89 --- a/drivers/gpu/drm/vc4/vc4_plane.c
90 +++ b/drivers/gpu/drm/vc4/vc4_plane.c
91 @@ -27,66 +27,6 @@
92 #include "vc4_drv.h"
93 #include "vc4_regs.h"
94
95 -enum vc4_scaling_mode {
96 - VC4_SCALING_NONE,
97 - VC4_SCALING_TPZ,
98 - VC4_SCALING_PPF,
99 -};
100 -
101 -struct vc4_plane_state {
102 - struct drm_plane_state base;
103 - /* System memory copy of the display list for this element, computed
104 - * at atomic_check time.
105 - */
106 - u32 *dlist;
107 - u32 dlist_size; /* Number of dwords allocated for the display list */
108 - u32 dlist_count; /* Number of used dwords in the display list. */
109 -
110 - /* Offset in the dlist to various words, for pageflip or
111 - * cursor updates.
112 - */
113 - u32 pos0_offset;
114 - u32 pos2_offset;
115 - u32 ptr0_offset;
116 -
117 - /* Offset where the plane's dlist was last stored in the
118 - * hardware at vc4_crtc_atomic_flush() time.
119 - */
120 - u32 __iomem *hw_dlist;
121 -
122 - /* Clipped coordinates of the plane on the display. */
123 - int crtc_x, crtc_y, crtc_w, crtc_h;
124 - /* Clipped area being scanned from in the FB. */
125 - u32 src_x, src_y;
126 -
127 - u32 src_w[2], src_h[2];
128 -
129 - /* Scaling selection for the RGB/Y plane and the Cb/Cr planes. */
130 - enum vc4_scaling_mode x_scaling[2], y_scaling[2];
131 - bool is_unity;
132 - bool is_yuv;
133 -
134 - /* Offset to start scanning out from the start of the plane's
135 - * BO.
136 - */
137 - u32 offsets[3];
138 -
139 - /* Our allocation in LBM for temporary storage during scaling. */
140 - struct drm_mm_node lbm;
141 -
142 - /* Set when the plane has per-pixel alpha content or does not cover
143 - * the entire screen. This is a hint to the CRTC that it might need
144 - * to enable background color fill.
145 - */
146 - bool needs_bg_fill;
147 -};
148 -
149 -static inline struct vc4_plane_state *
150 -to_vc4_plane_state(struct drm_plane_state *state)
151 -{
152 - return (struct vc4_plane_state *)state;
153 -}
154 -
155 static const struct hvs_format {
156 u32 drm; /* DRM_FORMAT_* */
157 u32 hvs; /* HVS_FORMAT_* */