|
@@ -849,9 +849,27 @@ static int nvidiafb_check_var(struct fb_var_screeninfo *var,
|
|
|
if (!mode_valid && info->monspecs.modedb_len)
|
|
|
return -EINVAL;
|
|
|
|
|
|
+ /*
|
|
|
+ * If we're on a flat panel, check if the mode is outside of the
|
|
|
+ * panel dimensions. If so, cap it and try for the next best mode
|
|
|
+ * before bailing out.
|
|
|
+ */
|
|
|
if (par->fpWidth && par->fpHeight && (par->fpWidth < var->xres ||
|
|
|
- par->fpHeight < var->yres))
|
|
|
- return -EINVAL;
|
|
|
+ par->fpHeight < var->yres)) {
|
|
|
+ const struct fb_videomode *mode;
|
|
|
+
|
|
|
+ var->xres = par->fpWidth;
|
|
|
+ var->yres = par->fpHeight;
|
|
|
+
|
|
|
+ mode = fb_find_best_mode(var, &info->modelist);
|
|
|
+ if (!mode) {
|
|
|
+ printk(KERN_ERR PFX "mode out of range of flat "
|
|
|
+ "panel dimensions\n");
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
+
|
|
|
+ fb_videomode_to_var(var, mode);
|
|
|
+ }
|
|
|
|
|
|
if (var->yres_virtual < var->yres)
|
|
|
var->yres_virtual = var->yres;
|