brcm2708: update linux 4.4 patches to latest version
[openwrt/staging/lynxis/omap.git] / target / linux / brcm2708 / patches-4.4 / 0284-drm-vc4-Fix-which-value-is-being-used-for-source-ima.patch
1 From 309b7268e9cc7baa21d195cc98387cb984720185 Mon Sep 17 00:00:00 2001
2 From: Eric Anholt <eric@anholt.net>
3 Date: Mon, 28 Dec 2015 14:45:25 -0800
4 Subject: [PATCH 284/304] drm/vc4: Fix which value is being used for source
5 image size.
6
7 This doesn't matter yet since we only allow 1:1 scaling, but the
8 comment clearly says we should be using the source size.
9
10 Signed-off-by: Eric Anholt <eric@anholt.net>
11 (cherry picked from commit f863e356013d628fa65b1cd89aa298eed26fc936)
12 ---
13 drivers/gpu/drm/vc4/vc4_plane.c | 23 ++++++++++++++---------
14 1 file changed, 14 insertions(+), 9 deletions(-)
15
16 --- a/drivers/gpu/drm/vc4/vc4_plane.c
17 +++ b/drivers/gpu/drm/vc4/vc4_plane.c
18 @@ -47,6 +47,8 @@ struct vc4_plane_state {
19
20 /* Clipped coordinates of the plane on the display. */
21 int crtc_x, crtc_y, crtc_w, crtc_h;
22 + /* Clipped size of the area scanned from in the FB. */
23 + u32 src_w, src_h;
24
25 /* Offset to start scanning out from the start of the plane's
26 * BO.
27 @@ -186,11 +188,6 @@ static int vc4_plane_setup_clipping_and_
28
29 vc4_state->offset = fb->offsets[0];
30
31 - vc4_state->crtc_x = state->crtc_x;
32 - vc4_state->crtc_y = state->crtc_y;
33 - vc4_state->crtc_w = state->crtc_w;
34 - vc4_state->crtc_h = state->crtc_h;
35 -
36 if (state->crtc_w << 16 != state->src_w ||
37 state->crtc_h << 16 != state->src_h) {
38 /* We don't support scaling yet, which involves
39 @@ -201,17 +198,25 @@ static int vc4_plane_setup_clipping_and_
40 return -EINVAL;
41 }
42
43 + vc4_state->src_w = state->src_w >> 16;
44 + vc4_state->src_h = state->src_h >> 16;
45 +
46 + vc4_state->crtc_x = state->crtc_x;
47 + vc4_state->crtc_y = state->crtc_y;
48 + vc4_state->crtc_w = state->crtc_w;
49 + vc4_state->crtc_h = state->crtc_h;
50 +
51 if (vc4_state->crtc_x < 0) {
52 vc4_state->offset += (drm_format_plane_cpp(fb->pixel_format,
53 0) *
54 -vc4_state->crtc_x);
55 - vc4_state->crtc_w += vc4_state->crtc_x;
56 + vc4_state->src_w += vc4_state->crtc_x;
57 vc4_state->crtc_x = 0;
58 }
59
60 if (vc4_state->crtc_y < 0) {
61 vc4_state->offset += fb->pitches[0] * -vc4_state->crtc_y;
62 - vc4_state->crtc_h += vc4_state->crtc_y;
63 + vc4_state->src_h += vc4_state->crtc_y;
64 vc4_state->crtc_y = 0;
65 }
66
67 @@ -260,8 +265,8 @@ static int vc4_plane_mode_set(struct drm
68 SCALER_POS2_ALPHA_MODE_PIPELINE :
69 SCALER_POS2_ALPHA_MODE_FIXED,
70 SCALER_POS2_ALPHA_MODE) |
71 - VC4_SET_FIELD(vc4_state->crtc_w, SCALER_POS2_WIDTH) |
72 - VC4_SET_FIELD(vc4_state->crtc_h, SCALER_POS2_HEIGHT));
73 + VC4_SET_FIELD(vc4_state->src_w, SCALER_POS2_WIDTH) |
74 + VC4_SET_FIELD(vc4_state->src_h, SCALER_POS2_HEIGHT));
75
76 /* Position Word 3: Context. Written by the HVS. */
77 vc4_dlist_write(vc4_state, 0xc0c0c0c0);