* [PATCH] drm/vc4: Fix the "no scaling" case on multi-planar YUV formats
@ 2018-07-25 12:29 Boris Brezillon
2018-07-27 20:55 ` Eric Anholt
0 siblings, 1 reply; 4+ messages in thread
From: Boris Brezillon @ 2018-07-25 12:29 UTC (permalink / raw)
To: Eric Anholt
Cc: David Airlie, Daniel Vetter, dri-devel, Boris Brezillon, stable
When there's no scaling requested ->is_unity should be true no matter
the format.
Also, when no scaling is requested and we have a multi-planar YUV
format, we should leave ->y_scaling[0] to VC4_SCALING_NONE and only
set ->x_scaling[0] to VC4_SCALING_PPF.
Doing this fixes an hardly visible artifact (seen when using modetest
and a rather big overlay plane in YUV420).
Fixes: fc04023fafec ("drm/vc4: Add support for YUV planes.")
Cc: <stable@vger.kernel.org>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
---
drivers/gpu/drm/vc4/vc4_plane.c | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
index cfb50fedfa2b..a3275fa66b7b 100644
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -297,6 +297,9 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state)
vc4_state->y_scaling[0] = vc4_get_scaling_mode(vc4_state->src_h[0],
vc4_state->crtc_h);
+ vc4_state->is_unity = (vc4_state->x_scaling[0] == VC4_SCALING_NONE &&
+ vc4_state->y_scaling[0] == VC4_SCALING_NONE);
+
if (num_planes > 1) {
vc4_state->is_yuv = true;
@@ -312,24 +315,17 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state)
vc4_get_scaling_mode(vc4_state->src_h[1],
vc4_state->crtc_h);
- /* YUV conversion requires that scaling be enabled,
- * even on a plane that's otherwise 1:1. Choose TPZ
- * for simplicity.
+ /* YUV conversion requires that horizontal scaling be enabled,
+ * even on a plane that's otherwise 1:1. Looks like only PPF
+ * works in that case, so let's pick that one.
*/
- if (vc4_state->x_scaling[0] == VC4_SCALING_NONE)
- vc4_state->x_scaling[0] = VC4_SCALING_TPZ;
- if (vc4_state->y_scaling[0] == VC4_SCALING_NONE)
- vc4_state->y_scaling[0] = VC4_SCALING_TPZ;
+ if (vc4_state->is_unity)
+ vc4_state->x_scaling[0] = VC4_SCALING_PPF;
} else {
vc4_state->x_scaling[1] = VC4_SCALING_NONE;
vc4_state->y_scaling[1] = VC4_SCALING_NONE;
}
- vc4_state->is_unity = (vc4_state->x_scaling[0] == VC4_SCALING_NONE &&
- vc4_state->y_scaling[0] == VC4_SCALING_NONE &&
- vc4_state->x_scaling[1] == VC4_SCALING_NONE &&
- vc4_state->y_scaling[1] == VC4_SCALING_NONE);
-
/* No configuring scaling on the cursor plane, since it gets
non-vblank-synced updates, and scaling requires requires
LBM changes which have to be vblank-synced.
@@ -672,7 +668,10 @@ static int vc4_plane_mode_set(struct drm_plane *plane,
vc4_dlist_write(vc4_state, SCALER_CSC2_ITR_R_601_5);
}
- if (!vc4_state->is_unity) {
+ if (vc4_state->x_scaling[0] != VC4_SCALING_NONE ||
+ vc4_state->x_scaling[1] != VC4_SCALING_NONE ||
+ vc4_state->y_scaling[0] != VC4_SCALING_NONE ||
+ vc4_state->y_scaling[1] != VC4_SCALING_NONE) {
/* LBM Base Address. */
if (vc4_state->y_scaling[0] != VC4_SCALING_NONE ||
vc4_state->y_scaling[1] != VC4_SCALING_NONE) {
--
2.14.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/vc4: Fix the "no scaling" case on multi-planar YUV formats
2018-07-25 12:29 [PATCH] drm/vc4: Fix the "no scaling" case on multi-planar YUV formats Boris Brezillon
@ 2018-07-27 20:55 ` Eric Anholt
0 siblings, 0 replies; 4+ messages in thread
From: Eric Anholt @ 2018-07-27 20:55 UTC (permalink / raw)
To: Boris Brezillon
Cc: David Airlie, Daniel Vetter, dri-devel, Boris Brezillon, stable
[-- Attachment #1: Type: text/plain, Size: 644 bytes --]
Boris Brezillon <boris.brezillon@bootlin.com> writes:
> When there's no scaling requested ->is_unity should be true no matter
> the format.
>
> Also, when no scaling is requested and we have a multi-planar YUV
> format, we should leave ->y_scaling[0] to VC4_SCALING_NONE and only
> set ->x_scaling[0] to VC4_SCALING_PPF.
>
> Doing this fixes an hardly visible artifact (seen when using modetest
> and a rather big overlay plane in YUV420).
>
> Fixes: fc04023fafec ("drm/vc4: Add support for YUV planes.")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/vc4: Fix the "no scaling" case on multi-planar YUV formats
@ 2018-07-27 20:55 ` Eric Anholt
0 siblings, 0 replies; 4+ messages in thread
From: Eric Anholt @ 2018-07-27 20:55 UTC (permalink / raw)
Cc: David Airlie, Daniel Vetter, dri-devel, Boris Brezillon, stable
[-- Attachment #1: Type: text/plain, Size: 644 bytes --]
Boris Brezillon <boris.brezillon@bootlin.com> writes:
> When there's no scaling requested ->is_unity should be true no matter
> the format.
>
> Also, when no scaling is requested and we have a multi-planar YUV
> format, we should leave ->y_scaling[0] to VC4_SCALING_NONE and only
> set ->x_scaling[0] to VC4_SCALING_PPF.
>
> Doing this fixes an hardly visible artifact (seen when using modetest
> and a rather big overlay plane in YUV420).
>
> Fixes: fc04023fafec ("drm/vc4: Add support for YUV planes.")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/vc4: Fix the "no scaling" case on multi-planar YUV formats
2018-07-27 20:55 ` Eric Anholt
(?)
@ 2018-08-03 8:11 ` Boris Brezillon
-1 siblings, 0 replies; 4+ messages in thread
From: Boris Brezillon @ 2018-08-03 8:11 UTC (permalink / raw)
To: Eric Anholt; +Cc: David Airlie, Daniel Vetter, dri-devel, stable
On Fri, 27 Jul 2018 13:55:03 -0700
Eric Anholt <eric@anholt.net> wrote:
> Boris Brezillon <boris.brezillon@bootlin.com> writes:
>
> > When there's no scaling requested ->is_unity should be true no matter
> > the format.
> >
> > Also, when no scaling is requested and we have a multi-planar YUV
> > format, we should leave ->y_scaling[0] to VC4_SCALING_NONE and only
> > set ->x_scaling[0] to VC4_SCALING_PPF.
> >
> > Doing this fixes an hardly visible artifact (seen when using modetest
> > and a rather big overlay plane in YUV420).
> >
> > Fixes: fc04023fafec ("drm/vc4: Add support for YUV planes.")
> > Cc: <stable@vger.kernel.org>
> > Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
>
> Reviewed-by: Eric Anholt <eric@anholt.net>
Queued to drm-misc-fixes.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-08-03 10:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-25 12:29 [PATCH] drm/vc4: Fix the "no scaling" case on multi-planar YUV formats Boris Brezillon
2018-07-27 20:55 ` Eric Anholt
2018-07-27 20:55 ` Eric Anholt
2018-08-03 8:11 ` Boris Brezillon
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.