diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2020-01-15 01:36:12 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2020-01-15 01:36:12 +0000 |
commit | bc5ba571fd1dca2f1b6a136e5b04e5a8157bc9c9 (patch) | |
tree | 3df028bf7fa1b138a4508dcd6161971ef10f9782 /sys | |
parent | 5dc4e494b3277a9cf5b1fbfd553ba0f2d6aec7ec (diff) |
drm/fb-helper: Round up bits_per_pixel if possible
From Geert Uytterhoeven
779f5790fa47d8175b7346449a036f37f5717778 in linux 4.19.y/4.19.96
f30e27779d3031a092c2a177b7fb76adccc45241 in mainline linux
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/drm/drm_fb_helper.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/dev/pci/drm/drm_fb_helper.c b/sys/dev/pci/drm/drm_fb_helper.c index d95b8acbebd..ec838933054 100644 --- a/sys/dev/pci/drm/drm_fb_helper.c +++ b/sys/dev/pci/drm/drm_fb_helper.c @@ -1742,7 +1742,7 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var, * Changes struct fb_var_screeninfo are currently not pushed back * to KMS, hence fail if different settings are requested. */ - if (var->bits_per_pixel != fb->format->cpp[0] * 8 || + if (var->bits_per_pixel > fb->format->cpp[0] * 8 || var->xres > fb->width || var->yres > fb->height || var->xres_virtual > fb->width || var->yres_virtual > fb->height) { DRM_DEBUG("fb requested width/height/bpp can't fit in current fb " @@ -1768,6 +1768,11 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var, } /* + * Likewise, bits_per_pixel should be rounded up to a supported value. + */ + var->bits_per_pixel = fb->format->cpp[0] * 8; + + /* * drm fbdev emulation doesn't support changing the pixel format at all, * so reject all pixel format changing requests. */ |