1 From c3393ac1098d1f191e37eed73bf366ebc88ac4ee Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Wed, 11 Sep 2024 14:49:05 +0100
4 Subject: [PATCH] drm/vc4: Correct condition for ignoring a plane to src rect
7 The logic for dropping a plane less than zero didn't account for the
8 possibility that a plane could be being upscaled with a src_rect with
9 width/height < 1 pixel, but not 0 subpixels.
11 Check for not 0 subpixels, not < 1, in both vc4 and vc6 paths.
13 Fixes: dac616899f87 ("drm/vc4: Drop planes that have 0 destination size")
14 Fixes: f73b18eb0d48 ("drm/vc4: Drop planes that are completely off-screen")
15 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
17 drivers/gpu/drm/vc4/vc4_plane.c | 6 ++++--
18 1 file changed, 4 insertions(+), 2 deletions(-)
20 --- a/drivers/gpu/drm/vc4/vc4_plane.c
21 +++ b/drivers/gpu/drm/vc4/vc4_plane.c
22 @@ -1160,7 +1160,8 @@ static int vc4_plane_mode_set(struct drm
23 width = vc4_state->src_w[0] >> 16;
24 height = vc4_state->src_h[0] >> 16;
26 - if (!width || !height || !vc4_state->crtc_w || !vc4_state->crtc_h) {
27 + if (!vc4_state->src_w[0] || !vc4_state->src_h[0] ||
28 + !vc4_state->crtc_w || !vc4_state->crtc_h) {
29 /* 0 source size probably means the plane is offscreen */
30 vc4_state->dlist_initialized = 1;
32 @@ -1698,7 +1699,8 @@ static int vc6_plane_mode_set(struct drm
33 width = vc4_state->src_w[0] >> 16;
34 height = vc4_state->src_h[0] >> 16;
36 - if (!width || !height || !vc4_state->crtc_w || !vc4_state->crtc_h) {
37 + if (!vc4_state->src_w[0] || !vc4_state->src_h[0] ||
38 + !vc4_state->crtc_w || !vc4_state->crtc_h) {
39 /* 0 source size probably means the plane is offscreen.
40 * 0 destination size is a redundant plane.