diff mbox series

[3/3] drm/vc4: Prefer PPF over TPZ when dst >= 2/3 src

Message ID 20181024100505.22436-3-boris.brezillon@bootlin.com (mailing list archive)
State New, archived
Headers show
Series [1/3] drm/vc4: Set PPF scaling when the source image is only vertically scaled | expand

Commit Message

Boris Brezillon Oct. 24, 2018, 10:05 a.m. UTC
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>
---
 drivers/gpu/drm/vc4/vc4_plane.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Eric Anholt Nov. 8, 2018, 3:18 p.m. UTC | #1
Boris Brezillon <boris.brezillon@bootlin.com> writes:

> 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>
> ---
>  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 5950e6b6b7f0..1d0d91e50aaf 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;
>  }

Reviewed-by: Eric Anholt <eric@anholt.net>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
index 5950e6b6b7f0..1d0d91e50aaf 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)