* [PATCH v2 1/2] drm/vc4: ->x_scaling[1] should never be set to VC4_SCALING_NONE
@ 2018-11-09 10:26 Boris Brezillon
2018-11-09 10:26 ` [PATCH v2 2/2] drm/vc4: Prefer PPF over TPZ when dst >= 2/3 src Boris Brezillon
2018-11-09 14:31 ` [PATCH v2 1/2] drm/vc4: ->x_scaling[1] should never be set to VC4_SCALING_NONE Boris Brezillon
0 siblings, 2 replies; 3+ messages in thread
From: Boris Brezillon @ 2018-11-09 10:26 UTC (permalink / raw)
To: Eric Anholt; +Cc: Boris Brezillon, dri-devel
For the YUV conversion to work properly, ->x_scaling[1] should never
be set to VC4_SCALING_NONE, but vc4_get_scaling_mode() might return
VC4_SCALING_NONE if the horizontal scaling ratio exactly matches the
horizontal subsampling factor. Add a test to turn VC4_SCALING_NONE
into VC4_SCALING_PPF when that happens.
The old ->x_scaling[0] adjustment is dropped as I couldn't find any
mention to this constraint in the spec and it's proven to be
unnecessary (I tested various multi-planar YUV formats with scaling
disabled, and all of them worked fine without this adjustment).
Fixes: fc04023fafec ("drm/vc4: Add support for YUV planes.")
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
---
Changes in v2:
- Remove the the ->x_scaling[0] = VC4_SCALING_PPF
assignment when ->is_unity is true and update the comment
- Add Eric's R-b
---
drivers/gpu/drm/vc4/vc4_plane.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
index 98fae4daa08c..6caa678edcff 100644
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -341,12 +341,14 @@ 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 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.
+ /* YUV conversion requires that horizontal scaling be enabled
+ * on the UV plane even if vc4_get_scaling_mode() returned
+ * VC4_SCALING_NONE (which can happen when the down-scaling
+ * ratio is 0.5). Let's force it to VC4_SCALING_PPF in this
+ * case.
*/
- if (vc4_state->is_unity)
- vc4_state->x_scaling[0] = VC4_SCALING_PPF;
+ if (vc4_state->x_scaling[1] == VC4_SCALING_NONE)
+ vc4_state->x_scaling[1] = VC4_SCALING_PPF;
} else {
vc4_state->is_yuv = false;
vc4_state->x_scaling[1] = VC4_SCALING_NONE;
--
2.17.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2 2/2] drm/vc4: Prefer PPF over TPZ when dst >= 2/3 src
2018-11-09 10:26 [PATCH v2 1/2] drm/vc4: ->x_scaling[1] should never be set to VC4_SCALING_NONE Boris Brezillon
@ 2018-11-09 10:26 ` Boris Brezillon
2018-11-09 14:31 ` [PATCH v2 1/2] drm/vc4: ->x_scaling[1] should never be set to VC4_SCALING_NONE Boris Brezillon
1 sibling, 0 replies; 3+ messages in thread
From: Boris Brezillon @ 2018-11-09 10:26 UTC (permalink / raw)
To: Eric Anholt; +Cc: Boris Brezillon, dri-devel
The HVS spec recommends using PPF when the downscaling ratio is
between 2/3 and 1. Let's modify vc4_get_scaling_mode() to follow this
recommendation.
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
---
Changes in v2:
- Add Eric's R-b
---
drivers/gpu/drm/vc4/vc4_plane.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
index 6caa678edcff..1728fb7d00ba 100644
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -129,12 +129,12 @@ static const struct hvs_format *vc4_get_hvs_format(u32 drm_format)
static enum vc4_scaling_mode vc4_get_scaling_mode(u32 src, u32 dst)
{
- if (dst > src)
+ if (dst == src)
+ return VC4_SCALING_NONE;
+ if (3 * dst >= 2 * src)
return VC4_SCALING_PPF;
- else if (dst < src)
- return VC4_SCALING_TPZ;
else
- return VC4_SCALING_NONE;
+ return VC4_SCALING_TPZ;
}
static bool plane_enabled(struct drm_plane_state *state)
--
2.17.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/2] drm/vc4: ->x_scaling[1] should never be set to VC4_SCALING_NONE
2018-11-09 10:26 [PATCH v2 1/2] drm/vc4: ->x_scaling[1] should never be set to VC4_SCALING_NONE Boris Brezillon
2018-11-09 10:26 ` [PATCH v2 2/2] drm/vc4: Prefer PPF over TPZ when dst >= 2/3 src Boris Brezillon
@ 2018-11-09 14:31 ` Boris Brezillon
1 sibling, 0 replies; 3+ messages in thread
From: Boris Brezillon @ 2018-11-09 14:31 UTC (permalink / raw)
To: Eric Anholt; +Cc: dri-devel
On Fri, 9 Nov 2018 11:26:32 +0100
Boris Brezillon <boris.brezillon@bootlin.com> wrote:
> For the YUV conversion to work properly, ->x_scaling[1] should never
> be set to VC4_SCALING_NONE, but vc4_get_scaling_mode() might return
> VC4_SCALING_NONE if the horizontal scaling ratio exactly matches the
> horizontal subsampling factor. Add a test to turn VC4_SCALING_NONE
> into VC4_SCALING_PPF when that happens.
>
> The old ->x_scaling[0] adjustment is dropped as I couldn't find any
> mention to this constraint in the spec and it's proven to be
> unnecessary (I tested various multi-planar YUV formats with scaling
> disabled, and all of them worked fine without this adjustment).
>
> Fixes: fc04023fafec ("drm/vc4: Add support for YUV planes.")
> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
> Reviewed-by: Eric Anholt <eric@anholt.net>
Series queued to drm-misc-next.
> ---
> Changes in v2:
> - Remove the the ->x_scaling[0] = VC4_SCALING_PPF
> assignment when ->is_unity is true and update the comment
> - Add Eric's R-b
> ---
> drivers/gpu/drm/vc4/vc4_plane.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
> index 98fae4daa08c..6caa678edcff 100644
> --- a/drivers/gpu/drm/vc4/vc4_plane.c
> +++ b/drivers/gpu/drm/vc4/vc4_plane.c
> @@ -341,12 +341,14 @@ 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 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.
> + /* YUV conversion requires that horizontal scaling be enabled
> + * on the UV plane even if vc4_get_scaling_mode() returned
> + * VC4_SCALING_NONE (which can happen when the down-scaling
> + * ratio is 0.5). Let's force it to VC4_SCALING_PPF in this
> + * case.
> */
> - if (vc4_state->is_unity)
> - vc4_state->x_scaling[0] = VC4_SCALING_PPF;
> + if (vc4_state->x_scaling[1] == VC4_SCALING_NONE)
> + vc4_state->x_scaling[1] = VC4_SCALING_PPF;
> } else {
> vc4_state->is_yuv = false;
> vc4_state->x_scaling[1] = VC4_SCALING_NONE;
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-11-09 14:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-09 10:26 [PATCH v2 1/2] drm/vc4: ->x_scaling[1] should never be set to VC4_SCALING_NONE Boris Brezillon
2018-11-09 10:26 ` [PATCH v2 2/2] drm/vc4: Prefer PPF over TPZ when dst >= 2/3 src Boris Brezillon
2018-11-09 14:31 ` [PATCH v2 1/2] drm/vc4: ->x_scaling[1] should never be set to VC4_SCALING_NONE 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.