@@ -47,6 +47,8 @@ struct vc4_plane_state {
47
47
48
48
/* Clipped coordinates of the plane on the display. */
49
49
int crtc_x , crtc_y , crtc_w , crtc_h ;
50
+ /* Clipped size of the area scanned from in the FB. */
51
+ u32 src_w , src_h ;
50
52
51
53
/* Offset to start scanning out from the start of the plane's
52
54
* BO.
@@ -170,11 +172,6 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state)
170
172
171
173
vc4_state -> offset = fb -> offsets [0 ];
172
174
173
- vc4_state -> crtc_x = state -> crtc_x ;
174
- vc4_state -> crtc_y = state -> crtc_y ;
175
- vc4_state -> crtc_w = state -> crtc_w ;
176
- vc4_state -> crtc_h = state -> crtc_h ;
177
-
178
175
if (state -> crtc_w << 16 != state -> src_w ||
179
176
state -> crtc_h << 16 != state -> src_h ) {
180
177
/* We don't support scaling yet, which involves
@@ -185,17 +182,25 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state)
185
182
return - EINVAL ;
186
183
}
187
184
185
+ vc4_state -> src_w = state -> src_w >> 16 ;
186
+ vc4_state -> src_h = state -> src_h >> 16 ;
187
+
188
+ vc4_state -> crtc_x = state -> crtc_x ;
189
+ vc4_state -> crtc_y = state -> crtc_y ;
190
+ vc4_state -> crtc_w = state -> crtc_w ;
191
+ vc4_state -> crtc_h = state -> crtc_h ;
192
+
188
193
if (vc4_state -> crtc_x < 0 ) {
189
194
vc4_state -> offset += (drm_format_plane_cpp (fb -> pixel_format ,
190
195
0 ) *
191
196
- vc4_state -> crtc_x );
192
- vc4_state -> crtc_w += vc4_state -> crtc_x ;
197
+ vc4_state -> src_w += vc4_state -> crtc_x ;
193
198
vc4_state -> crtc_x = 0 ;
194
199
}
195
200
196
201
if (vc4_state -> crtc_y < 0 ) {
197
202
vc4_state -> offset += fb -> pitches [0 ] * - vc4_state -> crtc_y ;
198
- vc4_state -> crtc_h += vc4_state -> crtc_y ;
203
+ vc4_state -> src_h += vc4_state -> crtc_y ;
199
204
vc4_state -> crtc_y = 0 ;
200
205
}
201
206
@@ -244,8 +249,8 @@ static int vc4_plane_mode_set(struct drm_plane *plane,
244
249
SCALER_POS2_ALPHA_MODE_PIPELINE :
245
250
SCALER_POS2_ALPHA_MODE_FIXED ,
246
251
SCALER_POS2_ALPHA_MODE ) |
247
- VC4_SET_FIELD (vc4_state -> crtc_w , SCALER_POS2_WIDTH ) |
248
- VC4_SET_FIELD (vc4_state -> crtc_h , SCALER_POS2_HEIGHT ));
252
+ VC4_SET_FIELD (vc4_state -> src_w , SCALER_POS2_WIDTH ) |
253
+ VC4_SET_FIELD (vc4_state -> src_h , SCALER_POS2_HEIGHT ));
249
254
250
255
/* Position Word 3: Context. Written by the HVS. */
251
256
vc4_dlist_write (vc4_state , 0xc0c0c0c0 );
0 commit comments