brcm2708: bcm2711: remove custom config file
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-4.19 / 950-0760-drm-vc4-Move-offsets-adjustment-out-of-setup_clippin.patch
1 From b371e04f38668a3dcde575879c557a5a8e348829 Mon Sep 17 00:00:00 2001
2 From: Boris Brezillon <boris.brezillon@bootlin.com>
3 Date: Fri, 3 Aug 2018 11:22:30 +0200
4 Subject: [PATCH 760/773] drm/vc4: Move ->offsets[] adjustment out of
5 setup_clipping_and_scaling()
6
7 The offset adjustment depends on the framebuffer modified, so let's
8 just move this operation in the DRM_FORMAT_MOD_LINEAR case inside
9 vc4_plane_mode_set().
10
11 This we'll be able to fix offset calculation for
12 DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED and DRM_FORMAT_MOD_BROADCOM_SANDXXX.
13
14 Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
15 Reviewed-by: Eric Anholt <eric@anholt.net>
16 Link: https://patchwork.freedesktop.org/patch/msgid/20180803092231.26446-4-boris.brezillon@bootlin.com
17 ---
18 drivers/gpu/drm/vc4/vc4_plane.c | 26 ++++++++++++++++----------
19 1 file changed, 16 insertions(+), 10 deletions(-)
20
21 --- a/drivers/gpu/drm/vc4/vc4_plane.c
22 +++ b/drivers/gpu/drm/vc4/vc4_plane.c
23 @@ -406,16 +406,6 @@ static int vc4_plane_setup_clipping_and_
24 vc4_state->y_scaling[1] = VC4_SCALING_NONE;
25 }
26
27 - /* Adjust the base pointer to the first pixel to be scanned out. */
28 - for (i = 0; i < num_planes; i++) {
29 - vc4_state->offsets[i] += (vc4_state->src_y /
30 - (i ? v_subsample : 1)) *
31 - fb->pitches[i];
32 - vc4_state->offsets[i] += (vc4_state->src_x /
33 - (i ? h_subsample : 1)) *
34 - fb->format->cpp[i];
35 - }
36 -
37 return 0;
38 }
39
40 @@ -523,6 +513,7 @@ static int vc4_plane_mode_set(struct drm
41 const struct hvs_format *format = vc4_get_hvs_format(fb->format->format);
42 u64 base_format_mod = fourcc_mod_broadcom_mod(fb->modifier);
43 int num_planes = drm_format_num_planes(format->drm);
44 + u32 h_subsample, v_subsample;
45 bool mix_plane_alpha;
46 bool covers_screen;
47 u32 scl0, scl1, pitch0;
48 @@ -568,10 +559,25 @@ static int vc4_plane_mode_set(struct drm
49 scl1 = vc4_get_scl_field(state, 0);
50 }
51
52 + h_subsample = drm_format_horz_chroma_subsampling(format->drm);
53 + v_subsample = drm_format_vert_chroma_subsampling(format->drm);
54 +
55 switch (base_format_mod) {
56 case DRM_FORMAT_MOD_LINEAR:
57 tiling = SCALER_CTL0_TILING_LINEAR;
58 pitch0 = VC4_SET_FIELD(fb->pitches[0], SCALER_SRC_PITCH);
59 +
60 + /* Adjust the base pointer to the first pixel to be scanned
61 + * out.
62 + */
63 + for (i = 0; i < num_planes; i++) {
64 + vc4_state->offsets[i] += vc4_state->src_y /
65 + (i ? v_subsample : 1) *
66 + fb->pitches[i];
67 + vc4_state->offsets[i] += vc4_state->src_x /
68 + (i ? h_subsample : 1) *
69 + fb->format->cpp[i];
70 + }
71 break;
72
73 case DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED: {