]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
drm/fb-helper: Scale back depth to supported maximum
authorLinus Walleij <linus.walleij@linaro.org>
Thu, 10 Jan 2019 11:40:49 +0000 (12:40 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 10 Jan 2019 19:54:42 +0000 (20:54 +0100)
commitf4bd542bcaee551fbc5b53061bd252b878712d4a
treec200ec6bf37e42604bdfc2db1bdd602c47d5d5cd
parent1581b2df4cbf614315225f121636e1eb7c80cbae
drm/fb-helper: Scale back depth to supported maximum

The following happened when migrating an old fbdev driver to DRM:

The Integrator/CP PL111 supports 16BPP but only ARGB1555/ABGR1555
or XRGB1555/XBGR1555 i.e. the maximum depth is 15.

This makes the initialization of the framebuffer fail since
the code in drm_fb_helper_single_fb_probe() assigns the same value
to sizes.surface_bpp and sizes.surface_depth. I.e. it simply assumes
a 1-to-1 mapping between BPP and depth, which is true in most cases
but not for this hardware that only support odd formats.

To support the odd case of a driver supporting 16BPP with only 15
bits of depth, this patch will make the code loop over the formats
supported on the primary plane on each CRTC managed by the FB
helper and cap the depth to the maximum supported on any primary
plane.

On the PL110 Integrator, this makes drm_mode_legacy_fb_format()
select DRM_FORMAT_XRGB1555 which is acceptable for this driver, and
thus we get framebuffer, penguin and console on the Integrator/CP.

Cc: Noralf Trønnes <noralf@tronnes.org>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190110114049.10618-1-linus.walleij@linaro.org
drivers/gpu/drm/drm_fb_helper.c