Commit 458a5513 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] fbdev: mode switching fix.

From: James Simmons <jsimmons@infradead.org>

This fixes the bugs that where in mode switch via stty.

The problem was we couldn't set the mode just by using the x and y
resolution.  We use modedb to fill in the rest.  There also was a bug that
allowed you to change the console resolution for drivers with fixed
resolutions.  This would mess up your display.  Now that is fixed.
parent ef7df33c
......@@ -776,17 +776,17 @@ int vc_resize(int currcons, unsigned int cols, unsigned int lines)
old_row_size = video_size_row;
old_screen_size = screenbuf_size;
video_num_lines = new_rows;
video_num_columns = new_cols;
video_size_row = new_row_size;
screenbuf_size = new_screen_size;
err = resize_screen(currcons, new_cols, new_rows);
if (err) {
kfree(newscreen);
return err;
}
video_num_lines = new_rows;
video_num_columns = new_cols;
video_size_row = new_row_size;
screenbuf_size = new_screen_size;
rlth = min(old_row_size, new_row_size);
rrem = new_row_size - rlth;
old_origin = origin;
......@@ -811,8 +811,6 @@ int vc_resize(int currcons, unsigned int cols, unsigned int lines)
screenbuf = newscreen;
kmalloced = 1;
screenbuf_size = new_screen_size;
if (IS_VISIBLE)
err = resize_screen(currcons, new_cols, new_rows);
set_origin(currcons);
/* do part of a reset_terminal() */
......
......@@ -1231,10 +1231,7 @@ static void atyfb_palette(int enter)
for (i = 0; i < FB_MAX; i++) {
info = registered_fb[i];
if (info &&
info->fbops == &atyfb_ops &&
info->display_fg &&
info->display_fg->vc_num == i) {
if (info && info->fbops == &atyfb_ops) {
par = (struct atyfb_par *) info->par;
atyfb_save_palette(par, enter);
......
......@@ -1783,7 +1783,6 @@ static int __devinit radeon_set_fbinfo (struct radeonfb_info *rinfo)
info->pseudo_palette = rinfo->pseudo_palette;
info->flags = FBINFO_FLAG_DEFAULT;
info->fbops = &radeonfb_ops;
info->display_fg = NULL;
info->screen_base = (char *)rinfo->fb_base;
/* Fill fix common fields */
......
This diff is collapsed.
......@@ -27,7 +27,6 @@ struct display {
/* Filled in by the frame buffer device */
u_short inverse; /* != 0 text black on white as default */
/* Filled in by the low-level console driver */
char fontname[40]; /* Font associated to this display */
u_char *fontdata;
int userfont; /* != 0 if fontdata kmalloc()ed */
u_short scrollmode; /* Scroll Method */
......
......@@ -391,7 +391,7 @@ static int my_atoi(const char *name)
}
/**
* __fb_try_mode - test a video mode
* fb_try_mode - test a video mode
* @var: frame buffer user defined part of display
* @info: frame buffer info structure
* @mode: frame buffer video mode structure
......@@ -403,10 +403,10 @@ static int my_atoi(const char *name)
*
*/
int __fb_try_mode(struct fb_var_screeninfo *var, struct fb_info *info,
int fb_try_mode(struct fb_var_screeninfo *var, struct fb_info *info,
const struct fb_videomode *mode, unsigned int bpp)
{
int err = 1;
int err = 0;
DPRINTK("Trying mode %s %dx%d-%d@%d\n", mode->name ? mode->name : "noname",
mode->xres, mode->yres, bpp, mode->refresh);
......@@ -430,10 +430,9 @@ int __fb_try_mode(struct fb_var_screeninfo *var, struct fb_info *info,
if (info->fbops->fb_check_var)
err = info->fbops->fb_check_var(var, info);
var->activate &= ~FB_ACTIVATE_TEST;
return !err;
return err;
}
/**
* fb_find_mode - finds a valid video mode
* @var: frame buffer user defined part of display
......@@ -536,18 +535,18 @@ int fb_find_mode(struct fb_var_screeninfo *var,
if ((name_matches(db[j], name, namelen) ||
(res_specified && res_matches(db[j], xres, yres))) &&
(!i || db[j].refresh == refresh) &&
__fb_try_mode(var, info, &db[j], bpp))
!fb_try_mode(var, info, &db[j], bpp))
return 2-i;
}
}
DPRINTK("Trying default video mode\n");
if (__fb_try_mode(var, info, default_mode, default_bpp))
if (!fb_try_mode(var, info, default_mode, default_bpp))
return 3;
DPRINTK("Trying all modes\n");
for (i = 0; i < dbsize; i++)
if (__fb_try_mode(var, info, &db[i], default_bpp))
if (!fb_try_mode(var, info, &db[i], default_bpp))
return 4;
DPRINTK("No valid mode found\n");
......
......@@ -2252,7 +2252,6 @@ static int __devinit radeon_set_fbinfo (struct radeonfb_info *rinfo)
info->pseudo_palette = rinfo->pseudo_palette;
info->flags = FBINFO_FLAG_DEFAULT;
info->fbops = &radeonfb_ops;
info->display_fg = NULL;
info->screen_base = (char *)rinfo->fb_base;
/* Fill fix common fields */
......
......@@ -516,7 +516,6 @@ struct fb_info {
struct fb_cmap cmap; /* Current cmap */
struct fb_ops *fbops;
char *screen_base; /* Virtual address */
struct vc_data *display_fg; /* Console visible on this display */
int currcon; /* Current VC. */
void *pseudo_palette; /* Fake palette of 16 colors */
#define FBINFO_STATE_RUNNING 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment