]> git.baikalelectronics.ru Git - kernel.git/commit
drm/fb-helper: Round up bits_per_pixel if possible
authorGeert Uytterhoeven <geert+renesas@glider.be>
Mon, 30 Dec 2019 13:27:34 +0000 (14:27 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 7 Jan 2020 15:54:03 +0000 (16:54 +0100)
commit0b240f15914010d17cd9e6889f5109c17885e8d3
treec730ac17c19d60e35cde9e33b52372dcd3df9a79
parentc28f3743f9785b5bc4531ab9193fe190fe99e59a
drm/fb-helper: Round up bits_per_pixel if possible

When userspace requests a video mode parameter value that is not
supported, frame buffer device drivers should round it up to a supported
value, if possible, instead of just rejecting it.  This allows
applications to quickly scan for supported video modes.

Currently this rule is not followed for the number of bits per pixel,
causing e.g. "fbset -depth N" to fail, if N is smaller than the current
number of bits per pixel.

Fix this by returning an error only if bits per pixel is too large, and
setting it to the current value otherwise.

See also Documentation/fb/framebuffer.rst, Section 2 (Programmer's View
of /dev/fb*").

Fixes: 41581ded21b04b48 ("drm/fb-helper: reject any changes to the fbdev")
Cc: stable@vger.kernel.org
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20191230132734.4538-1-geert+renesas@glider.be
drivers/gpu/drm/drm_fb_helper.c