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 <ar...@linux.ibm.com>
---
 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

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to