From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Eric Anholt <eric@anholt.net>
Cc: David Airlie <airlied@linux.ie>,
Boris Brezillon <boris.brezillon@bootlin.com>,
dri-devel@lists.freedesktop.org
Subject: [PATCH 4/5] drm/vc4: Move ->offsets[] adjustment out of setup_clipping_and_scaling()
Date: Wed, 25 Jul 2018 17:32:08 +0200 [thread overview]
Message-ID: <20180725153209.14366-5-boris.brezillon@bootlin.com> (raw)
In-Reply-To: <20180725153209.14366-1-boris.brezillon@bootlin.com>
From: Eric Anholt <eric@anholt.net>
The offset adjustment depends on the framebuffer modified, so let's
just move this operation in the DRM_FORMAT_MOD_LINEAR case inside
vc4_plane_mode_set().
This we'll be able to fix offset calculation for
DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED and DRM_FORMAT_MOD_BROADCOM_SANDXXX.
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
---
drivers/gpu/drm/vc4/vc4_plane.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
index 39e1fa3a8466..2b8ba1c412be 100644
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -354,14 +354,6 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state)
vc4_state->y_scaling[1] = VC4_SCALING_NONE;
}
- /* Adjust the base pointer to the first pixel to be scanned out. */
- for (i = 0; i < num_planes; i++) {
- vc4_state->offsets[i] += (src_y / (i ? v_subsample : 1)) *
- fb->pitches[i];
- vc4_state->offsets[i] += (src_x / (i ? h_subsample : 1)) *
- fb->format->cpp[i];
- }
-
return 0;
}
@@ -476,6 +468,7 @@ static int vc4_plane_mode_set(struct drm_plane *plane,
u64 base_format_mod = fourcc_mod_broadcom_mod(fb->modifier);
int num_planes = drm_format_num_planes(format->drm);
u32 src_x, src_y, crtc_h, crtc_w, src_h, src_w;
+ u32 h_subsample, v_subsample;
bool mix_plane_alpha;
bool covers_screen;
u32 scl0, scl1, pitch0;
@@ -527,11 +520,25 @@ static int vc4_plane_mode_set(struct drm_plane *plane,
src_y = state->src.y1 >> 16;
src_w = (state->src.x2 - state->src.x1) >> 16;
src_h = (state->src.y2 - state->src.y1) >> 16;
+ h_subsample = drm_format_horz_chroma_subsampling(format->drm);
+ v_subsample = drm_format_vert_chroma_subsampling(format->drm);
switch (base_format_mod) {
case DRM_FORMAT_MOD_LINEAR:
tiling = SCALER_CTL0_TILING_LINEAR;
pitch0 = VC4_SET_FIELD(fb->pitches[0], SCALER_SRC_PITCH);
+
+ /* Adjust the base pointer to the first pixel to be scanned
+ * out.
+ */
+ for (i = 0; i < num_planes; i++) {
+ vc4_state->offsets[i] += src_y /
+ (i ? v_subsample : 1) *
+ fb->pitches[i];
+ vc4_state->offsets[i] += src_x /
+ (i ? h_subsample : 1) *
+ fb->format->cpp[i];
+ }
break;
case DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED: {
--
2.14.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2018-07-25 15:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-25 15:32 [PATCH 0/5] drm/vc4: Fix negative X/Y positioning of planes Boris Brezillon
2018-07-25 15:32 ` [PATCH 1/5] drm/vc4: Fix TILE_Y_OFFSET definitions Boris Brezillon
2018-07-25 15:32 ` [PATCH 2/5] drm/vc4: Define missing PICTH0_SINK_PIX field Boris Brezillon
2018-07-27 20:24 ` Eric Anholt
2018-07-25 15:32 ` [PATCH 3/5] drm/vc4: Use drm_atomic_helper_check_plane_state() to simplify the logic Boris Brezillon
2018-07-27 20:38 ` Eric Anholt
2018-07-27 20:54 ` Boris Brezillon
2018-07-25 15:32 ` Boris Brezillon [this message]
2018-07-27 20:55 ` [PATCH 4/5] drm/vc4: Move ->offsets[] adjustment out of setup_clipping_and_scaling() Boris Brezillon
2018-07-25 15:32 ` [PATCH 5/5] drm/vc4: Fix negative X/Y positioning of planes using T_TILES modifier Boris Brezillon
2018-07-27 20:46 ` Eric Anholt
2018-07-27 20:59 ` Boris Brezillon
2018-08-03 9:06 ` Boris Brezillon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180725153209.14366-5-boris.brezillon@bootlin.com \
--to=boris.brezillon@bootlin.com \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=eric@anholt.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox