From: Reza Arbab Subject: [PATCH 2/2] drm/fb-helper: Do not scale depth down to 0 Date: Fri, 22 Mar 2019 15:56:13 -0500 Message-ID: <1553288173-10845-3-git-send-email-arbab@linux.ibm.com> References: <1553288173-10845-1-git-send-email-arbab@linux.ibm.com> Return-path: In-Reply-To: <1553288173-10845-1-git-send-email-arbab@linux.ibm.com> Sender: linux-kernel-owner@vger.kernel.org To: Dave Airlie , Sean Paul , David Airlie , Daniel Vetter , Robert Tarasov , Linus Walleij , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: wzabolot@elektron.elka.pw.edu.pl, Pavel Machek , Alex Deucher , =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= List-Id: dri-devel@lists.freedesktop.org If the scaling loop in drm_fb_helper_single_fb_probe() only finds supported depths greater than what it's looking for, it will set sizes.surface_depth = 0. This broke my udl device: [drm] test CRTC 0 primary plane udl 3-9.1:1.0: drm_fb_helper_single_fb_probe: test CRTC 0 format 0, depth=24 udl 3-9.1:1.0: drm_fb_helper_single_fb_probe: 24 > 16, skipping udl 3-9.1:1.0: drm_fb_helper_single_fb_probe: test CRTC 0 format 1, depth=32 udl 3-9.1:1.0: drm_fb_helper_single_fb_probe: 32 > 16, skipping [drm] requested bpp 16, scaled depth down to 0 Instead of setting zero depth, print that scaling was not possible and do nothing. Fixes: f4bd542bcaee ("drm/fb-helper: Scale back depth to supported maximum") Signed-off-by: Reza Arbab --- drivers/gpu/drm/drm_fb_helper.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 0e9349ff2d16..a7028655a065 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -1963,7 +1963,11 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper, best_depth = fmt->depth; } } - if (sizes.surface_depth != best_depth) { + + if (!best_depth) { + DRM_INFO("Could not scale depth to requested bpp %d", + sizes.surface_bpp); + } else if (sizes.surface_depth != best_depth) { DRM_INFO("requested bpp %d, scaled depth down to %d", sizes.surface_bpp, best_depth); sizes.surface_depth = best_depth; -- 1.8.3.1