From dac616899f8701cbb982822943a8d794f81a258a Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Tue, 6 Feb 2024 17:52:49 +0000 Subject: [PATCH 0884/1085] drm/vc4: Drop planes that have 0 destination size There is no point in trying to create a dlist entry for planes that have a 0 crtc size, and it can also cause grief in the vc6 dlist generation as it takes width-1 and height-1, causing wrap around. Drop these planes. Signed-off-by: Dave Stevenson --- drivers/gpu/drm/vc4/vc4_plane.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) --- a/drivers/gpu/drm/vc4/vc4_plane.c +++ b/drivers/gpu/drm/vc4/vc4_plane.c @@ -1140,7 +1140,7 @@ static int vc4_plane_mode_set(struct drm width = vc4_state->src_w[0] >> 16; height = vc4_state->src_h[0] >> 16; - if (!width || !height) { + if (!width || !height || !vc4_state->crtc_w || !vc4_state->crtc_h) { /* 0 source size probably means the plane is offscreen */ vc4_state->dlist_initialized = 1; return 0; @@ -1667,8 +1667,10 @@ static int vc6_plane_mode_set(struct drm width = vc4_state->src_w[0] >> 16; height = vc4_state->src_h[0] >> 16; - if (!width || !height) { - /* 0 source size probably means the plane is offscreen */ + if (!width || !height || !vc4_state->crtc_w || !vc4_state->crtc_h) { + /* 0 source size probably means the plane is offscreen. + * 0 destination size is a redundant plane. + */ vc4_state->dlist_initialized = 1; return 0; } @@ -2044,7 +2046,8 @@ int vc4_plane_atomic_check(struct drm_pl if (ret) return ret; - if (!vc4_state->src_w[0] || !vc4_state->src_h[0]) + if (!vc4_state->src_w[0] || !vc4_state->src_h[0] || + !vc4_state->crtc_w || !vc4_state->crtc_h) return 0; ret = vc4_plane_allocate_lbm(new_plane_state);