aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2015-12-28 17:45:25 -0500
committerEric Anholt <eric@anholt.net>2016-02-16 14:24:08 -0500
commitf863e356013d628fa65b1cd89aa298eed26fc936 (patch)
treeb5e21726c1d4533cf971cd0a87fcb50d1d9a5be3
parentfc2d6f1eabee9d971453da2a27a72471c2a347dd (diff)
drm/vc4: Fix which value is being used for source image size.
This doesn't matter yet since we only allow 1:1 scaling, but the comment clearly says we should be using the source size. Signed-off-by: Eric Anholt <eric@anholt.net>
-rw-r--r--drivers/gpu/drm/vc4/vc4_plane.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
index 713ec006baa9..d9c929096164 100644
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -47,6 +47,8 @@ struct vc4_plane_state {
47 47
48 /* Clipped coordinates of the plane on the display. */ 48 /* Clipped coordinates of the plane on the display. */
49 int crtc_x, crtc_y, crtc_w, crtc_h; 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 /* Offset to start scanning out from the start of the plane's 53 /* Offset to start scanning out from the start of the plane's
52 * BO. 54 * BO.
@@ -170,11 +172,6 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state)
170 172
171 vc4_state->offset = fb->offsets[0]; 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 if (state->crtc_w << 16 != state->src_w || 175 if (state->crtc_w << 16 != state->src_w ||
179 state->crtc_h << 16 != state->src_h) { 176 state->crtc_h << 16 != state->src_h) {
180 /* We don't support scaling yet, which involves 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 return -EINVAL; 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 if (vc4_state->crtc_x < 0) { 193 if (vc4_state->crtc_x < 0) {
189 vc4_state->offset += (drm_format_plane_cpp(fb->pixel_format, 194 vc4_state->offset += (drm_format_plane_cpp(fb->pixel_format,
190 0) * 195 0) *
191 -vc4_state->crtc_x); 196 -vc4_state->crtc_x);
192 vc4_state->crtc_w += vc4_state->crtc_x; 197 vc4_state->src_w += vc4_state->crtc_x;
193 vc4_state->crtc_x = 0; 198 vc4_state->crtc_x = 0;
194 } 199 }
195 200
196 if (vc4_state->crtc_y < 0) { 201 if (vc4_state->crtc_y < 0) {
197 vc4_state->offset += fb->pitches[0] * -vc4_state->crtc_y; 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 vc4_state->crtc_y = 0; 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 SCALER_POS2_ALPHA_MODE_PIPELINE : 249 SCALER_POS2_ALPHA_MODE_PIPELINE :
245 SCALER_POS2_ALPHA_MODE_FIXED, 250 SCALER_POS2_ALPHA_MODE_FIXED,
246 SCALER_POS2_ALPHA_MODE) | 251 SCALER_POS2_ALPHA_MODE) |
247 VC4_SET_FIELD(vc4_state->crtc_w, SCALER_POS2_WIDTH) | 252 VC4_SET_FIELD(vc4_state->src_w, SCALER_POS2_WIDTH) |
248 VC4_SET_FIELD(vc4_state->crtc_h, SCALER_POS2_HEIGHT)); 253 VC4_SET_FIELD(vc4_state->src_h, SCALER_POS2_HEIGHT));
249 254
250 /* Position Word 3: Context. Written by the HVS. */ 255 /* Position Word 3: Context. Written by the HVS. */
251 vc4_dlist_write(vc4_state, 0xc0c0c0c0); 256 vc4_dlist_write(vc4_state, 0xc0c0c0c0);