For the YUV conversion to work properly, ->x_scaling[0,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.

Fixes: fc04023fafec ("drm/vc4: Add support for YUV planes.")
Signed-off-by: Boris Brezillon <[email protected]>
---

The Cc-stable tag has been omitted on purpose: a few things have
changed in this portion of code and backporting this fix is not
trivial. Since noone complained so far, let's not bother backporting
it.
---
 drivers/gpu/drm/vc4/vc4_plane.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
index 32b7b9f47c5d..5950e6b6b7f0 100644
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -320,6 +320,9 @@ static int vc4_plane_setup_clipping_and_scaling(struct 
drm_plane_state *state)
                 */
                if (vc4_state->x_scaling[0] == VC4_SCALING_NONE)
                        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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to