diff options
author | Borislav Petkov <bp@suse.de> | 2022-07-11 10:58:01 +0300 |
---|---|---|
committer | Borislav Petkov <bp@suse.de> | 2022-07-11 10:58:01 +0300 |
commit | 5a88c48f4146de2c8c2ed7ddcaa76f898869f3a3 (patch) | |
tree | fc501a1b940026cbd5316f8665236c109d5f1a2e /drivers/video/fbdev/core/fbmem.c | |
parent | b69a2afd5afce9bf6d56e349d6ab592c916e20f2 (diff) | |
parent | 32346491ddf24599decca06190ebca03ff9de7f8 (diff) | |
download | linux-5a88c48f4146de2c8c2ed7ddcaa76f898869f3a3.tar.xz |
Merge tag 'v5.19-rc6' into tip:x86/kdump
Merge rc6 to pick up dependent changes to the bootparam UAPI header.
Signed-off-by: Borislav Petkov <bp@suse.de>
Diffstat (limited to 'drivers/video/fbdev/core/fbmem.c')
-rw-r--r-- | drivers/video/fbdev/core/fbmem.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index afa2863670f3..7ee6eb2fa715 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -19,6 +19,7 @@ #include <linux/kernel.h> #include <linux/major.h> #include <linux/slab.h> +#include <linux/sysfb.h> #include <linux/mm.h> #include <linux/mman.h> #include <linux/vt.h> @@ -510,7 +511,7 @@ static int fb_show_logo_line(struct fb_info *info, int rotate, while (n && (n * (logo->width + 8) - 8 > xres)) --n; - image.dx = (xres - n * (logo->width + 8) - 8) / 2; + image.dx = (xres - (n * (logo->width + 8) - 8)) / 2; image.dy = y ?: (yres - logo->height) / 2; } else { image.dx = 0; @@ -1016,6 +1017,16 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) if (ret) return ret; + /* verify that virtual resolution >= physical resolution */ + if (var->xres_virtual < var->xres || + var->yres_virtual < var->yres) { + pr_warn("WARNING: fbcon: Driver '%s' missed to adjust virtual screen size (%ux%u vs. %ux%u)\n", + info->fix.id, + var->xres_virtual, var->yres_virtual, + var->xres, var->yres); + return -EINVAL; + } + if ((var->activate & FB_ACTIVATE_MASK) != FB_ACTIVATE_NOW) return 0; @@ -1106,7 +1117,9 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, return -EFAULT; console_lock(); lock_fb_info(info); - ret = fb_set_var(info, &var); + ret = fbcon_modechange_possible(info, &var); + if (!ret) + ret = fb_set_var(info, &var); if (!ret) fbcon_update_vcs(info, var.activate & FB_ACTIVATE_ALL); unlock_fb_info(info); @@ -1752,6 +1765,17 @@ int remove_conflicting_framebuffers(struct apertures_struct *a, do_free = true; } + /* + * If a driver asked to unregister a platform device registered by + * sysfb, then can be assumed that this is a driver for a display + * that is set up by the system firmware and has a generic driver. + * + * Drivers for devices that don't have a generic driver will never + * ask for this, so let's assume that a real driver for the display + * was already probed and prevent sysfb to register devices later. + */ + sysfb_disable(); + mutex_lock(®istration_lock); do_remove_conflicting_framebuffers(a, name, primary); mutex_unlock(®istration_lock); |