drm/vc4: Prefer PPF over TPZ when dst >= 2/3 src
authorBoris Brezillon <boris.brezillon@bootlin.com>
Fri, 9 Nov 2018 10:26:33 +0000 (11:26 +0100)
committerBoris Brezillon <boris.brezillon@bootlin.com>
Fri, 9 Nov 2018 14:30:45 +0000 (15:30 +0100)
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>
Link: https://patchwork.freedesktop.org/patch/msgid/20181109102633.32603-2-boris.brezillon@bootlin.com
drivers/gpu/drm/vc4/vc4_plane.c

index 6caa678edcffa56a6f45ad0b9b3ee3691095390d..1728fb7d00ba8b1ea7069a1f5588b2ea7147f99e 100644 (file)
@@ -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)