@@ -68,141 +68,143 @@ static inline u32 armada_csc(struct drm_plane_state *state)
68
68
static void armada_drm_overlay_plane_atomic_update (struct drm_plane * plane ,
69
69
struct drm_plane_state * old_state )
70
70
{
71
- struct drm_plane_state * state = plane -> state ;
71
+ struct drm_plane_state * new_state = plane -> state ;
72
72
struct armada_crtc * dcrtc ;
73
73
struct armada_regs * regs ;
74
74
unsigned int idx ;
75
75
u32 cfg , cfg_mask , val ;
76
76
77
77
DRM_DEBUG_KMS ("[PLANE:%d:%s]\n" , plane -> base .id , plane -> name );
78
78
79
- if (!state -> fb || WARN_ON (!state -> crtc ))
79
+ if (!new_state -> fb || WARN_ON (!new_state -> crtc ))
80
80
return ;
81
81
82
82
DRM_DEBUG_KMS ("[PLANE:%d:%s] is on [CRTC:%d:%s] with [FB:%d] visible %u->%u\n" ,
83
83
plane -> base .id , plane -> name ,
84
- state -> crtc -> base .id , state -> crtc -> name ,
85
- state -> fb -> base .id ,
86
- old_state -> visible , state -> visible );
84
+ new_state -> crtc -> base .id , new_state -> crtc -> name ,
85
+ new_state -> fb -> base .id ,
86
+ old_state -> visible , new_state -> visible );
87
87
88
- dcrtc = drm_to_armada_crtc (state -> crtc );
88
+ dcrtc = drm_to_armada_crtc (new_state -> crtc );
89
89
regs = dcrtc -> regs + dcrtc -> regs_idx ;
90
90
91
91
idx = 0 ;
92
- if (!old_state -> visible && state -> visible )
92
+ if (!old_state -> visible && new_state -> visible )
93
93
armada_reg_queue_mod (regs , idx ,
94
94
0 , CFG_PDWN16x66 | CFG_PDWN32x66 ,
95
95
LCD_SPU_SRAM_PARA1 );
96
- val = armada_src_hw (state );
96
+ val = armada_src_hw (new_state );
97
97
if (armada_src_hw (old_state ) != val )
98
98
armada_reg_queue_set (regs , idx , val , LCD_SPU_DMA_HPXL_VLN );
99
- val = armada_dst_yx (state );
99
+ val = armada_dst_yx (new_state );
100
100
if (armada_dst_yx (old_state ) != val )
101
101
armada_reg_queue_set (regs , idx , val , LCD_SPU_DMA_OVSA_HPXL_VLN );
102
- val = armada_dst_hw (state );
102
+ val = armada_dst_hw (new_state );
103
103
if (armada_dst_hw (old_state ) != val )
104
104
armada_reg_queue_set (regs , idx , val , LCD_SPU_DZM_HPXL_VLN );
105
105
/* FIXME: overlay on an interlaced display */
106
- if (old_state -> src .x1 != state -> src .x1 ||
107
- old_state -> src .y1 != state -> src .y1 ||
108
- old_state -> fb != state -> fb ||
109
- state -> crtc -> state -> mode_changed ) {
106
+ if (old_state -> src .x1 != new_state -> src .x1 ||
107
+ old_state -> src .y1 != new_state -> src .y1 ||
108
+ old_state -> fb != new_state -> fb ||
109
+ new_state -> crtc -> state -> mode_changed ) {
110
110
const struct drm_format_info * format ;
111
111
u16 src_x ;
112
112
113
- armada_reg_queue_set (regs , idx , armada_addr (state , 0 , 0 ),
113
+ armada_reg_queue_set (regs , idx , armada_addr (new_state , 0 , 0 ),
114
114
LCD_SPU_DMA_START_ADDR_Y0 );
115
- armada_reg_queue_set (regs , idx , armada_addr (state , 0 , 1 ),
115
+ armada_reg_queue_set (regs , idx , armada_addr (new_state , 0 , 1 ),
116
116
LCD_SPU_DMA_START_ADDR_U0 );
117
- armada_reg_queue_set (regs , idx , armada_addr (state , 0 , 2 ),
117
+ armada_reg_queue_set (regs , idx , armada_addr (new_state , 0 , 2 ),
118
118
LCD_SPU_DMA_START_ADDR_V0 );
119
- armada_reg_queue_set (regs , idx , armada_addr (state , 1 , 0 ),
119
+ armada_reg_queue_set (regs , idx , armada_addr (new_state , 1 , 0 ),
120
120
LCD_SPU_DMA_START_ADDR_Y1 );
121
- armada_reg_queue_set (regs , idx , armada_addr (state , 1 , 1 ),
121
+ armada_reg_queue_set (regs , idx , armada_addr (new_state , 1 , 1 ),
122
122
LCD_SPU_DMA_START_ADDR_U1 );
123
- armada_reg_queue_set (regs , idx , armada_addr (state , 1 , 2 ),
123
+ armada_reg_queue_set (regs , idx , armada_addr (new_state , 1 , 2 ),
124
124
LCD_SPU_DMA_START_ADDR_V1 );
125
125
126
- val = armada_pitch (state , 0 ) << 16 | armada_pitch (state , 0 );
126
+ val = armada_pitch (new_state , 0 ) << 16 | armada_pitch (new_state ,
127
+ 0 );
127
128
armada_reg_queue_set (regs , idx , val , LCD_SPU_DMA_PITCH_YC );
128
- val = armada_pitch (state , 1 ) << 16 | armada_pitch (state , 2 );
129
+ val = armada_pitch (new_state , 1 ) << 16 | armada_pitch (new_state ,
130
+ 2 );
129
131
armada_reg_queue_set (regs , idx , val , LCD_SPU_DMA_PITCH_UV );
130
132
131
- cfg = CFG_DMA_FMT (drm_fb_to_armada_fb (state -> fb )-> fmt ) |
132
- CFG_DMA_MOD (drm_fb_to_armada_fb (state -> fb )-> mod ) |
133
+ cfg = CFG_DMA_FMT (drm_fb_to_armada_fb (new_state -> fb )-> fmt ) |
134
+ CFG_DMA_MOD (drm_fb_to_armada_fb (new_state -> fb )-> mod ) |
133
135
CFG_CBSH_ENA ;
134
- if (state -> visible )
136
+ if (new_state -> visible )
135
137
cfg |= CFG_DMA_ENA ;
136
138
137
139
/*
138
140
* Shifting a YUV packed format image by one pixel causes the
139
141
* U/V planes to swap. Compensate for it by also toggling
140
142
* the UV swap.
141
143
*/
142
- format = state -> fb -> format ;
143
- src_x = state -> src .x1 >> 16 ;
144
+ format = new_state -> fb -> format ;
145
+ src_x = new_state -> src .x1 >> 16 ;
144
146
if (format -> num_planes == 1 && src_x & (format -> hsub - 1 ))
145
147
cfg ^= CFG_DMA_MOD (CFG_SWAPUV );
146
- if (to_armada_plane_state (state )-> interlace )
148
+ if (to_armada_plane_state (new_state )-> interlace )
147
149
cfg |= CFG_DMA_FTOGGLE ;
148
150
cfg_mask = CFG_CBSH_ENA | CFG_DMAFORMAT |
149
151
CFG_DMA_MOD (CFG_SWAPRB | CFG_SWAPUV |
150
152
CFG_SWAPYU | CFG_YUV2RGB ) |
151
153
CFG_DMA_FTOGGLE | CFG_DMA_TSTMODE |
152
154
CFG_DMA_ENA ;
153
- } else if (old_state -> visible != state -> visible ) {
154
- cfg = state -> visible ? CFG_DMA_ENA : 0 ;
155
+ } else if (old_state -> visible != new_state -> visible ) {
156
+ cfg = new_state -> visible ? CFG_DMA_ENA : 0 ;
155
157
cfg_mask = CFG_DMA_ENA ;
156
158
} else {
157
159
cfg = cfg_mask = 0 ;
158
160
}
159
- if (drm_rect_width (& old_state -> src ) != drm_rect_width (& state -> src ) ||
160
- drm_rect_width (& old_state -> dst ) != drm_rect_width (& state -> dst )) {
161
+ if (drm_rect_width (& old_state -> src ) != drm_rect_width (& new_state -> src ) ||
162
+ drm_rect_width (& old_state -> dst ) != drm_rect_width (& new_state -> dst )) {
161
163
cfg_mask |= CFG_DMA_HSMOOTH ;
162
- if (drm_rect_width (& state -> src ) >> 16 !=
163
- drm_rect_width (& state -> dst ))
164
+ if (drm_rect_width (& new_state -> src ) >> 16 !=
165
+ drm_rect_width (& new_state -> dst ))
164
166
cfg |= CFG_DMA_HSMOOTH ;
165
167
}
166
168
167
169
if (cfg_mask )
168
170
armada_reg_queue_mod (regs , idx , cfg , cfg_mask ,
169
171
LCD_SPU_DMA_CTRL0 );
170
172
171
- val = armada_spu_contrast (state );
172
- if ((!old_state -> visible && state -> visible ) ||
173
+ val = armada_spu_contrast (new_state );
174
+ if ((!old_state -> visible && new_state -> visible ) ||
173
175
armada_spu_contrast (old_state ) != val )
174
176
armada_reg_queue_set (regs , idx , val , LCD_SPU_CONTRAST );
175
- val = armada_spu_saturation (state );
176
- if ((!old_state -> visible && state -> visible ) ||
177
+ val = armada_spu_saturation (new_state );
178
+ if ((!old_state -> visible && new_state -> visible ) ||
177
179
armada_spu_saturation (old_state ) != val )
178
180
armada_reg_queue_set (regs , idx , val , LCD_SPU_SATURATION );
179
- if (!old_state -> visible && state -> visible )
181
+ if (!old_state -> visible && new_state -> visible )
180
182
armada_reg_queue_set (regs , idx , 0x00002000 , LCD_SPU_CBSH_HUE );
181
- val = armada_csc (state );
182
- if ((!old_state -> visible && state -> visible ) ||
183
+ val = armada_csc (new_state );
184
+ if ((!old_state -> visible && new_state -> visible ) ||
183
185
armada_csc (old_state ) != val )
184
186
armada_reg_queue_mod (regs , idx , val , CFG_CSC_MASK ,
185
187
LCD_SPU_IOPAD_CONTROL );
186
- val = drm_to_overlay_state (state )-> colorkey_yr ;
187
- if ((!old_state -> visible && state -> visible ) ||
188
+ val = drm_to_overlay_state (new_state )-> colorkey_yr ;
189
+ if ((!old_state -> visible && new_state -> visible ) ||
188
190
drm_to_overlay_state (old_state )-> colorkey_yr != val )
189
191
armada_reg_queue_set (regs , idx , val , LCD_SPU_COLORKEY_Y );
190
- val = drm_to_overlay_state (state )-> colorkey_ug ;
191
- if ((!old_state -> visible && state -> visible ) ||
192
+ val = drm_to_overlay_state (new_state )-> colorkey_ug ;
193
+ if ((!old_state -> visible && new_state -> visible ) ||
192
194
drm_to_overlay_state (old_state )-> colorkey_ug != val )
193
195
armada_reg_queue_set (regs , idx , val , LCD_SPU_COLORKEY_U );
194
- val = drm_to_overlay_state (state )-> colorkey_vb ;
195
- if ((!old_state -> visible && state -> visible ) ||
196
+ val = drm_to_overlay_state (new_state )-> colorkey_vb ;
197
+ if ((!old_state -> visible && new_state -> visible ) ||
196
198
drm_to_overlay_state (old_state )-> colorkey_vb != val )
197
199
armada_reg_queue_set (regs , idx , val , LCD_SPU_COLORKEY_V );
198
- val = drm_to_overlay_state (state )-> colorkey_mode ;
199
- if ((!old_state -> visible && state -> visible ) ||
200
+ val = drm_to_overlay_state (new_state )-> colorkey_mode ;
201
+ if ((!old_state -> visible && new_state -> visible ) ||
200
202
drm_to_overlay_state (old_state )-> colorkey_mode != val )
201
203
armada_reg_queue_mod (regs , idx , val , CFG_CKMODE_MASK |
202
204
CFG_ALPHAM_MASK | CFG_ALPHA_MASK ,
203
205
LCD_SPU_DMA_CTRL1 );
204
- val = drm_to_overlay_state (state )-> colorkey_enable ;
205
- if (((!old_state -> visible && state -> visible ) ||
206
+ val = drm_to_overlay_state (new_state )-> colorkey_enable ;
207
+ if (((!old_state -> visible && new_state -> visible ) ||
206
208
drm_to_overlay_state (old_state )-> colorkey_enable != val ) &&
207
209
dcrtc -> variant -> has_spu_adv_reg )
208
210
armada_reg_queue_mod (regs , idx , val , ADV_GRACOLORKEY |
0 commit comments