1 From 7957b18f7d41e1ed846072ffa354df7838ed2669 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 759/782] drm/vc4: Move ->offsets[] adjustment out of
5 setup_clipping_and_scaling()
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
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.
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
18 drivers/gpu/drm/vc4/vc4_plane.c | 26 ++++++++++++++++----------
19 1 file changed, 16 insertions(+), 10 deletions(-)
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;
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)) *
32 - vc4_state->offsets[i] += (vc4_state->src_x /
33 - (i ? h_subsample : 1)) *
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;
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);
52 + h_subsample = drm_format_horz_chroma_subsampling(format->drm);
53 + v_subsample = drm_format_vert_chroma_subsampling(format->drm);
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);
60 + /* Adjust the base pointer to the first pixel to be scanned
63 + for (i = 0; i < num_planes; i++) {
64 + vc4_state->offsets[i] += vc4_state->src_y /
65 + (i ? v_subsample : 1) *
67 + vc4_state->offsets[i] += vc4_state->src_x /
68 + (i ? h_subsample : 1) *
73 case DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED: {